mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-22 09:38:52 +08:00
fix cloud horizon line when sky ground is off
This commit is contained in:
parent
dd35c0cb9d
commit
0ccec1e817
@ -28,6 +28,7 @@ uniform vec3 sunVec;
|
||||
uniform float sunElevation;
|
||||
|
||||
// uniform float far;
|
||||
uniform float near;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
@ -126,7 +127,9 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
float invLinZ (float lindepth){
|
||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||
}
|
||||
#ifdef OVERWORLD_SHADER
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
|
@ -84,6 +84,7 @@ vec3 toScreenSpace(vec3 p) {
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
uniform float near;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
|
||||
@ -117,6 +118,9 @@ float DH_inv_ld (float lindepth){
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
float invLinZ (float lindepth){
|
||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||
}
|
||||
#ifdef OVERWORLD_SHADER
|
||||
|
||||
// uniform sampler2D colortex12;
|
||||
|
@ -35,6 +35,7 @@ uniform float sunElevation;
|
||||
// uniform float far;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
uniform float near;
|
||||
|
||||
uniform int frameCounter;
|
||||
uniform float frameTimeCounter;
|
||||
@ -64,7 +65,7 @@ uniform float caveDetection;
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
float DH_ld(float dist) {
|
||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
return (2.0 * near) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||
}
|
||||
float DH_inv_ld (float lindepth){
|
||||
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define SHADER_VERSION_LABEL 473 // [473]
|
||||
#define SHADER_VERSION_LABEL 474 // [474]
|
||||
|
||||
#define saturate(x) clamp(x,0.0,1.0)
|
||||
|
||||
|
@ -282,7 +282,6 @@ vec4 renderLayer(
|
||||
){
|
||||
vec3 COLOR = vec3(0.0);
|
||||
float TOTAL_EXTINCTION = 1.0;
|
||||
|
||||
bool IntersecTerrain = false;
|
||||
|
||||
#ifdef CLOUDS_INTERSECT_TERRAIN
|
||||
@ -384,16 +383,16 @@ if(layer == 2){
|
||||
|
||||
COLOR += max(lighting - lighting*exp(-mult*muE),0.0) * TOTAL_EXTINCTION;
|
||||
TOTAL_EXTINCTION *= max(exp(-mult*muE),0.0);
|
||||
|
||||
|
||||
if (TOTAL_EXTINCTION < 1e-5) break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rayProgress += dV_view;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return vec4(COLOR, TOTAL_EXTINCTION);
|
||||
}
|
||||
}
|
||||
@ -414,6 +413,9 @@ vec3 layerStartingPosition(
|
||||
|
||||
return position;
|
||||
}
|
||||
float invLinZ_cloud (float lindepth){
|
||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||
}
|
||||
vec4 renderClouds(
|
||||
vec3 FragPosition,
|
||||
vec2 Dither,
|
||||
@ -549,7 +551,7 @@ vec4 renderClouds(
|
||||
total_extinction *= layer1.a;
|
||||
|
||||
// stop overdraw.
|
||||
altoNotVisible = (layer1.a < 1e-5 || notVisible)&& below_Layer1;
|
||||
altoNotVisible = (layer1.a < 1e-5 || notVisible) && below_Layer1;
|
||||
#endif
|
||||
|
||||
#ifdef CloudLayer2
|
||||
@ -593,10 +595,9 @@ vec4 renderClouds(
|
||||
#endif
|
||||
|
||||
#ifndef SKY_GROUND
|
||||
vec3 normView = normalize(dV_viewTEST);
|
||||
vec4 fogcolor = vec4(skyFromTex(normView, colortex4)/30.0, 0.0);
|
||||
|
||||
return mix(fogcolor, vec4(color, total_extinction), clamp(distantfog2,0.0,1.0));
|
||||
// return mix(fogcolor, vec4(color, total_extinction), clamp(distantfog2,0.0,1.0));
|
||||
return mix(vec4(vec3(0.0),1.0), vec4(color, total_extinction), clamp(distantfog2,0.0,1.0));
|
||||
#else
|
||||
return vec4(color, total_extinction);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user