Improvement for Indoor Dynamic Lighting

I am working on an RPG game with dynamic day/night cycle. I am using a moveable directional light. The main issue with this is that the back sides of objects are completely black and this looks horrible. To fix this issue, I added a stationary skylight without shadows to cast a small amount of ambient light along with the directional light. I scale the brightness with the day/night cycle and I am pretty happy with the results, however there is one huge problem. Indoor areas are way too bright. What I am looking for is a volume I can add to indoor areas to tell the ambient skylight not to light them at all. Does something like this already exist? If not, does this sound like something that would be possible? I am pretty good with C++ and I don’t mind modifying the source to add a volume object to do this. I would basically just want it to exclude adding skylight lighting to any object with an origin inside the volume.

I followed through the source code until I got to: BasePassPixelShader.usf which appears to be doing the skylighting of objects, but that is where I get lost. I’m not sure how to control this shader on a per object basis where I can add an if statement to decide whether to apply the lighting based on if the object is in my new volume object or not. Any help pointing me in the right direction would be appreciated. Thanks!

Indoor areas are too bright because you disabled shadow casting on the sky light, its shadowing prevents the sky lighting from affecting indoors (you can’t see the sky indoors).

Really what you need is dynamic GI, but right now the only thing UE4 supports is LPV which have some problems.

Here’s something to try - enable shadow casting on the sky light, and then use a faint ambient cubemap in the PP volume. That ambient cubemap gives you a global ambient term so that the lighting never goes to black, it is your ‘indoor’ lighting. Meanwhile the sky is still properly occluded.

Hey , thanks for your response. I agree that what I really need is dynamic GI. I played around with the distance field ambient occlusion, but I wasn’t happy with the results or the limitations listed in the documentation. I haven’t tried the LPV system, but based on some reading I don’t think it will work for what I need in its current state.

I enabled the shadow casting on the sky light, but it had no noticeable effect. I double checked that my indoor ceiling is a cube (SM_BrickWall), not a single sided plane, and that cast shadows is checked. Removing the skylight altogether makes my indoor scenes look the way I want them to with no external light. But then my outdoor shadows are completely black and look fake.

What I am trying to achieve is a system where indoor scenes use lightmass to pre-calculate the lighting using mostly point lights and outdoor scenes use dynamic lighting to support time of day. I still want to use lightmass for indoor scenes because lightmass pre-calculated lighting looks 10 times better than dynamic lighting. It should, it takes 10 minutes to calculate the lighting for one level.

I haven’t tried using an ambient cubemap in the PP volume, but I have a feeling that will add light to my indoor scenes which is what I want to avoid. I want to be able to create pitch black indoor areas.

Does my idea of modifying the source code to have a volume object to exclude certain areas from receiving ambient skylighting seem like something that is possible, or should I give up that idea and look for another solution? Thanks!

I enabled the shadow casting on the sky light, but it had no noticeable effect.

Did you rebuild lighting after that? Do your objects have proper lightmap UVs? That should definitely work, and it is the key to getting what you want. Note the skylight has to be stationary. Have a look at some working examples like the RealisticRendering sample.

What I am trying to achieve is a system where indoor scenes use lightmass to pre-calculate the lighting using mostly point lights and outdoor scenes use dynamic lighting to support time of day.

That is definitely achievable right now with the features out of the box. Movable directional light (you won’t get GI from it unless you enable LPV), Stationary skylight with shadow casting (update periodically with RecaptureSky blueprint function) and then various Stationary Point and Spot lights indoors which will store their GI in the lightmap.

Does my idea of modifying the source code to have a volume object to exclude certain areas from receiving ambient skylighting seem like something that is possible, or should I give up that idea and look for another solution?

It’s definitely possible, it just seems like a lot more work and lower quality than the skylight shadows.

Thanks ! It works great now. The trick was setting the Skylight to Stationary (not moveable like I had) and rebuilding lighting to get it to bake the Bent Normal occlusion information.