Interior directional lights

A world I’m working on has an outdoor section lit by a directional sun light, and an interior section that players can teleport to, currently placed underground. I’d like the lighting to be the same for both regions, and I’d like ideas or suggestions for how to do that. My ideas so far:

  • Just use the one directional light. — Doesn’t work because the ground covers the whole underground interior area in shadow.
  • Disable the ground from casting shadow. — In my case the ground object is terrain that I do want casting shadows on outdoor objects. Also other outdoor objects could still cast shadows.
  • Disable the ground mesh when teleporting underground. — Solves the ground shadow problem but not for other outdoor objects.
  • Duplicate the directional light underground. — It still catches shadows from objects above it. Also doubles the brightness of everything.
  • Toggle between the outdoor and underground lights with Udon. — Solves the over-bright problem but not the outdoor casters problem.
  • Use a spotlight or point light underground. — These have different lighting characteristics from directional lights, so I’d have to spend a while getting them to match.
  • Put everything indoors into a layer and set the two lights’ layer masks to only light their respective layer. — VRChat uses layers for stuff internally, and also Udon can’t access the GameObjects of players to set their layer anyway.
  • Move the interior section above the skybox mesh instead of underground. — Only possible because I’m using a mesh as a skybox. Would mean that I couldn’t use the “background” render queue for the sky. Interior objects might cast shadows onto the outdoor area.
  • Move the interior section above anything casting shadows but below the skybox, and use Udon to toggle visibility when teleporting. — Udon can’t access the player GameObjects to toggle their visibility.
  • Same as above, but wrap the interior section in fake occluders instead of using Udon. — The occlusion culling system is conservative and can still draw things that might be occluded. Also would occlude anything between the interior area and the skybox.

Here’s a visual demo of the setup, currently showing the “layers” solution. Sorry it’s a photo, my PC currently doesn’t have internet.

I recommend lighting them separately and tweaking your interior lights to get the same level. I suggest using area lighting, however they only work for baked lightmaps and it seems you’re using realtime lighting. I highly recommend using mixed lighting mode with baked lights for your interior.

  • Same as above, but wrap the interior section in fake occluders instead of using Udon. — The occlusion culling system is conservative and can still draw things that might be occluded. Also would occlude anything between the interior area and the skybox.

You can solve the inconsistencies with drawing by creating an occlusion portal object, and making the bounding box large enough to fit the entirety of the interior section inside of it.

I’m not sure how important shadows are to you for this particular project, but another simple solution off the top of my head would be to lean back on the ambient light setting in the lighting options tab for the scene. You could change the ambient light setting to solid color or gradient. In the absence of any lights, your scene will have the same ‘base’ light level applied to every object according to what you have the ambient lighting set as.

Adding to what other folks said, another option would be to put a separate section away from the main area , at the same height. it doesn’t have to be physically underwater or above the skybox, just far enough away so you can’t see it from the other section (behind a wall for example)

Then, simply teleport between the two. I’ve seen people use fake stairs that trick the user into thinking they are moving up or down, when in reality they are just teleported sideways to another section of the map.

I have some worlds I’m building and have come across this same problem, however in my case I have a system of caves so having the deeper part darker is desired.

Though not optimum, the other idea of using carefully placed point and spot lights (or baked area lights) might work, though you may run into issues once you get past a certain # of lights. My experience has been, they start to “flicker” since we’re getting into URP and HDRP territory which the vrcsdk on our > 3 yr+ old unity doesn’t handle well…

Hope that helps!

A mixed light still casts real-time shadows, which are the issue here (and the lights need to either be mixed or real-time, not baked, so that dynamic objects, like players, can be lit).

Even if I got the occlusion to work just right, it would still occlude things in the sky, above the rooms. I would need to make sure nothing ever got that high.

Oh, of course, I do have a large wall I could hide them behind. I was too stuck thinking only vertically. Thanks!

Indeed this is the same challenge I run into – though Unity itself handles 30 or 50 of them fine, the SDK knocks it down to about 8 max (a swag, since I haven’t seen it documented) and I understand the reasoning. The same can be said about active spatial sound sources, to which there seems to be a limit …

So, bake them all and lose light effects (even though realtime shadows help with immersion) or leave a few realtime ones and suffer potential fps drop or light flicker.

I’m curious to see how you address this in your build(s), as well the separate map areas, since I’m dealing with the same challenges.