LOTS of fixes, changes, improvements. changes made is bloated because of a skill issue.

FIXED AND IMPROVED translucent rendering. FIXED random stuff from rendering over the hand. FIXED hand shading. FIXED blue horses. FIXED translucent lighting on the hand. FIXED translucent lighting on entities. IMPROVED colored shadows. IMPROVED SSAO application to the scene. IMPROVED subsurface scattering and give it more settings. IMPROVED bloom. ADD AgX tonemap and make it default.
This commit is contained in:
Xonk
2024-05-04 21:08:24 -04:00
parent 343a68c816
commit 25a2284a60
70 changed files with 4096 additions and 1510 deletions

View File

@ -9,41 +9,48 @@ float hash12(vec2 p)
p3 += dot(p3, p3.yzx + 19.19);
return fract((p3.x + p3.y) * p3.z);
}
// Convert Noise2d() into a "star field" by stomping everthing below fThreshhold to zero.
float NoisyStarField( in vec2 vSamplePos, float fThreshhold )
// 1 out, 3 in...
float hash13(vec3 p3)
{
float StarVal = hash12( vSamplePos );
StarVal = clamp(StarVal/(1.0 - fThreshhold) - fThreshhold/(1.0 - fThreshhold),0.0,1.0);
p3 = fract(p3 * .1031);
p3 += dot(p3, p3.zyx + 31.32);
return fract((p3.x + p3.y) * p3.z);
}
// Convert Noise2d() into a "star field" by stomping everthing below fThreshhold to zero.
float NoisyStarField( in vec3 vSamplePos, float fThreshhold )
{
float StarVal = hash13( vSamplePos );
StarVal = clamp(StarVal/(1.0 - fThreshhold) - fThreshhold/(1.0 - fThreshhold),0.0,1.0);
return StarVal;
}
// Stabilize NoisyStarField() by only sampling at integer values.
float StableStarField( in vec2 vSamplePos, float fThreshhold )
float StableStarField( in vec3 vSamplePos, float fThreshhold )
{
// Linear interpolation between four samples.
// Note: This approach has some visual artifacts.
// There must be a better way to "anti alias" the star field.
float fractX = fract( vSamplePos.x );
float fractY = fract( vSamplePos.y );
vec2 floorSample = floor( vSamplePos );
float v1 = NoisyStarField( floorSample, fThreshhold );
float v2 = NoisyStarField( floorSample + vec2( 0.0, 1.0 ), fThreshhold );
float v3 = NoisyStarField( floorSample + vec2( 1.0, 0.0 ), fThreshhold );
float v4 = NoisyStarField( floorSample + vec2( 1.0, 1.0 ), fThreshhold );
vec3 floorSample = floor( vSamplePos.xyz );
float v1 = NoisyStarField( floorSample, fThreshhold);
float v2 = NoisyStarField( floorSample + vec3( 0.0, 1.0, 0.0), fThreshhold );
float v3 = NoisyStarField( floorSample + vec3( 1.0, 0.0, 0.0), fThreshhold );
float v4 = NoisyStarField( floorSample + vec3( 1.0, 1.0, 0.0), fThreshhold );
float StarVal = v1 * ( 1.0 - fractX ) * ( 1.0 - fractY )
+ v2 * ( 1.0 - fractX ) * fractY
+ v3 * fractX * ( 1.0 - fractY )
+ v4 * fractX * fractY;
return StarVal;
}
float stars(vec3 viewPos){
float elevation = clamp(viewPos.y,0.,1.);
vec2 uv = viewPos.xz/(1.5+elevation);
return exp((1.0-StableStarField(uv*1000.,0.999)) * -10) * 3;
// return StableStarField(uv*1000.,0.999)*0.5*0.3;
float stars = max(1.0 - StableStarField(viewPos*300.0 , 0.99),0.0);
return exp( stars * -20.0);
}