#
#   SETTINGS
#

profile.Low=CLOUD_RENDER_LOD=4.0 !cloudShadowsEnabled !cloudVolumeEnabled !fogVolumeEnabled !airTransmittanceHQ !waterVolumeEnabled shadowMapResolution=1024 shadowFilterIterations=9 !shadowVPSEnabled !contactShadowsEnabled indirectResReduction=2 !SVGF_FILTER !ssptEnabled !RINDIRECT_USE_SSAO !exposureComplexEnabled
profile.Medium=profile.Low fogVolumeEnabled shadowMapResolution=1536 contactShadowsEnabled RINDIRECT_USE_SSAO
profile.High=profile.Medium CLOUD_RENDER_LOD=3.0 cloudVolumeEnabled waterVolumeEnabled shadowMapResolution=2048 shadowFilterIterations=12 shadowVPSEnabled SVGF_FILTER exposureComplexEnabled
profile.Ultra=profile.High CLOUD_RENDER_LOD=3.0 airTransmittanceHQ shadowFilterIterations=15 ssptEnabled
profile.Extreme=profile.Ultra CLOUD_RENDER_LOD=2.0 cloudShadowsEnabled shadowMapResolution=4096 indirectResReduction=1

screen=INFO <profile> <empty> [ATMOS] [LIGHT] [TERRAIN] [CAMERA] [POST] [MISC]
screen.columns=1

screen.ATMOS=rainbowsEnabled sunPathRotation volumeWorldTimeAnim <empty> <empty> <empty> [AIRCOEFF] [CLOUDS] [FOG] [SKY] [WATER] <empty> <empty> <empty> [NETHER] [END]
screen.ATMOS.columns=2

    screen.AIRCOEFF=airRayleighMult airMieMult rayleighRedMult mieRedMult rayleighGreenMult mieGreenMult rayleighBlueMult mieBlueMult <empty> <empty> airOzoneMult airMistMult ozoneRedMult mistRedMult ozoneGreenMult mistGreenMult ozoneBlueMult mistBlueMult

    screen.CLOUDS=CLOUD_RENDER_LOD cloudTemporalUpscaleEnabled cloudReflectionsToggle cloudShadowsEnabled <empty> <empty> [CVOLUME] [CPLANAR] <empty> <empty> RSKY_SB_CloudWeather <empty> RSKY_SF_WeatherHumidity RSKY_SF_WeatherTemperature RSKY_SF_WeatherTurbulence RSKY_SF_WeatherCirrusBlend
        screen.CVOLUME=RSKY_SB_CloudVolume RSKY_SI_CloudV_Samples RSKY_SB_CloudV_DirectDither RSKY_SB_CloudV_AmbientDither cloudCumulusAlt cloudCumulusDepth cloudCumulusScaleMult cloudCumulusCoverageBias
        screen.CPLANAR=RSKY_SB_CirrocumulusCloud CLOUD_PLANE1_DEPTH CLOUD_PLANE1_COVERAGE <empty> <empty> <empty> RSKY_SB_CirrusCloud CLOUD_PLANE0_DEPTH CLOUD_PLANE0_COVERAGE <empty> <empty> <empty> RSKY_SB_NoctilucentCloud CLOUD_NL_COVERAGE

    screen.FOG=fogVolumeEnabled fogMistAdvanced fogAdaptiveSteps fogClipDist fogDensityMult fogSeaLevel fogMistAltitude fogMistFalloff mistMieAnisotropy fogMistLightingSteps <empty> <empty> fogSmoothingEnabled fogSmoothingPassEnabled <empty> <empty> RFOG_SB_FogWeather

    screen.SKY=airScatterIterations airmassIterations <empty> <empty> skyIlluminanceMult skyMultiscatterMult <empty> <empty> airTransmittanceHQ alternateOzoneDistribution ATMOS_BelowHorizon ATMOS_RenderPlanet PLANET_BOUNCELIGHT
    screen.SKY.columns=2

    screen.WATER=waterVolumeEnabled waterDensity waterVolAdaptiveSteps waterVolClipDist <empty> <empty> waterCoeffRed waterCoeffGreen waterCoeffBlue waterCoeffScatter <empty> <empty> waveMode waterNormalOctaves <empty> <empty> customIceEnabled

    screen.NETHER=netherSmokeEnabled netherSmokeDensity netherSmokeEmission netherSmokeEmissionMult netherHazeDensity
    screen.NETHER.columns=1

    screen.END=endSmokeGlow endSmokeGlowDynamic endSmokeGlowStrength
    screen.END.columns=1


screen.LIGHT=directionalLMEnabled UseLightleakPrevention <empty> [COLORS] [DIRECTLIGHT] [INDIRECTLIGHT]
screen.LIGHT.columns=1

    screen.COLORS=sunlightIllum moonlightIllum sunlightRedMult moonlightRedMult sunlightGreenMult moonlightGreenMult sunlightBlueMult moonlightBlueMult <empty> <empty> skylightIllum blocklightIllum skylightRedMult blocklightBaseTemp skylightGreenMult <empty> skylightBlueMult minimumAmbientIllum

    screen.DIRECTLIGHT=shadowMapResolution shadowPenumbraScale shadowVPSEnabled shadowFilterIterations contactShadowsEnabled subsurfaceScatterMode
        screen.DIRECTLIGHT.columns=1

    screen.INDIRECTLIGHT=indirectResReduction [FILTER] ssptEnabled ssptFullRangeRT ssptSPP ssptBounces ssptLightmapBlend ssptEmissionDistance <empty> <empty> ssptEmissionMode ssptAdvancedEmission labEmissionCurve <empty> <empty> <empty> RINDIRECT_USE_SSAO textureAoEnabled
        screen.FILTER=SVGF_FILTER <empty> SVGF_RAD SVGF_STRICTNESS SVGF_NORMALEXP
        screen.FILTER.columns=1


screen.TERRAIN=normalmapEnabled normalmapFormat vertexAttributeFix refractionEnabled <empty> <empty> wetnessMode puddleRippleSpeed <empty> <empty> windEffectsEnabled windIntensity <empty> <empty> [PARALLAX] [REFLECTIONS]
screen.TERRAIN.columns=2

    screen.PARALLAX=pomEnabled pomSamples pomShadowSamples pomDepth <empty> slopeNormalCalculation pomDepthEnabled
    screen.PARALLAX.columns=1

    screen.REFLECTIONS=resourcepackReflectionsEnabled specularHighlightsEnabled <empty> <empty> roughReflectionsEnabled roughReflectionSamples <empty> <empty> screenspaceReflectionsEnabled reflectionCaptureEnabled <empty> <empty> roughnessThreshold skyOcclusionThreshold
    screen.REFLECTIONS.columns=2


screen.CAMERA=camSensorWidth camFStops anamorphStretch [BLOOM] [DOF] [EXP] [FLARE] [MBLUR] [VIGNETTE]
screen.CAMERA.columns=1

    screen.BLOOM=bloomEnabled bloomIntensity <empty> bloomyFog
    screen.BLOOM.columns=1

    screen.DOF=DoFToggle DoFQuality DoFChromaDispersion chromaOffsetScale <empty> camFocus camManFocDis showFocusPlane
    screen.DOF.columns=1

    screen.EXP=LOCAL_EXPOSURE exposureComplexEnabled <empty> <empty> exposureDecay exposureBias exposureDarkClamp exposureBrightClamp exposureBrightPercentage exposureDarkPercentage exposureBrightWeight exposureDarkWeight exposureAverageWeight <empty> <empty> <empty> manualExposureEnabled manualExposureValue
    screen.EXP.columns=2

    screen.FLARE=lensFlareToggle lensFlareHaloToggle lensFlareIntensity lensFlareThreshold <empty> <empty> lensFlareGhostCount lensFlareGhostSpace lensFlareHaloRad lensFlareHaloDepth

    screen.MBLUR=motionblurToggle <empty> motionblurSamples motionblurScale
    screen.MBLUR.columns=1

    screen.VIGNETTE=vignetteEnabled <empty> vignetteStart vignetteEnd vignetteIntensity vignetteExponent
    screen.VIGNETTE.columns=1


screen.POST=CAS_Strength ResolutionScale tonemapOperator <empty> VIEWPORT_GAMUT screenBitdepth <empty> <empty> [ACES] [AA] [CGRADE] [PURKINJE] [FTOOL]
screen.POST.columns=2

    screen.ACES=acesRRTExposureBias acesRRTGammaLift acesRRTGlowGainOffset acesRRTSatOffset acesODTSatOffset
    screen.ACES.columns=1

    screen.AA=RESAMPLING_PARAM TAAU_FXAA_PostPass <empty> taaBlendWeight taaAntiFlicker taaLumaRejection TAA_AGGRESSIVE_ANTIFLICKER
    screen.AA.columns=1

    screen.CGRADE=doColorgrading <empty> <empty> <empty> vibranceInt saturationInt gammaCurve brightnessInt constrastInt <empty> colorlumR colorlumG colorlumB

    screen.PURKINJE=PURKINJE_EFFECT purkinjeExponent purkinjeTintRed purkinjeTintGreen purkinjeTintBlue
    screen.PURKINJE.columns=1

    screen.FTOOL=framingToolEnabled framingThirdsHor framingToAspect framingAspectX framingAspectY framingToAspectCenter
    screen.FTOOL.columns=1


screen.MISC=[INTERNAL] DEBUG_VIEW <empty> <empty> freezeAtmosAnim atmosAnimOffset planetRadiusScale LOCAL_EXPOSURE_DEMO

    screen.INTERNAL=*


sliders=sunPathRotation rayleighRedMult rayleighGreenMult rayleighBlueMult airRayleighMult mieRedMult mieGreenMult mieBlueMult airMieMult \
 ozoneRedMult ozoneGreenMult ozoneBlueMult airOzoneMult mistRedMult mistGreenMult mistBlueMult airMistMult \
 CLOUD_RENDER_LOD RSKY_SI_CloudV_Samples cloudCumulusAlt cloudCumulusDepth cloudCumulusScaleMult cloudCumulusCoverageBias \
 CLOUD_PLANE0_DEPTH CLOUD_PLANE0_COVERAGE CLOUD_PLANE1_DEPTH CLOUD_PLANE1_COVERAGE CLOUD_NL_COVERAGE RSKY_SF_WeatherHumidity RSKY_SF_WeatherTemperature RSKY_SF_WeatherTurbulence RSKY_SF_WeatherCirrusBlend \
 fogAdaptiveSteps fogClipDist fogDensityMult fogSeaLevel fogMistAltitude fogMistFalloff mistMieAnisotropy fogMistLightingSteps \
 airScatterIterations airmassIterations skyIlluminanceMult skyMultiscatterMult \
 waterDensity waterVolAdaptiveSteps waterVolClipDist waterCoeffRed waterCoeffGreen waterCoeffBlue waterCoeffScatter waterNormalOctaves \
 shadowMapResolution shadowPenumbraScale shadowFilterIterations indirectResReduction ssptSPP ssptBounces ssptLightmapBlend ssptEmissionDistance labEmissionCurve SVGF_STRICTNESS SVGF_NORMALEXP \
 netherSmokeDensity netherSmokeEmissionMult netherHazeDensity endSmokeGlowStrength \
 sunlightIllum moonlightIllum sunlightRedMult moonlightRedMult sunlightGreenMult moonlightGreenMult sunlightBlueMult moonlightBlueMult skylightIllum blocklightIllum skylightRedMult blocklightBaseTemp skylightGreenMult skylightBlueMult minimumAmbientIllum \
 windIntensity puddleRippleSpeed pomSamples pomShadowSamples pomDepth roughReflectionSamples roughnessThreshold skyOcclusionThreshold \
 camSensorWidth camFStops anamorphStretch bloomIntensity DoFQuality chromaOffsetScale \
 exposureDecay exposureBias manualExposureValue exposureDarkClamp exposureBrightClamp exposureBrightPercentage exposureDarkPercentage exposureBrightWeight exposureDarkWeight exposureAverageWeight \
 lensFlareIntensity lensFlareThreshold lensFlareGhostCount lensFlareGhostSpace lensFlareHaloRad lensFlareHaloDepth \
 motionblurSamples motionblurScale vignetteStart vignetteEnd vignetteIntensity vignetteExponent \
 acesRRTExposureBias acesRRTGammaLift acesRRTGlowGainOffset acesRRTSatOffset acesODTSatOffset CAS_Strength \
 taaBlendWeight taaMotionRejection taaAntiGhosting taaAntiFlicker taaLumaRejection taaHueRejection \
 vibranceInt saturationInt gammaCurve brightnessInt constrastInt colorlumR colorlumG colorlumB \
 framingAspectX framingAspectY framingToAspectCenter \
 atmosAnimOffset planetRadiusScale camManFocDis purkinjeExponent purkinjeTintRed purkinjeTintGreen purkinjeTintBlue



#
#   STUFF
#

version.1.16.5=G7
version.1.16.4=G7

oldLighting=false
oldHandLight=false
vignette=false
separateAo=true
underwaterOverlay=false
sun=false
moon=true
fog=off
rain.depth=false
clouds=off
supportsColorCorrection=true
# apparently this breaks banners somehow
# separateEntityDraws=false

blend.gbuffers_basic=off
blend.gbuffers_block=off
blend.gbuffers_terrain=off
blend.gbuffers_entities=off
blend.gbuffers_hand=off
blend.gbuffers_hand_water=off
blend.gbuffers_spidereyes=SRC_ALPHA ONE ZERO ONE
blend.gbuffers_armor_glint=SRC_ALPHA ONE ZERO ONE
blend.gbuffers_textured=off
blend.gbuffers_skybasic=off
blend.gbuffers_skytextured=off
blend.gbuffers_textured_lit=off
blend.gbuffers_clouds=off
blend.gbuffers_weather=off
blend.deferred=off

blend.gbuffers_water.colortex1=off
blend.gbuffers_water.colortex2=off
#blend.gbuffers_water.colortex3=off
blend.gbuffers_water.colortex4=off
blend.gbuffers_hand_water.colortex1=off
blend.gbuffers_hand_water.colortex2=off
blend.gbuffers_hand_water.colortex3=off
blend.gbuffers_hand_water.colortex4=off

texture.noise=image/noise2D.png
texture.prepare.depthtex1=image/curl3D.dat TEXTURE_3D RGB8 64 64 64 RGB UNSIGNED_BYTE
texture.prepare.colortex1=image/noiseShapePacked.dat TEXTURE_3D R8 128 128 128 RED UNSIGNED_BYTE
texture.prepare.colortex2=image/noiseErosionPacked.dat TEXTURE_3D R8 32 32 32 RED UNSIGNED_BYTE

texture.deferred.depthtex1=image/curl3D.dat TEXTURE_3D RGB8 64 64 64 RGB UNSIGNED_BYTE
texture.deferred.colortex1=image/noiseShapePacked.dat TEXTURE_3D R8 128 128 128 RED UNSIGNED_BYTE
texture.deferred.colortex2=image/noiseErosionPacked.dat TEXTURE_3D R8 32 32 32 RED UNSIGNED_BYTE
texture.deferred.colortex5=image/bluenoiseUV8.dat TEXTURE_3D RGB8 256 256 8 RGB UNSIGNED_BYTE

size.buffer.colortex5=256 384
size.buffer.colortex12=1024 512
size.buffer.colortex13=1024 512

program.world0/deferred1.enabled=(RSKY_SB_CloudVolume || RSKY_SB_CirrusCloud || RSKY_SB_CirrocumulusCloud || RSKY_SB_NoctilucentCloud)

program.world0/deferred5.enabled=ssptEnabled
program.world0/deferred6.enabled=SVGF_FILTER
program.world0/deferred7.enabled=SVGF_FILTER
program.world0/deferred8.enabled=SVGF_FILTER
program.world0/deferred9.enabled=SVGF_FILTER
program.world0/deferred10.enabled=SVGF_FILTER

program.world1/deferred5.enabled=ssptEnabled
program.world1/deferred6.enabled=SVGF_FILTER
program.world1/deferred7.enabled=SVGF_FILTER
program.world1/deferred8.enabled=SVGF_FILTER
program.world1/deferred9.enabled=SVGF_FILTER
program.world1/deferred10.enabled=SVGF_FILTER

program.world-1/deferred5.enabled=ssptEnabled
program.world-1/deferred6.enabled=SVGF_FILTER
program.world-1/deferred7.enabled=SVGF_FILTER
program.world-1/deferred8.enabled=SVGF_FILTER
program.world-1/deferred9.enabled=SVGF_FILTER
program.world-1/deferred10.enabled=SVGF_FILTER

#program.world0/composite1.enabled=fogVolumeEnabled || waterVolumeEnabled
program.world0/composite1.enabled=reflectionCaptureEnabled
#program.world0/composite3.enabled=fogSmoothingPassEnabled && (fogVolumeEnabled || waterVolumeEnabled)

#
#       UNIFORMS
#

uniform.float.worldAnimTime = worldDay % 48 + worldTime / 24000.0

#       TAA OFFSET
# variable.int.fmod8 = frameCounter % 8
# uniform.vec2.taaOffset = vec2((if( \
#    fmod8 == 0,  0.125, \
#    fmod8 == 1, -0.125, \
#    fmod8 == 2,  0.625, \
#    fmod8 == 3,  0.375, \
#    fmod8 == 4, -0.625, \
#    fmod8 == 5, -0.875, \
#    fmod8 == 6,  0.375, \
#    fmod8 == 7,  0.875, \
#    0.0)*0.6) / viewWidth, \
#    (if( \
#    fmod8 == 0, -0.375, \
#    fmod8 == 1,  0.375, \
#    fmod8 == 2,  0.125, \
#    fmod8 == 3, -0.625, \
#    fmod8 == 4,  0.625, \
#    fmod8 == 5, -0.125, \
#   fmod8 == 6, -0.875, \
#    fmod8 == 7,  0.875, \
#    0.0)*0.6) / viewHeight)

#
#   TAA Offsets by Zombye
#

uniform.float.frameR1 = frac(0.5 + frameCounter / 1.61803398874989484820458683436563)
variable.float.frameR2X = frac(0.5 + frameCounter / 1.32471795724474602596090885447809)
variable.float.frameR2Y = frac(0.5 + frameCounter / (1.32471795724474602596090885447809 * 1.32471795724474602596090885447809))
uniform.vec2.frameR2 = vec2(frameR2X, frameR2Y)

# TAA offset
uniform.vec2.taaOffset = vec2((frameR2X * 2.0 - 1.0) / viewWidth, (frameR2Y * 2.0 - 1.0) / viewHeight)

#       RESOLUTION UNIFORMS
uniform.vec2.viewSize = vec2(viewWidth, viewHeight)
uniform.vec2.pixelSize = vec2(1.0 / viewWidth, 1.0 / viewHeight)

variable.float.bloomYres    = min(1080.0, viewHeight)
variable.float.bloomXres    = bloomYres * aspectRatio
uniform.vec2.bloomResolution = vec2(bloomXres, bloomYres)

variable.float.skyCaptureYres = min(300.0, viewHeight / 2.5)
variable.float.skyCaptureXres = skyCaptureYres * 2.0
uniform.vec2.skyCaptureResolution = vec2(viewWidth / skyCaptureXres, viewHeight / skyCaptureYres)

#       DIRECTIONS
variable.float.upDirNorm    = 1.0 / sqrt((upPosition.x*upPosition.x) + (upPosition.y*upPosition.y) + (upPosition.z*upPosition.z))
uniform.vec3.upDirView      = vec3(upPosition.x*upDirNorm, upPosition.y*upDirNorm, upPosition.z*upDirNorm)
uniform.vec3.upDir          = vec3(0.0, 1.0, 0.0)

variable.float.sunDirNorm   = 1.0 / sqrt((sunPosition.x * sunPosition.x) + (sunPosition.y * sunPosition.y) + (sunPosition.z * sunPosition.z))
variable.float.svecX        = sunPosition.x * sunDirNorm
variable.float.svecY        = sunPosition.y * sunDirNorm
variable.float.svecZ        = sunPosition.z * sunDirNorm
uniform.vec3.sunDirView     = vec3(svecX, svecY, svecZ)
variable.float.sunDirX      = gbufferModelViewInverse.0.0 * sunPosition.x + gbufferModelViewInverse.1.0 * sunPosition.y + gbufferModelViewInverse.2.0 * sunPosition.z
variable.float.sunDirY      = gbufferModelViewInverse.0.1 * sunPosition.x + gbufferModelViewInverse.1.1 * sunPosition.y + gbufferModelViewInverse.2.1 * sunPosition.z
variable.float.sunDirZ      = gbufferModelViewInverse.0.2 * sunPosition.x + gbufferModelViewInverse.1.2 * sunPosition.y + gbufferModelViewInverse.2.2 * sunPosition.z
uniform.vec3.sunDir         = vec3(sunDirX * sunDirNorm, sunDirY * sunDirNorm, sunDirZ * sunDirNorm)

variable.float.moonDirNorm  = 1.0 / sqrt((moonPosition.x * moonPosition.x) + (moonPosition.y * moonPosition.y) + (moonPosition.z * moonPosition.z))
variable.float.mvecX        = moonPosition.x * moonDirNorm
variable.float.mvecY        = moonPosition.y * moonDirNorm
variable.float.mvecZ        = moonPosition.z * moonDirNorm
uniform.vec3.moonDirView    = vec3(mvecX, mvecY, mvecZ)
variable.float.moonDirX     = gbufferModelViewInverse.0.0 * moonPosition.x + gbufferModelViewInverse.1.0 * moonPosition.y + gbufferModelViewInverse.2.0 * moonPosition.z
variable.float.moonDirY     = gbufferModelViewInverse.0.1 * moonPosition.x + gbufferModelViewInverse.1.1 * moonPosition.y + gbufferModelViewInverse.2.1 * moonPosition.z
variable.float.moonDirZ     = gbufferModelViewInverse.0.2 * moonPosition.x + gbufferModelViewInverse.1.2 * moonPosition.y + gbufferModelViewInverse.2.2 * moonPosition.z
uniform.vec3.moonDir        = vec3(moonDirX * moonDirNorm, moonDirY * moonDirNorm, moonDirZ * moonDirNorm)

variable.float.shadowmapLightDirX = shadowModelViewInverse.2.0 * 1.0
variable.float.shadowmapLightDirY = shadowModelViewInverse.2.1 * 1.0
variable.float.shadowmapLightDirZ = shadowModelViewInverse.2.2 * 1.0
uniform.vec3.lightDir = vec3(shadowmapLightDirX, shadowmapLightDirY, shadowmapLightDirZ)
variable.float.shadowmapLightDirViewX = gbufferModelView.0.0 * shadowmapLightDirX + gbufferModelView.1.0 * shadowmapLightDirY + gbufferModelView.2.0 * shadowmapLightDirZ
variable.float.shadowmapLightDirViewY = gbufferModelView.0.1 * shadowmapLightDirX + gbufferModelView.1.1 * shadowmapLightDirY + gbufferModelView.2.1 * shadowmapLightDirZ
variable.float.shadowmapLightDirViewZ = gbufferModelView.0.2 * shadowmapLightDirX + gbufferModelView.1.2 * shadowmapLightDirY + gbufferModelView.2.2 * shadowmapLightDirZ
uniform.vec3.lightDirView = vec3(shadowmapLightDirViewX, shadowmapLightDirViewY, shadowmapLightDirViewZ)

variable.float.bloomYres    = min(1080.0, viewHeight)
variable.float.bloomXres    = bloomYres * aspectRatio
uniform.vec2.bloomResolution = vec2(bloomXres, bloomYres)

variable.float.timeSunrise  = ((clamp(sunAngle, 0.97, 1.00) - 0.97) / 0.03) + (1.0 - (clamp(sunAngle, 0.01, 0.10) - 0.01) / 0.09)
variable.float.timeNoon_0   = ((clamp(sunAngle, 0.01, 0.10) - 0.01) / 0.09) - ((clamp(sunAngle, 0.40, 0.49) - 0.40) / 0.09)
variable.float.timeSunset   = ((clamp(sunAngle, 0.40, 0.49) - 0.40) / 0.09) - ((clamp(sunAngle, 0.50, 0.53) - 0.50) / 0.03)
variable.float.timeNight    = ((clamp(sunAngle, 0.50, 0.53) - 0.50) / 0.03) - ((clamp(sunAngle, 0.97, 1.00) - 0.97) / 0.03)
uniform.vec4.daytime        = vec4(timeSunrise, timeNoon_0, timeSunset, timeNight)

variable.float.sunY         = sunDirY * sunDirNorm
variable.float.lf1          = (1.0 - ((clamp(-sunY, 0.002, 0.04) - 0.002) / 0.038)) * (1.0 - ((clamp(sunY, 0.002, 0.04) - 0.002) / 0.038))
uniform.float.lightFlip     = clamp(1.0 - lf1, 0.0, 1.0)

variable.float.smoothWorldTime = smooth(sunDirZ, frameTime*8.0, frameTime*8.0)
uniform.int.WorldTimeChange = if(abs(smoothWorldTime - sunDirZ) > 0.9, 1, 0)

#
#           DETAILED TIME DEPENDENT STUFF
#

variable.float.timeMorning      = ((clamp(worldTime, 22600.0, 23600.0) - 22600.0) / 1000.0)  + (1.0-((clamp(worldTime, 200.0, 1000.0) - 200.0) / 800.0))
variable.float.timeForenoon     = ((clamp(worldTime,   200.0,  1000.0) -   200.0) /  800.0)  - ((clamp(worldTime,  3500.0,  5500.0) -  3500.0) / 2000.0)
variable.float.timeNoon         = ((clamp(worldTime,  3500.0,  5500.0) -  3500.0) / 2000.0)  - ((clamp(worldTime,  6500.0,  8500.0) -  6500.0) / 2000.0)
variable.float.timeAfternoon    = ((clamp(worldTime,  6500.0,  8500.0) -  6500.0) / 2000.0)  - ((clamp(worldTime, 11000.0, 11800.0) - 11000.0) /  800.0)
variable.float.timeEvening      = ((clamp(worldTime, 11000.0, 11800.0) - 11000.0) /  800.0)  - ((clamp(worldTime, 13000.0, 13600.0) - 13000.0) /  600.0)
variable.float.timeDusk         = ((clamp(worldTime, 13000.0, 13600.0) - 13000.0) /  600.0)  - ((clamp(worldTime, 17000.0, 19000.0) - 17000.0) / 2000.0)
variable.float.timeDawn         = ((clamp(worldTime, 17000.0, 19000.0) - 17000.0) / 2000.0)  - ((clamp(worldTime, 22600.0, 23600.0) - 22600.0) / 1000.0)

variable.float.ctimeForenoon    = ((clamp(worldTime,   200.0,  1000.0) -   200.0) /  800.0)  - ((clamp(worldTime,  4500.0,  7000.0) -  4500.0) / 2500.0)
variable.float.ctimeAfternoon   = ((clamp(worldTime,  4500.0,  7000.0) -  4500.0) / 2500.0)  - ((clamp(worldTime, 11000.0, 11800.0) - 11000.0) /  800.0)


variable.float.MoonPhase_LightStrength = (abs(moonPhase - 4.0) / 4.0) + 0.35
variable.float.MoonPhase_Smoothed = smooth(MoonPhase_LightStrength, 10.0, 10.0)
uniform.float.RMoonPhaseOcclusion = MoonPhase_Smoothed


#
#           ATMOSPHERE CONCENTRATION DYNAMICS
#

variable.float.atmosRayleigh   = timeMorning * 0.9 + timeForenoon * 1.0 + timeNoon * 1.08 + timeAfternoon * 1.13 + timeEvening * 1.2 + timeDusk * 1.14 + timeDawn * 1.0 + wetness + rainStrength
variable.float.atmosMie        = (timeMorning * 0.75 + timeForenoon * 0.9 + timeNoon * 1.0 + timeAfternoon * 1.1 + timeEvening * 1.35 + timeDusk * 1.15 + timeDawn * 0.9 + wetness * 16.0)
variable.float.atmosOzone      = timeMorning * 1.25 + timeForenoon * 0.9 + timeNoon * 1.0 + timeAfternoon * 1.1 + timeEvening * 1.45 + timeDusk * 1.4 + timeDawn * 1.3
uniform.vec3.airDensityCoeff = vec3(atmosRayleigh, atmosMie, atmosOzone)


#
#           WEATHER DYNAMICS
#

variable.float.RW_Humidity_DayBias = 0.23 * timeSunrise + 0.14 * timeForenoon - 0.04 * timeAfternoon - 0.05 * timeEvening + 0.14 * timeDawn + wetness * 0.6
variable.float.RW_Temperature_DayBias = -0.3 * timeSunrise - 0.12 * timeForenoon + 0.1 * timeAfternoon - 0.05 * timeEvening - 0.13 * timeDusk - 0.2 * timeDawn - wetness * 0.15

#variable.float.RW_Temperature_BiomeBias = if(biome_precipitation == PPT_NONE, 0.3, biome_precipitation == PPT_SNOW, -0.3, 0.0)

variable.float.RW_Temperature_BiomeBias = if(biome_category == CAT_DESERT, 0.4, \
                                             biome_category == CAT_SAVANNA, 0.3, \
                                             biome_category == CAT_MESA, 0.3, \
                                             biome_category == CAT_EXTREME_HILLS, -0.2, \
                                             biome_category == CAT_ICY, -0.3, \
                                             biome_category == CAT_TAIGA, -0.15, \
                                             0.0)

variable.float.RW_Humidity_BiomeBias = if(biome_category == CAT_DESERT, -0.8, \
                                             biome_category == CAT_SAVANNA, -0.6, \
                                             biome_category == CAT_MESA, -0.5, \
                                             biome_category == CAT_JUNGLE, 0.3, \
                                             biome_category == CAT_SWAMP, 0.33, \
                                             biome_category == CAT_ICY, -0.15, \
                                             biome_category == CAT_TAIGA, -0.1, \
                                             0.0)

variable.float.RW_Turbulence_BiomeBias = if(biome_category == CAT_SAVANNA, 0.2, \
                                             biome_category == CAT_MESA, 0.3, \
                                             biome_category == CAT_EXTREME_HILLS, 0.3, \
                                             biome_category == CAT_JUNGLE, -0.4, \
                                             biome_category == CAT_SWAMP, -0.3, \
                                             biome_category == CAT_TAIGA, 0.12, \
                                             biome_category == CAT_ICY, -0.2, \
                                             0.0)

variable.float.RW_Fog_SeaLevelBias = if(biome_category == CAT_JUNGLE, 32.0, \
                                             biome_category == CAT_SWAMP, 4.0, \
                                             biome_category == CAT_TAIGA, 8.0, \
                                             biome_category == CAT_ICY, 16.0, \
                                             0.0)

uniform.float.RW_SeaLevelBias = smooth(75, RW_Fog_SeaLevelBias, 32.0, 32.0)

variable.float.RW_Humidity = clamp((sin(worldDay * 1.148) * 0.5 + 0.5) * 0.5 + (cos(worldDay * 0.714) * 0.5 + 0.5) * 0.6 + RW_Humidity_BiomeBias, 0.0, 1.0)
variable.float.RW_HumiditySmooth = clamp(smooth(50, RW_Humidity, 64.0, 64.0) + RW_Humidity_DayBias, 0.0, 1.0)
variable.float.RW_Temperature = clamp((sin(worldDay * 1.331) * 0.5 + 0.5) * 0.4 + (cos(worldDay * 0.48) * 0.5 + 0.5) * 0.6 + RW_Temperature_BiomeBias, 0.0, 1.0)
variable.float.RW_TemperatureSmooth = clamp(smooth(51, RW_Temperature, 64.0, 64.0) + RW_Temperature_DayBias, 0.0, 1.0)
variable.float.RW_Turbulence = clamp((sin(worldDay * 1.56 + 0.5) * 0.5 + 0.5) * 0.5 + (cos(worldDay * 0.97 + 1.38) * 0.5 + 0.5) * 0.5 + RW_Turbulence_BiomeBias, 0.0, 1.0)
variable.float.RW_TurbulenceSmooth = clamp(smooth(52, RW_Turbulence, 128.0, 128.0) - wetness * 0.3, 0.0, 1.0)
uniform.vec3.RWeatherParams = vec3(RW_HumiditySmooth, RW_TemperatureSmooth, RW_TurbulenceSmooth)


variable.bool.isCloudSunlit     = (worldTime>23000 || worldTime<12900)
uniform.vec3.cloudLightDir      = vec3(if(isCloudSunlit, sunDirX, moonDirX)*sunDirNorm, if(isCloudSunlit, sunDirY, moonDirY)*sunDirNorm, if(isCloudSunlit, sunDirZ, moonDirZ)*sunDirNorm)
uniform.vec3.cloudLightDirView  = vec3(if(isCloudSunlit, svecX, mvecX), if(isCloudSunlit, svecY, mvecY), if(isCloudSunlit, svecZ, mvecZ))
variable.float.cloudBackscatterInt = ((clamp(worldTime, 12550.0, 12800.0) - 12550.0) / 250.0) - ((clamp(worldTime, 23250.0, 23600.0) - 23250.0) / 350.0)

variable.float.cloudVolume0Cov   = 0.045*timeSunrise + 0.01*timeAfternoon + 0.03*timeSunset + 0.035*timeNight - wetness * 0.06
variable.float.cloudVolume0Density = timeMorning * 0.6 + timeForenoon * 0.9 + timeNoon * 1.0 + timeAfternoon * 1.0 + timeEvening * 0.7 + timeDusk * 0.6 + timeDawn * 0.7
variable.float.CloudVolume1Cov   = -0.01*timeSunrise + 0.01*timeForenoon + 0.02*timeAfternoon - 0.025*timeSunset - wetness * 0.06
variable.float.CloudVolume1Density = timeMorning * 1.0 + timeForenoon * 1.0 + timeNoon * 1.0 + timeAfternoon * 0.9 + timeEvening * 0.8 + timeDusk * 0.7 + timeDawn * 0.6


uniform.vec3.volumeCloudData = vec3(cloudVolume0Cov, cloudVolume0Density, if(isCloudSunlit, 1.0-cloudBackscatterInt*0.75, 1.0))
uniform.vec2.CloudVolume1Data = vec2(CloudVolume1Cov, CloudVolume1Density)

variable.float.cloudCirrusCov   = 0.04*timeSunrise + 0.02 * timeForenoon - 0.025*timeSunset - 0.02*timeNight
variable.float.cloudCirrusDensity = timeMorning * 0.9 + timeForenoon * 1.0 + timeNoon * 1.0 + timeAfternoon * 1.0 + timeEvening * 0.66 + timeDusk * 0.7 + timeDawn * 0.7
uniform.vec2.volumeCirrusData = vec2(cloudCirrusCov, cloudCirrusDensity)

variable.float.RW_CirrusType_BiomeBias = if(biome_category == CAT_TAIGA, 0.6, \
                                             biome_category == CAT_ICY, 0.8, \
                                             biome_category == CAT_EXTREME_HILLS, 0.4, \
                                             0.0)
variable.float.RW_CirrusType_BiasSmooth = clamp(1.0 - smooth(76, RW_CirrusType_BiomeBias, 32.0, 32.0), 0.0, 1.0)

variable.float.CloudCirrusProbability = clamp(0.5 + (RW_HumiditySmooth - 0.5) * 1.6 + (RW_TemperatureSmooth - 0.5) + wetness * 0.5, 0.0, 1.0)
variable.float.CloudCirrusType = clamp((sqrt(abs(RW_TurbulenceSmooth * 2.0 - 1.0)) * signum(RW_TurbulenceSmooth - 0.5)) * 0.5 + 0.5, 0.0, 1.0) * RW_CirrusType_BiasSmooth
variable.float.CloudCirrocumulusProbability = CloudCirrusProbability * CloudCirrusType
variable.float.CloudCirrostratusProbability = CloudCirrusProbability * (1.0 - CloudCirrusType)

uniform.vec2.RW_CirrusData = vec2(CloudCirrocumulusProbability - 0.8, CloudCirrostratusProbability - 0.7)


#
#           FOG DYNAMICS
#

#ifdef RFOG_SB_FogWeather
variable.float.RW_BIOME_FogMist = if(biome_category == CAT_JUNGLE, 0.5, \
                                    biome_category == CAT_SWAMP, 0.6, \
                                    0.0)

variable.float.RW_BIOME_FogMie = if(biome_category == CAT_JUNGLE, 1.0, \
                                    biome_category == CAT_SWAMP, 0.2, \
                                    0.0)

variable.float.RW_BIOME_Green = if(biome_category == CAT_JUNGLE, 1.45, \
                                    biome_category == CAT_SWAMP, 1.2, \
                                    0.0)

variable.float.RW_BIOME_Sand = if(biome_category == CAT_DESERT, 1.0, \
                                    biome_category == CAT_MESA, 0.8, \
                                    biome_category == CAT_SAVANNA, 0.6, \
                                    0.0)
#else
variable.float.RW_BIOME_FogMist = 0.0

variable.float.RW_BIOME_FogMie = 0.0

variable.float.RW_BIOME_Green = 0.0

variable.float.RW_BIOME_Sand = 0.0
#endif

variable.float.fogRayleigh  = 0.7 * timeMorning + 0.52 * timeForenoon + 0.5 * timeNoon + 0.41 * timeAfternoon + 0.33 * timeEvening + 0.45 * timeDusk + 0.9 * timeDawn + wetness
variable.float.fogMie       = max(1.0 * timeMorning + 0.5 * timeForenoon + 0.37 * timeNoon + 0.26 * timeAfternoon + 0.42 * timeEvening + 0.54 * timeDusk + 0.9 * timeDawn + wetness * 3.0, clamp(smooth(61, RW_BIOME_FogMie, 32.0, 32.0), 0.0, 1.0))
variable.float.fogMist      = max(1.0 * timeMorning + 0.06 * timeForenoon + timeDusk * 0.5 + timeDawn * 1.4 + wetness * 2.0, clamp(smooth(60, RW_BIOME_FogMist, 32.0, 32.0), 0.0, 1.0))

uniform.vec3.fogDensityCoeff = vec3(fogRayleigh, fogMie, fogMist)

uniform.float.RW_FOG_GreenShift = clamp(smooth(70, RW_BIOME_Green, 32.0, 32.0), 0.0, 2.0) * (timeForenoon + timeNoon + timeAfternoon)
uniform.float.RW_BIOME_Sandstorm = clamp(smooth(71, RW_BIOME_Sand, 32.0, 32.0), 0.0, 1.0) * wetness


variable.float.RW_BIOME_Dry = if(biome_category == CAT_DESERT, 1.0, \
                                    biome_category == CAT_MESA, 0.8, \
                                    biome_category == CAT_SAVANNA, 0.6, \
                                    biome_category == CAT_ICY, 1.0, \
                                    0.0)
uniform.float.RW_BIOME_Dryness = clamp(smooth(72, RW_BIOME_Dry, 32.0, 32.0), 0.0, 1.0)

variable.float.SkyMinLum    = min(skyColor.r, min(skyColor.g, skyColor.b))
variable.float.SkyMaxLum    = max(skyColor.r, max(skyColor.g, skyColor.b))

uniform.int.isLightning     = if(SkyMinLum > 0.35 && abs(SkyMinLum - SkyMaxLum) < 0.1, 1, 0)
variable.float.Lighting     = smooth(98, isLightning, 0.01, 0.5)
uniform.float.isLightningSmooth = clamp(Lighting, 0.0, 1.0)