Jump to content
  • Advertisement
Sign in to follow this  
poigwym

multi-light , shadow system

This topic is 933 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

I 'm going to implement multi-light into my engine.

some question:

Is there a good algorithm to find the nearest nth light of an entity ?  the direction light has no concrete position, how can I measure the distance between the directionlight and entity ?

 

 

if there are no lights , some shader can't work, such as the normal map... if there are no light , the normal map will be a  big joke!

 

another question:

how to add shadow into the engine?

 

Share this post


Link to post
Share on other sites
Advertisement

A spatial acceleration structure should help you finding the closest lights, brute force is also a viable option depending on the number of lights you have in your DataBase.

If you write a deferred renderer you won't need to find the closest lights at all.

 

A directionnal light is a point light at infinity, ie like the sun or moon or star lights, so you will always consider it visible (unless in a cave or such).

 

Without light the lighting part of your shader won't trigger, no light means pure black unless you have some ambient light to avoid the issue, but sure your per light function won't be called, I don't really see a problem with that...

 

There are many shadow tech, shadow buffers (usually called shadow maps, even though maps are typically used for precomputed things and not runtime computed things) are a popular tech, and there are plenty of variations, I'd try straightforward shadow mapping (ie depth buffer) + Parallel Split Shadows for the sun/moon/stars.

Share this post


Link to post
Share on other sites

Usually the only directional light in a scene is the sun, so it really shouldn't be a problem.

 

edit - also as far as shadows go, look into shadow maps.

Edited by Infinisearch

Share this post


Link to post
Share on other sites

how to define the distance ?  use AABB to detect collision between object and light? 

Exactly. Light bounds vs object bounds.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!