Shadow map develope (I)

Shadow map can help us generate full-screen shadow result. It can achieve natural self-shadow effect。But its bottleneck is hard shadow and resolution problem。
First, I want to use this dx9 sample to describe shadow map implement, shadow map is a multiple pass technique, so I divide into different term to decribe shadow map。
  1. The first pass, we need to generate the shadow map. Store the current render target and DepthStencil, then set render target to the shadow map texture, then tranform view space to lighting's view space(including projection space), write the depth value to the render target, finally resort previous render target and DepthStencil。
  2. The End pass, render the scene. Use camera's view space and projection space, set the shadow map texture, generate the shadow map martix that means transform from view space to lighting space. And in the pixel shader, we can at shadow map space to sink our shadow map texel, and using pcf(percentage closest filtering) to blur it, the texel color then compute with diffuse color is the output color.


Popular posts from this blog


After reading Steve Jobs Autobiography

Drawing textured cube with Vulkan on Android