add iris's TRANSLUCENT ENTITIES programs. potentially fix error in end/nether on intel ARC

This commit is contained in:
Xonk 2024-01-11 21:38:03 -05:00
parent 544af24f10
commit 57ffa75366
15 changed files with 104 additions and 34 deletions

View File

@ -397,7 +397,7 @@ void main() {
//////////////////////////////// //////////////////////////////// //////////////////////////////// ////////////////////////////////
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM) * color; vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM) * color;
#if defined HAND #if defined HAND
if (Albedo.a < 0.1) discard; if (Albedo.a < 0.1) discard;
#endif #endif

View File

@ -186,9 +186,9 @@ void main() {
gl_Position = ftransform(); gl_Position = ftransform();
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
/////// ----- COLOR STUFF ----- /////// /////// ----- COLOR STUFF ----- ///////
color = gl_Color; color = gl_Color;
@ -239,6 +239,7 @@ void main() {
#endif #endif
NameTags = 0; NameTags = 0;
#ifdef ENTITIES #ifdef ENTITIES
// disallow POM to work on item frames. // disallow POM to work on item frames.

View File

@ -15,6 +15,11 @@ varying vec4 color;
flat varying vec4 lightCol; flat varying vec4 lightCol;
#endif #endif
#ifdef ENTITIES
#undef WATER_BACKGROUND_SPECULAR
#undef SCREENSPACE_REFLECTIONS
#endif
flat varying float HELD_ITEM_BRIGHTNESS; flat varying float HELD_ITEM_BRIGHTNESS;
const bool colortex4MipmapEnabled = true; const bool colortex4MipmapEnabled = true;
@ -293,6 +298,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
//////////////////////////////// ////////////////////////////////
gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color; gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color;
vec3 Albedo = toLinear(gl_FragData[0].rgb); vec3 Albedo = toLinear(gl_FragData[0].rgb);
float UnchangedAlpha = gl_FragData[0].a; float UnchangedAlpha = gl_FragData[0].a;
@ -549,7 +556,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(isEyeInWater == 1) SkyReflection = vec3(0.0); if(isEyeInWater == 1) SkyReflection = vec3(0.0);
#endif #endif
#else #else
#ifdef WATER_BACKGROUND_SPECULAR #ifdef WATER_BACKGROUND_SPECULAR
SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0; SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0;
if(isEyeInWater == 1) SkyReflection = vec3(0.0); if(isEyeInWater == 1) SkyReflection = vec3(0.0);
#endif #endif
@ -571,16 +578,23 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0) * -4),0,1); float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0) * -4),0,1);
Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a); #ifdef ENTITIES
Reflections_Final = mix(FinalColor, Reflections_Final, fresnel); Reflections_Final = FinalColor;
#else
Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a);
Reflections_Final = mix(FinalColor, Reflections_Final, fresnel);
#endif
Reflections_Final += SunReflection; Reflections_Final += SunReflection;
gl_FragData[0].rgb = Reflections_Final; gl_FragData[0].rgb = Reflections_Final;
//correct alpha channel with fresnel #ifndef ENTITIES
gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel); //correct alpha channel with fresnel
gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel);
#endif
if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.); if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.);
} else { } else {

View File

@ -105,7 +105,7 @@ void main() {
if (mc_Entity.x == 72) mat = 0.5; if (mc_Entity.x == 72) mat = 0.5;
#ifdef ENTITIES #ifdef ENTITIES
mat = 0.2; mat = 0.1;
#endif #endif

View File

@ -1059,7 +1059,5 @@ void main() {
} }
#endif #endif
// gl_FragData[0].rgb = skyCloudsFromTexLOD2(feetPlayerPos_normalized, colortex12, 6).rgb/30;
/* DRAWBUFFERS:3 */ /* DRAWBUFFERS:3 */
} }

View File

@ -20,9 +20,9 @@ uniform float sunElevation;
uniform int frameCounter; uniform int frameCounter;
uniform float frameTimeCounter; uniform float frameTimeCounter;
varying vec2 texcoord; // varying vec2 texcoord;
uniform vec2 texelSize; uniform vec2 texelSize;
flat varying vec2 TAA_Offset; // flat varying vec2 TAA_Offset;
uniform int isEyeInWater; uniform int isEyeInWater;
uniform float rainStrength; uniform float rainStrength;
@ -284,7 +284,7 @@ void main() {
waterVolumetrics(vl, vec3(0.0), viewPos, estEyeDepth, estEyeDepth, length(viewPos), noise_1, totEpsilon, scatterCoef, ambientColVol, lightColVol*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)) , dot(normalize(viewPos), normalize(sunVec* lightCol.a ) )); waterVolumetrics(vl, vec3(0.0), viewPos, estEyeDepth, estEyeDepth, length(viewPos), noise_1, totEpsilon, scatterCoef, ambientColVol, lightColVol*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)) , dot(normalize(viewPos), normalize(sunVec* lightCol.a ) ));
gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.); gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.);
#else #else
vec3 fragpos0 = toScreenSpace(vec3(texcoord - TAA_Offset*texelSize*0.5,z)); vec3 fragpos0 = toScreenSpace(vec3(tc,z));
vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.6, vec3(0.2,0.4,1.0) * MIN_LIGHT_AMOUNT*0.01); vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.6, vec3(0.2,0.4,1.0) * MIN_LIGHT_AMOUNT*0.01);
gl_FragData[0].a = 1; gl_FragData[0].a = 1;
waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol); waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol);

View File

@ -179,12 +179,13 @@ void applyContrast(inout vec3 color, float contrast){
color = ((color - 0.5) * max(contrast, 0.0)) + 0.5; color = ((color - 0.5) * max(contrast, 0.0)) + 0.5;
} }
void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths){ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths, bool isEntity){
vec2 UnalteredTexcoord = Texcoord; vec2 UnalteredTexcoord = Texcoord;
float refractionStrength = isEntity ? 0.5 : 1.0;
Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE ); Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength );
float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g; float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g;
@ -222,7 +223,7 @@ void main() {
vec4 albedo = vec4(unpack0.ba,unpack1.rg); vec4 albedo = vec4(unpack0.ba,unpack1.rg);
vec2 tangentNormals = unpack0.xy*2.0-1.0; vec2 tangentNormals = unpack0.xy*2.0-1.0;
if(albedo.a <= 0.0) tangentNormals = vec2(0.0); if(albedo.a < 0.01) tangentNormals = vec2(0.0);
vec4 TranslucentShader = texture2D(colortex2, texcoord); vec4 TranslucentShader = texture2D(colortex2, texcoord);
////// --------------- UNPACK MISC --------------- ////// ////// --------------- UNPACK MISC --------------- //////
@ -230,6 +231,7 @@ void main() {
////// --------------- MASKS/BOOLEANS --------------- ////// ////// --------------- MASKS/BOOLEANS --------------- //////
bool iswater = trpData > 0.99; bool iswater = trpData > 0.99;
bool isTranslucentEntity = abs(trpData-0.1) < 0.01;
float translucentAlpha = trpData; float translucentAlpha = trpData;
////// --------------- get volumetrics ////// --------------- get volumetrics
@ -239,7 +241,7 @@ void main() {
////// --------------- distort texcoords as a refraction effect ////// --------------- distort texcoords as a refraction effect
vec2 refractedCoord = texcoord; vec2 refractedCoord = texcoord;
#ifdef Refraction #ifdef Refraction
ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z)); ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z), isTranslucentEntity);
#endif #endif
////// --------------- MAIN COLOR BUFFER ////// --------------- MAIN COLOR BUFFER
@ -367,4 +369,8 @@ void main() {
gl_FragData[0].r = vl.a * bloomyFogMult; // pass fog alpha so bloom can do bloomy fog gl_FragData[0].r = vl.a * bloomyFogMult; // pass fog alpha so bloom can do bloomy fog
gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0); gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0);
// if(isTranslucentEntity) gl_FragData[1].rgb = vec3(255);
// gl_FragData[1].rgb = clamp(vec3(tangentNormals.xy,0), 0.0,68000.0);
} }

View File

@ -184,16 +184,25 @@ float GetCumulusDensity(int layer, in vec3 pos, in int LoD, float minHeight, flo
float GetAltostratusDensity(vec3 pos){ float GetAltostratusDensity(vec3 pos){
float large = texture2D(noisetex, (pos.xz + cloud_movement)/100000. ).b;
float small = texture2D(noisetex, (pos.xz - cloud_movement)/10000. - vec2(-large,1-large)/5).b;
float shape = (small + pow((1.0-large),2.0))/2.0;
float Coverage; float Density; float Coverage; float Density;
DailyWeather_Alto(Coverage, Density); DailyWeather_Alto(Coverage, Density);
shape = pow(max(shape + Coverage - 0.5,0.0),2.0); float large = texture2D(noisetex, (pos.xz + cloud_movement)/100000. ).b;
shape *= Density; float small = texture2D(noisetex, (pos.xz - cloud_movement)/10000. - vec2(-large,1-large)/5).b;
large = max(large + Coverage - 0.5, 0.0);
// float shape = (small + pow((1.0-large),2.0))/2.0;
float weight = 0.7;
float shape = max( large*weight - small*(1.0-weight) ,0.0);
shape *= shape;
// infinite vertical height will mess with lighting, so get rid of it.
// shape = max(shape - pow(abs(LAYER2_HEIGHT - pos.y)/20,1.5), 0.0);
shape = min(min(shape , clamp((LAYER2_HEIGHT + 15) - pos.y,0,1)), 1.0 - clamp(LAYER2_HEIGHT - pos.y,0,1));
// shape *= Density;
return shape; return shape;
} }
@ -295,13 +304,14 @@ if(layer == 2){
float altostratus = GetAltostratusDensity(rayProgress); float altostratus = GetAltostratusDensity(rayProgress);
if(altostratus > 1e-5){ if(altostratus > 1e-5){
float muE = altostratus; float muE = altostratus * cloudDensity;
float directLight = 0.0; float directLight = 0.0;
for (int j = 0; j < 2; j++){ for (int j = 0; j < 2; j++){
vec3 shadowSamplePos_high = rayProgress + dV_Sun * (0.1 + j + dither); vec3 shadowSamplePos_high = rayProgress + dV_Sun * (0.1 + j * (0.5 + dither*0.05)) ;
float shadow = GetAltostratusDensity(shadowSamplePos_high); // vec3 shadowSamplePos_high = rayProgress + dV_Sun * (j * (0.5 + dither*0.05)) ;
directLight += shadow; /// (1+j); float shadow = GetAltostratusDensity(shadowSamplePos_high) * cloudDensity;
directLight += shadow;
} }
float skyscatter_alto = sqrt(altostratus*0.05); float skyscatter_alto = sqrt(altostratus*0.05);
@ -343,7 +353,7 @@ if(layer == 2){
#ifdef CloudLayer2 #ifdef CloudLayer2
// cast a shadow from higher clouds onto lower clouds // cast a shadow from higher clouds onto lower clouds
vec3 HighAlt_shadowPos = rayProgress + dV_Sun/abs(dV_Sun.y) * max(LAYER2_HEIGHT - rayProgress.y,0.0); vec3 HighAlt_shadowPos = rayProgress + dV_Sun/abs(dV_Sun.y) * max(LAYER2_HEIGHT - rayProgress.y,0.0);
float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) ; float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) * CloudLayer2_density;
directLight += HighAlt_shadow; directLight += HighAlt_shadow;
#endif #endif
@ -573,8 +583,8 @@ float GetCloudShadow(vec3 feetPlayerPos){
shadow += GetCumulusDensity(1, higherShadowStart, 0, CloudLayer1_height, CloudLayer1_height+100)*CloudLayer1_density; shadow += GetCumulusDensity(1, higherShadowStart, 0, CloudLayer1_height, CloudLayer1_height+100)*CloudLayer1_density;
#endif #endif
#ifdef CloudLayer2 #ifdef CloudLayer2
vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer1_height - playerPos.y,0.0); vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer2_height - playerPos.y,0.0);
shadow += GetAltostratusDensity(highShadowStart) * 0.5; shadow += GetAltostratusDensity(highShadowStart) * CloudLayer2_density;
#endif #endif
shadow = clamp(shadow,0.0,1.0); shadow = clamp(shadow,0.0,1.0);
@ -604,7 +614,7 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
#endif #endif
#ifdef CloudLayer2 #ifdef CloudLayer2
vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(CloudLayer2_height - WorldPos.y,0.0); vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(CloudLayer2_height - WorldPos.y,0.0);
shadow += GetAltostratusDensity(highShadowStart)*0.5; shadow += GetAltostratusDensity(highShadowStart)*CloudLayer2_density;
#endif #endif
shadow = clamp(shadow,0.0,1.0); shadow = clamp(shadow,0.0,1.0);

View File

@ -33,6 +33,12 @@ program.composite4.enabled = TAA_UPSCALING
# SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE # SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
#Get the correct alpha value : S_A*(1-DST_A)+DST_A #Get the correct alpha value : S_A*(1-DST_A)+DST_A
program.gbuffers_entities_translucent.enabled = IS_IRIS
#ifdef IS_IRIS
separateEntityDraws=true
blend.gbuffers_entities_translucent = off
#endif
blend.gbuffers_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_hand_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_hand_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
@ -50,7 +56,6 @@ blend.gbuffers_hand = off
blend.gbuffers_block = off blend.gbuffers_block = off
blend.gbuffers_entities = off blend.gbuffers_entities = off
blend.gbuffers_beaconbeam = off blend.gbuffers_beaconbeam = off
blend.gbuffers_water.colortex11 = off blend.gbuffers_water.colortex11 = off
blend.composite.colortex12 = off blend.composite.colortex12 = off

View File

@ -0,0 +1,6 @@
#version 120
#define ENTITIES
#define OVERWORLD_SHADER
#include "/dimensions/all_translucent.fsh"

View File

@ -0,0 +1,6 @@
#version 120
#define ENTITIES
#define OVERWORLD_SHADER
#include "/dimensions/all_translucent.vsh"

View File

@ -0,0 +1,6 @@
#version 120
#define ENTITIES
#define OVERWORLD_SHADER
#include "/dimensions/all_translucent.fsh"

View File

@ -0,0 +1,6 @@
#version 120
#define ENTITIES
#define OVERWORLD_SHADER
#include "/dimensions/all_translucent.vsh"

View File

@ -0,0 +1,6 @@
#version 120
#define ENTITIES
#define OVERWORLD_SHADER
#include "/dimensions/all_translucent.fsh"

View File

@ -0,0 +1,6 @@
#version 120
#define ENTITIES
#define OVERWORLD_SHADER
#include "/dimensions/all_translucent.vsh"