Jump to content

  • Log In with Google      Sign In   
  • Create Account

[dx9 HLSL] Shadow Map with point light


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 cebugdev   Members   -  Reputation: 318

Like
0Likes
Like

Posted 12 June 2011 - 08:09 AM

Hi all,

i am reading the tutorial for implementing shadow map in HLSL directx9 at
http://www.gamedev.net/page/resources/_/reference/programming/special-effects/shadows/soft-edged-shadows-r2193

and got me wondering how shadow map is done when using point light?
see, the tutorial is using a directional light where the LightViewProjection Matrix is calculated using D3DXMatrixLookAtLH( &matView, &vLightPos, &vLightAim, &g_vUp );
Point light does not have direction, but the direction is computed in HLSL instead.

so how do i do the shadowmap descrbed on the above link using point lights?
How do i compute the lightViewProjection matrix for point lights? can it be done in HLSL?

Thanks,

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 30389

Like
0Likes
Like

Posted 12 June 2011 - 08:21 AM

You can represent the point light as 6 spot-lights (cubic shadow maps), or 2 spot-lights (dual paraboloid shadow maps), or if the light source itself is outside the view-frustum, you can take a short-cut and treat it as a single spot-light.

#3 zipwax   GDNet+   -  Reputation: 114

Like
-1Likes
Like

Posted 12 March 2012 - 12:45 PM

That wasn't the most informative reply. Why represent it as six spot lights? Why can't I find a HLSL example for a point-light shadow routine where the point light simply uses a perspective transformation instead of a orthographic transformation? Are there any examples online of a point-source shadow mapping (SIMPLE) example?

#4 Zero01   Members   -  Reputation: 109

Like
0Likes
Like

Posted 14 March 2012 - 11:45 AM

take a look at http://gamedevelop.e...dow-mapping.htm

#5 zipwax   GDNet+   -  Reputation: 114

Like
0Likes
Like

Posted 15 March 2012 - 10:21 AM

To the first guy who asked the question, I figured it out. For a point-light, you simply duplicate the exact same projection matrix as you use for the camera. In other words, move the "eye" to the point source's location (the view matrix), and calculate the projection matrix to be the same as you used for the camera. Then calculate the shadow map. Be careful that the light is not too close to your model, or the shadow map won't contain all of the model, and you'll get STRANGE shadows.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS