Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Directional Lights - Casting Shadows

This topic is 6109 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''ve been working on a terrain engine in D3D8, and have decided to pre-process my lighting in the form of lightmaps... all funky looking so far, real nice However, when it comes to Directional lights, I have a slight problem... When casting a shadow I construct a line from the light to the point in question, trace along it, comparing against bounding boxes, then doing a line-plane-barycentric test at a higher resolution. With a directional light there is no origin for the light, such that you can strictly define a line to trace for shadows... My current solution is to take the center point of the terrain, then calculate a vector at the specified angle (for the directional light), and then multiply it such that the "starting" point for the directional light is almost infinitely far away (or as far as the datatype allows), such that the angles between the the min/max points will be so small as to not really matter... that way the shadows aren''t entirely accurate, yet they''re a pretty good approximation... Is this a good way of solving the problem? or is there a clever/better way of doing this that i haven''t thought of?? Many thanks for any help.. Jack;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!