• Advertisement
Sign in to follow this  

Outdoor vs Indoor Lighting

This topic is 1894 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 have an outdoor scene with some indoor elements like a house. When a player walks indoor, the lighting is all wrong because the indoor of the house is now being lit from the sun, regardless if walls are blocking the light.

So, how do people generally handle this? I was going to add a bounding box around the house, if the player collides with it, I would switch the lighting to just an ambient color and not take the sun. Similarly if the player walks outside, I'd switch back to using the sunlight.

The sun is needed for the outside walls to show lit vs shaded side. The indoor doesn't need that (at least from the sun).

Is that how others do this?

Thanks
Jeff.

Share this post


Link to post
Share on other sites
Advertisement
You can add a sun occlusion factor to your scene's materials, if your material is used outdoor you set this factor so it doesn't occlude sunlight, if it's used indoor you set it so it does occlude sunlight.
If you're using a deferred renderer you can store this value in your GBuffer.

I believe this technique is quite commonly used in some major engines and it's quite simple to implement.

Share this post


Link to post
Share on other sites
I think that if the house is really it's own environment, then you need to control it directly in order to get proper lighting. On the other hand, if it is like 007 on the N64 where you walk into the shacks but it isn't very "important" than it doesn't make much difference. I'm not sure how you are rendering these graphics. If you are using OpenGL directly, you can change lighting scheme between rendering different objects so that the house has its own lighting. The catch is that you'd have to create models for the outside and for the inside, although if you already have a single model that has polys on both sides, you may be able to just split them in your modeling software.

Share this post


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

  • Advertisement