diff --git a/shaders/dimensions/DH_solid.fsh b/shaders/dimensions/DH_solid.fsh index 7e0b427..0b66d0f 100644 --- a/shaders/dimensions/DH_solid.fsh +++ b/shaders/dimensions/DH_solid.fsh @@ -125,9 +125,20 @@ vec4 applyNoise(in vec4 fragColor, const in vec3 viewPos, const in float viewDis float lum = (fragColor.r + fragColor.g + fragColor.b) / 3.0; noiseAmplification = (1.0 - pow(lum * 2.0 - 1.0, 2.0)) * noiseAmplification; // Lessen the effect on depending on how dark the object is, equasion for this is -(2x-1)^{2}+1 noiseAmplification *= fragColor.a; // The effect would lessen on transparent objects + + // Mikis idea. make it such that you can control the step amount as distance increases out from where vanilla chunks end. + // ideally, close = higher steps and far = lower steps + float highestSteps = 16.0; + float lowestSteps = 2.0; + float transitionLength = 16.0 * 16.0; // distance it takes to reach the lowest steps from the highest. measured in meters/blocks. + + float transitionGradient = clamp((length(viewPos - cameraPosition) - (far+32.0)) / transitionLength,0.0,1.0); + transitionGradient = 1.0-pow(1.0-transitionGradient,2.0); // make the gradient appear smoother and less sudden when approaching low steps. + + int dynamicNoiseSteps = int(mix(highestSteps, lowestSteps, transitionGradient)); // Random value for each position - float randomValue = rand(quantize(viewPos, noiseSteps)) + float randomValue = rand(quantize(viewPos, dynamicNoiseSteps)) * 2.0 * noiseAmplification - noiseAmplification; // Modifies the color