Translucency
As far as i know, a pixel shader can''t read the existing colour/depth value. So how do you do translucency?
********
A Problem Worthy of Attack
Proves It''s Worth by Fighting Back
Using AlphaBlending: AlphaBlendEnable, SrcBlend and DestBlend (which affect what’s rendered).
As far as I know, pixel shaders operate on textures and vertex color data, not on the framebuffer (You can render scenes to texture and operate on it if you like).
Reading from the depth-buffer directly isn't possible in the pixel shader, because different IHVs have different Z-buffer compression techniques.
You can also render the z buffer to a texture I think.
[edited by - Coder on February 9, 2003 6:43:19 AM]
As far as I know, pixel shaders operate on textures and vertex color data, not on the framebuffer (You can render scenes to texture and operate on it if you like).
Reading from the depth-buffer directly isn't possible in the pixel shader, because different IHVs have different Z-buffer compression techniques.
You can also render the z buffer to a texture I think.
[edited by - Coder on February 9, 2003 6:43:19 AM]
How do you do translucency *in a shader engine* ?
********
A Problem Worthy of Attack
Proves It''s Worth by Fighting Back
********
A Problem Worthy of Attack
Proves It''s Worth by Fighting Back
Visit the nVidia and ATI websites and download the demos and source code from either which demonstrates translucency with pixel shaders.
How? Render to texture, read the pixels in the shader during the second pass with the texture coordinates slightly offset so that you can access the neighbouring pixels for the colour averaging used to simulate the light scattering.
Like I said though, source code and documentation is definately on the IHV sites. IIRC there''s also one in ShaderX too.
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
How? Render to texture, read the pixels in the shader during the second pass with the texture coordinates slightly offset so that you can access the neighbouring pixels for the colour averaging used to simulate the light scattering.
Like I said though, source code and documentation is definately on the IHV sites. IIRC there''s also one in ShaderX too.
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Your pixel shader output is R0. R0.a is the alpha. It mixes just like the fixed pipe. Fog, specular add, and alpha blending all take place AFTER the pixel shader has run.
A pixel shader is a replacement for your colorop and alphaops only.
A pixel shader is a replacement for your colorop and alphaops only.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement