• Advertisement

Archived

This topic is now archived and is closed to further replies.

Translucency

This topic is 5494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement