Boke
New member
It wasn't so hard after all... I am begining to think that shadow volumes may be a better solution though. I don't mind the aliasing to much, but at long light/object distances the shadows tend to jump around a great deal. I'm going to add some percentage closer filtering next... maybe that will help.
The funny looking black cube represents the light. The scene is rendered into the 6 faces of a 512 cube map. The values stored in the cube map rg channels ( using a lookup texture.. Thanks ATI guys!! ) are the cartesian distance from each rendered fragment to the light. Then the cube map is set as a texture for the final render and projected into the scene. The distance ( +ZBias ) is calculated again and compared to the 'projected' distance values.
Using the z distance, you seem to need much less ZBias than you do with z depth. It also seems to be less prone to errors... Heres a pic... ( Resized from 1024x768 ).
The funny looking black cube represents the light. The scene is rendered into the 6 faces of a 512 cube map. The values stored in the cube map rg channels ( using a lookup texture.. Thanks ATI guys!! ) are the cartesian distance from each rendered fragment to the light. Then the cube map is set as a texture for the final render and projected into the scene. The distance ( +ZBias ) is calculated again and compared to the 'projected' distance values.
Using the z distance, you seem to need much less ZBias than you do with z depth. It also seems to be less prone to errors... Heres a pic... ( Resized from 1024x768 ).