Outdoor vs Indoor Lighting

Started by
3 comments, last by kburkhart84 11 years, 5 months ago
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.
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.

I gets all your texture budgets!

If you implement shadows, you can also just rely on the shadows to deal with shadowing light sources located outside the house. Although what with shadows being a bit of a black art (no pun intended), you may need to fudge things a little.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Radikalizm,

Is this common? If you have multiple materials, then you'll need 2 draw calls. Is that correct?

Thanks
Jeff.
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.


This topic is closed to new replies.

Advertisement