tweak dirt_amount settings. add HYPER DETAILED WAVE misc setting

This commit is contained in:
Xonk 2024-03-02 18:53:51 -05:00
parent 0c184e8e31
commit 201ee55b9b
10 changed files with 12 additions and 447 deletions

View File

@ -380,7 +380,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if (iswater > 0.95){
vec3 posxz = feetPlayerPos + cameraPosition;
float bumpmult = WATER_WAVE_STRENGTH;
float bumpmult = 1.0;
posxz.xyz = getParallaxDisplacement(posxz) ;

View File

@ -817,7 +817,7 @@ void main() {
////// --------------- COLORS --------------- //////
float dirtAmount = Dirt_Amount;
float dirtAmount = Dirt_Amount + 0.01;
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;

View File

@ -363,7 +363,7 @@ void main() {
float dirtAmount = Dirt_Amount;
float dirtAmount = Dirt_Amount + 0.01;
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;

View File

@ -372,7 +372,7 @@ void main() {
////// --------------- underwater fog
if (isEyeInWater == 1){
float dirtAmount = Dirt_Amount;
float dirtAmount = Dirt_Amount + 0.01;
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;

View File

@ -1,392 +0,0 @@
#include "/lib/settings.glsl"
flat varying vec4 lightCol;
flat varying vec3 averageSkyCol;
// flat varying vec3 averageSkyCol_Clouds;
uniform sampler2D noisetex;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
uniform sampler2D dhDepthTex;
uniform sampler2D dhDepthTex1;
uniform sampler2D colortex2;
uniform sampler2D colortex3;
// uniform sampler2D colortex4;
uniform sampler2D colortex6;
flat varying vec3 WsunVec;
uniform vec3 sunVec;
uniform float sunElevation;
// uniform float far;
uniform float dhFarPlane;
uniform float dhNearPlane;
uniform int frameCounter;
uniform float frameTimeCounter;
// varying vec2 texcoord;
uniform vec2 texelSize;
// flat varying vec2 TAA_Offset;
uniform int isEyeInWater;
uniform float rainStrength;
uniform ivec2 eyeBrightnessSmooth;
uniform float eyeAltitude;
#define DHVLFOG
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
#include "/lib/color_transforms.glsl"
#include "/lib/color_dither.glsl"
#include "/lib/projections.glsl"
#include "/lib/res_params.glsl"
#include "/lib/sky_gradient.glsl"
#include "/lib/Shadow_Params.glsl"
#include "/lib/DistantHorizons_projections.glsl"
float DH_ld(float dist) {
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
}
float DH_inv_ld (float lindepth){
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
}
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
return (near * far) / (depth * (near - far) + far);
}
#ifdef OVERWORLD_SHADER
const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
flat varying vec3 refractedSunVec;
#define TIMEOFDAYFOG
#include "/lib/lightning_stuff.glsl"
#include "/lib/volumetricClouds.glsl"
#include "/lib/overworld_fog.glsl"
#endif
#ifdef NETHER_SHADER
uniform sampler2D colortex4;
#include "/lib/nether_fog.glsl"
#endif
#ifdef END_SHADER
uniform sampler2D colortex4;
#include "/lib/end_fog.glsl"
#endif
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
float interleaved_gradientNoise(){
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter);
}
float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a+ 1.0/1.6180339887 * frameCounter );
}
float R2_dither(){
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
}
void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient){
inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value
int spCount = rayMarchSampleCount;
vec3 start = toShadowSpaceProjected(rayStart);
vec3 end = toShadowSpaceProjected(rayEnd);
vec3 dV = (end-start);
//limit ray length at 32 blocks for performance and reducing integration error
//you can't see above this anyway
float maxZ = min(rayLength,12.0)/(1e-8+rayLength);
dV *= maxZ;
rayLength *= maxZ;
float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength;
estEndDepth *= maxZ;
estSunDepth *= maxZ;
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
vec3 absorbance = vec3(1.0);
vec3 vL = vec3(0.0);
float expFactor = 11.0;
for (int i=0;i<spCount;i++) {
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
vec3 spPos = start.xyz + dV*d;
vec3 progressW = start.xyz+cameraPosition+dVWorld;
vec3 ambientMul = exp(-max(estEndDepth * d,0.0) * waterCoefs );
vec3 Indirectlight = ambientMul*ambient;
vec3 light = Indirectlight * scatterCoef;
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
absorbance *= exp(-dd * rayLength * waterCoefs);
}
inColor += vL;
}
#ifdef OVERWORLD_SHADER
float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves
vec2 pos = wPos.xz + (lightSource.xz/lightSource.y*wPos.y);
if(isEyeInWater==1) pos = wPos.xz - (lightSource.xz/lightSource.y*wPos.y); // fix the fucky
vec2 movement = vec2(-0.035*frameTimeCounter);
float caustic = 0.0;
float weightSum = 0.0;
float radiance = 2.39996;
mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance)));
const vec2 wave_size[4] = vec2[](
vec2(64.),
vec2(32.,16.),
vec2(16.,32.),
vec2(48.)
);
for (int i = 0; i < 4; i++){
pos = rotationMatrix * pos;
vec2 speed = movement;
float waveStrength = 1.0;
if( i == 0) {
speed *= 0.15;
waveStrength = 2.0;
}
float small_wave = texture2D(noisetex, pos / wave_size[i] + speed ).b * waveStrength;
caustic += max( 1.0-sin( 1.0-pow( 0.5+sin( small_wave*3.0 )*0.5, 25.0) ), 0);
weightSum -= exp2(caustic*0.1);
}
return caustic / weightSum;
}
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEyeDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
int spCount = 8;
vec3 start = toShadowSpaceProjected(rayStart);
vec3 end = toShadowSpaceProjected(rayEnd);
vec3 dV = (end-start);
//limit ray length at 32 blocks for performance and reducing integration error
//you can't see above this anyway
float maxZ = min(rayLength,32.0)/(1e-8+rayLength);
dV *= maxZ;
vec3 dVWorld = mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
rayLength *= maxZ;
float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength;
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
// vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
// float phase = (phaseg(VdotL,0.6) + phaseg(VdotL,0.8)) * 0.5;
float phase = fogPhase(VdotL) ;
vec3 absorbance = vec3(1.0);
vec3 vL = vec3(0.0);
float expFactor = 11.0;
for (int i=0;i<spCount;i++) {
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0); //step length (derivative)
vec3 spPos = start.xyz + dV*d;
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
//project into biased shadowmap space
#ifdef DISTORT_SHADOWMAP
float distortFactor = calcDistort(spPos.xy);
#else
float distortFactor = 1.0;
#endif
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
float sh = 1.0;
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
sh = shadow2D( shadow, pos).x;
}
sh *= GetCloudShadow_VLFOG(progressW, WsunVec);
vec3 sunMul = exp(-max((estSunDepth - dY * d) ,0.0)/abs(refractedSunVec.y) * waterCoefs);
vec3 ambientMul = exp(-max(estEyeDepth - dY * d,0.0) * waterCoefs) * 2.0 ;
float np3_Y = normalize(mat3(gbufferModelViewInverse) * rayEnd).y;
float ambfogfade = clamp(exp(np3_Y*1.5 - 1.5),0.0,1.0) ;
float sunCaustics = clamp(pow(waterCaustics(progressW, WsunVec)+1,5) * 2.0, phase*0.8+0.2, 1.0);
// make it such that the volume is brighter farther away from the camera.
float bubbleOfClearness = max(pow(length(d*dVWorld)/16,5)*100.0,0.0) + 1;
float bubbleOfClearness2 = max(pow(length(d*dVWorld)/24,5)*100.0,0.0) + 1;
vec3 Directlight = (lightSource * sunCaustics * phase * (sunMul+0.5)) * sh * pow(abs(WsunVec.y),2) * bubbleOfClearness;
vec3 Indirectlight = max(ambient * ambientMul, vec3(0.6,0.6,1.0) * exp(-waterCoefs) * bubbleOfClearness2) * ambfogfade ;
vec3 light = (Directlight + Indirectlight) * scatterCoef ;
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
absorbance *= exp(-dd * rayLength * waterCoefs);
}
inColor += vL;
}
#endif
vec4 blueNoise(vec2 coord){
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
}
vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n);
}
vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
int spCount = rayMarchSampleCount;
vec3 start = toShadowSpaceProjected(rayStart);
vec3 end = toShadowSpaceProjected(rayEnd);
vec3 dV = (end-start);
//limit ray length at 32 blocks for performance and reducing integration error
//you can't see above this anyway
float maxZ = min(rayLength,12.0)/(1e-8+rayLength);
dV *= maxZ;
rayLength *= maxZ;
estEndDepth *= maxZ;
estSunDepth *= maxZ;
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
vec3 newabsorbance = exp(-rayLength * waterCoefs); // No need to take the integrated value
float phase = fogPhase(VdotL) * 5.0;
vec3 absorbance = vec3(1.0);
vec3 vL = vec3(0.0);
float expFactor = 11.0;
for (int i=0;i<spCount;i++) {
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
vec3 spPos = start.xyz + dV*d;
vec3 progressW = start.xyz+cameraPosition+dVWorld;
//project into biased shadowmap space
#ifdef DISTORT_SHADOWMAP
float distortFactor = calcDistort(spPos.xy);
#else
float distortFactor = 1.0;
#endif
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
float sh = 1.0;
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
sh = shadow2D( shadow, pos).x;
}
// #ifdef VL_CLOUDS_SHADOWS
// sh *= GetCloudShadow_VLFOG(progressW,WsunVec);
// #endif
vec3 sunMul = exp(-estSunDepth * d * waterCoefs * 1.1);
vec3 ambientMul = exp(-estEndDepth * d * waterCoefs );
vec3 Directlight = (lightSource * phase * sunMul) * sh;
vec3 Indirectlight = ambient * ambientMul;
vec3 light = (Indirectlight + Directlight) * scatterCoef;
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
absorbance *= exp(-waterCoefs * dd * rayLength);
}
// inColor += vL;
return vec4( vL, dot(newabsorbance,vec3(0.335)));
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
/* RENDERTARGETS:13 */
float noise_1 = R2_dither();
float noise_2 = blueNoise();
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
float z = texture2D(depthtex1,tc).x;
#ifdef DISTANT_HORIZONS
float DH_z = texture2D(dhDepthTex1,tc).x;
#else
float DH_z = 0.0;
#endif
float z0 = texture2D(depthtex0,tc).x;
float DH_z0 = texture2D(dhDepthTex,tc).x;
vec3 viewPos = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z);
vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0);
// if (isEyeInWater == 1){
float dirtAmount = Dirt_Amount;
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
#ifdef OVERWORLD_SHADER
float estEyeDepth = 1.0-clamp(eyeBrightnessSmooth.y/240.0,0.,1.0);
estEyeDepth = pow(estEyeDepth,3.0) * 32.0;
float Vdiff = distance(viewPos, viewPos0);
float VdotU = 0.5;
float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane
float estimatedSunDepth = estimatedDepth/abs(WsunVec.y); //assuming water plane
vec3 lightColVol = lightCol.rgb / 80.;
vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
vec3 ambientColVol = (averageSkyCol/30.0);
vec4 vl = waterVolumetrics_test(vec3(0), viewPos, estimatedDepth, estimatedSunDepth, length(viewPos), noise_1, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(normalize(viewPos), normalize(sunVec* lightCol.a )) );
// waterVolumetrics(vl, vec3(0.0), viewPos, estEyeDepth, estEyeDepth, length(viewPos), noise_1, totEpsilon, scatterCoef, ambientColVol, lightColVol*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)) , dot(normalize(viewPos), normalize(sunVec* lightCol.a ) ) );
gl_FragData[0] = clamp(vl, 0.000001,65000.);
#else
vec3 fragpos0 = toScreenSpace(vec3(tc,z));
vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.6, vec3(0.2,0.4,1.0) * MIN_LIGHT_AMOUNT*0.01);
gl_FragData[0].a = 1;
waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol);
#endif
// }
}

View File

@ -1,48 +0,0 @@
#include "/lib/settings.glsl"
#include "/lib/util.glsl"
#include "/lib/res_params.glsl"
flat varying vec4 lightCol;
flat varying vec3 averageSkyCol;
flat varying vec3 WsunVec;
flat varying vec3 refractedSunVec;
flat varying float tempOffsets;
uniform sampler2D colortex4;
uniform float sunElevation;
uniform vec3 sunPosition;
uniform mat4 gbufferModelViewInverse;
uniform int frameCounter;
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
void main() {
gl_Position = ftransform();
// gl_Position.xy = (gl_Position.xy*0.5+0.5)*0.51*2.0-1.0;
gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_RESOLUTION)*2.0-1.0;
tempOffsets = HaltonSeq2(frameCounter%10000);
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
// WsunVec = normalize(LightDir);
refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);
}

View File

@ -389,7 +389,7 @@ void main() {
vec3 playerPos = normalize(mat3(gbufferModelViewInverse) * viewPos1);
// vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
float dirtAmount = Dirt_Amount + 0.1;
float dirtAmount = Dirt_Amount + 0.05;
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;

View File

@ -634,6 +634,7 @@ uniform int moonPhase;
#define WATER_CAUSTICS_BRIGHTNESS 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
#define DENOISE_SSS_AND_SSAO
// #define HYPER_DETAILED_WAVES
///////////////////////////////////////////
// ----- DISTANT HORIZONS SETTINGS ----- //
///////////////////////////////////////////

View File

@ -59,13 +59,17 @@ vec3 getWaveNormal(vec3 posxz, bool isLOD){
// vary the normal's "smooth" factor as distance changes, to avoid noise from too much details.
float range = pow(clamp(1.0 - length(posxz - cameraPosition)/(32*4),0.0,1.0),2.0);
float deltaPos = mix(0.5, 0.1, range);
float normalMult = 10.0;
float normalMult = 10.0 * WATER_WAVE_STRENGTH;
if(isLOD){
normalMult = mix(5.0, normalMult, range);
deltaPos = mix(0.9, deltaPos, range);
}
#ifdef HYPER_DETAILED_WAVES
deltaPos = 0.025;
#endif
vec2 coord = posxz.xz;// - posxz.y;
float h0 = getWaterHeightmap(coord);

View File

@ -290,7 +290,7 @@ BLISS_SHADERS <empty> \
######## MISC SETTINGS
screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS
screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES
screen.the_orb.columns = 1
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B