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
 

bojack29

Member
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