Download

Struggling with outside/inside lighting

So, here’s my problem. I’m trying to create something like a cave but it’s too bright inside since I set the shadow amount to be around 0.4 + some skylight intensity

Eye adaptation is off.
I was thinking about a negative light but this nice feature was removed for some reason.

Do I have to make 2 separate levels with different world lightings for this?

](filedata/fetch?id=1806218&d=1598701226)​

If you want proper darkness inside, you need to use moveable skylight and directional light.

ehm, how is that supposed to help? he said he has some skylight intensity and everything is too bright inside. your suggestion would make exactly that: too bright inside. or if he lowers the skylight to be less dark inside, he’ll get very dark shadows outside.

@marasovec unfortunately there’s no way to filter out areas or use negative lights to darken the ambient light produced by a movable skylight.

you can use a static or stationary skylight instead, and precompute the lighting for it. this way the ambient light will be local per area. you can still have a movable sun light if you need dynamic time of day. if your skylight is stationary you can animate the skylight color with your time of day.
yes, this means using lightmass and baking lighting. however if you force every actor’s mesh in your scene to use the Volumetric Lightmap, you don’t need to create lightmap UVs at all.
if you need an immediate solution personally this would be my preferred method. as long as you don’t need to spawn static geometry at game time (i.e. having procedural levels) I find this to be a very good compromise between quality (much better than a movable skylight) and iteration time (you bake lighting yes, but no need to worry about lightmap UVs)

if you really need a movable skylight it’s often suggested a ‘solution’ with some sort of custom volume, sort of like a tunnel, which modifies the skylight intensity as you pass through it. this way when you enter the cave it gets darker as you pass the entrance, and find it to be dark when you’re finally inside. I find this solution to be very lacking because if you go inside and get darker skylight and look outside it will be very dark. and if you go outside and look inside it will be very bright. so you need to come up with more and more trickery to avoid this effect (like putting a dark semi-transparent plane to darken the inside, using postprocess volumes, etc)

you can also try using Distance Field AO. it works well up to a certain size, but once your interiors are big enough the occlusion becomes too “local”, and the floor/walls/ceiling are too far apart to occlude eachother and you’re back to having the unwanted outdoors-like ambient light inside.

there’s also the option of using a very dim skylight (tuned for interiors) and couple it with LPV. the idea is to tune the LPV values to be strong enough for the GI to act as ambient light. I’ve seen it work well enough, it’s just limited by the LPV featureset (very coarse voxels causing bleeding on thin walls, limited GI distance with a hard cut, performance not as good)

another option is to use raytracing in your skylight, but this limits your game to users with RTX cards.

you can also wait for UE5 to come out next year and use the Lumen lighting system, it should allow to do exactly what you need.

another trick to block the light from a Movable Skylight: make a decal, make a decal material for it, set the Decal Blend Mode to Ambient Occclusion, set the material AO output to 0, fill your interiors with these decals, profit.
probably drawcall heavy and requires a lot of placement. but you can effectively block all dynamic skylight with it. the decals can fade out by distance so you can fine tune your performance vs distance tradeoff, and since it’s material-based you can do gradients for transitions.

another solution is to use my Localized IBL system (link in my sig). but you need to modify the engine for that.

Erm… He probably has a static skylight - that’s how… Moveable skylight with MDF is how to get proper darkness inside…

MDF stands for Mesh Sistance Fields incase you do not know @marasovec. Mesh distance field ambient occlusion may be helpful for small caves, however in large caves, it wont cut it, as mesh distance field ambient occlusion has a somewhat limited distance range.

I do have a suggestion though. You could try using SSGI in your project. Its not a perfect and can have some unusual artefacts, however it would make your caves darker when viewed from outside.

Thanks guys
I’ll try your ideas

As Chosker said in order to correctly occlude interiors you should use a static/stationary skylight. Moveable skylights are unshadowed which causes interiors to be fully lit (DFAO is not sufficient to overcome this problem with most scenes). Static/stationary skylights on the other hand are properly shadowed and occluded, and they also generate volumetric lightmaps or light probes which will correctly light all moveable objects within the cave area.

With moveable skylights your best option is to simply hide the area with a plane that has an emissive black material on it that fades to translucent as you get near it.

Unless you’re manually changing the exposure between areas, turning off adaptive exposure is usually a bad idea. The whole point of adaptive exposure is specifically to deal with this type of use case; Where you have two areas with drastically different lighting. If you use a fixed exposure for your whole scene then you will not be able to realistically light it.

Could you not just use a trigger somewhere at the cave entrance to reduce the skylights intensity to a value, where it is dark enough in your cave, or turn it off completely, if necessary? Or use triggers to switch/blend between two different skylights, one for your daytime outside world, and one for dark places like your cave.

The easiest would be, if there is a trigger, that does not switch from 100% to 0% instantly, but let the change happen gradually, maybe depending on distance, how far away you are to the bright side or the dark side of this trigger.

Other than a black plane to occlude the cave and make it appear dark inside from the outside, there needs to be something that allows the cave to remain dark when viewing it on the outside. Post process volume(s) with darker exposure doesn’t do it because priority of the outside post process volume makes it light up in the cave. Is there something that can be changed about PPVs to get the inside of the cave to render dark? Why is the post process volume taking precedence over dynamic lighting that results in occluded or a semi-occluded area such as a cave losing darkness and getting lit according to the PPV it’s in?

I came up with another trick to block the ambient light from a Movable Skylight: make a decal, make a decal material for it, set the Decal Blend Mode to Ambient Occclusion, set the material AO output to 0, fill your interiors with these decals, profit.
probably drawcall heavy and requires a lot of placement. but you can effectively block all dynamic skylight with it. the decals can fade out by distance so you can fine tune your performance vs distance tradeoff, and since it’s material-based you can do gradients for transitions.