mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-22 17:47:34 +08:00
fix blocklight and ambient light interactions with rtao/ssgi/gtao. fix atmosphere haze self absorbance. fix cloud lighting during nausea. fix the issue were floodfill handheld lights cannot be toggled off. fix hardocded emission writing to the wrong buffer. fix lighting on translucents/particles in the end/nether
This commit is contained in:
parent
cfbdedfd4c
commit
fe459005c9
@ -113,14 +113,14 @@ void main() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 normals = viewToWorld(normals_and_materials.xyz);
|
vec3 normals = (normals_and_materials.xyz);
|
||||||
float materials = normals_and_materials.a;
|
float materials = normals_and_materials.a;
|
||||||
vec2 PackLightmaps = lightmapCoords;
|
vec2 PackLightmaps = lightmapCoords;
|
||||||
|
|
||||||
// PackLightmaps.y *= 1.05;
|
// PackLightmaps.y *= 1.05;
|
||||||
PackLightmaps = min(max(PackLightmaps,0.0)*1.05,1.0);
|
PackLightmaps = min(max(PackLightmaps,0.0)*1.05,1.0);
|
||||||
|
|
||||||
vec4 data1 = clamp( encode(normals.xyz, PackLightmaps), 0.0, 1.0);
|
vec4 data1 = clamp( encode(normals, PackLightmaps), 0.0, 1.0);
|
||||||
|
|
||||||
// alpha is material masks, set it to 0.65 to make a DH LODs mask.
|
// alpha is material masks, set it to 0.65 to make a DH LODs mask.
|
||||||
vec4 Albedo = vec4(gcolor.rgb, 1.0);
|
vec4 Albedo = vec4(gcolor.rgb, 1.0);
|
||||||
|
@ -425,32 +425,34 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
AmbientLightColor = averageSkyCol_Clouds / 30.0;
|
AmbientLightColor = averageSkyCol_Clouds / 30.0;
|
||||||
|
|
||||||
#ifdef IS_IRIS
|
#ifdef IS_IRIS
|
||||||
AmbientLightColor *= 2.5;
|
AmbientLightColor *= 2.5;
|
||||||
#else
|
#else
|
||||||
AmbientLightColor *= 0.5;
|
AmbientLightColor *= 0.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, lightmap.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
AmbientLightColor = skyCloudsFromTexLOD2(vec3(0.0,1.0,0.0), colortex4, 6).rgb / 30.0;
|
Indirect_lighting = skyCloudsFromTexLOD2(vec3(0.0,1.0,0.0), colortex4, 6).rgb / 30.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
AmbientLightColor = vec3(0.3,0.6,1.0) * 0.5;
|
Indirect_lighting = vec3(0.3,0.6,1.0) * 0.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
||||||
#ifdef IS_LPV_ENABLED
|
#ifdef IS_LPV_ENABLED
|
||||||
vec3 lpvPos = GetLpvPosition(feetPlayerPos);
|
vec3 lpvPos = GetLpvPosition(feetPlayerPos);
|
||||||
#else
|
#else
|
||||||
const vec3 lpvPos = vec3(0.0);
|
const vec3 lpvPos = vec3(0.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Indirect_lighting = DoAmbientLightColor(feetPlayerPos, lpvPos, AmbientLightColor, MinimumLightColor, Torch_Color, clamp(lightmap.xy,0,1), exposure);
|
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
|
||||||
|
|
||||||
#ifdef LINES
|
#ifdef LINES
|
||||||
|
|
||||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb);
|
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb);
|
||||||
|
|
||||||
if(SELECTION_BOX > 0) gl_FragData[0].rgba = vec4(toLinear(vec3(SELECT_BOX_COL_R, SELECT_BOX_COL_G, SELECT_BOX_COL_B)), 1.0);
|
if(SELECTION_BOX > 0) gl_FragData[0].rgba = vec4(toLinear(vec3(SELECT_BOX_COL_R, SELECT_BOX_COL_G, SELECT_BOX_COL_B)), 1.0);
|
||||||
|
@ -503,7 +503,7 @@ void main() {
|
|||||||
|
|
||||||
#if EMISSIVE_TYPE == 2
|
#if EMISSIVE_TYPE == 2
|
||||||
gl_FragData[1].a = SpecularTex.a;
|
gl_FragData[1].a = SpecularTex.a;
|
||||||
if(SpecularTex.a <= 0.0) gl_FragData[2].a = EMISSIVE;
|
if(SpecularTex.a <= 0.0) gl_FragData[1].a = EMISSIVE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EMISSIVE_TYPE == 3
|
#if EMISSIVE_TYPE == 3
|
||||||
@ -526,13 +526,6 @@ void main() {
|
|||||||
#if SSS_TYPE == 3
|
#if SSS_TYPE == 3
|
||||||
gl_FragData[1].b = SpecularTex.b;
|
gl_FragData[1].b = SpecularTex.b;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #ifndef ENTITIES
|
|
||||||
// if(PORTAL > 0){
|
|
||||||
// gl_FragData[2].rgb = vec3(0);
|
|
||||||
// gl_FragData[2].a = clamp(ENDPORTAL_EFFECT * 0.9, 0,0.9);
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// hit glow effect...
|
// hit glow effect...
|
||||||
|
@ -217,7 +217,7 @@ vec3 viewToWorld(vec3 viewPos) {
|
|||||||
vec4 pos;
|
vec4 pos;
|
||||||
pos.xyz = viewPos;
|
pos.xyz = viewPos;
|
||||||
pos.w = 0.0;
|
pos.w = 0.0;
|
||||||
pos = gbufferModelViewInverse * pos;
|
pos = gbufferModelViewInverse * pos ;
|
||||||
return pos.xyz;
|
return pos.xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,19 +629,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
|
|
||||||
float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + SkylightDir, 0.2);
|
float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + SkylightDir, 0.2);
|
||||||
AmbientLightColor *= skylight;
|
AmbientLightColor *= skylight;
|
||||||
|
|
||||||
|
Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, lightmap.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
// vec3 AmbientLightColor = skyCloudsFromTexLOD2(worldSpaceNormal, colortex4, 6).rgb / 15.0;
|
Indirect_lighting = skyCloudsFromTexLOD2(worldSpaceNormal, colortex4, 6).rgb / 30.0 ;
|
||||||
|
|
||||||
// vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb/ 30.0;
|
|
||||||
// vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb/ 30.0;
|
|
||||||
|
|
||||||
// up *= pow( max( worldSpaceNormal.y, 0), 2);
|
|
||||||
// down *= pow( max(-worldSpaceNormal.y, 0), 2);
|
|
||||||
// AmbientLightColor += up + down;
|
|
||||||
|
|
||||||
vec3 AmbientLightColor = vec3(0.1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
@ -658,14 +651,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
|
|
||||||
Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL;
|
Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL;
|
||||||
|
|
||||||
// vec3 AmbientLightColor = vec3(0.5,0.75,1.0) * 0.9 + 0.1;
|
|
||||||
// AmbientLightColor *= clamp(1.5 + dot(worldSpaceNormal, normalize(feetPlayerPos))*0.5,0,2);
|
|
||||||
|
|
||||||
vec3 AmbientLightColor = vec3(0.3,0.6,1.0) * 0.5;
|
vec3 AmbientLightColor = vec3(0.3,0.6,1.0) * 0.5;
|
||||||
|
|
||||||
AmbientLightColor = AmbientLightColor + 0.7 * AmbientLightColor * dot(worldSpaceNormal, normalize(feetPlayerPos));
|
Indirect_lighting = AmbientLightColor + 0.7 * AmbientLightColor * dot(worldSpaceNormal, normalize(feetPlayerPos));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
||||||
#ifdef IS_LPV_ENABLED
|
#ifdef IS_LPV_ENABLED
|
||||||
vec3 normalOffset = vec3(0.0);
|
vec3 normalOffset = vec3(0.0);
|
||||||
|
|
||||||
@ -684,7 +675,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
const vec3 lpvPos = vec3(0.0);
|
const vec3 lpvPos = vec3(0.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Indirect_lighting = DoAmbientLightColor(feetPlayerPos, lpvPos, AmbientLightColor, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy, exposure);
|
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
|
||||||
|
|
||||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ void main() {
|
|||||||
vec3 FlatNormals = texture2D(colortex15,texcoord).rgb * 2.0 - 1.0;
|
vec3 FlatNormals = texture2D(colortex15,texcoord).rgb * 2.0 - 1.0;
|
||||||
|
|
||||||
if(z >= 1.0){
|
if(z >= 1.0){
|
||||||
FlatNormals = worldToView(normal);
|
FlatNormals = normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
|
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
|
||||||
|
@ -6,9 +6,13 @@ flat varying vec3 WsunVec;
|
|||||||
uniform sampler2D colortex4;
|
uniform sampler2D colortex4;
|
||||||
|
|
||||||
uniform int frameCounter;
|
uniform int frameCounter;
|
||||||
|
|
||||||
uniform float sunElevation;
|
uniform float sunElevation;
|
||||||
uniform vec3 sunPosition;
|
uniform vec3 sunPosition;
|
||||||
uniform mat4 gbufferModelViewInverse;
|
uniform mat4 gbufferModelViewInverse;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "/lib/util.glsl"
|
#include "/lib/util.glsl"
|
||||||
#include "/lib/res_params.glsl"
|
#include "/lib/res_params.glsl"
|
||||||
|
|
||||||
|
@ -809,8 +809,9 @@ void main() {
|
|||||||
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
|
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
|
||||||
|
|
||||||
if(isDHrange){
|
if(isDHrange){
|
||||||
|
FlatNormals = normal;
|
||||||
|
normal = viewToWorld(normal);
|
||||||
slopednormal = normal;
|
slopednormal = normal;
|
||||||
FlatNormals = worldToView(normal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -899,6 +900,8 @@ void main() {
|
|||||||
bool inShadowmapBounds = false;
|
bool inShadowmapBounds = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MinimumLightColor = MinimumLightColor + 0.7 * MinimumLightColor * dot(slopednormal, feetPlayerPos_normalized);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////// FILTER STUFF //////////////////////////////////
|
/////////////////////////////////// FILTER STUFF //////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1023,7 +1026,7 @@ void main() {
|
|||||||
Shadows = ComputeShadowMap(projectedShadowPosition, distortFactor, noise_2, filteredShadow.x, flatNormNdotL, shadowMapFalloff, DirectLightColor, ShadowAlpha, LabSSS > 0.0);
|
Shadows = ComputeShadowMap(projectedShadowPosition, distortFactor, noise_2, filteredShadow.x, flatNormNdotL, shadowMapFalloff, DirectLightColor, ShadowAlpha, LabSSS > 0.0);
|
||||||
|
|
||||||
// transition to fallback lightmap shadow mask.
|
// transition to fallback lightmap shadow mask.
|
||||||
Shadows = mix(isWater ? 1.0 : LM_shadowMapFallback, Shadows, shadowMapFalloff);
|
Shadows = mix(isWater ? lightLeakFix : LM_shadowMapFallback, Shadows, shadowMapFalloff);
|
||||||
|
|
||||||
#ifdef OLD_LIGHTLEAK_FIX
|
#ifdef OLD_LIGHTLEAK_FIX
|
||||||
if (isEyeInWater == 0) Shadows *= lightLeakFix; // light leak fix
|
if (isEyeInWater == 0) Shadows *= lightLeakFix; // light leak fix
|
||||||
@ -1080,29 +1083,29 @@ void main() {
|
|||||||
///////////////////////////// INDIRECT LIGHTING /////////////////////////////
|
///////////////////////////// INDIRECT LIGHTING /////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if defined OVERWORLD_SHADER && (indirect_effect == 0 || indirect_effect == 1)
|
#if defined OVERWORLD_SHADER
|
||||||
Indirect_lighting = AmbientLightColor;
|
Indirect_lighting = AmbientLightColor;
|
||||||
|
|
||||||
float allDirections = dot(abs(slopednormal),vec3(1.0));
|
|
||||||
vec3 ambientcoefs = slopednormal / allDirections;
|
|
||||||
float SkylightDir = ambientcoefs.y*1.5;
|
|
||||||
|
|
||||||
if(isGrass) SkylightDir = 1.5;
|
|
||||||
|
|
||||||
float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1-lightmap.y)*0.8*0) ;
|
float skylight = 1.0;
|
||||||
|
#if indirect_effect != 2
|
||||||
|
float SkylightDir = (slopednormal / dot(abs(slopednormal),vec3(1.0))).y*1.5;
|
||||||
|
if(isGrass) SkylightDir = 1.5;
|
||||||
|
|
||||||
#if indirect_effect == 1
|
skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1-lightmap.y)*0.8);
|
||||||
skylight = min(skylight, mix(0.95, 2.5, pow(1-pow(1-SSAO_SSS.x, 0.5),2.0) ));
|
|
||||||
|
#if indirect_effect == 1
|
||||||
|
skylight = min(skylight, mix(0.95, 2.5, pow(1-pow(1-SSAO_SSS.x, 0.5),2.0) ));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Indirect_lighting *= skylight;
|
Indirect_lighting = doIndirectLighting(AmbientLightColor * skylight, MinimumLightColor, lightmap.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
Indirect_lighting = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb / 30.0;
|
Indirect_lighting = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb / 30.0;
|
||||||
vec3 up = skyCloudsFromTexLOD2(vec3(0.0,1.0,0.0), colortex4, 6).rgb / 30.0;
|
vec3 up = skyCloudsFromTexLOD2(vec3(0.0,1.0,0.0), colortex4, 6).rgb / 30.0;
|
||||||
|
|
||||||
Indirect_lighting = mix(up, Indirect_lighting, clamp(pow(1.0-pow(1.0-SSAO_SSS.x, 0.5),2.0),0.0,1.0));
|
Indirect_lighting = mix(up, Indirect_lighting, clamp(pow(1.0-pow(1.0-SSAO_SSS.x, 0.5),2.0),0.0,1.0));
|
||||||
|
|
||||||
AmbientLightColor = Indirect_lighting / 5.0;
|
AmbientLightColor = Indirect_lighting / 5.0;
|
||||||
#endif
|
#endif
|
||||||
@ -1112,28 +1115,7 @@ void main() {
|
|||||||
|
|
||||||
Indirect_lighting = Indirect_lighting + 0.7*mix(-Indirect_lighting, Indirect_lighting * dot(slopednormal, feetPlayerPos_normalized), clamp(pow(1.0-pow(1.0-SSAO_SSS.x, 0.5),2.0),0.0,1.0));
|
Indirect_lighting = Indirect_lighting + 0.7*mix(-Indirect_lighting, Indirect_lighting * dot(slopednormal, feetPlayerPos_normalized), clamp(pow(1.0-pow(1.0-SSAO_SSS.x, 0.5),2.0),0.0,1.0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IS_LPV_ENABLED
|
|
||||||
vec3 normalOffset = vec3(0.0);
|
|
||||||
|
|
||||||
if (any(greaterThan(abs(FlatNormals), vec3(1.0e-6))))
|
|
||||||
normalOffset = 0.5*viewToWorld(FlatNormals);
|
|
||||||
|
|
||||||
#if LPV_NORMAL_STRENGTH > 0
|
|
||||||
vec3 texNormalOffset = -normalOffset + slopednormal;
|
|
||||||
normalOffset = mix(normalOffset, texNormalOffset, (LPV_NORMAL_STRENGTH*0.01));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec3 lpvPos = GetLpvPosition(feetPlayerPos) + normalOffset;
|
|
||||||
#else
|
|
||||||
const vec3 lpvPos = vec3(0.0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// little highlight effect just to make caves look a little less flat.
|
|
||||||
MinimumLightColor = MinimumLightColor + MinimumLightColor*dot(feetPlayerPos_normalized, slopednormal)*0.7;
|
|
||||||
|
|
||||||
Indirect_lighting = DoAmbientLightColor(feetPlayerPos, lpvPos, Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B) , lightmap.xy, exposure);
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
Indirect_lighting += LightningFlashLighting;
|
Indirect_lighting += LightningFlashLighting;
|
||||||
#endif
|
#endif
|
||||||
@ -1166,29 +1148,56 @@ void main() {
|
|||||||
Indirect_lighting *= AO;
|
Indirect_lighting *= AO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GTAO
|
// GTAO... this is so dumb but whatevverrr
|
||||||
#if indirect_effect == 2
|
#if indirect_effect == 2
|
||||||
vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + bnoise);
|
float vanillaAO_curve = pow(1.0 - vanilla_AO*vanilla_AO,5.0);
|
||||||
Indirect_lighting = AmbientLightColor/2.5;
|
|
||||||
|
|
||||||
AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0);
|
|
||||||
|
|
||||||
Indirect_lighting *= AO;
|
vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + bnoise);
|
||||||
|
float GTAO = !hand ? ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z), viewPos, worldToView(slopednormal), r2) : 1.0;
|
||||||
|
AO = vec3(min(vanillaAO_curve,GTAO));
|
||||||
|
|
||||||
|
vec3 IndirectColor = Indirect_lighting;
|
||||||
|
|
||||||
|
float SkylightDir = (slopednormal / dot(abs(slopednormal),vec3(1.0))).y*1.5;
|
||||||
|
if(isGrass) SkylightDir = 1.5;
|
||||||
|
|
||||||
|
skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1-lightmap.y)*0.8);
|
||||||
|
skylight = min(skylight, mix(0.95, 2.5, pow(1-pow(1-GTAO, 0.5),2.0) ));
|
||||||
|
|
||||||
|
IndirectColor *= skylight;
|
||||||
|
|
||||||
|
Indirect_lighting = doIndirectLighting(IndirectColor, lightmap.y) * AO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// RTAO and/or SSGI
|
// RTAO and/or SSGI
|
||||||
#if indirect_effect == 3 || indirect_effect == 4
|
#if indirect_effect == 3 || indirect_effect == 4
|
||||||
|
if(!hand) Indirect_lighting = ApplySSRT(viewPos, normal, vec3(bnoise, noise_2), AmbientLightColor, MinimumLightColor, lightmap.y, isGrass, isDHrange);
|
||||||
// Indirect_lighting = AmbientLightColor;
|
|
||||||
|
|
||||||
|
|
||||||
ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), feetPlayerPos, lpvPos, exposure, lightmap.xy, AmbientLightColor*2.5, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass, hand);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined END_SHADER
|
#if defined END_SHADER
|
||||||
Direct_lighting *= AO;
|
Direct_lighting *= AO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
||||||
|
|
||||||
|
#ifdef IS_LPV_ENABLED
|
||||||
|
vec3 normalOffset = vec3(0.0);
|
||||||
|
|
||||||
|
if (any(greaterThan(abs(FlatNormals), vec3(1.0e-6))))
|
||||||
|
normalOffset = 0.5*viewToWorld(FlatNormals);
|
||||||
|
|
||||||
|
#if LPV_NORMAL_STRENGTH > 0
|
||||||
|
vec3 texNormalOffset = -normalOffset + slopednormal;
|
||||||
|
normalOffset = mix(normalOffset, texNormalOffset, (LPV_NORMAL_STRENGTH*0.01));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec3 lpvPos = GetLpvPosition(feetPlayerPos) + normalOffset;
|
||||||
|
#else
|
||||||
|
const vec3 lpvPos = vec3(0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////// SUB SURFACE SCATTERING ////////////////////////////
|
///////////////////////// SUB SURFACE SCATTERING ////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1237,9 +1246,8 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow, shadowMapFalloff2);
|
Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow, shadowMapFalloff2);
|
||||||
// Direct_SSS = vec3(1.0);
|
|
||||||
|
|
||||||
if (isEyeInWater == 0) Direct_SSS *= lightLeakFix;
|
Direct_SSS *= lightLeakFix;
|
||||||
|
|
||||||
#ifndef SCREENSPACE_CONTACT_SHADOWS
|
#ifndef SCREENSPACE_CONTACT_SHADOWS
|
||||||
Direct_SSS = mix(vec3(0.0), Direct_SSS, shadowMapFalloff2);
|
Direct_SSS = mix(vec3(0.0), Direct_SSS, shadowMapFalloff2);
|
||||||
@ -1298,7 +1306,7 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
#if DEBUG_VIEW == debug_NORMALS
|
#if DEBUG_VIEW == debug_NORMALS
|
||||||
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
|
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
|
||||||
gl_FragData[0].rgb = normalize(worldToView(normal));
|
gl_FragData[0].rgb = normal ;
|
||||||
#endif
|
#endif
|
||||||
#if DEBUG_VIEW == debug_SPECULAR
|
#if DEBUG_VIEW == debug_SPECULAR
|
||||||
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
|
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
|
||||||
|
@ -70,6 +70,8 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
|||||||
return (near * far) / (depth * (near - far) + far);
|
return (near * far) / (depth * (near - far) + far);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define IS_LPV_ENABLED
|
||||||
|
|
||||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
||||||
|
|
||||||
flat varying float exposure;
|
flat varying float exposure;
|
||||||
|
@ -434,7 +434,7 @@ void main() {
|
|||||||
////// --------------- BLEND FOG INTO SCENE
|
////// --------------- BLEND FOG INTO SCENE
|
||||||
//////////// apply VL fog over opaque and translucents
|
//////////// apply VL fog over opaque and translucents
|
||||||
|
|
||||||
color *= vl.a*cloudAlpha;
|
color *= vl.a*cloudAlpha ;
|
||||||
color += vl.rgb;
|
color += vl.rgb;
|
||||||
bloomyFogMult *= mix(vl.a,vl.a*0.5 + 0.5, rainStrength);
|
bloomyFogMult *= mix(vl.a,vl.a*0.5 + 0.5, rainStrength);
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void main() {
|
|||||||
// maximum control of color and luminance
|
// maximum control of color and luminance
|
||||||
// vec3 minimumlight = vec3(0.5,0.75,1.0) * (MIN_LIGHT_AMOUNT*0.001 + nightVision);
|
// vec3 minimumlight = vec3(0.5,0.75,1.0) * (MIN_LIGHT_AMOUNT*0.001 + nightVision);
|
||||||
vec3 minimumlight = vec3(0.5,0.75,1.0) * nightVision;
|
vec3 minimumlight = vec3(0.5,0.75,1.0) * nightVision;
|
||||||
averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,2.5) * (1.0-rainStrength*0.3), minimumlight);
|
averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,2.5) * (1.0-rainStrength*0.7), minimumlight);
|
||||||
averageSkyCol = max(averageSkyCol * PLANET_GROUND_BRIGHTNESS, minimumlight);
|
averageSkyCol = max(averageSkyCol * PLANET_GROUND_BRIGHTNESS, minimumlight);
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
@ -21,92 +21,56 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 DoAmbientLightColor(
|
vec3 doBlockLightLighting(
|
||||||
vec3 playerPos,
|
vec3 lightColor, float lightmap, float exposureValue,
|
||||||
vec3 lpvPos,
|
vec3 playerPos, vec3 lpvPos
|
||||||
vec3 SkyColor,
|
|
||||||
vec3 MinimumColor,
|
|
||||||
vec3 TorchColor,
|
|
||||||
vec2 Lightmap,
|
|
||||||
float Exposure
|
|
||||||
){
|
){
|
||||||
// Lightmap = vec2(0.0,1.0);
|
|
||||||
// float LightLevelZero = clamp(pow(eyeBrightnessSmooth.y/240. + Lightmap.y,2.0) ,0.0,1.0);
|
|
||||||
|
|
||||||
// do sky lighting.
|
float lightmapCurve = pow(1.0-sqrt(1.0-clamp(lightmap,0.0,1.0)),2.0) * 2.0;
|
||||||
float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5;
|
|
||||||
vec3 MinimumLight = MinimumColor * max(MIN_LIGHT_AMOUNT*0.01, nightVision * 0.1);
|
|
||||||
vec3 IndirectLight = max(SkyColor * ambient_brightness * skyLM * 0.7, MinimumLight);
|
|
||||||
|
|
||||||
// do torch lighting
|
vec3 blockLight = lightColor * lightmapCurve; //;
|
||||||
float TorchLM = pow(1.0-sqrt(1.0-clamp(Lightmap.x,0.0,1.0)),2.0) * 2.0;
|
|
||||||
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*Exposure),0.0,1.0));
|
|
||||||
|
|
||||||
vec3 TorchLight = TorchColor * TorchLM * TORCH_AMOUNT;
|
|
||||||
|
|
||||||
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
||||||
vec4 lpvSample = SampleLpvLinear(lpvPos);
|
vec4 lpvSample = SampleLpvLinear(lpvPos);
|
||||||
vec3 LpvTorchLight = GetLpvBlockLight(lpvSample);
|
vec3 lpvBlockLight = GetLpvBlockLight(lpvSample);
|
||||||
|
|
||||||
// i gotchu
|
// create a smooth falloff at the edges of the voxel volume.
|
||||||
float fadeLength = 10.0; // in blocks
|
float fadeLength = 10.0; // in meters
|
||||||
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
|
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
|
||||||
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
|
float voxelRangeFalloff = cubicRadius.x*cubicRadius.y*cubicRadius.z;
|
||||||
|
voxelRangeFalloff = 1.0 - pow(1.0-pow(voxelRangeFalloff,1.5),3.0);
|
||||||
LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :)
|
|
||||||
|
|
||||||
TorchLight = mix(TorchLight, LpvTorchLight/5.0, LpvFadeF);
|
// outside the voxel volume, lerp to vanilla lighting as a fallback
|
||||||
|
blockLight = mix(blockLight, lpvBlockLight/5.0, voxelRangeFalloff);
|
||||||
|
|
||||||
const vec3 normal = vec3(0.0); // TODO
|
#ifdef Hand_Held_lights
|
||||||
|
// create handheld lightsources
|
||||||
|
const vec3 normal = vec3(0.0); // TODO
|
||||||
|
|
||||||
if (heldItemId > 0)
|
if (heldItemId > 0)
|
||||||
TorchLight += GetHandLight(heldItemId, playerPos, normal);
|
blockLight += GetHandLight(heldItemId, playerPos, normal);
|
||||||
|
|
||||||
if (heldItemId2 > 0)
|
if (heldItemId2 > 0)
|
||||||
TorchLight += GetHandLight(heldItemId2, playerPos, normal);
|
blockLight += GetHandLight(heldItemId2, playerPos, normal);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return IndirectLight + TorchLight * TorchBrightness_autoAdjust;
|
// try to make blocklight have consistent visiblity in different light levels.
|
||||||
|
float autoBrightness = mix(1.0, 30.0, clamp(exp(-10.0*exposureValue),0.0,1.0));
|
||||||
|
blockLight *= autoBrightness;
|
||||||
|
|
||||||
|
return blockLight * TORCH_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 doIndirectLighting(
|
||||||
// this is dumb, and i plan to remove it eventually...
|
vec3 lightColor, vec3 minimumLightColor, float lightmap
|
||||||
vec4 RT_AmbientLight(
|
|
||||||
vec3 playerPos,
|
|
||||||
vec3 lpvPos,
|
|
||||||
float Exposure,
|
|
||||||
vec2 Lightmap,
|
|
||||||
vec3 TorchColor
|
|
||||||
){
|
){
|
||||||
float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5;
|
|
||||||
|
|
||||||
|
float lightmapCurve = (pow(lightmap,15.0)*2.0 + pow(lightmap,2.5))*0.5;
|
||||||
|
|
||||||
// do torch lighting
|
vec3 indirectLight = lightColor * lightmapCurve * ambient_brightness * 0.7;
|
||||||
float TorchLM = pow(1.0-sqrt(1.0-clamp(Lightmap.x,0.0,1.0)),2.0) * 2.0;
|
|
||||||
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*Exposure),0.0,1.0)) ;
|
|
||||||
vec3 TorchLight = TorchColor * TorchLM * TORCH_AMOUNT ;
|
|
||||||
|
|
||||||
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
|
||||||
vec4 lpvSample = SampleLpvLinear(lpvPos);
|
|
||||||
vec3 LpvTorchLight = GetLpvBlockLight(lpvSample);
|
|
||||||
|
|
||||||
// i gotchu
|
indirectLight += minimumLightColor * max(MIN_LIGHT_AMOUNT*0.01, nightVision * 0.1);
|
||||||
float fadeLength = 10.0; // in blocks
|
|
||||||
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
|
|
||||||
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
|
|
||||||
|
|
||||||
LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :)
|
return indirectLight;
|
||||||
|
|
||||||
TorchLight = mix(TorchLight,LpvTorchLight/5.0, LpvFadeF);
|
|
||||||
|
|
||||||
const vec3 normal = vec3(0.0); // TODO
|
|
||||||
|
|
||||||
if (heldItemId > 0)
|
|
||||||
TorchLight += GetHandLight(heldItemId, playerPos, normal);
|
|
||||||
|
|
||||||
if (heldItemId2 > 0)
|
|
||||||
TorchLight += GetHandLight(heldItemId2, playerPos, normal);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return vec4(TorchLight, skyLM);
|
|
||||||
}
|
}
|
@ -291,22 +291,17 @@ vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes, bool hand){
|
|||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplySSRT(
|
vec3 ApplySSRT(
|
||||||
inout vec3 lighting,
|
|
||||||
vec3 viewPos,
|
vec3 viewPos,
|
||||||
vec3 normal,
|
vec3 normal,
|
||||||
vec3 noise,
|
vec3 noise,
|
||||||
|
|
||||||
vec3 playerPos,
|
vec3 indirectLightColor,
|
||||||
vec3 lpvPos,
|
vec3 minLightColor,
|
||||||
float Exposure,
|
float lightmap,
|
||||||
vec2 lightmaps,
|
|
||||||
|
|
||||||
vec3 skylightcolor,
|
|
||||||
vec3 torchcolor,
|
|
||||||
|
|
||||||
bool isGrass,
|
bool isGrass,
|
||||||
bool hand
|
bool isLOD
|
||||||
){
|
){
|
||||||
int nrays = RAY_COUNT;
|
int nrays = RAY_COUNT;
|
||||||
|
|
||||||
@ -318,9 +313,7 @@ void ApplySSRT(
|
|||||||
vec3 occlusion2 = vec3(0.0);
|
vec3 occlusion2 = vec3(0.0);
|
||||||
vec3 skycontribution2 = vec3(0.0);
|
vec3 skycontribution2 = vec3(0.0);
|
||||||
|
|
||||||
// rgb = torch color * lightmap. a = sky lightmap.
|
vec3 ambientColor = doIndirectLighting(indirectLightColor * 2.5, minLightColor, lightmap);
|
||||||
vec4 Lighting = RT_AmbientLight(playerPos, lpvPos, Exposure, lightmaps, torchcolor);
|
|
||||||
skylightcolor = max(skylightcolor * ambient_brightness * Lighting.a, vec3(1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision));
|
|
||||||
|
|
||||||
for (int i = 0; i < nrays; i++){
|
for (int i = 0; i < nrays; i++){
|
||||||
int seed = (frameCounter%40000)*nrays+i;
|
int seed = (frameCounter%40000)*nrays+i;
|
||||||
@ -330,33 +323,32 @@ void ApplySSRT(
|
|||||||
#ifdef HQ_SSGI
|
#ifdef HQ_SSGI
|
||||||
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, noise.z, 50.); // ssr rt
|
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, noise.z, 50.); // ssr rt
|
||||||
#else
|
#else
|
||||||
vec3 rayHit = RT(mat3(gbufferModelView)*rayDir, viewPos, noise.z, 30., hand); // choc sspt
|
vec3 rayHit = RT(mat3(gbufferModelView)*rayDir, viewPos, noise.z, 30., isLOD); // choc sspt
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
if(isGrass) rayDir.y = clamp(rayDir.y + 0.5,-1,1);
|
if(isGrass) rayDir.y = clamp(rayDir.y + 0.5,-1,1);
|
||||||
|
|
||||||
// rayDir.y = mix(-1.0, rayDir.y, lightmaps.y*lightmaps.y);
|
skycontribution = mix(ambientColor, pow(skyCloudsFromTexLOD(rayDir, colortex4, 0).rgb/30, vec3(0.7)), lightmap);
|
||||||
skycontribution = pow(skyCloudsFromTexLOD(rayDir, colortex4, 0).rgb/30, vec3(0.7)) *2.5 * ambient_brightness * Lighting.a + Lighting.rgb;
|
|
||||||
#else
|
#else
|
||||||
skycontribution = (pow(skyCloudsFromTexLOD2(rayDir, colortex4, 6).rgb / 30.0,vec3(0.7))/2.5 * ambient_brightness) * Lighting.a + skylightcolor*(1-Lighting.a) + Lighting.rgb;
|
skycontribution = pow(skyCloudsFromTexLOD2(rayDir, colortex4, 6).rgb / 30.0,vec3(0.7));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
skycontribution = max(skycontribution, vec3(1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision));
|
skycontribution = max(skycontribution, minLightColor * max(MIN_LIGHT_AMOUNT*0.01, nightVision * 0.1));
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
if(isGrass) rayDir.y = clamp(rayDir.y + 0.25,-1,1);
|
if(isGrass) rayDir.y = clamp(rayDir.y + 0.25,-1,1);
|
||||||
|
|
||||||
skycontribution = skylightcolor * (max(rayDir.y,pow(1.0-lightmaps.y,2))*0.95+0.05) + Lighting.rgb;
|
skycontribution = ambientColor * (max(rayDir.y,pow(1.0-lightmap,2))*0.95+0.05);
|
||||||
#else
|
#else
|
||||||
skycontribution = skylightcolor + Lighting.rgb;
|
skycontribution = ambientColor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if indirect_effect == 4
|
#if indirect_effect == 4
|
||||||
skycontribution2 = skylightcolor + Lighting.rgb;
|
skycontribution2 = ambientColor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -370,7 +362,6 @@ void ApplySSRT(
|
|||||||
|
|
||||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){
|
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){
|
||||||
radiance += texture2D(colortex5, previousPosition.xy).rgb * GI_Strength + skycontribution;
|
radiance += texture2D(colortex5, previousPosition.xy).rgb * GI_Strength + skycontribution;
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
radiance += skycontribution;
|
radiance += skycontribution;
|
||||||
}
|
}
|
||||||
@ -389,14 +380,14 @@ void ApplySSRT(
|
|||||||
radiance += skycontribution;
|
radiance += skycontribution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isLOD) return max(radiance/nrays, 0.0);
|
||||||
|
|
||||||
occlusion *= AO_Strength;
|
occlusion *= AO_Strength;
|
||||||
|
|
||||||
#if indirect_effect == 4
|
|
||||||
lighting = max(radiance/nrays - max(occlusion, occlusion2*0.5)/nrays, 0.0);
|
|
||||||
#else
|
|
||||||
lighting = max(radiance/nrays - occlusion/nrays, 0.0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(hand) lighting = skylightcolor/1.5;
|
#if indirect_effect == 4
|
||||||
|
return max(radiance/nrays - max(occlusion, occlusion2*0.5)/nrays, 0.0);
|
||||||
|
#else
|
||||||
|
return max(radiance/nrays - occlusion/nrays, 0.0);
|
||||||
|
#endif
|
||||||
}
|
}
|
@ -112,6 +112,7 @@ vec4 GetVolumetricFog(
|
|||||||
|
|
||||||
vec3 color = vec3(0.0);
|
vec3 color = vec3(0.0);
|
||||||
float absorbance = 1.0;
|
float absorbance = 1.0;
|
||||||
|
float AtmosphereAbsorbance = 1.0;
|
||||||
|
|
||||||
float lightleakfix = 1.0 - caveDetection;
|
float lightleakfix = 1.0 - caveDetection;
|
||||||
float lightleakfix2 = pow(clamp(eyeBrightnessSmooth.y/240. ,0.0,1.0),3.0);
|
float lightleakfix2 = pow(clamp(eyeBrightnessSmooth.y/240. ,0.0,1.0),3.0);
|
||||||
@ -235,19 +236,28 @@ vec4 GetVolumetricFog(
|
|||||||
absorbance *= fogVolumeCoeff;
|
absorbance *= fogVolumeCoeff;
|
||||||
|
|
||||||
//------ ATMOSPHERE HAZE EFFECT
|
//------ ATMOSPHERE HAZE EFFECT
|
||||||
|
#if defined CloudLayer0 && defined VOLUMETRIC_CLOUDS
|
||||||
|
float cloudPlaneCutoff = clamp((CloudLayer0_height + max(eyeAltitude-(CloudLayer0_height-100),0)) - progressW.y,0.0,1.0);
|
||||||
|
#else
|
||||||
|
float cloudPlaneCutoff = 1.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// just air
|
// just air
|
||||||
vec2 airCoef = exp2(-max(progressW.y-SEA_LEVEL,0.0)/vec2(8.0e3, 1.2e3)*vec2(6.,7.0)) * (24.0 * atmosphereMult) * Haze_amount * clamp((CloudLayer0_height + max(eyeAltitude-(CloudLayer0_height-100),0)) - progressW.y,0.0,1.0);
|
vec2 airCoef = exp2(-max(progressW.y-SEA_LEVEL,0.0)/vec2(8.0e3, 1.2e3)*vec2(6.,7.0)) * (24.0 * atmosphereMult) * Haze_amount * cloudPlaneCutoff;
|
||||||
|
|
||||||
// Pbr for air, yolo mix between mie and rayleigh for water droplets
|
// Pbr for air, yolo mix between mie and rayleigh for water droplets
|
||||||
vec3 rL = rC*airCoef.x;
|
vec3 rL = rC*airCoef.x;
|
||||||
vec3 m = mC*(airCoef.y+densityVol*300.0);
|
vec3 m = mC*(airCoef.y+densityVol*300.0);
|
||||||
|
|
||||||
// calculate the atmosphere haze seperately and purely additive to color, do not contribute to absorbtion.
|
// calculate the atmosphere haze seperately and purely additive to color, do not contribute to absorbtion.
|
||||||
vec3 Atmosphere = LightSourcePhased * sh * (rayL*rL + sunPhase*m) + (AveragedAmbientColor*0.7) * (rL+m) * lightleakfix2;
|
vec3 atmosphereVolumeCoeff = exp(-(rL+m)*dd*dL_alternate);
|
||||||
color += (Atmosphere - Atmosphere*exp(-(rL+m)*dd*dL_alternate)) / (rL+m+1e-6) * absorbance;
|
|
||||||
|
vec3 Atmosphere = (LightSourcePhased * sh * (rayL*rL + sunPhase*m) + AveragedAmbientColor * (rL+m)) * lightleakfix2;
|
||||||
|
color += (Atmosphere - Atmosphere * atmosphereVolumeCoeff) / (rL+m+1e-6) * AtmosphereAbsorbance * absorbance;
|
||||||
|
AtmosphereAbsorbance *= dot(atmosphereVolumeCoeff, vec3(0.33333));
|
||||||
|
|
||||||
//------ LPV FOG EFFECT
|
//------ LPV FOG EFFECT
|
||||||
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
||||||
color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * TorchBrightness_autoAdjust * absorbance;
|
color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * TorchBrightness_autoAdjust * absorbance;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
#define SELECT_BOX_COL_G 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
#define SELECT_BOX_COL_G 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||||
#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||||
|
|
||||||
// #define OLD_CAVE_DETECTION
|
#define OLD_CAVE_DETECTION
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// ----- DISTANT HORIZONS SETTINGS ----- //
|
// ----- DISTANT HORIZONS SETTINGS ----- //
|
||||||
|
@ -467,7 +467,7 @@ vec4 renderClouds(
|
|||||||
dV_Sun *= lightCol.a;
|
dV_Sun *= lightCol.a;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float SdotV = dot(mat3(gbufferModelView)*WsunVec, normalize(FragPosition)) ;
|
float SdotV = dot(WsunVec, normalize(mat3(gbufferModelViewInverse)*FragPosition + gbufferModelViewInverse[3].xyz));
|
||||||
|
|
||||||
float mieDay = phaseg(SdotV, 0.85) + phaseg(SdotV, 0.75);
|
float mieDay = phaseg(SdotV, 0.85) + phaseg(SdotV, 0.75);
|
||||||
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
|
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
|
||||||
|
@ -482,9 +482,9 @@ uniform.float.noPuddleAreas = smooth(if(in(biome, 3, 4, 16, 37, 39, 48, 49, 31,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined OLD_CAVE_DETECTION
|
#if defined OLD_CAVE_DETECTION
|
||||||
variable.bool.inTheDarkTimer = smooth(if(eyeBrightness.y < 0.01, 1.0, 0.0), 30.0, 1.0) > 0.99
|
variable.bool.inTheDarkTimer = smooth(if(eyeBrightness.y < 0.01, 1.0, 0.0), 10.0, 0.0) > 0.99
|
||||||
|
|
||||||
uniform.float.caveDetection = smooth(if(inTheDarkTimer, 1.0, 0.0), 10.0, 0.5)
|
uniform.float.caveDetection = smooth(if(inTheDarkTimer, 1.0, 0.0), 3.0, 1.0)
|
||||||
#else
|
#else
|
||||||
# the idea is to modulate the mood value between 0 - 1
|
# the idea is to modulate the mood value between 0 - 1
|
||||||
# then check if the modulated value is non-zero. when it goes back to zero, it will have a very slowly deteriorating value.
|
# then check if the modulated value is non-zero. when it goes back to zero, it will have a very slowly deteriorating value.
|
||||||
|
Loading…
Reference in New Issue
Block a user