• FEATURED
• FEATURED
• FEATURED
• FEATURED
• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# [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.

4 replies to this topic

### #1cebugdev  Members

Posted 12 June 2011 - 08:09 AM

Hi all,

i am reading the tutorial for implementing shadow map in HLSL directx9 at

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,

### #2Hodgman  Moderators

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.

### #3zipwax  Members

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?

### #4Zero01  Members

Posted 14 March 2012 - 11:45 AM

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

### #5zipwax  Members

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.