mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
ADD mob hit glow, RGB curve sliders, better rough reflections. FIX world border, enchant glint, unmatched lighting on translucents and solids. TWEAK a bunch of stuff all over the place i cant remember
This commit is contained in:
@ -1,12 +1,7 @@
|
||||
// in this here file im doing all the lighting for sunlight, ambient light, torches, for solids and translucents.
|
||||
|
||||
|
||||
#ifndef OVERWORLD
|
||||
uniform float lightningFlash;
|
||||
|
||||
#endif
|
||||
|
||||
uniform float nightVision;
|
||||
|
||||
//// OVERWORLD ////
|
||||
#ifdef OVERWORLD
|
||||
vec3 DoAmbientLighting (vec3 SkyColor, vec3 TorchColor, vec2 Lightmap, float skyLightDir){
|
||||
@ -18,9 +13,7 @@ vec3 DoAmbientLighting (vec3 SkyColor, vec3 TorchColor, vec2 Lightmap, float sky
|
||||
vec3 TorchLight = TorchColor * TorchLM * 0.75;
|
||||
TorchLight *= TORCH_AMOUNT;
|
||||
|
||||
SkyColor = (SkyColor * 2.0 * ambient_brightness) * 8./150./3.;
|
||||
|
||||
SkyColor += vec3(Lightning_R,Lightning_G,Lightning_B) * 25.0 * skyLightDir * lightningFlash ;
|
||||
SkyColor = (SkyColor * ambient_brightness) / 30.0;
|
||||
|
||||
float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5;
|
||||
vec3 SkyLight = max(SkyColor * skyLM, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision) );
|
||||
|
@ -72,7 +72,7 @@
|
||||
// ----- INDIRECT LIGHT RELATED SETTINGS ----- //
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#define MIN_LIGHT_AMOUNT 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 4.0 5.0]
|
||||
#define MIN_LIGHT_AMOUNT 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 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||
#define ambient_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 ambient_colortype 0 // [0 1]
|
||||
@ -330,6 +330,7 @@ uniform int moonPhase;
|
||||
#define aperture 0.8 // [0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1.0 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55 1.6 1.65 1.7 1.75 1.8 1.85 1.9 1.95 2.0 2.05 2.1 2.15 2.2 2.25 2.3 2.35 2.4 2.45 2.5 2.55 2.6 2.65 2.7 2.75 2.8 2.85 2.9 2.95 3.0 3.05 3.1 3.15 3.2 3.25 3.3 3.35 3.4 3.45 3.5 3.55 3.6 3.65 3.7 3.75 3.8 3.85 3.9 3.95 4.0 4.05 4.1 4.15 4.2 4.25 4.3 4.35 4.4 4.45 4.5 4.55 4.6 4.65 4.7 4.75 4.8 4.85 4.9 4.95 5.0 5.05 5.1 5.15 5.2 5.25 5.3 5.35 5.4 5.45 5.5 5.55 5.6 5.65 5.7 5.75 5.8 5.85 5.9 5.95 6.0 6.05 6.1 6.15 6.2 6.25 6.3 6.35 6.4 6.45 6.5 6.55 6.6 6.65 6.7 6.75 6.8 6.85 6.9 6.95 7.0 7.05 7.1 7.15 7.2 7.25 7.3 7.35 7.4 7.45 7.5 7.55 7.6 7.65 7.7 7.75 7.8 7.85 7.9 7.95 8.0 8.05 8.1 8.15 8.2 8.25 8.3 8.35 8.4 8.45 8.5 8.55 8.6 8.65 8.7 8.75 8.8 8.85 8.9 8.95 9.0 9.05 9.1 9.15 9.2 9.25 9.3 9.35 9.4 9.45 9.5 9.55 9.6 9.65 9.7 9.75 9.8 9.85 9.9 9.95 ]
|
||||
#define MANUAL_FOCUS -2 // [-2 -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 28 29 30 32 33 35 36 38 40 41 43 45 47 48 50 52 54 56 58 60 63 65 67 70 72 75 77 80 83 85 88 91 94 98 101 104 108 111 115 119 123 127 132 136 141 146 151 156 161 167 173 179 186 193 200 207 215 224 232 242 251 262 273 284 297 310 324 339 355 372 391 411 433 457 483 512]
|
||||
#define DoF_Adaptation_Speed 1.00 // [0.20 0.21 0.23 0.24 0.25 0.27 0.29 0.30 0.32 0.34 0.36 0.39 0.41 0.43 0.46 0.49 0.52 0.55 0.59 0.62 0.66 0.70 0.74 0.79 0.84 0.89 0.94 1.00 1.06 1.13 1.20 1.27 1.35 1.43 1.52 1.61 1.71 1.82 1.93 2.05 2.18 2.31 2.45 2.60 2.76 2.93 3.11 3.30 3.51 3.72 3.95 4.19 4.45 4.73 5.02 5.33 5.65 6.00]
|
||||
|
||||
// #define DOF_JITTER_SHADOW
|
||||
// // #define DOF_JITTER_FOCUS 32 // [-1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 28 29 30 32 33 35 36 38 40 41 43 45 47 48 50 52 54 56 58 60 63 65 67 70 72 75 77 80 83 85 88 91 94 98 101 104 108 111 115 119 123 127 132 136 141 146 151 156 161 167 173 179 186 193 200 207 215 224 232 242 251 262 273 284 297 310 324 339 355 372 391 411 433 457 483 512]
|
||||
#define JITTER_STRENGTH 1.0 // sorry [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0]
|
||||
@ -348,10 +349,20 @@ uniform int moonPhase;
|
||||
#define SATURATION 0.00 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ]
|
||||
#define CROSSTALK 0.0 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ]
|
||||
|
||||
// #define LUMINANCE_CURVE
|
||||
// #define COLOR_CURVE
|
||||
#define UPPER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
#define LOWER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
|
||||
#define R_UPPER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
#define R_LOWER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
|
||||
#define G_UPPER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
#define G_LOWER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
|
||||
#define B_UPPER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
#define B_LOWER_CURVE 0.0 // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
|
||||
|
||||
#define CONTRAST 1.0 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 1.0 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.2 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.3 1.31 1.32 1.33 1.34 1.35 1.36 1.37 1.38 1.39 1.4 1.41 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.5 1.51 1.52 1.53 1.54 1.55 1.56 1.57 1.58 1.59 1.6 1.61 1.62 1.63 1.64 1.65 1.66 1.67 1.68 1.69 1.7 1.71 1.72 1.73 1.74 1.75 1.76 1.77 1.78 1.79 1.8 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.9 1.91 1.92 1.93 1.94 1.95 1.96 1.97 1.98 1.99 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 ]
|
||||
|
||||
#define EXPOSURE_MULTIPLIER 1.0 // [0.25 0.4 0.5 0.6 0.7 0.75 0.8 0.85 0.9 0.95 1.0 1.1 1.2 1.3 1.4 1.5 2.0 3.0 4.0]
|
||||
|
@ -184,15 +184,20 @@ vec3 SampleVNDFGGX(
|
||||
// Sample a reflection direction off the hemisphere
|
||||
const float tau = 6.2831853; // 2 * pi
|
||||
float phi = tau * xy.x;
|
||||
|
||||
float cosTheta = xonk_fma(1.0 - xy.y, 1.0 + viewerDirection.z, -viewerDirection.z) ;
|
||||
float sinTheta = sqrt(clamp(1.0 - cosTheta * cosTheta, 0.0, 1.0));
|
||||
vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * sinTheta, cosTheta);
|
||||
|
||||
// xonk note, i dont know what im doing but this kinda does what i want so whatever
|
||||
float attemptTailClamp = clamp(sinTheta,max(cosTheta-0.25,0), cosTheta);
|
||||
float attemptTailClamp2 = clamp(cosTheta,max(sinTheta-0.25,0), sinTheta);
|
||||
|
||||
vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * attemptTailClamp2, attemptTailClamp);
|
||||
// vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * sinTheta, cosTheta);
|
||||
|
||||
// Evaluate halfway direction
|
||||
// This gives the normal on the hemisphere
|
||||
// xonk note, i added those magic numbers huhuhuh
|
||||
vec3 halfway = reflected*0.5 + viewerDirection*1.5;
|
||||
// vec3 halfway = reflected + viewerDirection;
|
||||
vec3 halfway = reflected + viewerDirection;
|
||||
|
||||
// Transform the halfway direction back to hemiellispoid configuation
|
||||
// This gives the final sampled normal
|
||||
@ -248,10 +253,11 @@ void MaterialReflections(
|
||||
|
||||
|
||||
// f0 = vec3(0.9);
|
||||
// roughness = 0.0;
|
||||
// roughness = 0.5;
|
||||
|
||||
mat3 basis = CoordBase(normal);
|
||||
vec3 normSpaceView = -np3*basis ;
|
||||
|
||||
|
||||
// roughness stuff
|
||||
#ifdef Rough_reflections
|
||||
@ -279,7 +285,8 @@ void MaterialReflections(
|
||||
SunReflection = directlighting * GGX(normal, -np3, sunPos, roughness, vec3(f0.y));
|
||||
|
||||
#ifdef Sky_reflection
|
||||
if( Roughness_Threshold == 1.0 || (f0.y * (1.0 - roughness * Roughness_Threshold)) > 0.005) SkyReflection = pow(clamp(1.0-VisibilityFactor,0,1),0.3)*( skyCloudsFromTex(L, colortex4).rgb / 150. ) * 5.;
|
||||
//pow(clamp(1.0-VisibilityFactor,0,1),0.3)*
|
||||
if( Roughness_Threshold == 1.0 || (f0.y * (1.0 - roughness * Roughness_Threshold)) > 0.005) SkyReflection = skyCloudsFromTex(L, colortex4).rgb / 30.;
|
||||
#endif
|
||||
|
||||
if (hasReflections) { // Skip sky reflection and SSR if its just not very visible anyway
|
||||
@ -291,14 +298,12 @@ void MaterialReflections(
|
||||
rayQuality = reflection_quality;
|
||||
#endif
|
||||
|
||||
|
||||
noise.b = mix_float(noise.b, 0.5 + (noise.b-0.5),rayContribLuma);
|
||||
if(hand) {rayQuality = max(rayQuality,30.0); noise.b = 0.5 + (noise.b-0.5);}
|
||||
|
||||
vec3 rtPos = rayTraceSpeculars(mat3(gbufferModelView) * L, fragpos.xyz, (noise.b), rayQuality, hand, reflectLength);
|
||||
|
||||
float LOD = clamp(reflectLength * 6.0, 0.0,6.0);
|
||||
if(hand || isEntities) LOD = VisibilityFactor*6;
|
||||
// LOD = 0.0;
|
||||
|
||||
if (rtPos.z < 1.0) { // Reproject on previous frame
|
||||
@ -463,7 +468,7 @@ void MaterialReflections_E(
|
||||
roughness = unpackRoughness(roughness);
|
||||
f0 = f0.y == 0.0 ? vec3(0.02) : f0;
|
||||
|
||||
// roughness = 0.0;
|
||||
// roughness = 0.1;
|
||||
// f0 = vec3(0.9);
|
||||
|
||||
float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0.y) * -4),0,1);
|
||||
|
@ -199,7 +199,7 @@ float PhaseHG(float cosTheta, float g) {
|
||||
return Inv4Pi * (1 - g * g) / (denom * sqrt(denom));
|
||||
}
|
||||
|
||||
uniform float lightningFlash;
|
||||
uniform vec3 lightningEffect;
|
||||
|
||||
vec4 renderClouds(
|
||||
vec3 FragPosition,
|
||||
@ -264,7 +264,7 @@ vec4 renderClouds(
|
||||
|
||||
float timing = 1.0 - clamp(pow(abs(dV_Sun.y)/150.0,2.0),0.0,1.0);
|
||||
|
||||
vec3 lightningColor = vec3(Lightning_R,Lightning_G,Lightning_B) * 1000.0 * lightningFlash;
|
||||
vec3 lightningColor = lightningEffect * 4.0;
|
||||
|
||||
#ifdef Cumulus
|
||||
for(int i=0;i<maxIT_clouds;i++) {
|
||||
|
@ -94,10 +94,7 @@ vec4 getVolumetricRays(
|
||||
vec3 sunColor = lightCol.rgb / 80.0;
|
||||
vec3 skyCol0 = AmbientColor / 150. * 5. ; // * max(abs(WsunVec.y)/150.0,0.);
|
||||
|
||||
vec3 lightningColor = vec3(Lightning_R,Lightning_G,Lightning_B) * 25.0 * lightningFlash * max(eyeBrightnessSmooth.y,0)/240.;
|
||||
#ifdef ReflectedFog
|
||||
lightningColor *= 0.01;
|
||||
#endif
|
||||
vec3 lightningColor = (lightningEffect / 10) * (max(eyeBrightnessSmooth.y,0)/240.);
|
||||
|
||||
vec3 np3 = normVec(wpos);
|
||||
float ambfogfade = clamp(exp(np3.y* 2 - 2),0.0,1.0) * 4 ;
|
||||
@ -232,17 +229,16 @@ vec4 InsideACloudFog(
|
||||
vec3 Fog_SkyCol = averageSkyCol/ 150. * 5. ; // * max(abs(WsunVec.y)/150.0,0.);
|
||||
vec3 Fog_SunCol = lightCol.rgb / 80.0;
|
||||
|
||||
|
||||
vec3 lightningColor = vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0 * lightningFlash * max(eyeBrightnessSmooth.y,0)/240.;
|
||||
vec3 lightningColor = (lightningEffect / 10) * (max(eyeBrightnessSmooth.y,0)/240.);
|
||||
|
||||
#ifdef ReflectedFog
|
||||
lightningColor *= 0.01;
|
||||
#ifndef ReflectedFog
|
||||
vec3 np3 = normVec(wpos);
|
||||
float ambfogfade = clamp(exp(np3.y* 2 - 2),0.0,1.0) * 4 ;
|
||||
|
||||
lightningColor *= ambfogfade;
|
||||
#endif
|
||||
|
||||
vec3 np3 = normVec(wpos);
|
||||
float ambfogfade = clamp(exp(np3.y* 2 - 2),0.0,1.0) * 4 ;
|
||||
|
||||
Fog_SkyCol += (lightningColor/10) * ambfogfade;
|
||||
Fog_SkyCol += lightningColor;
|
||||
|
||||
|
||||
|
||||
@ -258,9 +254,6 @@ vec4 InsideACloudFog(
|
||||
float timing = 1.0 - clamp(pow(abs(dV_Sun.y)/150.0,2.0),0.0,1.0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
||||
float mie = phaseg(SdotV,0.7)*5.0 + 1.0;
|
||||
float rayL = phaseRayleigh(SdotV);
|
||||
|
Reference in New Issue
Block a user