allow SSAO to interact with the hand

This commit is contained in:
Xonk
2024-03-27 18:19:55 -04:00
parent 0fc3d21d8a
commit 1637a994ec
5 changed files with 34 additions and 19 deletions

View File

@ -66,8 +66,5 @@ void applyGameplayEffects_FRAGMENT(inout vec3 color, in vec2 texcoord){
// when damage is taken, flash the above effect. because it uses the stuff above, it seamlessly blends to them.
color = mix(color, distortedScreen, (vignette*vignette) * sqrt(hurt));
#endif
// if(isDead) color = vec3(0);
#endif
}

View File

@ -237,9 +237,15 @@ vec3 rayTrace_GI(vec3 dir,vec3 position,float dither, float quality){
}
return vec3(1.1);
}
vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes){
float dist = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases
float convertHandDepth_3(in float depth, bool hand) {
if(!hand) return depth;
float ndcDepth = depth * 2.0 - 1.0;
ndcDepth /= MC_HAND_DEPTH;
return ndcDepth * 0.5 + 0.5;
}
vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes, bool hand){
float dist = 1.0 + clamp(position.z*position.z,0,2); // shrink sample size as distance increases
float stepSize = stepsizes / dist;
int maxSteps = STEPS;
@ -257,6 +263,7 @@ vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes){
vec3 stepv = direction/len;
int iterations = min(int(min(len, mult*len)-2), maxSteps);
//Do one iteration for closest texel (good contact shadows)
@ -278,7 +285,7 @@ vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes){
if( sp < currZ) {
float dist = abs(sp-currZ)/currZ;
if (dist <= 0.1) return vec3(spos.xy, invLinZ(sp))/vec3(RENDER_SCALE,1.0);
if (dist <= mix(0.5, 0.1, clamp(position.z*position.z - 0.1,0,1))) return vec3(spos.xy, invLinZ(sp))/vec3(RENDER_SCALE,1.0);
}
}
return vec3(1.1);
@ -294,7 +301,8 @@ void ApplySSRT(
vec3 skylightcolor,
vec3 torchcolor,
bool isGrass
bool isGrass,
bool hand
){
int nrays = RAY_COUNT;
@ -318,7 +326,7 @@ void ApplySSRT(
#ifdef HQ_SSGI
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, noise.z, 50.); // ssr rt
#else
vec3 rayHit = RT(mat3(gbufferModelView)*rayDir, viewPos, noise.z, 30.); // choc sspt
vec3 rayHit = RT(mat3(gbufferModelView)*rayDir, viewPos, noise.z, 30., hand); // choc sspt
#endif
#ifdef SKY_CONTRIBUTION_IN_SSRT

View File

@ -200,8 +200,7 @@ float cloudVol(int layer, in vec3 pos, in vec3 samplePos, in float cov, in int L
// float curvature = 1-exp(-25*pow(clamp(1.0 - length(pos - cameraPosition)/(32*80),0.0,1.0),2));
// curvature = clamp(1.0 - length(pos - cameraPosition)/(32*128),0.0,1.0);
float otherlayer = max(pos.y - (CloudLayer0_height+99.5), 0.0) > 0 ? 0.0 : 1.0;
float upperPlane = otherlayer;