mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Cylindrical fog
- having the world position is very nice - mojang manages to do multiple matrix multiplications
This commit is contained in:
parent
135f0d8e3c
commit
47f8d3f1b5
1 changed files with 1 additions and 5 deletions
|
@ -30,9 +30,7 @@ void FLWFinalizeWorldPos(inout vec4 worldPos) {
|
||||||
|
|
||||||
BoxCoord = (worldPos.xyz - uLightBoxMin) / uLightBoxSize;
|
BoxCoord = (worldPos.xyz - uLightBoxMin) / uLightBoxSize;
|
||||||
|
|
||||||
#if defined(USE_FOG)
|
FragDistance = max(length(worldPos.xz), abs(worldPos.y)); // cylindrical fog
|
||||||
FragDistance = length(worldPos.xyz);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gl_Position = uViewProjection * worldPos;
|
gl_Position = uViewProjection * worldPos;
|
||||||
}
|
}
|
||||||
|
@ -57,13 +55,11 @@ vec4 FLWBlockTexture(vec2 texCoords) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FLWFinalizeColor(vec4 color) {
|
void FLWFinalizeColor(vec4 color) {
|
||||||
#if defined(USE_FOG)
|
|
||||||
float a = color.a;
|
float a = color.a;
|
||||||
float fog = clamp(FLWFogFactor(), 0., 1.);
|
float fog = clamp(FLWFogFactor(), 0., 1.);
|
||||||
|
|
||||||
color = mix(uFogColor, color, fog);
|
color = mix(uFogColor, color, fog);
|
||||||
color.a = a;
|
color.a = a;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ALPHA_DISCARD)
|
#if defined(ALPHA_DISCARD)
|
||||||
if (color.a < ALPHA_DISCARD) {
|
if (color.a < ALPHA_DISCARD) {
|
||||||
|
|
Loading…
Reference in a new issue