Sign in to follow this  

Per pixel diffuse+spec and depth shadow mapping in DX8

This topic is 4858 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

Hi all... This is getting a bit longer I guess. I have a DirectX 8.1 compatible hardware platform with 4 texture stages which is capable of depth shadow mapping. What I want to do is to have fully blown per pixel lighting (diffuse & specular) plus depth shadow mapping for the scene. My current idea is to have two framebuffers. The first framebuffer is rendered using only the lighting information (say, do per pixel light calculations plus depth shadowing) which would mean one render pass per light there. The second one would be rendered in a single pass using only textures. In a final step those two buffers then are blended together. This seems somewhat reasonable to me since it means 2 passes per light (shadow buffer generation & ppl) and a final pass for textures (at the moment I don't have an idea about how to reduce that count). The thing is: it won't work properly because the diffuse component has to be modulated with the textures where the specular component has to be added. Another idea would be to do diffuse and specular separately. This would average to the same amount of passes since I can do two lights diffuse or specular per pass. However, I'd need 3 render targets there. Hm. I don't even want to thing about alpha blending right now. :) I am ready to try anything promising, but it's just a huge amount of work so I wanted to hear your opinions / ideas about that topic before diving right into it. Thanks, Alex

Share this post


Link to post
Share on other sites
Hm. When I think about it the second solution doesn't sound too bad to me. But I guess that'll get me into a real mesh uploading / framebuffer changin hell.

Share this post


Link to post
Share on other sites
If you don't use colored specular, just white, you can accumulate it exactly like you accumulate color, except in the alpha. When you do your final blend, do framebuffer.rgb*texturediffuse.xyz + framebuffer.a

If the specular color changes per object, but not per light, you can accumulate a specularamount as above, then do framebuffer.rgb*texturediffuse.xyz + framebuffer.a*objectspecularcolor.rgb

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Here's a rough idea that I haven't actually tried yet - for a shadow mapping method with just one framebuffer - render just an ambient pass into framebuffer color, then render all shadows into framebuffer alpha, then do a final alpha blended diffuse/specular pass into framebuffer color using: dst_color + (src_color * dst_alpha). If framebuffer alpha is cleared to white, and shadows are rendered as dark, then: fully unshadowed pixels will be dst_color + src_color (i.e. ambient + diff/spec) and fully shadowed shadowed pixels will be dst_color (ambient only). Partially shadowed pixels have some diff/spec. Naturally, there are a dozen details I've left out (and probably ar least one fatal flaw), but the general idea is: no diff/spec on shadowed pixels.

joe
image space

Share this post


Link to post
Share on other sites

This topic is 4858 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this