few more tweaks/improvements to resourcepack skybox support

This commit is contained in:
Xonk
2025-03-22 00:07:30 -04:00
parent f453b02fbc
commit 04f9d47b25
4 changed files with 43 additions and 18 deletions

View File

@ -1334,7 +1334,7 @@ void main() {
Background += Sky;
#if RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 2 || RESOURCEPACK_SKY == 3
vec3 resourcePackskyBox = skyboxCol * clamp(unsigned_WsunVec.y*255.0,0.01,1.0);
vec3 resourcePackskyBox = skyboxCol * 50.0 * clamp(unsigned_WsunVec.y*255.0,0.1,1.0);
#ifdef SKY_GROUND
resourcePackskyBox *= atmosphereGround;

View File

@ -6,15 +6,22 @@ uniform sampler2D colortex1;
uniform sampler2D colortex2;
uniform vec2 texelSize;
float interleaved_gradientNoise(){
// vec2 coord = gl_FragCoord.xy + (frameCounter%40000);
vec2 coord = gl_FragCoord.xy ;
// vec2 coord = gl_FragCoord.xy;
float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715)) );
return noise ;
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
#if defined OVERWORLD_SHADER
/* RENDERTARGETS:1,2 */
#endif
void main() {
@ -22,11 +29,21 @@ void main() {
gl_FragData[0] = texelFetch2D(colortex1, ivec2(gl_FragCoord.xy),0);
if(texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0 || texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy), 0).x < 1.0) {
if(
texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0
#ifdef DISTANT_HORIZONS
|| texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy), 0).x < 1.0
#endif
) {
// doing this for precision reasons, DH does NOT like depth => 1.0
}else{
gl_FragData[0].rgb = texelFetch2D(colortex2, ivec2(gl_FragCoord.xy),0).rgb * 10.0;
vec3 skyColor = texelFetch2D(colortex2, 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;
}

View File

@ -96,7 +96,7 @@ blend.gbuffers_block_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_A
blend.gbuffers_beaconbeam = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_entities_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_spidereyes = ONE ONE ONE ONE
blend.gbuffers_skytextured = ONE ONE ONE ONE
blend.gbuffers_skytextured = SRC_ALPHA ONE ONE ONE
blend.shadow = ONE ZERO ONE ZERO
# Disable blending

View File

@ -30,24 +30,32 @@ void main() {
#if RESOURCEPACK_SKY != 0
/* RENDERTARGETS:2 */
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
vec4 COLOR = texture2D(texture, texcoord.xy);
COLOR.rgb = toLinear(COLOR.rgb);
COLOR *= color;
vec4 COLOR = texture2D(texture, texcoord.xy) * color;
#if RESOURCEPACK_SKY == 3
if(renderStage == 1 || renderStage == 3) { discard; return; }
#endif
bool isSun = renderStage == MC_RENDER_STAGE_SUN || renderStage == 4;
bool isMoon = renderStage == MC_RENDER_STAGE_MOON || renderStage == 5;
bool isSkyBox = (renderStage == MC_RENDER_STAGE_SKY || renderStage == MC_RENDER_STAGE_CUSTOM_SKY) || (renderStage == 1 || renderStage == 3);
#if RESOURCEPACK_SKY == 1
if(renderStage == 4 || renderStage == 5) { discard; return; }
#else
if(renderStage == 4 || renderStage == MC_RENDER_STAGE_SUN) COLOR.rgb *= 5.0;
if(isMoon || isSun) { discard; return; }
#endif
COLOR.rgb = max(COLOR.rgb - COLOR.rgb * interleaved_gradientNoise()*0.05, 0.0);
#if RESOURCEPACK_SKY == 3
if(isSkyBox) { discard; return; }
#endif
gl_FragData[0] = vec4(COLOR.rgb*0.1, COLOR.a);
vec3 NEWCOLOR = COLOR.rgb;
if(isSun) NEWCOLOR.rgb = COLOR.rgb * 10.0;
if(isMoon) NEWCOLOR.rgb = COLOR.rgb * 10.0;
if(isSkyBox) NEWCOLOR.rgb = COLOR.rgb * 2.0;
NEWCOLOR.rgb = toLinear(NEWCOLOR.rgb);
NEWCOLOR.rgb = max(NEWCOLOR.rgb - NEWCOLOR.rgb * interleaved_gradientNoise()*0.05, 0.0);
gl_FragData[0] = vec4(NEWCOLOR.rgb*0.1, COLOR.a);
#else
discard;
#endif