optimizing calculation of shadowmap coordinates
Hi!
For my shadowmapping, i calculate the texture coordinates for the shadowmap in my vertex shader (since the objects move, i have to do this in every frame):
float4 shadowMapPos = mul(Input.Pos, lightViewProj);
Out.shadowcoord = shadowMapPos.xy/(shadowMapPos.w*2.0f)+0.5f;
Out.shadowcoord.y = 1.0f-Out.shadowcoord.y;
Out.lightdist = shadowMapPos.z/shadowMapPos.w;
this gives me the position of the vertices in lightViewProjection space and the distance between the vected and the lightsource.
I wanted to know, wether there is a more performant way for doing this (i'm using XNA (based on directX) and HLSL) or wether I can optimize my calculation somehow?
Thanks!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement