Jump to content

Realistic nights issue


5150

Recommended Posts

Okay, so ive been working on the realistic nights resource trying to get rid of the terrible fog effect issue you get while the server transitions to night time. problem is, you need to keep the fog effect to accurately portray the dark night feature, without it its just a black sky gradient. i tried to delay the start of the fog until after sunset (if ((th >= 22.9) and (th <=23)) then), when it just about gets full night but instead of the fog starting at 0% at the time 22.9 (22:55) and quickly increasing to 100% by 23:00, it starts at about 50% and increases to 100% by 23:00. This results in the fog abruptly showing up in the screen for a short time before it clears out into darkness.

i guess what im asking is does anyone know how to edit the whole 'if' statement including 22.9 to 23 to allow the fog to begin at 0% rather than 50%. video attached to see what the hell im talking about
https://streamable.com/m4zfeh
as you can see, the "fog" abruptly appears eventually turning to night, rather than gradually appearing then transitioning to night. the fog is what makes that night feature appear so it cant just be removed. ive shortened the time it takes to turn full night because the fog looks like crap during sunset

ive tried to explain the best i can, sorry if it doesnt make much sense. leave a comment if you need more info, thanks in advance

for this code, intens = 1200

Spoiler
function timeInterval()
	if (getMinuteDuration() >= 100) then
		return getMinuteDuration()
	else
		return 100
	end
end

setTimer(function()
	local h, m = getTime()
	local th = h + (m /60)
	local tm = m + (h * 60)
	if ((th >= 20) and (th <=23)) then
		if (th <=23) then
		setSkyGradient(clr(bx, th), clr(by, th), clr(bz, th), clr(ax, th), clr(ay, th), clr(az, th))
		end
		if ((th >= 22.9) and (th <=23)) then
		setFogDistance(-intens + (intens/1020 * (1380 - tm)))
		end
	elseif (((th > 23) and (th <=24)) or ((th >= 0) and (th <2))) then
		setFogDistance(-intens)
		setSkyGradient(0, 0, 0, 0, 0, 0)
	elseif ((th >=2) and (th <= 5)) then
		setSkyGradient(uclr(bx/10, h), uclr(by/10, th), uclr(bz/10, th), uclr(ax/10, th), uclr(ay/10, th), uclr(az/10, th))
		setFogDistance(-intens + (intens/180 * (tm-120)))
	end
	if ((th > 5) and (th < 20)) then
		resetSkyGradient()
	end
end, timeInterval(), 0)

 

 

Edited by 5150
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...