From af4c9380c2d392800d34e395a94b4e0a02d61277 Mon Sep 17 00:00:00 2001 From: Sasha Date: Wed, 12 Jul 2023 00:47:14 +0100 Subject: [PATCH] added Hald CLUT option --- shaders/final.fsh | 11 +++++++++++ shaders/lang/en_us.lang | 2 ++ shaders/lib/settings.glsl | 2 ++ shaders/shaders.properties | 6 ++++-- shaders/texture/hald_clut.png | Bin 0 -> 53438 bytes 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 shaders/texture/hald_clut.png diff --git a/shaders/final.fsh b/shaders/final.fsh index 60dd0a6..8a71dc0 100644 --- a/shaders/final.fsh +++ b/shaders/final.fsh @@ -7,6 +7,7 @@ varying vec2 texcoord; uniform sampler2D colortex7; +uniform sampler2D depthtex2; // lut // uniform sampler2D noisetex; uniform vec2 texelSize; uniform float viewWidth; @@ -122,6 +123,16 @@ void main() { vec3 FINAL_COLOR = clamp(int8Dither(col,texcoord),0.0,1.0); + #ifdef HALD_CLUT + #define LUT_WIDTH 1728 + #define LUT_DEPTH 144 + FINAL_COLOR = clamp(FINAL_COLOR, 0.0, 0.9999999); + ivec3 rounded = ivec3(FINAL_COLOR * float(LUT_DEPTH)); + int index = (rounded.b * LUT_DEPTH * LUT_DEPTH) + (rounded.g * LUT_DEPTH) + rounded.r; + ivec2 sampleCoord = ivec2(index % LUT_WIDTH, index / LUT_WIDTH); + FINAL_COLOR = texelFetch2D(depthtex2, sampleCoord, 0).rgb; + #endif + #ifdef LUMINANCE_CURVE applyLuminanceCurve(FINAL_COLOR, LOWER_CURVE, UPPER_CURVE); #endif diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 63306f8..fa64248 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -195,6 +195,8 @@ screen.Post_Processing = Post Processing option.BLEND_FACTOR = Blend Factor option.TAA_UPSCALING = Temporal Upscaling option.SCALE_FACTOR = Scale Factor + option.HALD_CLUT=Color LUT + option.HALD_CLUT.comment=Enables using a Hald CLUT. Default is an identity LUT that you can use this as a base for edits. screen.LabPBR = Lab PBR diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 4f4020e..a120adc 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -348,6 +348,8 @@ uniform int moonPhase; #define SATURATION 0.00 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ] #define CROSSTALK 0.0 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ] +// #define HALD_CLUT + // #define LUMINANCE_CURVE #define UPPER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] #define LOWER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 91da691..1ca97d1 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -46,6 +46,8 @@ alphaTest.gbuffers_skybasic=false alphaTest.gbuffers_skytextured=false alphaTest.gbuffers_hand=true +texture.composite.depthtex2 = texture/hald_clut.png + sliders = UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH @@ -186,9 +188,9 @@ PhysicsMod_support [LabPBR] ### PURKINJE screen.Purkinje_effect.columns = 1 screen.Purkinje_effect = Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Purkinje_Multiplier - + ## EDITING screen.Editing.columns = 1 - screen.Editing = Compositing_Sky CompSky_R CompSky_G CompSky_B CONTRAST LUMINANCE_CURVE UPPER_CURVE LOWER_CURVE + screen.Editing = Compositing_Sky CompSky_R CompSky_G CompSky_B HALD_CLUT CONTRAST LUMINANCE_CURVE UPPER_CURVE LOWER_CURVE diff --git a/shaders/texture/hald_clut.png b/shaders/texture/hald_clut.png new file mode 100644 index 0000000000000000000000000000000000000000..b18529cb9e17ff889f8162c56696e99bd1e60301 GIT binary patch literal 53438 zcmeHQdu&rx7{6HE6r5``W@d;iG0|d}n+XdB#WC!FZ9&(?R}uG6w=gu~V-l&34MCkw zqklA8B@#_d6{11Y5hIJ61Rn`(5GfNgeC!Vc*fAfGO|r_Y-#PcTy^rIX()6}2KN6m~ z_j1oY-}#;I{J!t|eJ@wvu`*|N{%lE-aw=BYYa}UaANzUn1(GD)^ZkVj=(mE0R@JPQ zB-eG4)V@uULiA7Vzev*4#ga5yFG)*0l9c!OTfL53>EERad)Zyj93T6kZ2h$lys_d) z_2u_>91qt#^6($uh}HpqOVo{Q?2{9WkZXKtNIpB_{aA@ zs=uUsc=Bv8yzMieWiVhlQd7jQYZ>`?kNl^hfk5llz+!93QfuLazop%IyxUjH|C3;U zgZ!-WpvAu0(la!`Z|*C;Uwesr^ZpN;>$@&1uKL@rT=V1Ng}=&IPk6_3qBj=}cKyZP zojt#I!+q>A?*1)1gHq4iRpp6~7A zNAf*v;Qf(n&gMkl(ss*tuWhZlv5G&QhQ3)h^myZ%<$Z69JOg=6(T6TnhF;lbaU7l1 z6x^~-J6`3>mId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