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

@ -186,8 +186,8 @@ void main() {
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 = gl_Color;
@ -240,6 +240,7 @@ void main() {
NameTags = 0;
#ifdef ENTITIES
// disallow POM to work on item frames.
if(entityId == 2300) SIGN = 1;

View File

@ -15,6 +15,11 @@ varying vec4 color;
flat varying vec4 lightCol;
#endif
#ifdef ENTITIES
#undef WATER_BACKGROUND_SPECULAR
#undef SCREENSPACE_REFLECTIONS
#endif
flat varying float HELD_ITEM_BRIGHTNESS;
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;
vec3 Albedo = toLinear(gl_FragData[0].rgb);
float UnchangedAlpha = gl_FragData[0].a;
@ -571,15 +578,22 @@ 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);
#ifdef ENTITIES
Reflections_Final = FinalColor;
#else
Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a);
Reflections_Final = mix(FinalColor, Reflections_Final, fresnel);
#endif
Reflections_Final += SunReflection;
gl_FragData[0].rgb = Reflections_Final;
#ifndef ENTITIES
//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.);

View File

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

View File

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

View File

@ -20,9 +20,9 @@ uniform float sunElevation;
uniform int frameCounter;
uniform float frameTimeCounter;
varying vec2 texcoord;
// varying vec2 texcoord;
uniform vec2 texelSize;
flat varying vec2 TAA_Offset;
// flat varying vec2 TAA_Offset;
uniform int isEyeInWater;
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 ) ));
gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.);
#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);
gl_FragData[0].a = 1;
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;
}
void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths){
void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths, bool isEntity){
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;
@ -222,7 +223,7 @@ void main() {
vec4 albedo = vec4(unpack0.ba,unpack1.rg);
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);
////// --------------- UNPACK MISC --------------- //////
@ -230,6 +231,7 @@ void main() {
////// --------------- MASKS/BOOLEANS --------------- //////
bool iswater = trpData > 0.99;
bool isTranslucentEntity = abs(trpData-0.1) < 0.01;
float translucentAlpha = trpData;
////// --------------- get volumetrics
@ -239,7 +241,7 @@ void main() {
////// --------------- distort texcoords as a refraction effect
vec2 refractedCoord = texcoord;
#ifdef Refraction
ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z));
ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z), isTranslucentEntity);
#endif
////// --------------- 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[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 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;
DailyWeather_Alto(Coverage, Density);
shape = pow(max(shape + Coverage - 0.5,0.0),2.0);
shape *= Density;
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;
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;
}
@ -295,13 +304,14 @@ if(layer == 2){
float altostratus = GetAltostratusDensity(rayProgress);
if(altostratus > 1e-5){
float muE = altostratus;
float muE = altostratus * cloudDensity;
float directLight = 0.0;
for (int j = 0; j < 2; j++){
vec3 shadowSamplePos_high = rayProgress + dV_Sun * (0.1 + j + dither);
float shadow = GetAltostratusDensity(shadowSamplePos_high);
directLight += shadow; /// (1+j);
vec3 shadowSamplePos_high = rayProgress + dV_Sun * (0.1 + j * (0.5 + dither*0.05)) ;
// vec3 shadowSamplePos_high = rayProgress + dV_Sun * (j * (0.5 + dither*0.05)) ;
float shadow = GetAltostratusDensity(shadowSamplePos_high) * cloudDensity;
directLight += shadow;
}
float skyscatter_alto = sqrt(altostratus*0.05);
@ -343,7 +353,7 @@ if(layer == 2){
#ifdef CloudLayer2
// 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);
float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) ;
float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) * CloudLayer2_density;
directLight += HighAlt_shadow;
#endif
@ -573,8 +583,8 @@ float GetCloudShadow(vec3 feetPlayerPos){
shadow += GetCumulusDensity(1, higherShadowStart, 0, CloudLayer1_height, CloudLayer1_height+100)*CloudLayer1_density;
#endif
#ifdef CloudLayer2
vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer1_height - playerPos.y,0.0);
shadow += GetAltostratusDensity(highShadowStart) * 0.5;
vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer2_height - playerPos.y,0.0);
shadow += GetAltostratusDensity(highShadowStart) * CloudLayer2_density;
#endif
shadow = clamp(shadow,0.0,1.0);
@ -604,7 +614,7 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
#endif
#ifdef CloudLayer2
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
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
#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_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_entities = off
blend.gbuffers_beaconbeam = off
blend.gbuffers_water.colortex11 = 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"