#
#   SETTINGS
#

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

screen.ATMOS=sunPathRotation volumeWorldTimeAnim <empty> [AIRCOEFF] [CLOUDS] [FOG] [WATER]
screen.ATMOS.columns=1

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

    screen.CLOUDS=RSKY_CloudReflections cloudShadowsEnabled <empty> [CVOLUME] [CPLANAR]
    screen.CLOUDS.columns=1
        screen.CVOLUME=RSKY_VC_Enabled RSKY_VC_Samples <empty> RSKY_VC_Altitude RSKY_VC_Depth RSKY_VC_ClipDistance RSKY_VC_CoverageBias
        screen.CVOLUME.columns=1
        screen.CPLANAR=RSKY_PC_Enabled <empty> RSKY_PC_Altitude RSKY_PC_Depth RSKY_PC_CoverageBias
        screen.CPLANAR.columns=1

    screen.FOG=fogVolumeEnabled fogAdaptiveSteps fogClipDist fogDensityMult fogSeaLevel
    screen.FOG.columns=1

    screen.WATER=waterDensity <empty> waterCoeffRed waterCoeffGreen waterCoeffBlue waterCoeffScatter <empty> waterNormalOctaves
    screen.WATER.columns=1


screen.LIGHT=shadowMapResolution shadowFilterSize shadowFilterIterations <empty> AMBIENT_LIGHT_MODE <empty> [COLORS] UseLightleakPrevention
screen.LIGHT.columns=1

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


screen.TERRAIN=normalmapEnabled normalmapFormat wetnessMode windEffectsEnabled windIntensity <empty> screenspaceReflectionsEnabled skyOcclusionThreshold
screen.TERRAIN.columns=1

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

    screen.BLOOM=bloomEnabled bloomIntensity
    screen.BLOOM.columns=1

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

    screen.EXP=exposureDecay exposureBias exposureDarkClamp exposureBrightClamp <empty> <empty> exposureComplexEnabled exposureBrightPercentage exposureDarkPercentage <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 screenBitdepth VIEWPORT_GAMUT <empty> [AA] [CGRADE] [FTOOL]
screen.POST.columns=1

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

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

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


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

    screen.INTERNAL=*

sliders=fogAdaptiveSteps fogClipDist fogDensityMult fogSeaLevel airRayleighMult airMieMult rayleighRedMult mieRedMult rayleighGreenMult mieGreenMult rayleighBlueMult mieBlueMult airOzoneMult ozoneRedMult ozoneGreenMult ozoneBlueMult \
RSKY_VC_Samples RSKY_VC_Altitude RSKY_VC_Depth RSKY_VC_ClipDistance RSKY_VC_CoverageBias RSKY_PC_Altitude RSKY_PC_Depth RSKY_PC_CoverageBias waterDensity waterCoeffRed waterCoeffGreen waterCoeffBlue waterCoeffScatter waterNormalOctaves \
shadowFilterSize shadowFilterIterations sunlightIllum moonlightIllum sunlightRedMult moonlightRedMult sunlightGreenMult moonlightGreenMult sunlightBlueMult moonlightBlueMult skylightIllum blocklightIllum skylightRedMult blocklightRedMult \
skylightGreenMult blocklightGreenMult skylightBlueMult blocklightBlueMult windIntensity skyOcclusionThreshold camSensorWidth camFStops anamorphStretch bloomIntensity chromaOffsetScale camManFocDis \
exposureDecay exposureBias exposureDarkClamp exposureBrightClamp exposureBrightPercentage exposureDarkPercentage manualExposureValue lensFlareIntensity lensFlareThreshold lensFlareGhostCount lensFlareGhostSpace lensFlareHaloRad lensFlareHaloDepth \
motionblurSamples motionblurScale CAS_Strength taaBlendWeight taaAntiFlicker taaLumaRejection vibranceInt saturationInt gammaCurve brightnessInt constrastInt <empty> colorlumR colorlumG colorlumB framingAspectX framingAspectY framingToAspectCenter \
atmosAnimOffset planetRadiusScale

oldLighting=false
oldHandLight=false
vignette=false
separateAo=true
underwaterOverlay=false
sun=false
moon=true
fog=off
rain.depth=false
clouds=off
supportsColorCorrection=true

blend.gbuffers_basic=off
blend.gbuffers_block=off
blend.gbuffers_terrain=off
#blend.gbuffers_entities=off
blend.gbuffers_hand=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=SRC_ALPHA ONE ZERO ONE
#blend.gbuffers_textured_lit=off
blend.gbuffers_clouds=off
blend.gbuffers_weather=off
blend.deferred=off
blend.prepare=off
blend.dh_terrain=off

blend.gbuffers_water.colortex1=off
blend.gbuffers_water.colortex6=off
blend.gbuffers_water.colortex7=off
blend.gbuffers_entities.colortex1=off
blend.gbuffers_entities.colortex6=off
blend.gbuffers_textured_lit.colortex1=off
blend.gbuffers_textured_lit.colortex6=off
blend.gbuffers_hand_water.colortex1=off
blend.gbuffers_hand_water.colortex6=off

blend.dh_water.colortex1=off
blend.dh_water.colortex6=off
blend.dh_water.colortex7=off

texture.noise=image/noise2D.png

size.buffer.colortex3=256 384

iris.features.required=SSBO COMPUTE_SHADERS CUSTOM_IMAGES

bufferObject.0=176
bufferObject.1=16
bufferObject.2=128

image.RDepthComp0Image = RDepthComp0 RED R16F HALF_FLOAT true true 1.0 1.0
image.RDepthComp1Image = RDepthComp0 RED R16F HALF_FLOAT true true 1.0 1.0

dhShadow.enabled = false

alphaTest.dh_terrain = off

#
#       UNIFORMS
#

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

#
#   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)

#       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.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.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.cloudLightFlip1 = ((clamp(worldTime, 22600.0, 22900.0) - 22600.0) / 300.0) - ((clamp(worldTime, 23000.00, 23200.0) - 23000.0) / 200.0)
variable.float.cloudLightFlip2 = ((clamp(worldTime, 12600.0, 12900.0) - 12600.0) / 300.0) - ((clamp(worldTime, 12900.00, 13200.0) - 12900.0) / 300.0)
uniform.float.cloudLightFlip   = clamp(1.0 - (cloudLightFlip1 + cloudLightFlip2), 0.0, 1.0)

variable.float.cloudVolumeCov   = -0.04 * timeSunrise - 0.02 * timeNoon_0 + 0.025 * timeSunset - wetness * 0.08
variable.float.cloudVolumeDensity = 0.75 * timeSunrise + 1.0 * timeNoon_0 + 0.85 * timeSunset + 0.7 * timeNight
uniform.vec3.volumeCloudData = vec3(cloudVolumeCov, cloudVolumeDensity, if(isCloudSunlit, 1.0-cloudBackscatterInt*0.75, 1.0))

variable.float.cloudCirrusCov   = -0.05*timeSunrise + 0.0 * timeNoon_0 - 0.075*timeSunset - 0.06*timeNight
variable.float.cloudCirrusDensity = timeSunrise * 0.8 + timeNoon_0 * 1.0 + timeSunset * 0.9 + timeNight * 0.8
uniform.vec2.volumeCirrusData = vec2(cloudCirrusCov, cloudCirrusDensity)

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

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)


#
#           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 * 1.2 + timeForenoon * 1.1 + timeNoon * 1.0 + timeAfternoon * 1.05 + timeEvening * 1.28 + timeDusk * 1.14 + timeDawn * 1.0 + wetness
variable.float.atmosMie        = timeMorning * 1.0 + timeForenoon * 1.0 + timeNoon * 1.0 + timeAfternoon * 1.1 + timeEvening * 1.22 + timeDusk * 1.15 + timeDawn * 0.9 + wetness * 16.0
variable.float.atmosOzone      = timeMorning * 1.4 + timeForenoon * 1.0 + timeNoon * 1.0 + timeAfternoon * 1.15 + timeEvening * 1.45 + timeDusk * 1.4 + timeDawn * 1.3
uniform.vec3.airDensityCoeff = vec3(atmosRayleigh, atmosMie, atmosOzone)

#
#           FOG DYNAMICS
#

variable.float.fogRayleigh  = 1.2 * timeMorning + 1.0 * timeForenoon + 0.8 * timeNoon + 0.75 * timeAfternoon + 0.8 * timeEvening + 0.9 * timeDusk + 1.0 * timeDawn + wetness
variable.float.fogMie       = 1.6 * timeMorning + 1.0 * timeForenoon + 0.7 * timeNoon + 0.6 * timeAfternoon + 0.55 * timeEvening + 0.75 * timeDusk + 1.0 * timeDawn + wetness * 4.0
variable.float.fogMist      = 1.0 * timeMorning + 0.06 * timeForenoon + timeDawn * 0.35 + wetness * 2.0

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