Author Topic: question: light transmission with any image  (Read 6319 times)

0 Members and 1 Guest are viewing this topic.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: question: light transmission with any image
« Reply #15 on: May 11, 2021, 10:24:48 am »
I finally found the error. or no error, just not working properly. Thank you for your help! All your solutions are super and workable! In the form in which it appears in the attached code. De! I can’t draw on the track so easily. I finally understood why it doesn’t let light through, instead it gets closer to black. Here may be the z-buffer problem. I will draw the fire, but if I draw behind it later, its color will no longer be visible. So I messed up there that I put it in the wrong drawing order. However, I can't hit the right order. Either it is not visible through a glass window or it is visible even when it should not. I think I'll ask Galleon about this. Thank you for your help !

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: question: light transmission with any image
« Reply #16 on: May 11, 2021, 10:28:42 am »
I formulate the problem: on the track, the walls of the blocks have a glass effect. To look all right, you need to draw in the right order. That's fine, it works. But what happens if we put a light-transmitting texture inside the maze? _dontblend? _depthbuffer? Or do I have to put the fireballs in order? Unfortunately, I don't really understand this thing yet.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: question: light transmission with any image
« Reply #17 on: May 11, 2021, 11:20:14 am »
Quote
I show the problem. The program draws a fire with the background hidden. The fire, or "pic," is a piercing image. How can I adjust your transparency?

just add this before DO (to row 16 after SCREEN statement):

Code: QB64: [Select]
  1. _SETALPHA 127, _RGB32(0, 0, 0) TO _RGB32(255, 255, 255), pic
  2.  

then is this result:

  [ You are not allowed to view this attachment ]  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: question: light transmission with any image
« Reply #18 on: May 11, 2021, 11:41:03 am »
Of course, you can also set only part of the image as transparent. For only one part of the flame transparent, try setting the values to
 
_SETALPHA 127, _RGB32 (100, 100, 100) TO _RGB32 (255, 255, 0), pic

or is possible to set different alpha levels to different colors on image :)

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: question: light transmission with any image
« Reply #19 on: May 11, 2021, 12:32:04 pm »
thanks Petr! It has already succeeded. I just can’t integrate into the game because the drawing sequences are complicated.
there are plenty of things I don't understand in the world :) _SETALPHA. I studied, but I don't understand how you can use "A TO B" to determine which colors I mean. :) Then here’s _DEPTHBUFFER ... it’s a very funny thing. I experiment with this because either the fire is full or just dark or transparent, but it is visible from everywhere, even through the wall. So it's not good at all. What else do I not understand? :) _DONTBLEND / _BLEND I want to understand these once :)
Unfortunately, I can't find a good description anywhere.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: question: light transmission with any image
« Reply #20 on: May 11, 2021, 01:17:37 pm »
Blend and dontblend, I can tell you about easily.

Take a screen with any red/green/blue color you want:  _RGB(255, 0, 0) for all red, for example.

Take a second screen with any non-solid alpha color: _RGBA(0, 0, 255, 128) for half-transparent blue, for example.

If _BLEND is on, and you _PUTIMAGE the 2nd image onto the 1st one, it’ll blend the colors together and you’ll end up with a pale purple screen.

If _DONTBLEND is active, and you _PUTIMAGE the 2nd image onto the first one, it’ll completely overwrite the first one and duplicate the 2nd. 

_BLEND on mixes colors together.

_BLEND off replaces one color with the other.  (_DONTBLEND)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: question: light transmission with any image
« Reply #21 on: May 11, 2021, 02:19:54 pm »
thanks SMcNeill! i think i understand (not sure) .then i will try. Just _PUTIMAGE? Does it work with simple PRINT, _MAPTRIANGLE, LINE, CIRCLE? I'll try.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: question: light transmission with any image
« Reply #22 on: May 11, 2021, 03:49:06 pm »
thanks SMcNeill! i think i understand (not sure) .then i will try. Just _PUTIMAGE? Does it work with simple PRINT, _MAPTRIANGLE, LINE, CIRCLE? I'll try.

It should work with all those, as long as you’re putting one color over another.

Think of _BLEND as taking two buckets of paint, dumping them together into a third bucket to mix them together.  Half Yellow + Half Blue makes Green.

With _DONTBLEND, you’re just pouring paint from one bucket into the other.  If it starts blue, it ends up blue.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: question: light transmission with any image
« Reply #23 on: May 11, 2021, 04:37:19 pm »
I am a Linux user and do not know what the Windows character "U" is supposed to do, but for me, my machine interprets the "U" as a large plus sign and a checkered pattern.  Can someone post what it is meant to look like?  Not complaining. Just curious.
Logic is the beginning of wisdom.

Offline justsomeguy

  • Newbie
  • Posts: 47
    • View Profile
Re: question: light transmission with any image
« Reply #24 on: May 11, 2021, 04:44:34 pm »
@johnno56 I believe it is a uni-code character. Different language keyboards have these.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: question: light transmission with any image
« Reply #25 on: May 11, 2021, 04:48:05 pm »
My version of QB64 (1.5) receives a "copy and paste" of the listing as shown in the screen capture. I am not complaining. Just curious and looking for a fix....

  [ You are not allowed to view this attachment ]  
Logic is the beginning of wisdom.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: question: light transmission with any image
« Reply #26 on: May 11, 2021, 04:50:44 pm »
command me! :)

  [ You are not allowed to view this attachment ]  

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: question: light transmission with any image
« Reply #27 on: May 11, 2021, 06:15:05 pm »
MasterGy,

Removed the Plus from the print string and added Petr's alpha line and runs just fine...

  [ You are not allowed to view this attachment ]  

Thank you.
Logic is the beginning of wisdom.