# MakeUp - shader.properties

#Profiles
profile.no_effects=        !SHADOW_CASTING SHADOW_QTY_SLIDER=1 SHADOW_DISTANCE_SLIDER=0 REFLECTION_SLIDER=0 !DOF DOF_STRENGTH=0.09 AO=0 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=0 !MOTION_BLUR REFRACTION=0 SUN_REFLECTION=0 WAVING=0 V_CLOUDS=0 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0 !BLOOM CHROMA_ABER=0 VOL_LIGHT=0 !CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0 !COLORED_SHADOW MOTION_BLUR_SAMPLES=4 !MATERIAL_GLOSS
profile.shadowless_low=    !SHADOW_CASTING SHADOW_QTY_SLIDER=1 SHADOW_DISTANCE_SLIDER=0 REFLECTION_SLIDER=1 !DOF DOF_STRENGTH=0.09 AO=0 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=0 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=0 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0 !BLOOM CHROMA_ABER=0 VOL_LIGHT=0 !CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0 !COLORED_SHADOW MOTION_BLUR_SAMPLES=4 !MATERIAL_GLOSS
profile.shadowless_medium= !SHADOW_CASTING SHADOW_QTY_SLIDER=1 SHADOW_DISTANCE_SLIDER=0 REFLECTION_SLIDER=1 !DOF DOF_STRENGTH=0.09 AO=1 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=0 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=1 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0 !BLOOM CHROMA_ABER=0 VOL_LIGHT=0 !CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0 !COLORED_SHADOW MOTION_BLUR_SAMPLES=4 MATERIAL_GLOSS
profile.shadowless_high=   !SHADOW_CASTING SHADOW_QTY_SLIDER=1 SHADOW_DISTANCE_SLIDER=0 REFLECTION_SLIDER=2 !DOF DOF_STRENGTH=0.09 AO=1 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=2 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=1 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0  BLOOM CHROMA_ABER=0 VOL_LIGHT=1  CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0 !COLORED_SHADOW MOTION_BLUR_SAMPLES=4 MATERIAL_GLOSS
profile.low=                SHADOW_CASTING SHADOW_QTY_SLIDER=1 SHADOW_DISTANCE_SLIDER=0 REFLECTION_SLIDER=2 !DOF DOF_STRENGTH=0.09 AO=1 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=2 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=1 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0  BLOOM CHROMA_ABER=0 VOL_LIGHT=1  CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0 !COLORED_SHADOW MOTION_BLUR_SAMPLES=4 MATERIAL_GLOSS
profile.medium=             SHADOW_CASTING SHADOW_QTY_SLIDER=2 SHADOW_DISTANCE_SLIDER=1 REFLECTION_SLIDER=2 !DOF DOF_STRENGTH=0.09 AO=1 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=2 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=1 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0  BLOOM CHROMA_ABER=0 VOL_LIGHT=1  CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0  COLORED_SHADOW MOTION_BLUR_SAMPLES=4 MATERIAL_GLOSS
profile.high=               SHADOW_CASTING SHADOW_QTY_SLIDER=3 SHADOW_DISTANCE_SLIDER=2 REFLECTION_SLIDER=2 !DOF DOF_STRENGTH=0.09 AO=1 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=2 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=1 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0  BLOOM CHROMA_ABER=0 VOL_LIGHT=1  CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0  COLORED_SHADOW MOTION_BLUR_SAMPLES=4 MATERIAL_GLOSS
profile.extremeplus=        SHADOW_CASTING SHADOW_QTY_SLIDER=3 SHADOW_DISTANCE_SLIDER=2 REFLECTION_SLIDER=2  DOF DOF_STRENGTH=0.09 AO=1 AOSTEPS=5 AO_STRENGTH=0.70 AA_TYPE=2 !MOTION_BLUR REFRACTION=1 SUN_REFLECTION=1 WAVING=1 V_CLOUDS=1 CLOUD_STEPS_AVG=10 CLOUD_VOL_STYLE=0 BLOOM_SAMPLES=3.0  BLOOM CHROMA_ABER=0 VOL_LIGHT=1  CLOUD_REFLECTION WATER_ABSORPTION=0.10 COLOR_SCHEME=1 !VANILLA_WATER WATER_COLOR_SOURCE=0  COLORED_SHADOW MOTION_BLUR_SAMPLES=4 MATERIAL_GLOSS

# Default forced options
vignette = false
separateAo = false
oldLighting = false
dynamicHandLight = true
oldHandLight = false
underwaterOverlay = false
sun = true
moon = true
frustum.culling = true
shadow.culling = true
particles.before.deferred = true

#if V_CLOUDS > 0
    clouds = off
#endif

texture.gbuffers.noisetex = textures/water_256_RG_8bit.png
# texture.gbuffers.colortex2 = textures/bluenoise_64.png
# texture.deferred.colortex2 = textures/bluenoise_64.png
# texture.composite.colortex2 = textures/bluenoise_64.png

#if CLOUD_VOL_STYLE == 0
    texture.gbuffers.gaux2 = textures/clouds_natural_512_R_8bit.png
    texture.deferred.gaux2 = textures/clouds_natural_512_R_8bit.png
#else
    texture.gbuffers.gaux2 = textures/clouds_blocky_512_R_8bit.png
    texture.deferred.gaux2 = textures/clouds_blocky_512_R_8bit.png
#endif


program.shadow.enabled=SHADOW_CASTING
program.world0/shadow.enabled=SHADOW_CASTING
program.world1/shadow.enabled=SHADOW_CASTING
program.world-1/shadow.enabled=SHADOW_CASTING

# Config main screen
screen.columns = 3
screen = <profile> <empty> ACERCADE <empty> WAVING <empty> COLOR_SCHEME BLOOM REFLECTION_SLIDER <empty> AO SUN_REFLECTION SHADOW_CASTING V_CLOUDS CLOUD_REFLECTION COLORED_SHADOW AA_TYPE REFRACTION SHADOW_LOCK DOF MATERIAL_GLOSS VOL_LIGHT CHROMA_ABER <empty> <empty> MOTION_BLUR [ADVANCED_SCREEN]

# Sub-screens:
screen.ADVANCED_SCREEN.columns=3
screen.ADVANCED_SCREEN = [COMPATIBILITY_SCREEN] [ACCESIBILITY_SCREEN] [CUSTOM_COLORS_SCREEN] <empty> <empty> <empty> [SHADOWS_SCREEN] [DOF_SCREEN] [AO_SCREEN] [WATER_SCREEN] [POST_SCREEN] [CLOUDS_SCREEN] [LIGHT_SCREEN] [FOG_SCREEN] [MOTION_BLUR_SCREEN]

screen.COMPATIBILITY_SCREEN = USE_BASIC_SH BLACK_ENTITY_FIX DEBUG_MODE
screen.SHADOWS_SCREEN = SHADOW_TYPE SHADOW_BLUR SHADOW_DISTANCE_SLIDER SHADOW_QTY_SLIDER SHADOW_LOCK
screen.DOF_SCREEN = DOF_STRENGTH
screen.AO_SCREEN = AOSTEPS AO_STRENGTH
screen.WATER_SCREEN = WATER_ABSORPTION WATER_TEXTURE VANILLA_WATER WATER_COLOR_SOURCE WATER_TURBULENCE
screen.POST_SCREEN = BLOOM_SAMPLES CHROMA_ABER_STRENGTH
screen.CLOUDS_SCREEN = CLOUD_SPEED CLOUD_STEPS_AVG CLOUD_VOL_STYLE END_CLOUDS sunPathRotation
screen.LIGHT_SCREEN = AVOID_DARK_LEVEL NIGHT_BRIGHT BLOCKLIGHT_TEMP DYN_HAND_LIGHT
screen.FOG_SCREEN = FOG_ACTIVE FOG_ADJUST NETHER_FOG_DISTANCE
screen.MOTION_BLUR_SCREEN = MOTION_BLUR_STRENGTH MOTION_BLUR_SAMPLES
screen.ACCESIBILITY_SCREEN = COLOR_BLINDNESS COLOR_BLIND_MODE

screen.CUSTOM_COLORS_DAY.columns=3
screen.CUSTOM_COLORS_DAY = LIGHT_DAY_COLOR_R LIGHT_DAY_COLOR_G LIGHT_DAY_COLOR_B ZENITH_DAY_COLOR_R ZENITH_DAY_COLOR_G ZENITH_DAY_COLOR_B HORIZON_DAY_COLOR_R HORIZON_DAY_COLOR_G HORIZON_DAY_COLOR_B

screen.CUSTOM_COLORS_SUNSET.columns=3
screen.CUSTOM_COLORS_SUNSET = LIGHT_SUNSET_COLOR_R LIGHT_SUNSET_COLOR_G LIGHT_SUNSET_COLOR_B ZENITH_SUNSET_COLOR_R ZENITH_SUNSET_COLOR_G ZENITH_SUNSET_COLOR_B HORIZON_SUNSET_COLOR_R HORIZON_SUNSET_COLOR_G HORIZON_SUNSET_COLOR_B

screen.CUSTOM_COLORS_NIGHT.columns=3
screen.CUSTOM_COLORS_NIGHT = LIGHT_NIGHT_COLOR_R LIGHT_NIGHT_COLOR_G LIGHT_NIGHT_COLOR_B ZENITH_NIGHT_COLOR_R ZENITH_NIGHT_COLOR_G ZENITH_NIGHT_COLOR_B HORIZON_NIGHT_COLOR_R HORIZON_NIGHT_COLOR_G HORIZON_NIGHT_COLOR_B

screen.CUSTOM_COLORS_WATER.columns=3
screen.CUSTOM_COLORS_WATER = WATER_COLOR_R WATER_COLOR_G WATER_COLOR_B

screen.CUSTOM_COLORS_NV.columns=3
screen.CUSTOM_COLORS_NV = NV_COLOR_R NV_COLOR_G NV_COLOR_B

screen.CUSTOM_COLORS_SCREEN.columns=1
screen.CUSTOM_COLORS_SCREEN = [CUSTOM_COLORS_DAY] [CUSTOM_COLORS_SUNSET] [CUSTOM_COLORS_NIGHT] [CUSTOM_COLORS_WATER] [CUSTOM_COLORS_NV] <empty> OMNI_TINT_CUSTOM

sliders = SHADOW_DISTANCE_SLIDER SHADOW_QTY_SLIDER REFLECTION_SLIDER SHADOW_BLUR DOF_STRENGTH AOSTEPS AO_STRENGTH MOTION_BLUR_STRENGTH WATER_ABSORPTION CHROMA_ABER_STRENGTH BLOOM_SAMPLES CLOUD_STEPS_AVG sunPathRotation NIGHT_BRIGHT AVOID_DARK_LEVEL WATER_TURBULENCE FOG_ADJUST MOTION_BLUR_SAMPLES BLOCKLIGHT_TEMP LIGHT_DAY_COLOR_R LIGHT_DAY_COLOR_G LIGHT_DAY_COLOR_B ZENITH_DAY_COLOR_R ZENITH_DAY_COLOR_G ZENITH_DAY_COLOR_B HORIZON_DAY_COLOR_R HORIZON_DAY_COLOR_G HORIZON_DAY_COLOR_B LIGHT_SUNSET_COLOR_R LIGHT_SUNSET_COLOR_G LIGHT_SUNSET_COLOR_B ZENITH_SUNSET_COLOR_R ZENITH_SUNSET_COLOR_G ZENITH_SUNSET_COLOR_B HORIZON_SUNSET_COLOR_R HORIZON_SUNSET_COLOR_G HORIZON_SUNSET_COLOR_B LIGHT_NIGHT_COLOR_R LIGHT_NIGHT_COLOR_G LIGHT_NIGHT_COLOR_B ZENITH_NIGHT_COLOR_R ZENITH_NIGHT_COLOR_G ZENITH_NIGHT_COLOR_B HORIZON_NIGHT_COLOR_R HORIZON_NIGHT_COLOR_G HORIZON_NIGHT_COLOR_B WATER_COLOR_R WATER_COLOR_G WATER_COLOR_B NV_COLOR_R NV_COLOR_G NV_COLOR_B OMNI_TINT_CUSTOM SHADOW_LOCK

# Custom uniforms -----

# Many values are precalculated to avoid their later or repetitive calculation.

# Pixel size
uniform.float.pixelSizeX = 1.0 / viewWidth
uniform.float.pixelSizeY = 1.0 / viewHeight
uniform.float.aspectRatioInverse = 1.0 / aspectRatio

# Time constants
variable.float.hour_world = worldTime * 0.001
uniform.float.dayMoment = hour_world * 0.04166666666666667

# Day color mixer (for shadows) - This formula allows graphing the function that is calculated later.
# It allows setting values depending on the time of day. Particularly interesting are the transitions
# from day to night and vice versa, which are often used to indicate the intensity of the shadow
# (when it is produced by the moon instead of the sun), and other similar things.
# f(x) = min(−((x−.25)^2)∙20 + 1.25, 1)
# g(x) = min(−((x−.75)^2)∙50 + 3.125, 1)

variable.float.moment_aux = dayMoment - 0.25
variable.float.moment_aux_2 = moment_aux * moment_aux
uniform.float.dayMixer = clamp(-moment_aux_2 * 20.0 + 1.25, 0.0, 1.0)

variable.float.moment_aux_3 = dayMoment - 0.75
variable.float.moment_aux_4 = moment_aux_3 * moment_aux_3
uniform.float.nightMixer = clamp(-moment_aux_4 * 50.0 + 3.125, 0.0, 1.0)

# Day color mixer (for volumetric light) - "Similar to the previous case, but applied to values
# dependent on the time of day for volumetric lighting.

variable.float.moment_aux_5 = (dayMoment * 4.0) - 1.0
variable.float.moment_aux_6 = moment_aux_5 * moment_aux_5 * moment_aux_5 * moment_aux_5
variable.float.day_vol_mixer = clamp(((-moment_aux_6 + 1.0) * 7.0) + 1.0, 1.0, 8.0)

variable.float.moment_aux_7 = (dayMoment * 4.0) - 3.0
variable.float.moment_aux_8 = moment_aux_7 * moment_aux_7 * moment_aux_7 * moment_aux_7
variable.float.night_vol_mixer = clamp(((-moment_aux_8 + 1.0) * 7.0) + 1.0, 1.0, 8.0)

uniform.float.volumetricDayMixer = max(day_vol_mixer, night_vol_mixer)

# Light mix - Similar to the previous cases, a value that depends on the time of day
# to adjust various different parameters.
variable.float.light_mix_a = if((worldTime >= 0 && worldTime < 12485) || worldTime >= 23515, 1.0, 0.0)
variable.float.light_mix_b = if(worldTime >= 12485 && worldTime < 13085, 1.0 - ((worldTime - 12485) * 0.0016666666666666668), 0.0)
variable.float.light_mix_c = 0.0
variable.float.light_mix_d = if(worldTime >= 22915 && worldTime < 23515, (worldTime - 22915) * 0.0016666666666666668, 0.0)
variable.float.light_mix_e = max(light_mix_a, light_mix_b)
variable.float.light_mix_f = max(light_mix_c, light_mix_d)
uniform.float.dayNightMix = max(light_mix_e, light_mix_f)

# Frame modulus
uniform.int.frameMod = fmod(frameCounter, 16)

# TAA OFFSET - The offset for TAA is precalculated here.
# It is based on a pentagon (repeated twice as it is a multiple of the 10-frame module.)
# The traversal goes from one vertex of the pentagon to another at the opposite end,
# so that the traversal between different points is maximized and the images vary
# as much as possible from one to the next. It helps to make the flickering of the image
# so fast that it is "absorbed" and better masked by the TAA history.

#if AA_TYPE > 0
    uniform.vec2.taaOffset = vec2((if( \
    frameMod == 0,  0.5, \
    frameMod == 1, -0.5, \
    frameMod == 2, -0.5, \
    frameMod == 3,  0.5, \
    frameMod == 4,  0.5, \
    frameMod == 5, -0.5, \
    frameMod == 6, -0.5, \
    frameMod == 7,  0.5, \
    frameMod == 8,  0.5, \
    frameMod == 9, -0.5, \
    frameMod == 10, -0.5, \
    frameMod == 11,  0.5, \
    frameMod == 12,  0.5, \
    frameMod == 13, -0.5, \
    frameMod == 14, -0.5, \
    frameMod == 15,  0.5, \
    0.0)) * pixelSizeX, \
    (if( \
    frameMod == 0,  0.5, \
    frameMod == 1, -0.5, \
    frameMod == 2,  0.5, \
    frameMod == 3, -0.5, \
    frameMod == 4,  0.5, \
    frameMod == 5, -0.5, \
    frameMod == 6,  0.5, \
    frameMod == 7, -0.5, \
    frameMod == 8,  0.5, \
    frameMod == 9, -0.5, \
    frameMod == 10,  0.5, \
    frameMod == 11, -0.5, \
    frameMod == 12,  0.5, \
    frameMod == 13, -0.5, \
    frameMod == 14,  0.5, \
    frameMod == 15, -0.5, \
    0.0)) * pixelSizeY)

    # Dither shift - When Temporal sampling is active, dithering patterns change over time.
    # This only works in recent versions of Minecraft/Optifine/Iris.
    # For older versions, a mechanism that depends on the
    # uniform "frameMod" is used to calculate the increment.

        uniform.float.ditherShift = if( \
        frameMod == 0, 0.0625, \
        frameMod == 1, 0.4375, \
        frameMod == 2, 0.875, \
        frameMod == 3, 0.625, \
        frameMod == 4, 0.25, \
        frameMod == 5, 0.8125, \
        frameMod == 6, 0.125, \
        frameMod == 7, 0.9375, \
        frameMod == 8, 0.3125, \
        frameMod == 9, 0.5, \
        frameMod == 10, 0.375, \
        frameMod == 11, 0.5625, \
        frameMod == 12, 0.75, \
        frameMod == 13, 0.6875, \
        frameMod == 14, 0.1875, \
        frameMod == 15, 0.0, \
        0.0)
#endif

# FOV - A precalculated value related to FOV
uniform.float.fovYInverse = 1.0 / atan(1.0 / gbufferProjection.1.1) * 0.5

# float horizontalFOV = atan(1.0 / gbufferProjection[0].x);
# float verticalFOV = atan(1.0 / gbufferProjection[1].y); <-- fovYInverse

#ifdef DISTANT_HORIZONS
dhShadow.enabled = false
blend.dh_water=SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ONE_MINUS_SRC_ALPHA
#endif

# BLOOM Mipmap level calculation
variable.float.softBaseSize = 128.0
variable.float.softLodScale = max(1.0, viewHeight / softBaseSize)
# Optifine use 'log'. Divide with ln(2) (0.69314718)
uniform.float.softLod = max(0.0, log(softLodScale) / 0.69314718)