tweak indirect SSS to be a little bright like it used to be. Tweak sampling for shadow filtering, ssao, rtao, ssgi, and specular reflections.

This commit is contained in:
Xonk 2023-10-14 23:34:52 -04:00
parent 87d25d0637
commit d9d3cd0c2d
24 changed files with 238 additions and 271 deletions

View File

@ -47,5 +47,9 @@
block.8 = minecraft:water minecraft:flowing_water
# workaorund mixed render stages
block.3000 = minecraft:redstone_wire
layer.translucent = minecraft:glass_pane minecraft:glass
# layer.cutout = minecraft:tripwire minecraft:slime_block minecraft:nether_portal minecraft:honey_block minecraft:ice minecraft:black_stained_glass minecraft:black_stained_glass_pane minecraft:blue_stained_glass minecraft:blue_stained_glass_pane minecraft:brown_stained_glass minecraft:brown_stained_glass_pane minecraft:cyan_stained_glass minecraft:cyan_stained_glass_pane minecraft:gray_stained_glass minecraft:gray_stained_glass_pane minecraft:green_stained_glass minecraft:green_stained_glass_pane minecraft:light_blue_stained_glass minecraft:light_blue_stained_glass_pane minecraft:light_gray_stained_glass minecraft:light_gray_stained_glass_pane minecraft:lime_stained_glass minecraft:lime_stained_glass_pane minecraft:magenta_stained_glass minecraft:magenta_stained_glass_pane minecraft:orange_stained_glass minecraft:orange_stained_glass_pane minecraft:pink_stained_glass minecraft:pink_stained_glass_pane minecraft:purple_stained_glass minecraft:purple_stained_glass_pane minecraft:red_stained_glass minecraft:red_stained_glass_pane minecraft:white_stained_glass minecraft:white_stained_glass_pane minecraft:yellow_stained_glass minecraft:yellow_stained_glass_pane minecraft:glass_pane minecraft:glass

View File

@ -1,6 +1,5 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
#include "/lib/Shadow_Params.glsl"
varying vec4 lmtexcoord;
varying vec4 color;
@ -28,6 +27,7 @@ uniform mat4 shadowProjection;
uniform vec3 cameraPosition;
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
uniform vec2 texelSize;

View File

@ -213,28 +213,7 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
vec3 srgbToLinear2(vec3 srgb){
return mix(
srgb / 12.92,
pow(.947867 * srgb + .0521327, vec3(2.4) ),
step( .04045, srgb )
);
}
vec3 blackbody2(float Temp)
{
float t = pow(Temp, -1.5);
float lt = log(Temp);
vec3 col = vec3(0.0);
col.x = 220000.0 * t + 0.58039215686;
col.y = 0.39231372549 * lt - 2.44549019608;
col.y = Temp > 6500. ? 138039.215686 * t + 0.72156862745 : col.y;
col.z = 0.76078431372 * lt - 5.68078431373;
col = clamp(col,0.0,1.0);
col = Temp < 1000. ? col * Temp * 0.001 : col;
return srgbToLinear2(col);
}
uniform float near;

View File

@ -381,6 +381,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz;
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;

View File

@ -1,6 +1,8 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
#include "/lib/bokeh.glsl"
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
/*

View File

@ -104,23 +104,6 @@ vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n);
}
vec2 tapLocation_alternate(
int sampleNumber,
float spinAngle,
int nb,
float nbRot,
float r0
){
float alpha = (float(sampleNumber*1.0f + r0) * (1.0 / (nb)));
float angle = alpha * (nbRot * 3.14) ;
float ssR = alpha + spinAngle*3.14;
float sin_v, cos_v;
sin_v = sin(angle);
cos_v = cos(angle);
return vec2(cos_v, sin_v)*ssR;
}
vec3 viewToWorld(vec3 viewPos) {
vec4 pos;
pos.xyz = viewPos;
@ -129,28 +112,6 @@ vec3 viewToWorld(vec3 viewPos) {
return pos.xyz;
}
// Emin's and Gri's combined ideas to stop peter panning and light leaking, also has little shadowacne so thats nice
// https://www.complementary.dev/reimagined
// https://github.com/gri573
void GriAndEminShadowFix(
inout vec3 WorldPos,
vec3 FlatNormal,
float VanillaAO,
float SkyLightmap,
bool Entities
){
float DistanceOffset = clamp(0.1 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ;
vec3 Bias = FlatNormal * DistanceOffset; // adjust the bias thingy's strength as it gets farther away.
// stop lightleaking
if(SkyLightmap < 0.1 && !Entities) {
WorldPos += mix(Bias, 0.5 * (0.5 - fract(WorldPos + cameraPosition + FlatNormal*0.01 ) ), VanillaAO) ;
}else{
WorldPos += Bias;
}
}
#include "/lib/Shadow_Params.glsl"
@ -166,6 +127,20 @@ vec2 tapLocation_simple(
return vec2(cos_v, sin_v) * sqrt(alpha);
}
vec2 SpiralSample(
int samples, int totalSamples, float rotation, float Xi
){
float alpha = float(samples + Xi) * (1.0 / float(totalSamples));
float theta = 3.14159265359 * alpha * rotation ;
float r = sqrt(Xi);
float x = r * sin(theta);
float y = r * cos(theta);
return vec2(x, y);
}
void main() {
/* DRAWBUFFERS:3 */
vec2 texcoord = gl_FragCoord.xy*texelSize;
@ -229,6 +204,8 @@ void main() {
// GriAndEminShadowFix(p3, viewToWorld(FlatNormals), vanillAO, lightmap.y, entities);
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos + Custom_ViewMatrix[3].xyz;
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
@ -251,21 +228,15 @@ void main() {
float diffthreshM = diffthresh*mult*d0*k/20.;
float avgDepth = 0.0;
// int seed = (frameCounter%40000) * 2 + (1+frameCounter);
// float samplePos = fract(R2_samples(seed).x + blueNoise(gl_FragCoord.xy).x) * 1.61803398874;
int seed = (frameCounter%40000) + frameCounter*2;
float samplePos = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
float noise = 0.5+blueNoise();
float noise = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
for(int i = 0; i < VPS_Search_Samples; i++){
// vec2 offsetS = tapLocation_alternate(i+1, i/VPS_Search_Samples, 7, 20, samplePos) * noise;
vec2 offsetS = tapLocation_simple(i, 7, 9, samplePos);
vec2 offsetS = SpiralSample(i, 7, 8, noise);
float weight = 3.0 + (i+blueNoise() ) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
// float d = texelFetch2D( shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;
float d = texelFetch2D( shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;

View File

@ -25,6 +25,7 @@ void main() {
gl_Position = ftransform();
WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
TAA_Offset = offsets[framemod8];

View File

@ -3,7 +3,6 @@
const bool colortex5MipmapEnabled = true;
#ifdef OVERWORLD_SHADER
const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
@ -18,8 +17,8 @@ const bool colortex5MipmapEnabled = true;
#endif
#include "/lib/lightning_stuff.glsl"
#endif
#ifdef NETHER_SHADER
uniform float nightVision;
@ -210,17 +209,20 @@ vec3 BilateralFiltering(sampler2D tex, sampler2D depth,vec2 coord,float frDepth,
return vec3(sampled.x,sampled.yz/sampled.w);
}
float interleaved_gradientNoise(){
// vec2 coord = gl_FragCoord.xy + (frameCounter%40000);
vec2 coord = gl_FragCoord.xy + frameTimeCounter;
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
// vec2 coord = gl_FragCoord.xy + frameTimeCounter;
// vec2 coord = gl_FragCoord.xy;
float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715)) );
return noise ;
}
vec2 R2_dither(){
float R2_dither(){
vec2 alpha = vec2(0.75487765, 0.56984026);
return vec2(fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter), fract((1.0-alpha.x) * gl_FragCoord.x + (1.0-alpha.y) * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter));
return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter) ;
}
// vec2 R2_dither(){
// vec2 alpha = vec2(0.75487765, 0.56984026);
// return vec2(fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter), fract((1.0-alpha.x) * gl_FragCoord.x + (1.0-alpha.y) * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter));
// }
float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * (frameCounter*0.5+0.5) );
}
@ -574,13 +576,17 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
}
vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
vec3 absorbed = max(luma(albedo) - albedo,0.0);
vec3 absorbed = max(1.0 - albedo,0.0);
// vec3 scatter = sqrt(exp(-(absorbed * Scattering * 15))) * (1.0 - Scattering);
vec3 scatter = exp(-5 * Scattering)*vec3(1);
// vec3 scatter = exp(-5 * Scattering)*vec3(1);
vec3 scatter = exp((Scattering*Scattering) * absorbed * -5) * sqrt(1.0 - Scattering);
// scatter *= pow(Density,LabSSS_Curve);
scatter *= clamp(1 - exp(Density * -10),0,1);
return scatter ;
}
// #ifdef IS_IRIS
@ -614,22 +620,20 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
void main() {
vec2 texcoord = gl_FragCoord.xy*texelSize;
////// --------------- SETUP COORDINATE SPACES --------------- //////
////// --------------- SETUP STUFF --------------- //////
vec2 texcoord = gl_FragCoord.xy*texelSize;
float z0 = texture2D(depthtex0,texcoord).x;
float z = texture2D(depthtex1,texcoord).x;
vec2 tempOffset = TAA_Offset;
float noise = blueNoise();
int seed = (frameCounter%40000) + frameCounter*2;
float noise = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
float blueNoise = blueNoise();
vec2 tempOffset = TAA_Offset;
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
vec3 feetPlayerPos_normalized = normVec(feetPlayerPos);
vec3 viewPos_handfix = viewPos;
if ( z < 0.56) viewPos_handfix.z /= MC_HAND_DEPTH; // fix lighting on hand
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
@ -748,7 +752,7 @@ void main() {
Background = Background * Clouds.a + Clouds.rgb;
#endif
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(noise)), 0.0, 65000.);
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(blueNoise)), 0.0, 65000.);
#endif
#if defined NETHER_SHADER || defined END_SHADER
@ -789,6 +793,9 @@ void main() {
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
if(!hand) GriAndEminShadowFix(feetPlayerPos_shadow, viewToWorld(FlatNormals), vanilla_AO, lightmap.y, entities);
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz;
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
@ -797,7 +804,6 @@ void main() {
float distortFactor = calcDistort(projectedShadowPosition.xy);
projectedShadowPosition.xy *= distortFactor;
bool ShadowBounds = false;
if(shadowDistanceRenderMul > 0.0) ShadowBounds = length(feetPlayerPos_shadow) < max(shadowDistance - 20,0.0);
@ -825,8 +831,9 @@ void main() {
#endif
float rdMul = filteredShadow.x*distortFactor*d0*k/shadowMapResolution;
for(int i = 0; i < samples; i++){
// vec2 offsetS = tapLocation(i,samples,1.618, noise,0.0);
// vec2 offsetS = SpiralSample(i, 7, 8, noise)*0.5;
vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5;
float isShadow = shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, smallbias) ).x;
@ -953,6 +960,7 @@ void main() {
Indirect_lighting = DoAmbientLighting(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy, skylight);
#endif
Indirect_lighting += LightningFlashLighting;
#endif
@ -1024,18 +1032,12 @@ void main() {
#endif
#if indirect_effect == 1
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ) ;
// vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
// if(!hand) Indirect_lighting *= ssao(viewPos,noise,FlatNormals) * AO;
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
// if (!hand) ssAO(AO, SkySSS, viewPos, 1.0, blueNoise(gl_FragCoord.xy).rg, FlatNormals , texcoord, ambientCoefs, lightmap.xy, isLeaf);
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf);
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
AO *= exp((1.0-SSAO_SSS.x) * -5.0);
SkySSS = SSAO_SSS.y;
// SampleSSAO(AO, SkySSS, texcoord);
Indirect_lighting *= AO;
#endif
@ -1043,7 +1045,7 @@ void main() {
#if indirect_effect == 2
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
vec2 r2 = fract(R2_samples(frameCounter%40000) + blueNoise(gl_FragCoord.xy).rg);
vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + blueNoise(gl_FragCoord.xy).rg);
if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0);
Indirect_lighting *= AO;
@ -1051,7 +1053,7 @@ void main() {
// RTAO and/or SSGI
#if indirect_effect == 3 || indirect_effect == 4
if (!hand) ApplySSRT(Indirect_lighting, normal, blueNoise(gl_FragCoord.xy).rg, viewPos, lightmap.xy, AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass);
if (!hand) ApplySSRT(Indirect_lighting, normal, blueNoise(gl_FragCoord.xy).xy, viewPos, lightmap.xy, AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass);
#endif
#ifdef SSS_view
@ -1063,31 +1065,26 @@ void main() {
#ifdef Ambient_SSS
if (!hand){
vec3 SSS_forSky = vec3(0.0);
#if indirect_effect != 1
SkySSS = ScreenSpace_SSS(viewPos, FlatNormals, hand, isLeaf);
SkySSS = ScreenSpace_SSS(viewPos, FlatNormals, hand, isLeaf, noise);
#endif
vec3 ambientColor = (AmbientLightColor / 30.0 ) * 1.5;
vec3 ambientColor = (AmbientLightColor / 30.0) * 2.5;
float skylightmap = pow(lightmap.y,3);
float uplimit = clamp(1.0-pow(clamp(ambientCoefs.y + 0.5,0.0,1.0),2),0,1);
SSS_forSky = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
SSS_forSky *= ambientColor;
SSS_forSky *= skylightmap;
// SSS_forSky *= uplimit;
Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
Indirect_SSS *= ambientColor;
Indirect_SSS *= skylightmap;
// Combine with the other SSS
Indirect_SSS += SSS_forSky;
SSS_forSky = vec3((1.0 - SkySSS) * LabSSS);
vec3 SSS_forSky = vec3((1.0 - SkySSS) * LabSSS);
SSS_forSky *= ambientColor;
SSS_forSky *= skylightmap;
////light up dark parts so its more visible
//light up dark parts so its more visible
Indirect_lighting = max(Indirect_lighting, SSS_forSky);
Indirect_lighting += Indirect_SSS;
// apply to ambient light.
Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientsss_brightness);
#ifdef OVERWORLD_SHADER
if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10);
@ -1115,8 +1112,8 @@ void main() {
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * albedo;
#ifdef Specular_Reflections
vec3 specNoise = vec3(blueNoise(gl_FragCoord.xy).rg, interleaved_gradientNoise());
DoSpecularReflections(gl_FragData[0].rgb, viewPos, feetPlayerPos_normalized, WsunVec, specNoise, normal, SpecularTex.r, SpecularTex.g, albedo, DirectLightColor*Shadows*NdotL, lightmap.y, hand);
vec2 specularNoises = vec2(noise, interleaved_gradientNoise());
DoSpecularReflections(gl_FragData[0].rgb, viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, normal, SpecularTex.r, SpecularTex.g, albedo, DirectLightColor*Shadows*NdotL, lightmap.y, hand);
#endif
Emission(gl_FragData[0].rgb, albedo, SpecularTex.a);
@ -1140,7 +1137,7 @@ void main() {
vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
vec3 ambientColVol = max((averageSkyCol_Clouds / 30.0) * custom_lightmap_T, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)) ;
waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec));
waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedSunDepth, Vdiff, blueNoise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec));
}
#else
if (iswater && isEyeInWater == 0){
@ -1151,15 +1148,33 @@ void main() {
vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.3, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision));
waterVolumetrics_notoverworld(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol);
waterVolumetrics_notoverworld(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedDepth, Vdiff, blueNoise, totEpsilon, scatterCoef, ambientColVol);
}
#endif
// vec3 testPos = feetPlayerPos_normalized + vec3(lightningBoltPosition.x, clamp(feetPlayerPos.y, lightningBoltPosition.y, lightningBoltPosition.y+150.0),lightningBoltPosition.z);
// // vec3 testPos = feetPlayerPos_normalized + vec3(lightningBoltPosition.x, lightningBoltPosition.y + 60,lightningBoltPosition.z);
// gl_FragData[0].rgb = vec3(1) * CustomPhase(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0));
// float phaseorigin = 1.0 - clamp(dot(feetPlayerPos_normalized, normalize(testPos) ),0.0,1.0);
// gl_FragData[0].rgb = vec3(1) * CustomPhase(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0));
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
// // vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos + Custom_ViewMatrix[3].xyz;
// // projectedShadowPosition = mat3(Custom_ProjectionMatrix) * projectedShadowPosition + Custom_ProjectionMatrix[3].xyz;
// vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
// projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
// //apply distortion
// float distortFactor = calcDistort(projectedShadowPosition.xy);
// projectedShadowPosition.xy *= distortFactor;
// projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
// gl_FragData[0].rgb = vec3(1.0) * shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0, 0.00005)).x;
/* DRAWBUFFERS:3 */
}

View File

@ -18,6 +18,7 @@ uniform vec3 sunPosition;
uniform float rainStrength;
uniform float sunElevation;
uniform int frameCounter;
uniform float frameTimeCounter;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),

View File

@ -275,7 +275,7 @@ void main() {
vec3 fragpos0 = toScreenSpace(vec3(texcoord - TAA_Offset*texelSize*0.5,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 , 1, 1, blueNoise(), totEpsilon, scatterCoef, ambientColVol);
waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol);
#endif
}
}

View File

@ -26,6 +26,7 @@ uniform int frameCounter;
//////////////////////////////VOID MAIN//////////////////////////////
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
void main() {
gl_Position = ftransform();

View File

@ -10,7 +10,7 @@ flat varying vec3 sunColor;
flat varying vec3 moonColor;
// flat varying vec3 zenithColor;
flat varying vec3 WsunVec;
// flat varying vec3 WsunVec;
flat varying vec2 tempOffsets;
flat varying float exposure;
@ -46,6 +46,9 @@ vec4 lightCol = vec4(lightSourceColor, float(sunElevation > 1e-5)*2-1.);
#include "/lib/sky_gradient.glsl"
#include "/lib/Shadow_Params.glsl"
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = normalize(LightDir);
vec3 toShadowSpaceProjected(vec3 p3){
p3 = mat3(gbufferModelViewInverse) * p3 + gbufferModelViewInverse[3].xyz;
p3 = mat3(shadowModelView) * p3 + shadowModelView[3].xyz;
@ -133,7 +136,8 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
vec2 planetSphere = vec2(0.0);
vec3 sky = vec3(0.0);
vec3 skyAbsorb = vec3(0.0);
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = normalize(LightDir);
sky = calculateAtmosphere(averageSkyCol*4000./2.0, viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
@ -155,7 +159,8 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
// vec3 WsunVec = normalize(LightDir);
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
if(viewVector.y < -0.025) sky = sky * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;

View File

@ -1,5 +1,7 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
@ -136,8 +138,6 @@ void main() {
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
float lightDir = float( sunVis >= 1e-5)*2.0-1.0;
#endif
//////////////////////////////

View File

@ -13,6 +13,7 @@ uniform float sunElevation;
uniform sampler2D colortex4;
uniform int frameCounter;
uniform float frameTimeCounter;
#include "/lib/util.glsl"
#include "/lib/res_params.glsl"

View File

@ -120,6 +120,7 @@ void applyColorCurve(inout vec3 color, vec4 darks, vec4 brights){
}
#endif
uniform int hideGUI;
void main() {
#ifdef BICUBIC_UPSCALING
vec3 col = SampleTextureCatmullRom(colortex7,texcoord,1.0/texelSize).rgb;
@ -168,8 +169,13 @@ void main() {
// uniform sampler2D shadowcolor0;
// uniform sampler2D shadowtex0;
// uniform sampler2D shadowtex1;
// if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0)).rgb;
// vec2 texrood = texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0);
// if( hideGUI == 1){
// vec2 texrood = texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0);
// if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texrood).rgb;
// if(texrood.x > 0.49 && texrood.x < 0.51 && texrood.y > 0.49 && texrood.y < 0.51) gl_FragColor.rgb = vec3(1,0,0);
// // if(texrood.x > 0.49 && texrood.x < 0.51 && texrood.y > 0.49 && texrood.y < 0.51) gl_FragColor.rgb = vec3(1,0,0);
// }
}

View File

@ -34,40 +34,46 @@ mat4 BuildTranslationMatrix(const in vec3 delta) {
vec4(delta, 1.0));
}
vec3 LightDir = vec3(0.0, 1.0, 0.0);
// vec3 LightDir = vec3(sin(frameTimeCounter*10), 0.2, -cos(frameTimeCounter*10));
uniform vec3 CamPos;
// vec3 LightDir = vec3(1.0, 0.5, 1.0);
float rate = frameTimeCounter;
vec3 LightDir = vec3(sin(rate), 0.3, cos(rate));
// vec3 LightDir = vec3(cos(rate),sin(rate),cos(rate));
const float shadowIntervalSize = 2.0f;
vec3 GetShadowIntervalOffset() {
return fract(CamPos / shadowIntervalSize) * shadowIntervalSize - vec3(3,0,1);
}
mat4 BuildShadowViewMatrix(const in vec3 localLightDir) {
//#ifndef WORLD_END
// return shadowModelView;
//#else
const vec3 worldUp = vec3(0, 0, -1);
const vec3 worldUp = vec3(1, 0, 0);
vec3 zaxis = localLightDir;
vec3 xaxis = normalize(cross(worldUp, zaxis));
vec3 yaxis = normalize(cross(zaxis, xaxis));
vec3 zaxis = localLightDir;
mat4 shadowModelViewEx = mat4(1.0);
shadowModelViewEx[0].xyz = vec3(xaxis.x, yaxis.x, zaxis.x);
shadowModelViewEx[1].xyz = vec3(xaxis.y, yaxis.y, zaxis.y);
shadowModelViewEx[2].xyz = vec3(xaxis.z, yaxis.z, zaxis.z);
// float check = localLightDir.y;
// if(check < 0.0) zaxis.y = -zaxis.y;
vec3 intervalOffset = GetShadowIntervalOffset();
mat4 translation = BuildTranslationMatrix(intervalOffset);
return shadowModelViewEx * translation ;
//#endif
vec3 xaxis = normalize(cross(worldUp, zaxis));
vec3 yaxis = normalize(cross(zaxis, xaxis));
mat4 shadowModelViewEx = mat4(1.0);
shadowModelViewEx[0].xyz = vec3(xaxis.x, yaxis.x, zaxis.x);
shadowModelViewEx[1].xyz = vec3(xaxis.y, yaxis.y, zaxis.y);
shadowModelViewEx[2].xyz = vec3(xaxis.z, yaxis.z, zaxis.z);
vec3 intervalOffset = GetShadowIntervalOffset();
mat4 translation = BuildTranslationMatrix(intervalOffset);
return shadowModelViewEx * translation;
}
mat4 BuildShadowProjectionMatrix() {
float maxDist = min(shadowDistance, far);
return BuildOrthoProjectionMatrix(maxDist, maxDist, -far, far);
}
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
*/

View File

@ -40,7 +40,7 @@ vec3 ToneMap_Hejl2015(in vec3 hdr)
}
vec3 HableTonemap(vec3 linearColor) {
// A = shoulder strength
const float A = 0.45;
const float A = 0.6;
// B = linear strength
const float B = 0.5;
// C = linear angle

View File

@ -3,29 +3,48 @@ vec2 R2_samples(int n){
return fract(alpha * n);
}
vec3 cosineHemisphereSample(vec2 Xi){
float theta = 2.0 * 3.14159265359 * Xi.y;
float r = sqrt(Xi.x);
float x = r * cos(theta);
float y = r * sin(theta);
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
}
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 T = normalize(cross(UpVector, N));
vec3 B = cross(N, T);
return vec3((T * H.x) + (B * H.y) + (N * H.z));
}
vec2 SpiralSample(
int samples, int totalSamples, float rotation, float Xi
){
float alpha = float(samples + Xi) * (1.0 / float(totalSamples));
float theta = 3.14159265359 * alpha * rotation ;
float r = sqrt(Xi);
float x = r * sin(theta);
float y = r * cos(theta);
return vec2(x, y);
}
////////////////////////////////////////////////////////////////
///////////////////////////// SSAO ////////////////////////
////////////////////////////////////////////////////////////////
const float PI = 3.141592653589793238462643383279502884197169;
vec2 tapLocation_alternate(
int samples, int totalSamples, float rotation, float rng
){
float alpha = float(samples + rng) * (1.0 / float(totalSamples));
float angle = alpha * (rotation * PI);
float sin_v = sin(angle);
float cos_v = cos(angle);
return vec2(cos_v, sin_v) * alpha;
}
vec2 SSAO(
vec3 viewPos, vec3 normal, bool hand, bool leaves
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
){
if(hand) return vec2(1,0);
if(hand) return vec2(1.0,0.0);
int samples = 7;
float occlusion = 0.0;
float sss = 0.0;
float dist = 1.0 + clamp(viewPos.z*viewPos.z/50.0,0,5); // shrink sample size as distance increases
@ -41,23 +60,11 @@ vec2 SSAO(
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
// int seed = (frameCounter%40000)*2 + (1+frameCounter);
// vec2 samplePos = fract(R2_samples(seed).xy + blueNoise(gl_FragCoord.xy).xy);
int samples = 7;
int seed = (frameCounter%40000) + frameCounter*2;
float samplePos = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
float occlusion = 0.0; float sss = 0.0;
int n = 0;
for (int i = 0; i < samples; i++) {
vec2 sp = tapLocation_alternate(i, 7, 9, samplePos) * 0.2;
vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * 0.2 * mulfov2;
float rd = mulfov2 ;
vec2 sampleOffset = sp * rd;
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth*RENDER_SCALE.x && offset.y < viewHeight*RENDER_SCALE.y ) {
@ -85,19 +92,13 @@ vec2 SSAO(
return max(1.0 - vec2(occlusion, sss)/n, 0.0);
}
float ScreenSpace_SSS(
vec3 viewPos, vec3 normal, bool hand, bool leaves
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
){
if(hand) return 1.0;
if(hand) return 0.0;
int samples = 7;
float occlusion = 0.0;
float sss = 0.0;
// float radius[7] = float[](
// 0.15,
// 0.15,
// 0.15,
// 0.15,
// 0.15,
// 0.15,
// 0.15
// );
float dist = 1.0 + clamp(viewPos.z*viewPos.z/50.0,0,5); // shrink sample size as distance increases
float mulfov2 = gbufferProjection[1][1]/(3 * dist);
@ -106,22 +107,15 @@ float ScreenSpace_SSS(
float dist3 = clamp(1-exp( viewPos.z*viewPos.z / -50),0,1);
if(leaves) maxR2_2 = mix(10, maxR2_2, dist3);
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
int seed = (frameCounter%40000) * 2 + (1+frameCounter);
float samplePos = fract(R2_samples(seed).x + blueNoise(gl_FragCoord.xy).x) * 1.61803398874;
int samples = 7;
float sss = 0.0;
int n = 0;
for (int i = 0; i < samples; i++) {
vec2 sp = tapLocation_alternate(i, samples, 20, samplePos)* 0.2;
float rd = mulfov2 ;
vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * 0.2 * mulfov2;
vec2 sampleOffset = sp * rd;
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth*RENDER_SCALE.x && offset.y < viewHeight*RENDER_SCALE.y ) {
@ -130,12 +124,10 @@ float ScreenSpace_SSS(
float dsquared = dot(vec, vec);
if (dsquared > 1e-5){
if(dsquared > maxR2_2){
float NdotV = 1.0 - clamp(dot(vec*dsquared, normalize(normal)),0.,1.);
sss += max((NdotV - (1.0-NdotV)) * clamp(1.0-maxR2_2/dsquared,0.0,1.0) ,0.0);
}
n += 1;
}
}
@ -146,6 +138,7 @@ float ScreenSpace_SSS(
////////////////////////////////////////////////////////////////////
///////////////////////////// RTAO/SSGI ////////////////////////
////////////////////////////////////////////////////////////////////
vec3 rayTrace_GI(vec3 dir,vec3 position,float dither, float quality){
vec3 clipPosition = toClipSpace3(position);
@ -222,24 +215,6 @@ vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes){
return vec3(1.1);
}
vec3 cosineHemisphereSample(vec2 Xi, float roughness){
float r = sqrt(Xi.x);
float theta = 2.0 * 3.14159265359 * Xi.y;
float x = r * cos(theta);
float y = r * sin(theta);
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
}
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 T = normalize(cross(UpVector, N));
vec3 B = cross(N, T);
return vec3((T * H.x) + (B * H.y) + (N * H.z));
}
void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 viewPos, vec2 lightmaps, vec3 skylightcolor, vec3 torchcolor, bool isGrass){
int nrays = RAY_COUNT;
@ -255,14 +230,15 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 viewPos, vec2 li
vec3 torchlight = vec3(0.0);
DoRTAmbientLighting(torchcolor, lightmaps, skyLM, torchlight, skylightcolor);
vec2 noisey = blueNoise(gl_FragCoord.xy).xy;
for (int i = 0; i < nrays; i++){
int seed = (frameCounter%40000)*nrays+i;
vec2 ij = fract(R2_samples(seed) + noise );
vec3 rayDir = TangentToWorld(normal, normalize(cosineHemisphereSample(ij,1.0)) ,1.0);
vec2 ij = fract(R2_samples(seed) + noise);
vec3 rayDir = TangentToWorld(normal, normalize(cosineHemisphereSample(ij)) ,1.0);
#ifdef HQ_SSGI
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, blueNoise(), 50.); // ssr rt
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, blueNoise(), 50.); // ssr rt
#else
vec3 rayHit = RT(mat3(gbufferModelView)*rayDir, viewPos, blueNoise(), 30.); // choc sspt
#endif

View File

@ -252,7 +252,7 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
#define MOB_SSS
// #define MISC_BLOCK_SSS
#define Ambient_SSS
#define ambientsss_brightness 1 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 ]
#define ambientsss_brightness 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0]
// #define Porosity
@ -500,5 +500,4 @@ uniform int moonPhase;
#ifdef LIGHTNING_FLASH
#endif
#if BLISS_SHADERS == 0
#endif
#endif

View File

@ -106,7 +106,7 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo
return vec3(1.1);
}
float xonk_fma(float a,float b,float c){
float fma(float a,float b,float c){
return a * b + c;
}
@ -114,7 +114,7 @@ float xonk_fma(float a,float b,float c){
vec3 SampleVNDFGGX(
vec3 viewerDirection, // Direction pointing towards the viewer, oriented such that +Z corresponds to the surface normal
vec2 alpha, // Roughness parameter along X and Y of the distribution
vec2 xy // Pair of uniformly distributed numbers in [0, 1)
float xy // Pair of uniformly distributed numbers in [0, 1)
) {
// alpha *= alpha;
// Transform viewer direction to the hemisphere configuration
@ -122,9 +122,9 @@ vec3 SampleVNDFGGX(
// Sample a reflection direction off the hemisphere
const float tau = 6.2831853; // 2 * pi
float phi = tau * xy.x;
float phi = tau * xy;
float cosTheta = xonk_fma(1.0 - xy.y, 1.0 + viewerDirection.z, -viewerDirection.z) ;
float cosTheta = fma(1.0 - xy, 1.0 + viewerDirection.z, -viewerDirection.z) ;
float sinTheta = sqrt(clamp(1.0 - cosTheta * cosTheta, 0.0, 1.0));
// xonk note, i dont know what im doing but this kinda does what i want so whatever
@ -169,7 +169,7 @@ void DoSpecularReflections(
vec3 FragPos, // toScreenspace(vec3(screenUV, depth)
vec3 WorldPos,
vec3 LightPos, // should be in world space
vec3 Noise, // xy = noise texure. z = simple blue noise
vec2 Noise, // x = bluenoise z = interleaved gradient noise
vec3 Normal, // normals in world space
float Roughness, // red channel of specular texture _S
@ -199,7 +199,7 @@ void DoSpecularReflections(
vec3 ViewDir = -WorldPos*Basis;
#ifdef Rough_reflections
vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(Roughness), fract(R2_Sample(frameCounter%40000) + Noise.xy));
vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(Roughness), Noise.x);
if(Hand) SamplePoints = normalize(vec3(0.0,0.0,1.0));
#else
vec3 SamplePoints = normalize(vec3(0.0,0.0,1.0));
@ -247,7 +247,7 @@ void DoSpecularReflections(
#endif
float reflectLength = 0.0;
vec3 RaytracePos = rayTraceSpeculars(mat3(gbufferModelView) * L, FragPos, Noise.z, float(SSR_Quality), Hand, reflectLength);
vec3 RaytracePos = rayTraceSpeculars(mat3(gbufferModelView) * L, FragPos, Noise.y, float(SSR_Quality), Hand, reflectLength);
float LOD = clamp(pow(reflectLength, pow(1.0-sqrt(Roughness),5.0) * 3.0) * 6.0, 0.0, 6.0); // use higher LOD as the reflection goes on, to blur it. this helps denoise a little.
if(Roughness <= 0.0) LOD = 0.0;

View File

@ -86,6 +86,13 @@ vec4 GetVolumetricFog(
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
// vec3 fragposition = mat3(Custom_ViewMatrix) * wpos + Custom_ViewMatrix[3].xyz;
// fragposition = diagonal3(Custom_ProjectionMatrix) * fragposition + Custom_ProjectionMatrix[3].xyz;
//project view origin into projected shadowmap space
vec3 start = toShadowSpaceProjected(vec3(0.0));
@ -105,6 +112,7 @@ vec4 GetVolumetricFog(
vec3 vL = vec3(0.);
float SdotV = dot(sunVec,normalize(viewPosition))*lightCol.a;
// float SdotV = dot(normalize(LightDir * mat3(gbufferModelViewInverse)), normalize(viewPosition))*lightCol.a;
float dL = length(dVWorld);
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
@ -203,11 +211,8 @@ vec4 GetVolumetricFog(
vec3 AtmosphericFog = skyCol0 * (rL*3.0 + m);// + (LightSourceColor * sh) * (rayL*rL*3.0 + m*mie);
// extra fog effects
// vec3 rainRays = (LightSourceColor*sh) * (rayL*(phaseg(SdotV,0.7))) * clamp(pow(WsunVec.y,5)*2,0.0,1) * rainStrength * noPuddleAreas * RainFog_amount;
// vec3 CaveRays = (LightSourceColor*sh) * phaseg(SdotV,0.7) * 0.001 * (1.0 - lightleakfix);
vec3 vL0 = (AtmosphericFog + AmbientLight + DirectLight + Lightning) * lightleakfix;
// vec3 vL0 = DirectLight;
// #if defined Cave_fog && defined TEST
// vL0 += cavefogCol;

View File

@ -34,14 +34,12 @@ program.composite4.enabled = TAA_UPSCALING
#Get the correct alpha value : S_A*(1-DST_A)+DST_A
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 ZERO
blend.gbuffers_textured = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_textured_lit = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_armor_glint = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_weather = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_damagedblock = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
# dont laugh this is the only thing that works with no issue on iris :(
blend.gbuffers_textured = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ZERO
blend.gbuffers_textured_lit = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ZERO
blend.gbuffers_armor_glint = ONE ONE ONE ONE
blend.gbuffers_weather = ONE ONE ONE ONE
blend.gbuffers_skytextured = ONE ONE ONE ONE
blend.gbuffers_damagedblock = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
# Disable blending
blend.gbuffers_hand = off
@ -226,7 +224,7 @@ PhysicsMod_support [LabPBR]
######## MISC SETTINGS
screen.Misc_Settings.columns=1
screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS
screen.Misc_Settings = [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS
screen.the_orb.columns = 1
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B

View File

@ -8,6 +8,7 @@ varying vec2 texcoord;
uniform sampler2D tex;
uniform sampler2D noisetex;
uniform int frameCounter;
// varying vec4 color;
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////

View File

@ -9,8 +9,6 @@ Read the terms of modification and sharing before changing something below pleas
!! DO NOT REMOVE !!
*/
#include "/lib/settings.glsl"
#include "/lib/Shadow_Params.glsl"
#include "/lib/bokeh.glsl"
#define SHADOW_MAP_BIAS 0.5
const float PI = 3.1415927;
@ -39,12 +37,15 @@ uniform vec3 shadowCamera;
uniform vec3 shadowLightVec;
uniform float shadowMaxProj;
attribute vec4 mc_midTexCoord;
varying vec4 glcolor;
// varying vec4 color;
attribute vec4 mc_Entity;
uniform int blockEntityId;
uniform int entityId;
#include "/lib/Shadow_Params.glsl"
#include "/lib/bokeh.glsl"
const float PI48 = 150.796447372*WAVY_SPEED;
float pi2wt = PI48*frameTimeCounter;
@ -100,17 +101,26 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
}
// uniform int renderStage;
void main() {
texcoord.xy = gl_MultiTexCoord0.xy;
// color = gl_Color;
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
// position = gl_Vertex.xyz;
// if((renderStage == 10 || renderStage == 12) && mc_Entity.x != 3000) {
// position = (shadowModelViewInverse * vec4(gl_Vertex.xyz,1.0)).xyz;
// }
// position = mat3(Custom_ViewMatrix) * position + Custom_ViewMatrix[3].xyz;
// HHHHHHHHH ITS THE JITTER DOF HERE TO SAY HELLO
// It turns out 'position' above is just viewPos lmao
// #ifdef DOF_JITTER_SHADOW
@ -162,25 +172,13 @@ void main() {
}
#endif
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
// vec3 position = mat3(Custom_ViewMatrix) * vec3(gl_Vertex) + Custom_ViewMatrix[3].xyz;
// vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
gl_Position = BiasShadowProjection(toClipSpace3(position));
texcoord.xy = gl_MultiTexCoord0.xy;
if(mc_Entity.x == 8 || mc_Entity.x == 9) gl_Position.w = -1.0;
if(mc_Entity.x == 8 || mc_Entity.x == 9) gl_Position.w = -1.0;
/// this is to ease the shadow acne on big fat entities like ghasts.
float bias = 6.0;
if(entityId == 1100){
// increase bias on parts facing the sun
vec3 FlatNormals = normalize(gl_NormalMatrix * gl_Normal);
@ -188,9 +186,5 @@ void main() {
bias = 6.0 + (1-clamp(dot(WsunVec,FlatNormals),0,1))*0.3;
}
gl_Position.z /= bias;
}
}