• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Shaders X-ray Shader for each pixel?

B

Blaster

Guest
I've been tinkering with shaders for a bit and wanted to ask if it's possible to do this or any guidance in the right direction: A shader that checks if each pixel on the sprite is visible. If the pixel is not visible (an enemy is standing in front of them, blocking the pxiel), draw the pixel in front and make it transparent with a white glowing border.
Any help appreciated
 
B

bojack29

Guest
Yes. Youd have to use surfaces though, maybe the application surface?

I assume you mean providing a different color when the two overlap?

You draw the two sprites to a surface at .5 alpha. Where they overlap they will have a higher opacity. This is where the shader will recognize a higher alpha pixel and redraw all pixels a new color. Then it merely redraws all .5 alpha pixels as full again.
 
B

Blaster

Guest
Yes. Youd have to use surfaces though, maybe the application surface?

I assume you mean providing a different color when the two overlap?

You draw the two sprites to a surface at .5 alpha. Where they overlap they will have a higher opacity. This is where the shader will recognize a higher alpha pixel and redraw all pixels a new color. Then it merely redraws all .5 alpha pixels as full again.
This makes a lot of sense, thanks! I'll start by reading up on surfaces.
 
Top