Jump to content
  • Advertisement
Sign in to follow this  
alirakiyan

Shadow Mapping

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

I can make shadow map texture using a shader. now I wanna draw the shadowed scene without that shader.

I wanna draw the scene in my application using RenderStates so that I can draw shadowed effect like bumps.

can any one help me please?

Share this post


Link to post
Share on other sites
Advertisement
I can draw the scene using shaders. but I can't use any other shaders in such a scene cuz i'm using shadow shader!

I wanna draw shadows NOT using shaders .

the first part of shadow mapping is OK. (generating depth map as a texture)

now I need to know what to do next?




Share this post


Link to post
Share on other sites
To use your depth based shadow map to render the final scene, you need a shader that sample the shadow map as a global texture. You need 2 values from the light source's projection matrix to convert from the inverted ZW scale to a linear depth scale. To support multiple light sources, you should do the conversion in the pixel shader. Convert pixel positions from world space to linear light space using the transpose of an orthogonal 3x3 matrix from the light source. When a depth map have perspective, the bias must be multiplied by the depth because the pixels cause more artifacts when they are bigger.

http://www.gamedev.net/topic/604984-linear-depth-buffer-for-rendering-shadows/

When comparing the depths, use a mask of 2 filters and calculate the optimal bias on the CPU.
The first method will sample the depth using bilinear interpolation and make a comparison so that there is hard edges.
The second method will sample the depth map using a special filter that compare the 4 closest points and interpolate the intensity so that there is acne.
Taking the maximum intensity of both gives a soft result when there would not be acne as long as the shadow reciever is casting shadows.

Share this post


Link to post
Share on other sites
You cannot do shadow mapping without programmable shaders. That is because you need to do a per-fragment (per-element) depth-test, which is something unachievable with fixed function render states and stuff.
You could try stencil shadows, those will work with fixed-function pipeline.

[color="#FF0000"]EDIT: Sorry for misleading, I dug over the internets and found GL_ARB_shadow extension from 2002, which I wasn't aware of. This could mean there is something like that in DX8/9. But I'm unable to help with that :(

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!