fix resourcepack sky support once and for all

This commit is contained in:
Xonk
2026-02-13 19:52:15 -05:00
parent 42f210516c
commit 95288f21bd
3 changed files with 15 additions and 11 deletions
+13 -8
View File
@@ -3,7 +3,7 @@
#include "/lib/macro_lod_mod.glsl"
uniform sampler2D colortex1;
uniform sampler2D colortex2;
uniform sampler2D colortex9;
uniform sampler2D depthtex0;
uniform vec2 texelSize;
@@ -22,16 +22,21 @@ float interleaved_gradientNoise(){
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
#if RESOURCEPACK_SKY != 0
/* RENDERTARGETS:1,2 */
#endif
//the idea is write from gbuffers -> buffer blend -> in deferred2 write blended contents to sky area -> clear previous buffer written to from gbuffers
#if RESOURCEPACK_SKY != 0
/* RENDERTARGETS:1,9 */
#endif
void main() {
vec2 texcoord = gl_FragCoord.xy * texelSize;
// re-write contents back to the buffer so as to not lose anything
gl_FragData[0] = texelFetch(colortex1, ivec2(gl_FragCoord.xy), 0);
// deferred data does not exist where depth >= 1.0 (sky/infinite distance)
// free space for high precision color
if(
texelFetch(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0
@@ -43,14 +48,14 @@ void main() {
// doing this for precision reasons, DH does NOT like depth => 1.0
}else{
vec3 skyColor = texelFetch(colortex2, ivec2(gl_FragCoord.xy),0).rgb;
vec3 skyColor = texelFetch(colortex9, ivec2(gl_FragCoord.xy),0).rgb;
skyColor.rgb = max(skyColor.rgb - skyColor.rgb * interleaved_gradientNoise()*0.05, 0.0);
gl_FragData[0].rgb = skyColor/50.0;
gl_FragData[0].a = 0.0;
gl_FragData[0].a = 1.0;
}
gl_FragData[1] = vec4(0,0,0,0);
// clear colortex9 for gbuffers_weather to use
gl_FragData[1] = vec4(0.0,0.0,0.0,0.0);
}
+1 -1
View File
@@ -7,7 +7,7 @@ const int colortex4Format = RGBA16F; // LUT - light values and skyboxes (ever
const int colortex6Format = R11F_G11F_B10F; // additional buffer for bloom (composite3->final)
const int colortex7Format = RGBA8; // Final output, transparencies id (gbuffer->composite4)
const int colortex8Format = RGBA16; // ENCODE Specular + geonormal + vanilla AO
const int colortex9Format = RGBA8; // rain in alpha
const int colortex9Format = RGBA16F; // rain in alpha
const int colortex10Format = RGBA16F; // resourcepack Skies
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEPTHs
+1 -2
View File
@@ -28,7 +28,7 @@
void main() {
#if RESOURCEPACK_SKY != 0
/* RENDERTARGETS:2 */
/* RENDERTARGETS:9 */
vec4 COLOR = texture(texture, texcoord.xy) * color;
@@ -44,7 +44,6 @@ void main() {
if(isSkyBox) { discard; return; }
#endif
vec3 NEWCOLOR = COLOR.rgb;
if(isSun) NEWCOLOR.rgb = COLOR.rgb * 10.0;