Dynamic Exposure For Lighting

I’m currently working on a lighting system that will automatically set the exposure of lighting depending on what is displayed on screen, and what the player is focused on.

My goal with this script is to achieve more immersive and realistic lighting conditions in my games.

EDIT: Updates -

-- Fixed flickering while moving
-- Added more focal points to average the exposure between
-- Adjusted the exposure value of the sky, so being outside is just like normal roblox lighting
-- Light objects and neon parts are also taken into account when adjusting exposure

https://www.roblox.com/games/4919225159/Automatic-Exposure

15 Likes

This is essentially the peak of realism in lighting for me to see, the fact that you’ve gone through the effort of having this simple but extremely effective effect.

This can relate to me looking out of the window after a whole day of sitting in a chair, only for my eyes to catch the sun & burn in despair.

Really looking forward to seeing what’s to come for the future of this lighting system! :v:

2 Likes

The exposure data should be averaged from a bunch of rays around the screen, NOT just the middle.

2 Likes

It is, but so far it’s only 3 for performance. 1 being the focal point, 1 being the camera point, and 1 being the foreground in between.

1 Like

This is really cool, but it goes very dark when I put my camera down so maybe you could fix that.

Overall, this system will be good for cave environments and I’m excited to see how it will be utilized in the future.

1 Like

The automatic exposure is pretty cool. I like what you’re creating! What I would try to focus on is how quickly the exposure changes. When I was playing the game and just walking around, my screen kept getting bright then dark, making it kind of nauseating.

1 Like

You can cast tens of rays per-frame without a visible performance drop, don’t worry.

1 Like

Ok well couple things wrong with that…

Firstly performance is more affected by the length of the ray, rather than the amount of rays.

Secondly I have to cast more than 1 ray per focal point. First I have to raycast forward to find the focal point and the color of the surface the client is looking at. Then I have to have a really long ray casting from that point, to the sun’s position to determine how shaded the focal point is, and I need to do another long ray to determine how shaded the foreground is, etc.

1 Like

The effect still doesn’t work very well if you can’t stare at the end of a tunnel without the effect assuming you’re looking at the sky. that’s my main issue, plus everything working rampantly and probably giving me eye strain outside of the tunnel. there’s plenty to improve, i just thought collecting data from the whole screen would be part of the improvement.

1 Like

Well achieving ultimate realism isn’t really possible at the moment, and it’s made even more difficult by the fact that I can’t just detect the color of any given pixel, I have to detect the color of the part and combine it with a lot of estimations based on the current lighting condition, before I can properly determine how far from middle gray the pixel is.

About the tunnel sky issue though, since there are no bounding walls to the map, if you look outside the tunnel you are literally looking at the sky.

1 Like

Fixed and adjusted more settings and I’m pretty happy with it, will be putting in all my projects from here on out.

1 Like

Alright, ill be expecting the place file link in my dms.

1 Like

This is awesome. I feel like you should make the exposure adjust slower and maybe add a bit of delay just to make it more realistic. Are you gonna release the script?