Jump to content
  • Advertisement
Sign in to follow this  
Lord Gzoo

shadow maps- w/o pixel shaders?

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

WAIT! So can i use shadow map techniques without using a pixel shader? or should i stop being cheap and replace my.. well... geforce.. 2... :\ lol oh, and if i can, how? :)

Share this post


Link to post
Share on other sites
Advertisement

  1. Create a texture using a depth buffer format.
  2. Set level0 of the texture as the depth buffer.
  3. Disable colour writes (probably by setting SRCBLEND=0 DSTBLEND=1).
  4. Render the occluder geometry from the point of view of your light.
  5. Set the depth buffer back to normal and reenable colour writes.
  6. Set texture 0 to the depth buffer format texture.
  7. Set up the texcoord source for stage0 to be the camera-space position.
  8. Set up a texture matrix in stage 0 to transform from camera-space positions to projected light-space positions.
  9. Set up the remaining texture stages to apply your shadow with the appropriate blending.
  10. Sip a large drink with an umbrella in it.


The last step is optional but recommended.

Share this post


Link to post
Share on other sites
Yeah, you can do shadow mapping without using pixel shaders but you still need (assuming you want proper shadow mapping) a graphics card capable of doing the depth comparison for you. That is still GeForce3 and above as far as I'm aware. Unfortunately, you'll probably find on ATi cards of that generation you can't create a depth texture in Direct3D, at least that was my experience, and I don't know much about OpenGL but your card needs to support the GL_ARB_depth_texture and GL_ARB_shadow (or equivelent) if you want the hardware comparison there.

-Mezz

Share this post


Link to post
Share on other sites
There's a good demo and explanation here:
http://www.paulsprojects.net/tutorials/smt/smt.html

Its relatively old, so doesn't include use of the frame buffer object extension, which makes shadow mapping easier, i.e. you can drop pbuffers out of the equation, but is still a very good starting point. There is also a demo in the Nvidia SDK, think it also lives somewhere on the developer website as well.

Share this post


Link to post
Share on other sites
One thing to keep in mind though, is that in a practical game, the cost of generating and rendering the shadow maps will be so great that you'll, more often than not, want to reset your min spec to shader 2.0 class hardware, and that's still while ignoring the low quality that a hardware SM will give most of the time. On that last point, there are exceptions to that rule, such as SimmerD's Ancident Galaxy, but his camera is also a fair distance away from most shadows, so the low quality is not very evident. If you're targeting GF2 hardware, go for shadow volumes, not shadow maps.

Share this post


Link to post
Share on other sites
Another idea is to use alpha test to do your shadow map comparisons. This gives you 8-bit depth shadows, and can work on very old hw.

This is what I do in my engine, although other features make my engine require gf3+...

Share this post


Link to post
Share on other sites
thanks for all the replies, i didn't even know there's an animal called texture matrix.

Quote:
Original post by superpig

  1. Create a texture using a depth buffer format.
  2. Set level0 of the texture as the depth buffer.
  3. Disable colour writes (probably by setting SRCBLEND=0 DSTBLEND=1).
  4. Render the occluder geometry from the point of view of your light.
  5. Set the depth buffer back to normal and reenable colour writes.
  6. Set texture 0 to the depth buffer format texture.
  7. Set up the texcoord source for stage0 to be the camera-space position.
  8. Set up a texture matrix in stage 0 to transform from camera-space positions to projected light-space positions.
  9. Set up the remaining texture stages to apply your shadow with the appropriate blending.
  10. Sip a large drink with an umbrella in it.


The last step is optional but recommended.


meow, woof.
how does d3d know to take values from the default depth buffer AND the texture and compare them all nicely together?
it just.. knows that?
or am i missing something?
i guess i AM missing something.

Share this post


Link to post
Share on other sites
Lord Gzoo: I think
Quote:
Set up the remaining texture stages to apply your shadow with the appropriate blending.
would be where the depth compare is applied, but I'm not sure (I've only done shader-based SMs).

Share this post


Link to post
Share on other sites
No, this is the special hardware hack that NVidia did back with the GF2 (?). Basically, it detects when you're reading from a depth format texture using a projected 4D coord (x, y, z, w), calculates (x/w, y/w) to do the read, then compares it to (z/w). The final result of the sampling comes out as either 0 or 1 depending on which is higher.

The major downside is that it doesn't work on ATI cards, natch.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!