Get light's direction L when computing shadow

   2819   5   2
User Avatar
Member
22 posts
Joined: June 2008
Offline
Hello,

How can one get light's direction vector L in shader when computing shadowmap?

Trying to read this from illuminance loop, this doesn not work for me.
illuminance(P)
{
if( isshadowray() ){
printf(“L is: %d\n”, L);
}
}
This prints nothing.

Tried to make sort of custom illuminance loop, yet no luck.
lights = getlights(\“lightmask\”,_lightmask_,\“categories\”,_categories_);
if (setcurrentlight(lights)) {
if( isshadowray() ){
printf(“lights: %d\n”, lights);
}
}

The ‘lights’ array is empty in this case.

How can I read light's direction while computing shadow?
TD @ Mr.X Inc
User Avatar
Member
1390 posts
Joined: July 2005
Offline
sergey_sh
Hello,

How can one get light's direction vector L in shader when computing shadowmap?

Shadow map is computed by a light acting as a camera. So light's direction is just -I.

Afaik in this mode mantra evaluates only opacity part of a surface shader, so it doesn't evaluate illuminance loop at all.

As to ray traced shadow “L” is the answer, but I think isshadowray() inside illuminance() evaluates always to 0, as shadow rays (see above) don't touch this loop.
User Avatar
Member
22 posts
Joined: June 2008
Offline
thanks!
TD @ Mr.X Inc
User Avatar
Member
22 posts
Joined: June 2008
Offline
May I have a stupid question.

How can one get actual camera direction - the direction of camera from which final image is computed while shader is being called for deep shadows creation?
TD @ Mr.X Inc
User Avatar
Member
1390 posts
Joined: July 2005
Offline
sergey_sh
How can one get actual camera direction - the direction of camera from which final image is computed while shader is being called for deep shadows creation?

…while shader is being called for deep shadow map creation? I don't think there is a way other than providing it by an user parameter to a shader. Mantra doesn't know the camera other than a light casting shadow during that stage. Divide and conquer.

Perhaps if you tell what is your goal, it will be easier to find a way.
User Avatar
Member
22 posts
Joined: June 2008
Offline
SYmek, thanks for your reply.

Just need an angle between camera and light when mantra is creating deep shadow map. Looks like user parameter is the only solution.
TD @ Mr.X Inc
  • Quick Links