Posted By: txesmi
[SUB] Omnidirectional shadows - 06/20/12 11:32
Hi,
since i received many requests about the shadows I shown on the what are you working on topic, i decided to explain how they are computed. I have to say that this shader is not a solution for any game. It is just a hobbyist workaround looking for a dynamic point shadow projection. In fact, it only works with models and sprites and it has not native lights support. The light properties are passed through the material skills.
The shadows are computed with a depth cubemap that is rendered over a 32bit floating point bitmap, very similar to the 3dgs shadows example but with six cameras instead of one.
Continuing with the differences to the 3dgs shadows example, the depth shader computes the distance between the light and the lighted surface in world space instead of the z axis (depth) in view space, so the returned red channel value is the real distance to the light point.
Diffuse, specular and light range maths are directly taken from the shader programming tutorials
Hope it helps,
salud!
EDITED____________
ominishadows.zip
since i received many requests about the shadows I shown on the what are you working on topic, i decided to explain how they are computed. I have to say that this shader is not a solution for any game. It is just a hobbyist workaround looking for a dynamic point shadow projection. In fact, it only works with models and sprites and it has not native lights support. The light properties are passed through the material skills.
The shadows are computed with a depth cubemap that is rendered over a 32bit floating point bitmap, very similar to the 3dgs shadows example but with six cameras instead of one.
Click to reveal..
Continuing with the differences to the 3dgs shadows example, the depth shader computes the distance between the light and the lighted surface in world space instead of the z axis (depth) in view space, so the returned red channel value is the real distance to the light point.
Click to reveal..
Diffuse, specular and light range maths are directly taken from the shader programming tutorials
Click to reveal..
Hope it helps,
salud!
EDITED____________
ominishadows.zip