end fog tweaks

This commit is contained in:
Xonk 2023-06-22 18:23:35 -04:00
parent de21572911
commit b1a6c8d0c3
5 changed files with 25 additions and 16 deletions

View File

@ -65,7 +65,8 @@ vec3 DoAmbientLighting_End(vec3 FogColor, vec3 TorchColor, float Lightmap, vec3
FogColor = (FogColor / pow(0.00001 + dot(FogColor,vec3(0.3333)),1.0) ) * 0.1; FogColor = (FogColor / pow(0.00001 + dot(FogColor,vec3(0.3333)),1.0) ) * 0.1;
// vec3 AmbientLight = sqrt( clamp(1.25 + dot(Normal,np3),0.0,1.0)) * (vec3(0.5,0.75,1.0) * 0.05); // vec3 AmbientLight = sqrt( clamp(1.25 + dot(Normal,np3),0.0,1.0)) * (vec3(0.5,0.75,1.0) * 0.05);
vec3 AmbientLight = sqrt( clamp(1.25 + dot(Normal,np3),0.0,1.0)*0.5) * FogColor; // vec3 AmbientLight = sqrt( clamp(1.25 + dot(Normal,np3),0.0,1.0)*0.5) * FogColor;
vec3 AmbientLight = vec3(0.5,0.75,1.0) * 0.05 + FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0)*0.5;
return TorchLight + AmbientLight; return TorchLight + AmbientLight;
} }

View File

@ -79,7 +79,7 @@ vec3 LightSourcePosition(vec3 WorldPos, vec3 CameraPos){
float SwirlBounds = clamp(sqrt(length(vec3(Origin.x,Origin.y-100,Origin.z)) / 150.0 - 1.0) ,0.0,1.0); float SwirlBounds = clamp(sqrt(length(vec3(Origin.x,Origin.y-100,Origin.z)) / 150.0 - 1.0) ,0.0,1.0);
if( SwirlBounds < 1.0) { if( SwirlBounds < 1.0) {
Origin.y -= 200; Origin.y -= 260;
} else { } else {
Origin = WorldPos - CameraPos ; Origin = WorldPos - CameraPos ;
@ -113,10 +113,11 @@ vec3 LightSourcePosition(vec3 WorldPos, vec3 CameraPos){
///////////////// COLOR ///////////////// COLOR
vec3 LightSourceColor(float SwirlBounds){ vec3 LightSourceColor(float SwirlBounds){
vec3 Color = vec3(0.5, 0.5, 1.0); vec3 Color = vec3(0.7, 0.8, 1.0);
#ifndef THE_ORB #ifndef THE_ORB
if( SwirlBounds < 1.0) { if( SwirlBounds < 1.0) {
// Color = vec3(0.5, 0.5, 1.0); // Color = vec3(0.5, 0.5, 1.0);
} else { } else {
@ -171,6 +172,7 @@ vec3 LightSourceShape(vec3 WorldPos){
Shapes.r = max(Shapes.r, max(1.0 - AltCenter / 75.0, 0.0)); Shapes.r = max(Shapes.r, max(1.0 - AltCenter / 75.0, 0.0));
// debug donut // debug donut
// radius = 50.0; // radius = 50.0;
// thickness = 5.0 * radius; // thickness = 5.0 * radius;
@ -214,7 +216,7 @@ float cloudVol(in vec3 pos, int LOD){
// make the eye of the swirl have no fog, so you can actually see. // make the eye of the swirl have no fog, so you can actually see.
finalfog = max(finalfog - Shapes.r, 0.0); finalfog = max(finalfog - Shapes.r, 0.0);
// finalfog = Shapes.b; finalfog += Shapes.b;
return finalfog; return finalfog;
@ -260,7 +262,7 @@ mat2x3 getVolumetricRays(float dither,vec3 fragpos,float dither2) {
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld; progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
float densityVol = cloudVol(progressW,1); float densityVol = cloudVol(progressW,1);
float density = min(densityVol,0.1); float density = min(densityVol,0.09);
float air = 0.005; float air = 0.005;
/// THE OOOOOOOOOOOOOOOOOOOOOORB /// THE OOOOOOOOOOOOOOOOOOOOOORB
@ -271,7 +273,7 @@ mat2x3 getVolumetricRays(float dither,vec3 fragpos,float dither2) {
// float OrbMie = max(exp2(4.0 + length(LightPos) / -20),0.0); // float OrbMie = max(exp2(4.0 + length(LightPos) / -20),0.0);
float OrbMie = max(1.0-length(LightPos)/200,0.0); float OrbMie = max(1.0-length(LightPos)/250,0.0);
float N = 2.50; float N = 2.50;
OrbMie = pow(1.0-pow(1.0-OrbMie,1.0/N),N); OrbMie = pow(1.0-pow(1.0-OrbMie,1.0/N),N);
OrbMie *= 10.0; OrbMie *= 10.0;

View File

@ -318,9 +318,9 @@ float rayTraceShadow(vec3 dir,vec3 position,float dither){
(-near -position.z) / dir.z : far*sqrt(3.) ; (-near -position.z) / dir.z : far*sqrt(3.) ;
vec3 direction = toClipSpace3(position+dir*rayLength)-clipPosition; //convert to clip space vec3 direction = toClipSpace3(position+dir*rayLength)-clipPosition; //convert to clip space
direction.xyz = direction.xyz/max(abs(direction.x)/texelSize.x,abs(direction.y)/texelSize.y); //fixed step size direction.xyz = direction.xyz/max(abs(direction.x)/texelSize.x,abs(direction.y)/texelSize.y); //fixed step size
vec3 stepv = direction * 3.0 * clamp(MC_RENDER_QUALITY,1.,2.0)*vec3(RENDER_SCALE,1.0); vec3 stepv = direction * 3.0 * clamp(MC_RENDER_QUALITY,1.,2.0);
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0); vec3 spos = clipPosition;
spos += stepv*dither ; spos += stepv*dither ;
for (int i = 0; i < int(quality); i++) { for (int i = 0; i < int(quality); i++) {
@ -398,13 +398,19 @@ void main() {
vec3 LightColor = LightSourceColor(clamp(sqrt(length(p3+cameraPosition) / 150.0 - 1.0) ,0.0,1.0)); vec3 LightColor = LightSourceColor(clamp(sqrt(length(p3+cameraPosition) / 150.0 - 1.0) ,0.0,1.0));
vec3 LightPos = LightSourcePosition(p3+cameraPosition, cameraPosition); vec3 LightPos = LightSourcePosition(p3+cameraPosition, cameraPosition);
// float LightFalloff = max(exp2(4.0 + length(LightPos) / -50),0.0); float LightFalloff = max(exp2(4.0 + length(LightPos) / -25),0.0);
float LightFalloff = max(1.0-length(LightPos)/255,0.0); // float LightFalloff = max(1.0-length(LightPos)/255,0.0);
LightFalloff = pow(1.0-pow(1.0-LightFalloff,0.5),2.0); // LightFalloff = pow(1.0-pow(1.0-LightFalloff,0.5),2.0);
LightFalloff *= 10.0; // LightFalloff *= 10.0;
// float LightFalloff = max(1.0-length(LightPos)/250,0.0);
// float N = 2.50;
// LightFalloff = pow(1.0-pow(1.0-LightFalloff,1.0/N),N);
// LightFalloff *= 10.0;
// 0.5 added because lightsources are always high radius. // 0.5 added because lightsources are always high radius.
float NdotL = clamp( dot(normal,normalize(-LightPos)),0.0,1.0); float NdotL = clamp( dot(normal,normalize(-LightPos)),0.0,1.0);
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
float fogshadow = GetCloudShadow(p3+cameraPosition, LightPos, blueNoise()); float fogshadow = GetCloudShadow(p3+cameraPosition, LightPos, blueNoise());
vec3 LightSource = (LightColor * max(LightColor - (1-fogshadow) ,0.0)) * LightFalloff * NdotL ; vec3 LightSource = (LightColor * max(LightColor - (1-fogshadow) ,0.0)) * LightFalloff * NdotL ;
@ -420,8 +426,8 @@ void main() {
LightSource += (LightColor * max(LightColor - 0.6,0.0)) * vec3(1.0,1.3,1.0) * LightFalloff2 * (NdotL*0.7+0.3); LightSource += (LightColor * max(LightColor - 0.6,0.0)) * vec3(1.0,1.3,1.0) * LightFalloff2 * (NdotL*0.7+0.3);
// float RT_Shadows = rayTraceShadow(worldToView(normalize(-LightPos)), fragpos_RTSHADOW, blueNoise()); float RT_Shadows = rayTraceShadow(worldToView(normalize(-LightPos)), fragpos_RTSHADOW, blueNoise());
// if(!hand) LightSource *= RT_Shadows*RT_Shadows; if(!hand) LightSource *= RT_Shadows*RT_Shadows;
// finalize // finalize

View File

@ -2,4 +2,4 @@
#define WORLD #define WORLD
#define BLOCKENTITIES #define BLOCKENTITIES
#include "/gbuffers_all_solid.fsh" #include "/programs/all_solid.fsh"

View File

@ -2,4 +2,4 @@
#define WORLD #define WORLD
#define BLOCKENTITIES #define BLOCKENTITIES
#include "/gbuffers_all_solid.vsh" #include "/programs/all_solid.vsh"