Hello, I am making a dynamic brightness thing that affects the game’s brightness from these factors: Clocktime, Cloud Density, & Cloud Cover.
The TimeBrightness factors in clocktime utilizing this this tutorial. Essentially, it uses a sine wave to calculate the brightness being affected during specific game time.
local mam = game.Lighting:GetMinutesAfterMidnight()/60
local TimeBrightness = TimeAmplitude * math.cos(mam * (pi/12) + pi) + TimeOffset
Then we have the Cloud’s brightness. I’ve been struggling with this because I’m unsure how to scale down the brightness with the clouds, rather it increasing if the Cover & Density are low.
local CloudBrightness = (.5 * (.25 - CloudsData.Density)) + (.75 - CloudsData.Cover)
LightingData.Brightness = (CloudBrightness + TimeBrightness) + .25
The .25
and .75
are just constant numbers that subtract from the Cover and Density data. I multiplied its density by .5 because I want the Cover to impact the brightness more than the density. This math is far from perfect but it’s worth a try.
Any help is appreciated!