mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 08:42:50 +08:00
tweak indirect SSS to be a little bright like it used to be. Tweak sampling for shadow filtering, ssao, rtao, ssgi, and specular reflections.
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
varying vec4 lmtexcoord;
|
||||
varying vec4 color;
|
||||
@ -28,6 +27,7 @@ uniform mat4 shadowProjection;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
uniform float frameTimeCounter;
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
uniform vec2 texelSize;
|
||||
|
||||
|
@ -213,28 +213,7 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-7.,-1.)/8.,
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
vec3 srgbToLinear2(vec3 srgb){
|
||||
return mix(
|
||||
srgb / 12.92,
|
||||
pow(.947867 * srgb + .0521327, vec3(2.4) ),
|
||||
step( .04045, srgb )
|
||||
);
|
||||
}
|
||||
vec3 blackbody2(float Temp)
|
||||
{
|
||||
float t = pow(Temp, -1.5);
|
||||
float lt = log(Temp);
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
col.x = 220000.0 * t + 0.58039215686;
|
||||
col.y = 0.39231372549 * lt - 2.44549019608;
|
||||
col.y = Temp > 6500. ? 138039.215686 * t + 0.72156862745 : col.y;
|
||||
col.z = 0.76078431372 * lt - 5.68078431373;
|
||||
col = clamp(col,0.0,1.0);
|
||||
col = Temp < 1000. ? col * Temp * 0.001 : col;
|
||||
|
||||
return srgbToLinear2(col);
|
||||
}
|
||||
|
||||
uniform float near;
|
||||
|
||||
|
@ -381,6 +381,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz;
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
#include "/lib/bokeh.glsl"
|
||||
|
||||
uniform float frameTimeCounter;
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
/*
|
||||
|
@ -104,23 +104,6 @@ vec2 R2_samples(int n){
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha * n);
|
||||
}
|
||||
vec2 tapLocation_alternate(
|
||||
int sampleNumber,
|
||||
float spinAngle,
|
||||
int nb,
|
||||
float nbRot,
|
||||
float r0
|
||||
){
|
||||
float alpha = (float(sampleNumber*1.0f + r0) * (1.0 / (nb)));
|
||||
float angle = alpha * (nbRot * 3.14) ;
|
||||
|
||||
float ssR = alpha + spinAngle*3.14;
|
||||
float sin_v, cos_v;
|
||||
|
||||
sin_v = sin(angle);
|
||||
cos_v = cos(angle);
|
||||
return vec2(cos_v, sin_v)*ssR;
|
||||
}
|
||||
vec3 viewToWorld(vec3 viewPos) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
@ -129,28 +112,6 @@ vec3 viewToWorld(vec3 viewPos) {
|
||||
return pos.xyz;
|
||||
}
|
||||
|
||||
|
||||
// Emin's and Gri's combined ideas to stop peter panning and light leaking, also has little shadowacne so thats nice
|
||||
// https://www.complementary.dev/reimagined
|
||||
// https://github.com/gri573
|
||||
void GriAndEminShadowFix(
|
||||
inout vec3 WorldPos,
|
||||
vec3 FlatNormal,
|
||||
float VanillaAO,
|
||||
float SkyLightmap,
|
||||
bool Entities
|
||||
){
|
||||
float DistanceOffset = clamp(0.1 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ;
|
||||
vec3 Bias = FlatNormal * DistanceOffset; // adjust the bias thingy's strength as it gets farther away.
|
||||
|
||||
// stop lightleaking
|
||||
if(SkyLightmap < 0.1 && !Entities) {
|
||||
WorldPos += mix(Bias, 0.5 * (0.5 - fract(WorldPos + cameraPosition + FlatNormal*0.01 ) ), VanillaAO) ;
|
||||
}else{
|
||||
WorldPos += Bias;
|
||||
}
|
||||
}
|
||||
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
|
||||
@ -166,6 +127,20 @@ vec2 tapLocation_simple(
|
||||
|
||||
return vec2(cos_v, sin_v) * sqrt(alpha);
|
||||
}
|
||||
vec2 SpiralSample(
|
||||
int samples, int totalSamples, float rotation, float Xi
|
||||
){
|
||||
float alpha = float(samples + Xi) * (1.0 / float(totalSamples));
|
||||
|
||||
float theta = 3.14159265359 * alpha * rotation ;
|
||||
|
||||
float r = sqrt(Xi);
|
||||
float x = r * sin(theta);
|
||||
float y = r * cos(theta);
|
||||
|
||||
return vec2(x, y);
|
||||
}
|
||||
|
||||
void main() {
|
||||
/* DRAWBUFFERS:3 */
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
@ -229,6 +204,8 @@ void main() {
|
||||
|
||||
// GriAndEminShadowFix(p3, viewToWorld(FlatNormals), vanillAO, lightmap.y, entities);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos + Custom_ViewMatrix[3].xyz;
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
|
||||
@ -251,21 +228,15 @@ void main() {
|
||||
float diffthreshM = diffthresh*mult*d0*k/20.;
|
||||
float avgDepth = 0.0;
|
||||
|
||||
// int seed = (frameCounter%40000) * 2 + (1+frameCounter);
|
||||
// float samplePos = fract(R2_samples(seed).x + blueNoise(gl_FragCoord.xy).x) * 1.61803398874;
|
||||
|
||||
int seed = (frameCounter%40000) + frameCounter*2;
|
||||
float samplePos = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
|
||||
float noise = 0.5+blueNoise();
|
||||
float noise = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
|
||||
|
||||
for(int i = 0; i < VPS_Search_Samples; i++){
|
||||
|
||||
// vec2 offsetS = tapLocation_alternate(i+1, i/VPS_Search_Samples, 7, 20, samplePos) * noise;
|
||||
|
||||
vec2 offsetS = tapLocation_simple(i, 7, 9, samplePos);
|
||||
vec2 offsetS = SpiralSample(i, 7, 8, noise);
|
||||
|
||||
|
||||
float weight = 3.0 + (i+blueNoise() ) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
|
||||
float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
|
||||
// float d = texelFetch2D( shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;
|
||||
float d = texelFetch2D( shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;
|
||||
|
||||
|
@ -25,6 +25,7 @@ void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
|
||||
|
||||
TAA_Offset = offsets[framemod8];
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
const bool colortex5MipmapEnabled = true;
|
||||
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
const bool shadowHardwareFiltering = true;
|
||||
uniform sampler2DShadow shadow;
|
||||
@ -18,8 +17,8 @@ const bool colortex5MipmapEnabled = true;
|
||||
#endif
|
||||
|
||||
#include "/lib/lightning_stuff.glsl"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NETHER_SHADER
|
||||
|
||||
uniform float nightVision;
|
||||
@ -210,17 +209,20 @@ vec3 BilateralFiltering(sampler2D tex, sampler2D depth,vec2 coord,float frDepth,
|
||||
return vec3(sampled.x,sampled.yz/sampled.w);
|
||||
}
|
||||
float interleaved_gradientNoise(){
|
||||
// vec2 coord = gl_FragCoord.xy + (frameCounter%40000);
|
||||
vec2 coord = gl_FragCoord.xy + frameTimeCounter;
|
||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
||||
// vec2 coord = gl_FragCoord.xy + frameTimeCounter;
|
||||
// vec2 coord = gl_FragCoord.xy;
|
||||
float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715)) );
|
||||
return noise ;
|
||||
}
|
||||
|
||||
vec2 R2_dither(){
|
||||
float R2_dither(){
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return vec2(fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter), fract((1.0-alpha.x) * gl_FragCoord.x + (1.0-alpha.y) * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter));
|
||||
return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter) ;
|
||||
}
|
||||
// vec2 R2_dither(){
|
||||
// vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
// return vec2(fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter), fract((1.0-alpha.x) * gl_FragCoord.x + (1.0-alpha.y) * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter));
|
||||
// }
|
||||
float blueNoise(){
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * (frameCounter*0.5+0.5) );
|
||||
}
|
||||
@ -574,13 +576,17 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
|
||||
}
|
||||
vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
||||
|
||||
vec3 absorbed = max(luma(albedo) - albedo,0.0);
|
||||
|
||||
vec3 absorbed = max(1.0 - albedo,0.0);
|
||||
// vec3 scatter = sqrt(exp(-(absorbed * Scattering * 15))) * (1.0 - Scattering);
|
||||
vec3 scatter = exp(-5 * Scattering)*vec3(1);
|
||||
// vec3 scatter = exp(-5 * Scattering)*vec3(1);
|
||||
|
||||
vec3 scatter = exp((Scattering*Scattering) * absorbed * -5) * sqrt(1.0 - Scattering);
|
||||
|
||||
// scatter *= pow(Density,LabSSS_Curve);
|
||||
scatter *= clamp(1 - exp(Density * -10),0,1);
|
||||
|
||||
|
||||
return scatter ;
|
||||
}
|
||||
// #ifdef IS_IRIS
|
||||
@ -614,22 +620,20 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
|
||||
////// --------------- SETUP COORDINATE SPACES --------------- //////
|
||||
////// --------------- SETUP STUFF --------------- //////
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
|
||||
float z0 = texture2D(depthtex0,texcoord).x;
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
|
||||
vec2 tempOffset = TAA_Offset;
|
||||
float noise = blueNoise();
|
||||
int seed = (frameCounter%40000) + frameCounter*2;
|
||||
float noise = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
|
||||
float blueNoise = blueNoise();
|
||||
|
||||
vec2 tempOffset = TAA_Offset;
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
|
||||
vec3 feetPlayerPos_normalized = normVec(feetPlayerPos);
|
||||
vec3 viewPos_handfix = viewPos;
|
||||
|
||||
if ( z < 0.56) viewPos_handfix.z /= MC_HAND_DEPTH; // fix lighting on hand
|
||||
|
||||
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
|
||||
|
||||
@ -748,7 +752,7 @@ void main() {
|
||||
Background = Background * Clouds.a + Clouds.rgb;
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(noise)), 0.0, 65000.);
|
||||
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(blueNoise)), 0.0, 65000.);
|
||||
#endif
|
||||
|
||||
#if defined NETHER_SHADER || defined END_SHADER
|
||||
@ -789,6 +793,9 @@ void main() {
|
||||
vec3 feetPlayerPos_shadow = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
if(!hand) GriAndEminShadowFix(feetPlayerPos_shadow, viewToWorld(FlatNormals), vanilla_AO, lightmap.y, entities);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos_shadow + Custom_ViewMatrix[3].xyz;
|
||||
|
||||
vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos_shadow + shadowModelView[3].xyz;
|
||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
@ -797,7 +804,6 @@ void main() {
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
|
||||
|
||||
bool ShadowBounds = false;
|
||||
if(shadowDistanceRenderMul > 0.0) ShadowBounds = length(feetPlayerPos_shadow) < max(shadowDistance - 20,0.0);
|
||||
|
||||
@ -825,8 +831,9 @@ void main() {
|
||||
#endif
|
||||
float rdMul = filteredShadow.x*distortFactor*d0*k/shadowMapResolution;
|
||||
|
||||
|
||||
for(int i = 0; i < samples; i++){
|
||||
// vec2 offsetS = tapLocation(i,samples,1.618, noise,0.0);
|
||||
// vec2 offsetS = SpiralSample(i, 7, 8, noise)*0.5;
|
||||
vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5;
|
||||
|
||||
float isShadow = shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, smallbias) ).x;
|
||||
@ -953,6 +960,7 @@ void main() {
|
||||
Indirect_lighting = DoAmbientLighting(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy, skylight);
|
||||
#endif
|
||||
|
||||
|
||||
Indirect_lighting += LightningFlashLighting;
|
||||
#endif
|
||||
|
||||
@ -1024,18 +1032,12 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if indirect_effect == 1
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ) ;
|
||||
// vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
||||
// if(!hand) Indirect_lighting *= ssao(viewPos,noise,FlatNormals) * AO;
|
||||
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
|
||||
|
||||
// if (!hand) ssAO(AO, SkySSS, viewPos, 1.0, blueNoise(gl_FragCoord.xy).rg, FlatNormals , texcoord, ambientCoefs, lightmap.xy, isLeaf);
|
||||
|
||||
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf);
|
||||
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
|
||||
AO *= exp((1.0-SSAO_SSS.x) * -5.0);
|
||||
SkySSS = SSAO_SSS.y;
|
||||
|
||||
// SampleSSAO(AO, SkySSS, texcoord);
|
||||
Indirect_lighting *= AO;
|
||||
|
||||
#endif
|
||||
@ -1043,7 +1045,7 @@ void main() {
|
||||
#if indirect_effect == 2
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
|
||||
|
||||
vec2 r2 = fract(R2_samples(frameCounter%40000) + blueNoise(gl_FragCoord.xy).rg);
|
||||
vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + blueNoise(gl_FragCoord.xy).rg);
|
||||
if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0);
|
||||
|
||||
Indirect_lighting *= AO;
|
||||
@ -1051,7 +1053,7 @@ void main() {
|
||||
|
||||
// RTAO and/or SSGI
|
||||
#if indirect_effect == 3 || indirect_effect == 4
|
||||
if (!hand) ApplySSRT(Indirect_lighting, normal, blueNoise(gl_FragCoord.xy).rg, viewPos, lightmap.xy, AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass);
|
||||
if (!hand) ApplySSRT(Indirect_lighting, normal, blueNoise(gl_FragCoord.xy).xy, viewPos, lightmap.xy, AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass);
|
||||
#endif
|
||||
|
||||
#ifdef SSS_view
|
||||
@ -1063,31 +1065,26 @@ void main() {
|
||||
#ifdef Ambient_SSS
|
||||
if (!hand){
|
||||
|
||||
vec3 SSS_forSky = vec3(0.0);
|
||||
|
||||
#if indirect_effect != 1
|
||||
SkySSS = ScreenSpace_SSS(viewPos, FlatNormals, hand, isLeaf);
|
||||
SkySSS = ScreenSpace_SSS(viewPos, FlatNormals, hand, isLeaf, noise);
|
||||
#endif
|
||||
|
||||
vec3 ambientColor = (AmbientLightColor / 30.0 ) * 1.5;
|
||||
vec3 ambientColor = (AmbientLightColor / 30.0) * 2.5;
|
||||
float skylightmap = pow(lightmap.y,3);
|
||||
float uplimit = clamp(1.0-pow(clamp(ambientCoefs.y + 0.5,0.0,1.0),2),0,1);
|
||||
|
||||
SSS_forSky = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
|
||||
SSS_forSky *= ambientColor;
|
||||
SSS_forSky *= skylightmap;
|
||||
// SSS_forSky *= uplimit;
|
||||
Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
|
||||
Indirect_SSS *= ambientColor;
|
||||
Indirect_SSS *= skylightmap;
|
||||
|
||||
// Combine with the other SSS
|
||||
Indirect_SSS += SSS_forSky;
|
||||
|
||||
SSS_forSky = vec3((1.0 - SkySSS) * LabSSS);
|
||||
vec3 SSS_forSky = vec3((1.0 - SkySSS) * LabSSS);
|
||||
SSS_forSky *= ambientColor;
|
||||
SSS_forSky *= skylightmap;
|
||||
|
||||
////light up dark parts so its more visible
|
||||
//light up dark parts so its more visible
|
||||
Indirect_lighting = max(Indirect_lighting, SSS_forSky);
|
||||
Indirect_lighting += Indirect_SSS;
|
||||
|
||||
// apply to ambient light.
|
||||
Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientsss_brightness);
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10);
|
||||
@ -1115,8 +1112,8 @@ void main() {
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * albedo;
|
||||
|
||||
#ifdef Specular_Reflections
|
||||
vec3 specNoise = vec3(blueNoise(gl_FragCoord.xy).rg, interleaved_gradientNoise());
|
||||
DoSpecularReflections(gl_FragData[0].rgb, viewPos, feetPlayerPos_normalized, WsunVec, specNoise, normal, SpecularTex.r, SpecularTex.g, albedo, DirectLightColor*Shadows*NdotL, lightmap.y, hand);
|
||||
vec2 specularNoises = vec2(noise, interleaved_gradientNoise());
|
||||
DoSpecularReflections(gl_FragData[0].rgb, viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, normal, SpecularTex.r, SpecularTex.g, albedo, DirectLightColor*Shadows*NdotL, lightmap.y, hand);
|
||||
#endif
|
||||
|
||||
Emission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
||||
@ -1140,7 +1137,7 @@ void main() {
|
||||
vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
|
||||
vec3 ambientColVol = max((averageSkyCol_Clouds / 30.0) * custom_lightmap_T, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)) ;
|
||||
|
||||
waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec));
|
||||
waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedSunDepth, Vdiff, blueNoise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec));
|
||||
}
|
||||
#else
|
||||
if (iswater && isEyeInWater == 0){
|
||||
@ -1151,15 +1148,33 @@ void main() {
|
||||
|
||||
vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.3, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision));
|
||||
|
||||
waterVolumetrics_notoverworld(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol);
|
||||
waterVolumetrics_notoverworld(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedDepth, Vdiff, blueNoise, totEpsilon, scatterCoef, ambientColVol);
|
||||
}
|
||||
#endif
|
||||
// vec3 testPos = feetPlayerPos_normalized + vec3(lightningBoltPosition.x, clamp(feetPlayerPos.y, lightningBoltPosition.y, lightningBoltPosition.y+150.0),lightningBoltPosition.z);
|
||||
// // vec3 testPos = feetPlayerPos_normalized + vec3(lightningBoltPosition.x, lightningBoltPosition.y + 60,lightningBoltPosition.z);
|
||||
|
||||
// gl_FragData[0].rgb = vec3(1) * CustomPhase(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0));
|
||||
// float phaseorigin = 1.0 - clamp(dot(feetPlayerPos_normalized, normalize(testPos) ),0.0,1.0);
|
||||
|
||||
// gl_FragData[0].rgb = vec3(1) * CustomPhase(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0));
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
|
||||
|
||||
// // vec3 projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos + Custom_ViewMatrix[3].xyz;
|
||||
// // projectedShadowPosition = mat3(Custom_ProjectionMatrix) * projectedShadowPosition + Custom_ProjectionMatrix[3].xyz;
|
||||
|
||||
// vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz;
|
||||
// projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||
|
||||
// //apply distortion
|
||||
// float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
// projectedShadowPosition.xy *= distortFactor;
|
||||
|
||||
// projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
// gl_FragData[0].rgb = vec3(1.0) * shadow2D(shadow, projectedShadowPosition - vec3(0.0,0.0, 0.00005)).x;
|
||||
|
||||
|
||||
/* DRAWBUFFERS:3 */
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ uniform vec3 sunPosition;
|
||||
uniform float rainStrength;
|
||||
uniform float sunElevation;
|
||||
uniform int frameCounter;
|
||||
uniform float frameTimeCounter;
|
||||
|
||||
uniform int framemod8;
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
|
@ -275,7 +275,7 @@ void main() {
|
||||
vec3 fragpos0 = toScreenSpace(vec3(texcoord - TAA_Offset*texelSize*0.5,z));
|
||||
vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.6, vec3(0.2,0.4,1.0) * MIN_LIGHT_AMOUNT*0.01);
|
||||
gl_FragData[0].a = 1;
|
||||
waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1 , 1, 1, blueNoise(), totEpsilon, scatterCoef, ambientColVol);
|
||||
waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol);
|
||||
#endif
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ uniform int frameCounter;
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
|
||||
uniform float frameTimeCounter;
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
@ -10,7 +10,7 @@ flat varying vec3 sunColor;
|
||||
flat varying vec3 moonColor;
|
||||
// flat varying vec3 zenithColor;
|
||||
|
||||
flat varying vec3 WsunVec;
|
||||
// flat varying vec3 WsunVec;
|
||||
|
||||
flat varying vec2 tempOffsets;
|
||||
flat varying float exposure;
|
||||
@ -46,6 +46,9 @@ vec4 lightCol = vec4(lightSourceColor, float(sunElevation > 1e-5)*2-1.);
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
|
||||
// vec3 WsunVec = normalize(LightDir);
|
||||
|
||||
vec3 toShadowSpaceProjected(vec3 p3){
|
||||
p3 = mat3(gbufferModelViewInverse) * p3 + gbufferModelViewInverse[3].xyz;
|
||||
p3 = mat3(shadowModelView) * p3 + shadowModelView[3].xyz;
|
||||
@ -133,7 +136,8 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
|
||||
vec2 planetSphere = vec2(0.0);
|
||||
vec3 sky = vec3(0.0);
|
||||
vec3 skyAbsorb = vec3(0.0);
|
||||
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
|
||||
// vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
|
||||
// vec3 WsunVec = normalize(LightDir);
|
||||
|
||||
sky = calculateAtmosphere(averageSkyCol*4000./2.0, viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
|
||||
|
||||
@ -155,7 +159,8 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
|
||||
vec3 viewVector = cartToSphere(p);
|
||||
|
||||
vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
|
||||
// vec3 WsunVec = mat3(gbufferModelViewInverse)*sunVec;
|
||||
// vec3 WsunVec = normalize(LightDir);
|
||||
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
|
||||
|
||||
if(viewVector.y < -0.025) sky = sky * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
uniform float frameTimeCounter;
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
|
||||
|
||||
@ -136,8 +138,6 @@ void main() {
|
||||
|
||||
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
|
||||
|
||||
float lightDir = float( sunVis >= 1e-5)*2.0-1.0;
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
|
@ -13,6 +13,7 @@ uniform float sunElevation;
|
||||
|
||||
uniform sampler2D colortex4;
|
||||
uniform int frameCounter;
|
||||
uniform float frameTimeCounter;
|
||||
|
||||
#include "/lib/util.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
@ -120,6 +120,7 @@ void applyColorCurve(inout vec3 color, vec4 darks, vec4 brights){
|
||||
}
|
||||
#endif
|
||||
|
||||
uniform int hideGUI;
|
||||
void main() {
|
||||
#ifdef BICUBIC_UPSCALING
|
||||
vec3 col = SampleTextureCatmullRom(colortex7,texcoord,1.0/texelSize).rgb;
|
||||
@ -168,8 +169,13 @@ void main() {
|
||||
// uniform sampler2D shadowcolor0;
|
||||
// uniform sampler2D shadowtex0;
|
||||
// uniform sampler2D shadowtex1;
|
||||
// if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0)).rgb;
|
||||
// vec2 texrood = texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0);
|
||||
|
||||
|
||||
// if( hideGUI == 1){
|
||||
// vec2 texrood = texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0);
|
||||
// if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texrood).rgb;
|
||||
|
||||
|
||||
// if(texrood.x > 0.49 && texrood.x < 0.51 && texrood.y > 0.49 && texrood.y < 0.51) gl_FragColor.rgb = vec3(1,0,0);
|
||||
// // if(texrood.x > 0.49 && texrood.x < 0.51 && texrood.y > 0.49 && texrood.y < 0.51) gl_FragColor.rgb = vec3(1,0,0);
|
||||
// }
|
||||
}
|
||||
|
Reference in New Issue
Block a user