Lighting settings sync for ViewportFrames

As a Roblox developer, it is currently too hard to create ViewportFrames with the same lighting as the game because we have to replicate the lighting through each ViewportFrame. We can solve this issue by have a toggle in Studio that uses the same or similar lighting as the main viewport (ie. game.Lighting). It would look something like this in properties:

image

What can I do with this feature?
You will be able to display separate models and items through different frames with the same lighting as the main lighting similar to what CS:GO does here:

(This is the viewmodel, on a completely different layer than the background)

This will improve not only my experience but many other developers because it will open up a new lane for creativity in your game. Many FPS games will be able to utilize this so guns and models won’t be clipping which could affect not only the user experience but competitive gameplay.

This would also be useful for keeping lighting in many ViewportFrames in sync with the game’s lighting if it’s constantly changing (such as with a day-night cycle, or weather). Without this feature, this would have to be done with many property changed connections, or a management script.

13 Likes

Related post.
https://devforum.roblox.com/t/add-terrain-support-rendering-from-outside-its-parental-structure-for-viewportframe/219346/2

1 Like

The problem with this is that VPF’s don’t use the same lighting at a fundamental level, so having it match the world doesn’t exactly work.

If your world lighting is ShadowMap, the VPF is going to look like a flat shaded cartoon in comparison.

However, we can try to match what few settings we do have.
VPF.LightDirection could be derived from Lighting:GetSunDirection(), VPF.Ambient from Lighting.OutdoorAmbient, and VPF.LightColor from Lighting.ColorShift_Top.

Wouldn’t be perfect, but if we set Lighting.Brightness to 0.5 it looks rather similar.

8 Likes