mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-22 09:38:52 +08:00
fix TAAU breaking GTAO
This commit is contained in:
parent
da2177cfe9
commit
cf56275230
@ -11,8 +11,8 @@ const float golden_ratio = 0.5 + 0.5 * sqrt(5.0);
|
||||
const float golden_angle = tau / golden_ratio / golden_ratio;
|
||||
const float hand_depth = 0.56;
|
||||
|
||||
#if defined TAA && defined TAAU
|
||||
const float taau_render_scale = TAAU_RENDER_SCALE;
|
||||
#if defined TAA && defined TAA_UPSCALING
|
||||
const float taau_render_scale = RENDER_SCALE.x;
|
||||
#else
|
||||
const float taau_render_scale = 1.0;
|
||||
#endif
|
||||
|
@ -87,10 +87,6 @@ vec3 LightSourcePosition(vec3 WorldPos, vec3 CameraPos){
|
||||
// Origin -= RandomPosition * 100;
|
||||
}
|
||||
|
||||
#ifdef THE_ORB
|
||||
Origin = WorldPos - ManualLightPos;
|
||||
#endif
|
||||
|
||||
return Origin;
|
||||
}
|
||||
|
||||
@ -127,10 +123,6 @@ vec3 LightSourceColor(float SwirlBounds){
|
||||
|
||||
}
|
||||
|
||||
#ifdef THE_ORB
|
||||
Color = vec3(ORB_R, ORB_G, ORB_B) * ORB_ColMult;
|
||||
#endif
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
@ -305,10 +297,10 @@ mat2x3 getVolumetricRays(float dither,vec3 fragpos,float dither2) {
|
||||
vec3 CastedLight = LightColor * OrbMie * exp(CastLight * 15 * (LightColor*(1.0-CastLight/3)-1.50)) ;
|
||||
CastedLight += (LightColor * vec3(1.0,1.3,1.0)) * exp(abs(densityVol*2.0 - 0.3) * 15 * (LightColor*CastLight)) * (max(OrbMie - density*10,0.0)/10);
|
||||
|
||||
#ifdef THE_ORB
|
||||
density += clamp((1.0 - length(LightPos) / 10.0) * 10 ,0.0,1.0) ;
|
||||
InnerLight = vec3(0.0);
|
||||
#endif
|
||||
// #ifdef THE_ORB
|
||||
// density += clamp((1.0 - length(LightPos) / 10.0) * 10 ,0.0,1.0) ;
|
||||
// InnerLight = vec3(0.0);
|
||||
// #endif
|
||||
|
||||
vec3 AmbientLight = fogColor * 0.05 * pow(exp(density * -2),20);
|
||||
|
||||
|
@ -182,7 +182,7 @@
|
||||
// #define WhiteWorld // THIS IS A DEBUG VIEW. uses to see AO easier. used to see fake GI better (green light)
|
||||
#define TAA
|
||||
// #define TAA_UPSCALING // Lowers render resolution and uses TAA to combine several lower resolution images (greatly improves performance). USE THIS INSTEAD OF SHADER RENDER QUALITY OPTION IF YOU WANT TO INCREASE FPS (Leave it to 1). IF YOU WANT TO INCREASE QUALITY DISABLE THIS AND INCREASE SHADER RENDER QUALITY
|
||||
#define Seasons
|
||||
// #define Seasons
|
||||
#define Season_Length 24 // how long each season lasts in minecraft days. 91 is roughly how long each season is in reality. 1 will make a year last 4 days [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91]
|
||||
// #define Snowy_Winter // snow in the winter, yes or no?
|
||||
#define Summer_R 1.0 // the color of the plants during this season [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]
|
||||
|
@ -312,6 +312,81 @@ void LabEmission(
|
||||
if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve);
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
||||
|
||||
vec3 absorbed = max(luma(albedo) - albedo,0.0);
|
||||
|
||||
// vec3 scatter = exp(-sqrt(max(Scattering+0.05,0.0) * absorbed * 25)) * exp(Scattering * -5);
|
||||
vec3 scatter = exp(-sqrt(Scattering * absorbed * 5)) * pow((-Scattering+1.0)*1.25,2.0);
|
||||
scatter *= pow(Density,LabSSS_Curve);
|
||||
// temporary
|
||||
|
||||
scatter *= ambientsss_brightness;
|
||||
|
||||
return scatter;
|
||||
}
|
||||
|
||||
void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
|
||||
ivec2 pos = ivec2(gl_FragCoord.xy);
|
||||
const float tan70 = tan(70.*3.14/180.);
|
||||
|
||||
float dist = 1.0 + (clamp(fragpos.z*fragpos.z/50.0,0,2)); // shrink sample size as distance increases
|
||||
float mulfov2 = gbufferProjection[1][1]/(tan70 * dist);
|
||||
|
||||
float dist3 = clamp(1-exp( fragpos.z*fragpos.z / -50),0,1);
|
||||
float maxR2_2 = mix(10, fragpos.z*fragpos.z*mulfov2*2./50.0, dist3);
|
||||
|
||||
float rd = mulfov2 * 0.1;
|
||||
|
||||
|
||||
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
|
||||
|
||||
// int seed = (frameCounter%40000)*2 + (1+frameCounter);
|
||||
// float randomDir = fract(R2_samples(seed).y + noise.x ) * 1.61803398874 ;
|
||||
|
||||
float n = 0.0;
|
||||
vec2 v = fract(vec2(noise.x,interleaved_gradientNoise()) + (frameCounter%10000) * vec2(0.75487765, 0.56984026));
|
||||
|
||||
for (int j = 0; j < 7+2 ;j++) {
|
||||
|
||||
vec2 sp = tapLocation(j,v.x,7+2,2.,v.y);
|
||||
|
||||
// vec2 sp = tapLocation_alternate(j, 0.0, 7, 20, randomDir);
|
||||
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 ) {
|
||||
vec3 t0 = toScreenSpace(vec3(offset*texelSize+acc+0.5*texelSize,texelFetch2D(depthtex1,offset,0).x) * vec3(1.0/RENDER_SCALE, 1.0) );
|
||||
vec3 vec = t0.xyz - fragpos;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
sss = max(1.0 - sss/n, 0.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void main() {
|
||||
float dirtAmount = Dirt_Amount;
|
||||
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
||||
@ -333,6 +408,7 @@ void main() {
|
||||
vec4 trpData = texture2D(colortex7,texcoord);
|
||||
bool iswater = trpData.a > 0.99;
|
||||
vec4 SpecularTex = texture2D(colortex8,texcoord);
|
||||
float LabSSS = clamp((-65.0 + SpecularTex.z * 255.0) / 190.0 ,0.0,1.0);
|
||||
|
||||
vec4 data = texture2D(colortex1,texcoord); // terraom
|
||||
vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y));
|
||||
@ -352,6 +428,7 @@ void main() {
|
||||
vec2 lightmap = dataUnpacked1.yz;
|
||||
bool translucent = abs(dataUnpacked1.w-0.5) <0.01;
|
||||
bool hand = abs(dataUnpacked1.w-0.75) <0.01;
|
||||
float Indirect_SSS = 0.0;
|
||||
|
||||
if (z >=1.0) {
|
||||
vec3 color = clamp(gl_Fog.color.rgb*pow(luma(gl_Fog.color.rgb),-0.75)*0.65,0.0,1.0)*0.02;
|
||||
@ -362,9 +439,20 @@ void main() {
|
||||
|
||||
p3 += gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||
|
||||
vec3 FogColor = (gl_Fog.color.rgb / pow(0.00001 + dot(gl_Fog.color.rgb,vec3(0.3333)),1.0) ) * 0.2;
|
||||
|
||||
// do all ambient lighting stuff
|
||||
vec3 Indirect_lighting = DoAmbientLighting_Nether(gl_Fog.color.rgb, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
|
||||
vec3 Indirect_lighting = DoAmbientLighting_Nether(FogColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
|
||||
|
||||
if(!hand) Indirect_lighting *= ssao(fragpos,noise,FlatNormals) * vanilla_AO;
|
||||
|
||||
|
||||
// ScreenSpace_SSS(Indirect_SSS, fragpos, vec2(R2_dither()), FlatNormals);
|
||||
|
||||
|
||||
// Indirect_lighting *= 1 + SubsurfaceScattering_sky(albedo, Indirect_SSS, LabSSS) * 5;
|
||||
|
||||
|
||||
|
||||
vec3 LightColor = LightSourceColor();
|
||||
|
||||
@ -388,8 +476,6 @@ void main() {
|
||||
MaterialReflections_N(gl_FragData[0].rgb, SpecularTex.r, SpecularTex.ggg, albedo, normal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg,noise), hand);
|
||||
#endif
|
||||
|
||||
if(!hand) gl_FragData[0].rgb *= ssao(fragpos,noise,FlatNormals) * vanilla_AO;
|
||||
|
||||
#ifdef LabPBR_Emissives
|
||||
LabEmission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
||||
#endif
|
||||
@ -421,5 +507,7 @@ void main() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// gl_FragData[0].rgb = SubsurfaceScattering_sky(albedo, Indirect_SSS, 1.0) * vec3(1);
|
||||
/* DRAWBUFFERS:3 */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user