mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-22 09:38:52 +08:00
intial changes for commit #495
This commit is contained in:
parent
e81bb7eedc
commit
4869877f77
50
shaders/dimensions/DH_generic.fsh
Normal file
50
shaders/dimensions/DH_generic.fsh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include "/lib/settings.glsl"
|
||||||
|
|
||||||
|
varying vec4 pos;
|
||||||
|
varying vec4 gcolor;
|
||||||
|
|
||||||
|
uniform vec2 texelSize;
|
||||||
|
uniform vec3 cameraPosition;
|
||||||
|
uniform sampler2D depthtex1;
|
||||||
|
|
||||||
|
uniform mat4 gbufferModelViewInverse;
|
||||||
|
uniform float far;
|
||||||
|
uniform int frameCounter;
|
||||||
|
|
||||||
|
vec3 toLinear(vec3 sRGB){
|
||||||
|
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
|
||||||
|
}
|
||||||
|
|
||||||
|
float interleaved_gradientNoise_temporal(){
|
||||||
|
#ifdef TAA
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
/* RENDERTARGETS:2 */
|
||||||
|
void main() {
|
||||||
|
if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) {
|
||||||
|
|
||||||
|
vec3 viewPos = pos.xyz;
|
||||||
|
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||||
|
|
||||||
|
float falloff = exp(-10.0 * (1.0-clamp(1.0 - playerPos.y/5000.0,0.0,1.0)));
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DH_OVERDRAW_PREVENTION
|
||||||
|
#if OVERDRAW_MAX_DISTANCE == 0
|
||||||
|
float maxOverdrawDistance = far;
|
||||||
|
#else
|
||||||
|
float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(length(playerPos) < clamp(far-16*4, 16, maxOverdrawDistance) || texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){ discard; return;}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
vec3 Albedo = toLinear(gcolor.rgb) ;
|
||||||
|
|
||||||
|
gl_FragData[0] = vec4(Albedo * Emissive_Brightness * 0.1, gcolor.a);
|
||||||
|
}
|
||||||
|
}
|
52
shaders/dimensions/DH_generic.vsh
Normal file
52
shaders/dimensions/DH_generic.vsh
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include "/lib/settings.glsl"
|
||||||
|
#include "/lib/res_params.glsl"
|
||||||
|
|
||||||
|
varying vec4 pos;
|
||||||
|
varying vec4 gcolor;
|
||||||
|
|
||||||
|
uniform vec2 texelSize;
|
||||||
|
uniform int framemod8;
|
||||||
|
|
||||||
|
#if DOF_QUALITY == 5
|
||||||
|
uniform int hideGUI;
|
||||||
|
uniform int frameCounter;
|
||||||
|
uniform float aspectRatio;
|
||||||
|
uniform float screenBrightness;
|
||||||
|
uniform float far;
|
||||||
|
#include "/lib/bokeh.glsl"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "/lib/TAA_jitter.glsl"
|
||||||
|
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_Position = ftransform();
|
||||||
|
|
||||||
|
#ifdef TAA_UPSCALING
|
||||||
|
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
|
||||||
|
#endif
|
||||||
|
#ifdef TAA
|
||||||
|
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pos = gl_ModelViewMatrix * gl_Vertex;
|
||||||
|
gcolor = gl_Color;
|
||||||
|
|
||||||
|
#if DOF_QUALITY == 5
|
||||||
|
vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0);
|
||||||
|
jitter = rotate(radians(float(frameCounter))) * jitter;
|
||||||
|
jitter.y *= aspectRatio;
|
||||||
|
jitter.x *= DOF_ANAMORPHIC_RATIO;
|
||||||
|
|
||||||
|
#if MANUAL_FOCUS == -2
|
||||||
|
float focusMul = 0;
|
||||||
|
#elif MANUAL_FOCUS == -1
|
||||||
|
float focusMul = gl_Position.z + (far / 3.0) - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25);
|
||||||
|
#else
|
||||||
|
float focusMul = gl_Position.z + (far / 3.0) - MANUAL_FOCUS;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2;
|
||||||
|
gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0);
|
||||||
|
#endif
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
varying vec4 pos;
|
varying vec4 pos;
|
||||||
|
varying vec4 localPos;
|
||||||
varying vec4 gcolor;
|
varying vec4 gcolor;
|
||||||
varying vec2 lightmapCoords;
|
varying vec2 lightmapCoords;
|
||||||
varying vec4 normals_and_materials;
|
varying vec4 normals_and_materials;
|
||||||
@ -10,6 +11,7 @@ flat varying float EMISSIVE;
|
|||||||
flat varying int dh_material_id;
|
flat varying int dh_material_id;
|
||||||
|
|
||||||
uniform float far;
|
uniform float far;
|
||||||
|
uniform float nightVision;
|
||||||
// uniform int hideGUI;
|
// uniform int hideGUI;
|
||||||
uniform mat4 gbufferModelView;
|
uniform mat4 gbufferModelView;
|
||||||
uniform mat4 gbufferModelViewInverse;
|
uniform mat4 gbufferModelViewInverse;
|
||||||
@ -53,6 +55,7 @@ float encodeVec2(float x,float y){
|
|||||||
|
|
||||||
uniform mat4 gbufferProjection;
|
uniform mat4 gbufferProjection;
|
||||||
uniform mat4 gbufferProjectionInverse;
|
uniform mat4 gbufferProjectionInverse;
|
||||||
|
uniform vec3 cameraPosition;
|
||||||
|
|
||||||
vec3 toScreenSpace(vec3 p) {
|
vec3 toScreenSpace(vec3 p) {
|
||||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||||
@ -95,7 +98,48 @@ float densityAtPos(in vec3 pos){
|
|||||||
|
|
||||||
return mix(xy.r,xy.g, f.y);
|
return mix(xy.r,xy.g, f.y);
|
||||||
}
|
}
|
||||||
uniform vec3 cameraPosition;
|
|
||||||
|
// https://gitlab.com/jeseibel/distant-horizons-core/-/blob/main/core/src/main/resources/shaders/flat_shaded.frag?ref_type=heads
|
||||||
|
// Property of Distant Horizons [mod]
|
||||||
|
|
||||||
|
const int noiseSteps = 4;
|
||||||
|
const float noiseIntensity = 10.0;
|
||||||
|
const int noiseDropoff = 1024;
|
||||||
|
|
||||||
|
float rand(float co) { return fract(sin(co*(91.3458)) * 47453.5453); }
|
||||||
|
float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); }
|
||||||
|
float rand(vec3 co) { return rand(co.xy + rand(co.z)); }
|
||||||
|
|
||||||
|
vec3 quantize(const in vec3 val, const in int stepSize) {
|
||||||
|
return floor(val * stepSize) / stepSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 applyNoise(in vec4 fragColor, const in vec3 viewPos, const in float viewDist) {
|
||||||
|
// vec3 vertexNormal = normalize(cross(dFdy(vPos.xyz), dFdx(vPos.xyz)));
|
||||||
|
// // This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable
|
||||||
|
// vec3 fixedVPos = vPos.xyz + vertexNormal * 0.001;
|
||||||
|
|
||||||
|
float noiseAmplification = noiseIntensity * 0.01;
|
||||||
|
float lum = (fragColor.r + fragColor.g + fragColor.b) / 3.0;
|
||||||
|
noiseAmplification = (1.0 - pow(lum * 2.0 - 1.0, 2.0)) * noiseAmplification; // Lessen the effect on depending on how dark the object is, equasion for this is -(2x-1)^{2}+1
|
||||||
|
noiseAmplification *= fragColor.a; // The effect would lessen on transparent objects
|
||||||
|
|
||||||
|
// Random value for each position
|
||||||
|
float randomValue = rand(quantize(viewPos, noiseSteps))
|
||||||
|
* 2.0 * noiseAmplification - noiseAmplification;
|
||||||
|
|
||||||
|
// Modifies the color
|
||||||
|
// A value of 0 on the randomValue will result in the original color, while a value of 1 will result in a fully bright color
|
||||||
|
vec3 newCol = fragColor.rgb + (1.0 - fragColor.rgb) * randomValue;
|
||||||
|
newCol = clamp(newCol, 0.0, 1.0);
|
||||||
|
|
||||||
|
if (noiseDropoff != 0) {
|
||||||
|
float distF = min(viewDist / noiseDropoff, 1.0);
|
||||||
|
newCol = mix(newCol, fragColor.rgb, distF); // The further away it gets, the less noise gets applied
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec4(newCol,1.0);
|
||||||
|
}
|
||||||
|
|
||||||
/* RENDERTARGETS:1,7,8 */
|
/* RENDERTARGETS:1,7,8 */
|
||||||
void main() {
|
void main() {
|
||||||
@ -107,7 +151,7 @@ void main() {
|
|||||||
float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE;
|
float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(clamp(1.0-length(pos.xyz)/clamp(far - 32.0,32.0,maxOverdrawDistance),0.0,1.0) > 0.0 ){
|
if(clamp(1.0-length(localPos.xyz)/clamp(far - 32.0,32.0,maxOverdrawDistance),0.0,1.0) > 0.0 ){
|
||||||
discard;
|
discard;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -120,11 +164,14 @@ void main() {
|
|||||||
// PackLightmaps.y *= 1.05;
|
// PackLightmaps.y *= 1.05;
|
||||||
PackLightmaps = min(max(PackLightmaps,0.0)*1.05,1.0);
|
PackLightmaps = min(max(PackLightmaps,0.0)*1.05,1.0);
|
||||||
|
|
||||||
vec4 data1 = clamp( encode(normals, PackLightmaps), 0.0, 1.0);
|
vec4 data1 = clamp( encode(viewToWorld(normals), PackLightmaps), 0.0, 1.0);
|
||||||
|
|
||||||
// alpha is material masks, set it to 0.65 to make a DH LODs mask.
|
// alpha is material masks, set it to 0.65 to make a DH LODs mask.
|
||||||
vec4 Albedo = vec4(gcolor.rgb, 1.0);
|
#ifdef DH_NOISE_TEXTURE
|
||||||
|
vec4 Albedo = applyNoise(gcolor, localPos.rgb+cameraPosition, length(localPos.xyz));
|
||||||
|
#else
|
||||||
|
vec4 Albedo = vec4(gcolor.rgb, 1.0);
|
||||||
|
#endif
|
||||||
// vec3 worldPos = mat3(gbufferModelViewInverse)*pos.xyz + cameraPosition;
|
// vec3 worldPos = mat3(gbufferModelViewInverse)*pos.xyz + cameraPosition;
|
||||||
// worldPos = (worldPos*vec3(1.0,1./48.,1.0)/4) ;
|
// worldPos = (worldPos*vec3(1.0,1./48.,1.0)/4) ;
|
||||||
// worldPos = floor(worldPos * 4.0 + 0.001) / 32.0;
|
// worldPos = floor(worldPos * 4.0 + 0.001) / 32.0;
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
#include "/lib/res_params.glsl"
|
#include "/lib/res_params.glsl"
|
||||||
|
|
||||||
varying vec4 pos;
|
varying vec4 pos;
|
||||||
|
varying vec4 localPos;
|
||||||
varying vec4 gcolor;
|
varying vec4 gcolor;
|
||||||
varying vec2 lightmapCoords;
|
varying vec2 lightmapCoords;
|
||||||
varying vec4 normals_and_materials;
|
varying vec4 normals_and_materials;
|
||||||
flat varying float SSSAMOUNT;
|
flat varying float SSSAMOUNT;
|
||||||
flat varying float EMISSIVE;
|
flat varying float EMISSIVE;
|
||||||
flat varying int dh_material_id;
|
flat varying int dh_material_id;
|
||||||
|
uniform float nightVision;
|
||||||
|
|
||||||
uniform vec2 texelSize;
|
uniform vec2 texelSize;
|
||||||
uniform int framemod8;
|
uniform int framemod8;
|
||||||
@ -25,9 +27,9 @@ uniform float far;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
uniform mat4 gbufferModelViewInverse;
|
uniform mat4 gbufferModelViewInverse;
|
||||||
uniform mat4 gbufferModelView;
|
uniform mat4 gbufferModelView;
|
||||||
|
|
||||||
uniform float far;
|
uniform float far;
|
||||||
uniform mat4 dhProjection;
|
uniform mat4 dhProjection;
|
||||||
uniform vec3 cameraPosition;
|
uniform vec3 cameraPosition;
|
||||||
@ -37,38 +39,45 @@ uniform vec3 cameraPosition;
|
|||||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||||
return vec4(projMAD(dhProjection, viewSpacePosition),-viewSpacePosition.z);
|
return vec4(projMAD(dhProjection, viewSpacePosition),-viewSpacePosition.z);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#define SEASONS_VSH
|
#define SEASONS_VSH
|
||||||
#define DH_SEASONS
|
#define DH_SEASONS
|
||||||
#include "/lib/climate_settings.glsl"
|
#include "/lib/climate_settings.glsl"
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = ftransform();
|
|
||||||
|
|
||||||
/*
|
// vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
// vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
// #ifdef PLANET_CURVATURE
|
||||||
|
// float curvature = length(worldpos) / (16*8);
|
||||||
|
// worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||||
|
// #endif
|
||||||
|
// position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||||
|
|
||||||
float cellSize = 32*2;
|
// gl_Position = toClipSpace3(position);
|
||||||
vec3 modulusWorldPos = vec3(worldpos.x,worldpos.y,worldpos.z) + fract(cameraPosition/cellSize)*cellSize - cellSize*0.5;
|
|
||||||
|
vec4 vPos = gl_Vertex;
|
||||||
|
|
||||||
|
vec3 cameraOffset = fract(cameraPosition);
|
||||||
|
vPos.xyz = floor(vPos.xyz + cameraOffset + 0.5) - cameraOffset;
|
||||||
|
|
||||||
|
vec4 viewPos = gl_ModelViewMatrix * vPos;
|
||||||
|
localPos = gbufferModelViewInverse * viewPos;
|
||||||
|
gl_Position = dhProjection * viewPos;
|
||||||
|
|
||||||
worldpos.y -= (clamp(1.0-length(modulusWorldPos)/max(far-32,0.0),0.0,1.0)) * 50.0;
|
|
||||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
|
||||||
gl_Position = toClipSpace3(position);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef TAA_UPSCALING
|
#ifdef TAA_UPSCALING
|
||||||
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
|
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TAA
|
#ifdef TAA
|
||||||
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
|
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lightmapCoords = gl_MultiTexCoord1.xy; // is this even correct? lol'
|
lightmapCoords = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
|
||||||
|
|
||||||
gcolor = gl_Color;
|
gcolor = gl_Color;
|
||||||
pos = gl_ModelViewMatrix * gl_Vertex;
|
|
||||||
|
|
||||||
EMISSIVE = 0.0;
|
EMISSIVE = 0.0;
|
||||||
if(dhMaterialId == DH_BLOCK_ILLUMINATED || gl_MultiTexCoord1.x >= 0.95) EMISSIVE = 0.5;
|
if(dhMaterialId == DH_BLOCK_ILLUMINATED || gl_MultiTexCoord1.x >= 0.95) EMISSIVE = 0.5;
|
||||||
@ -85,7 +94,6 @@ void main() {
|
|||||||
normals_and_materials = vec4(normalize(gl_NormalMatrix * gl_Normal), MATERIALS);
|
normals_and_materials = vec4(normalize(gl_NormalMatrix * gl_Normal), MATERIALS);
|
||||||
dh_material_id = dhMaterialId;
|
dh_material_id = dhMaterialId;
|
||||||
|
|
||||||
|
|
||||||
#if defined Seasons && defined OVERWORLD_SHADER
|
#if defined Seasons && defined OVERWORLD_SHADER
|
||||||
YearCycleColor(gcolor.rgb, gl_Color.rgb, dhMaterialId == DH_BLOCK_LEAVES, dhMaterialId == DH_BLOCK_GRASS);
|
YearCycleColor(gcolor.rgb, gl_Color.rgb, dhMaterialId == DH_BLOCK_LEAVES, dhMaterialId == DH_BLOCK_GRASS);
|
||||||
#endif
|
#endif
|
||||||
|
@ -117,10 +117,22 @@ uniform int isEyeInWater;
|
|||||||
uniform float rainStrength;
|
uniform float rainStrength;
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CLOUDSHADOWSONLY
|
#define CLOUDSHADOWSONLY
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef OVERWORLD_SHADER
|
||||||
|
#undef WATER_SUN_SPECULAR
|
||||||
|
#endif
|
||||||
float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) {
|
float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) {
|
||||||
r = max(pow(r,2.5), 0.0001);
|
r = max(pow(r,2.5), 0.0001);
|
||||||
|
|
||||||
@ -200,16 +212,30 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater)
|
|||||||
|
|
||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float interleaved_gradientNoise_temporal(){
|
||||||
|
#ifdef TAA
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
float interleaved_gradientNoise(){
|
||||||
|
vec2 coord = gl_FragCoord.xy;
|
||||||
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
|
return noise;
|
||||||
|
}
|
||||||
float R2_dither(){
|
float R2_dither(){
|
||||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
vec2 coord = gl_FragCoord.xy ;
|
||||||
|
|
||||||
|
#ifdef TAA
|
||||||
|
coord += + (frameCounter%40000) * 2.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||||
}
|
}
|
||||||
float interleaved_gradientNoise(){
|
|
||||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
|
||||||
float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715) ) );
|
|
||||||
return noise ;
|
|
||||||
}
|
|
||||||
vec3 viewToWorld(vec3 viewPos) {
|
vec3 viewToWorld(vec3 viewPos) {
|
||||||
vec4 pos;
|
vec4 pos;
|
||||||
pos.xyz = viewPos;
|
pos.xyz = viewPos;
|
||||||
@ -246,6 +272,10 @@ vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){
|
|||||||
return normalize(bump*tbnMatrix);
|
return normalize(bump*tbnMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FORWARD_SPECULAR
|
||||||
|
#define FORWARD_ENVIORNMENT_REFLECTION
|
||||||
|
#define FORWARD_BACKGROUND_REFLECTION
|
||||||
|
#define FORWARD_ROUGH_REFLECTION
|
||||||
|
|
||||||
/* RENDERTARGETS:2,7 */
|
/* RENDERTARGETS:2,7 */
|
||||||
void main() {
|
void main() {
|
||||||
@ -310,7 +340,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
vec3 Direct_lighting = vec3(0.0);
|
vec3 Direct_lighting = vec3(0.0);
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
vec3 DirectLightColor = lightCol.rgb/80.0;
|
vec3 DirectLightColor = lightCol.rgb/2400.0;
|
||||||
|
|
||||||
float NdotL = clamp(dot(normals, normalize(WsunVec2)),0.0,1.0);
|
float NdotL = clamp(dot(normals, normalize(WsunVec2)),0.0,1.0);
|
||||||
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
||||||
@ -342,13 +372,14 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x;
|
Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CLOUDS_SHADOWS
|
|
||||||
Shadows *= pow(GetCloudShadow(playerPos),3);
|
#ifdef CLOUDS_SHADOWS
|
||||||
#endif
|
Shadows *= GetCloudShadow(playerPos + cameraPosition, WsunVec);
|
||||||
|
#endif
|
||||||
|
|
||||||
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
||||||
|
|
||||||
vec3 AmbientLightColor = averageSkyCol_Clouds/30.0;
|
vec3 AmbientLightColor = averageSkyCol_Clouds/900.0;
|
||||||
|
|
||||||
vec3 ambientcoefs = normals_and_materials.xyz / dot(abs(normals_and_materials.xyz), vec3(1.0));
|
vec3 ambientcoefs = normals_and_materials.xyz / dot(abs(normals_and_materials.xyz), vec3(1.0));
|
||||||
float SkylightDir = ambientcoefs.y*1.5;
|
float SkylightDir = ambientcoefs.y*1.5;
|
||||||
@ -366,7 +397,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||||
|
|
||||||
// specular
|
// specular
|
||||||
#ifdef WATER_REFLECTIONS
|
#ifdef FORWARD_SPECULAR
|
||||||
vec3 Reflections_Final = vec3(0.0);
|
vec3 Reflections_Final = vec3(0.0);
|
||||||
vec4 Reflections = vec4(0.0);
|
vec4 Reflections = vec4(0.0);
|
||||||
vec3 BackgroundReflection = FinalColor;
|
vec3 BackgroundReflection = FinalColor;
|
||||||
@ -386,8 +417,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
#ifdef SNELLS_WINDOW
|
#ifdef SNELLS_WINDOW
|
||||||
if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0);
|
if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0);
|
||||||
#endif
|
#endif
|
||||||
#if defined SCREENSPACE_REFLECTIONS && defined DH_SCREENSPACE_REFLECTIONS
|
#if defined FORWARD_ENVIORNMENT_REFLECTION && defined DH_SCREENSPACE_REFLECTIONS
|
||||||
vec3 rtPos = rayTrace(reflectedVector, viewPos, interleaved_gradientNoise(), fresnel, false);
|
vec3 rtPos = rayTrace(reflectedVector, viewPos, interleaved_gradientNoise_temporal(), fresnel, false);
|
||||||
if (rtPos.z < 1.){
|
if (rtPos.z < 1.){
|
||||||
vec3 previousPosition = mat3(gbufferModelViewInverse) * DH_toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
vec3 previousPosition = mat3(gbufferModelViewInverse) * DH_toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
||||||
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
||||||
@ -398,11 +429,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef WATER_BACKGROUND_SPECULAR
|
#ifdef FORWARD_BACKGROUND_REFLECTION
|
||||||
BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0;
|
BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 1200.0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WATER_SUN_SPECULAR
|
#ifdef WATER_SUN_SPECULAR
|
||||||
SunReflection = Direct_lighting * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0-Reflections.a);
|
SunReflection = (DirectLightColor * Shadows) * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0-Reflections.a);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Reflections_Final = mix(BackgroundReflection, Reflections.rgb, Reflections.a) * fresnel;
|
Reflections_Final = mix(BackgroundReflection, Reflections.rgb, Reflections.a) * fresnel;
|
||||||
|
@ -14,7 +14,7 @@ flat varying vec3 averageSkyCol_Clouds;
|
|||||||
flat varying vec4 lightCol;
|
flat varying vec4 lightCol;
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
#if defined Daily_Weather
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams0;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams1;
|
||||||
#endif
|
#endif
|
||||||
@ -56,11 +56,26 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = ftransform();
|
gl_Position = dhProjection * gl_ModelViewMatrix * gl_Vertex;
|
||||||
|
|
||||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
|
|
||||||
|
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||||
|
|
||||||
|
// worldpos.y -= length(worldpos)/(16*2);
|
||||||
|
|
||||||
|
#ifdef PLANET_CURVATURE
|
||||||
|
float curvature = length(worldpos) / (16*8);
|
||||||
|
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||||
|
#endif
|
||||||
|
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||||
|
|
||||||
|
gl_Position = toClipSpace3(position);
|
||||||
|
|
||||||
pos = gl_ModelViewMatrix * gl_Vertex;
|
pos = gl_ModelViewMatrix * gl_Vertex;
|
||||||
|
|
||||||
|
// vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
isWater = 0;
|
isWater = 0;
|
||||||
@ -68,13 +83,13 @@ void main() {
|
|||||||
isWater = 1;
|
isWater = 1;
|
||||||
|
|
||||||
// offset water to not look like a full cube
|
// offset water to not look like a full cube
|
||||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz ;
|
// vec3 worldpos = mat3(gbufferModelViewInverse) * position;// + gbufferModelViewInverse[3].xyz ;
|
||||||
worldpos.y -= 1.8/16.0;
|
// worldpos.y -= 1.8/16.0;
|
||||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
// position = mat3(gbufferModelView) * worldpos;// + gbufferModelView[3].xyz;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_Position = toClipSpace3(position);
|
// gl_Position = toClipSpace3(position);
|
||||||
|
|
||||||
normals_and_materials = vec4(normalize(gl_Normal), 1.0);
|
normals_and_materials = vec4(normalize(gl_Normal), 1.0);
|
||||||
|
|
||||||
@ -83,7 +98,6 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||||
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
||||||
|
|
||||||
|
@ -62,17 +62,25 @@ uniform vec2 texelSize;
|
|||||||
|
|
||||||
uniform ivec2 eyeBrightnessSmooth;
|
uniform ivec2 eyeBrightnessSmooth;
|
||||||
uniform float rainStrength;
|
uniform float rainStrength;
|
||||||
|
uniform float nightVision;
|
||||||
|
|
||||||
flat varying float HELD_ITEM_BRIGHTNESS;
|
flat varying float HELD_ITEM_BRIGHTNESS;
|
||||||
|
|
||||||
#ifndef OVERWORLD_SHADER
|
|
||||||
uniform float nightVision;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "/lib/util.glsl"
|
#include "/lib/util.glsl"
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CLOUDSHADOWSONLY
|
#define CLOUDSHADOWSONLY
|
||||||
|
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -223,8 +231,8 @@ vec3 toClipSpace3(vec3 viewSpacePosition) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
flat varying vec3 WsunVec2;
|
flat varying vec3 WsunVec2;
|
||||||
const float mincoord = 1.0/4096.0;
|
const float mincoord = 1.0/4096.0;
|
||||||
const float maxcoord = 1.0-mincoord;
|
const float maxcoord = 1.0-mincoord;
|
||||||
|
|
||||||
uniform sampler2D normals;
|
uniform sampler2D normals;
|
||||||
varying vec4 tangent;
|
varying vec4 tangent;
|
||||||
@ -373,7 +381,12 @@ void main() {
|
|||||||
#else
|
#else
|
||||||
vec3 playerCamPos = cameraPosition;
|
vec3 playerCamPos = cameraPosition;
|
||||||
#endif
|
#endif
|
||||||
lightmap.x = max(lightmap.x, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length((feetPlayerPos+cameraPosition) - playerCamPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0));
|
// lightmap.x = max(lightmap.x, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length((feetPlayerPos+cameraPosition) - playerCamPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0));
|
||||||
|
if(HELD_ITEM_BRIGHTNESS > 0.0){
|
||||||
|
float pointLight = clamp(1.0-length((feetPlayerPos+cameraPosition)-playerCamPos)/HANDHELD_LIGHT_RANGE,0.0,1.0);
|
||||||
|
lightmap.x = mix(lightmap.x, HELD_ITEM_BRIGHTNESS, pointLight*pointLight);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WEATHER
|
#ifdef WEATHER
|
||||||
@ -402,7 +415,7 @@ void main() {
|
|||||||
if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS;
|
if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS;
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
directLightColor = lightCol.rgb/80.0;
|
directLightColor = lightCol.rgb/2400.0;
|
||||||
float Shadows = 1.0;
|
float Shadows = 1.0;
|
||||||
|
|
||||||
vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||||
@ -417,7 +430,7 @@ void main() {
|
|||||||
Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
||||||
|
|
||||||
#ifdef CLOUDS_SHADOWS
|
#ifdef CLOUDS_SHADOWS
|
||||||
Shadows *= GetCloudShadow(feetPlayerPos);
|
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Direct_lighting = directLightColor * Shadows;
|
Direct_lighting = directLightColor * Shadows;
|
||||||
@ -426,7 +439,7 @@ void main() {
|
|||||||
Direct_lighting *= phaseg(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), 0.65)*2 + 0.5;
|
Direct_lighting *= phaseg(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), 0.65)*2 + 0.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AmbientLightColor = averageSkyCol_Clouds / 30.0;
|
AmbientLightColor = averageSkyCol_Clouds / 900.0;
|
||||||
|
|
||||||
#ifdef IS_IRIS
|
#ifdef IS_IRIS
|
||||||
AmbientLightColor *= 2.5;
|
AmbientLightColor *= 2.5;
|
||||||
@ -438,11 +451,11 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
Indirect_lighting = skyCloudsFromTexLOD2(vec3(0.0,1.0,0.0), colortex4, 6).rgb / 30.0;
|
Indirect_lighting = volumetricsFromTex(vec3(0.0,1.0,0.0), colortex4, 6).rgb / 1200.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
Indirect_lighting = vec3(0.3,0.6,1.0) * 0.5;
|
Indirect_lighting = vec3(0.3,0.6,1.0) * 0.1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
||||||
|
@ -23,10 +23,12 @@ flat varying float exposure;
|
|||||||
flat varying vec3 averageSkyCol_Clouds;
|
flat varying vec3 averageSkyCol_Clouds;
|
||||||
flat varying vec4 lightCol;
|
flat varying vec4 lightCol;
|
||||||
flat varying vec3 WsunVec;
|
flat varying vec3 WsunVec;
|
||||||
#if defined Daily_Weather
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams0;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -106,12 +108,12 @@ void main() {
|
|||||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
|
|
||||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
|
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||||
bool istopv = worldpos.y > cameraPosition.y + 5.0 && lmtexcoord.w > 0.94;
|
bool istopv = worldpos.y > cameraPosition.y + 5.0 && lmtexcoord.w > 0.99;
|
||||||
|
|
||||||
if(!istopv){
|
if(!istopv){
|
||||||
worldpos.xyz -= cameraPosition;
|
worldpos.xyz -= cameraPosition - vec3(2.0,0.0,2.0) * min(max(eyeBrightnessSmooth.y/240.0-0.95,0.0)*11.0,1.0);
|
||||||
}else{
|
}else{
|
||||||
worldpos.xyz -= cameraPosition + vec3(2.0,0.0,2.0);
|
worldpos.xyz -= cameraPosition ;
|
||||||
}
|
}
|
||||||
|
|
||||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||||
@ -140,8 +142,8 @@ void main() {
|
|||||||
|
|
||||||
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||||
#if defined Daily_Weather
|
#if defined Daily_Weather
|
||||||
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0) / 2.0, 0.0);
|
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);
|
||||||
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0) / 2.0, 0.0);
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -94,25 +94,40 @@ flat varying int SIGN;
|
|||||||
|
|
||||||
flat varying float HELD_ITEM_BRIGHTNESS;
|
flat varying float HELD_ITEM_BRIGHTNESS;
|
||||||
uniform float noPuddleAreas;
|
uniform float noPuddleAreas;
|
||||||
|
uniform float nightVision;
|
||||||
|
|
||||||
// float interleaved_gradientNoise(){
|
// float interleaved_gradientNoise(){
|
||||||
// return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
// return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
float interleaved_gradientNoise_temporal(){
|
float interleaved_gradientNoise_temporal(){
|
||||||
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
#ifdef TAA
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
return noise;
|
return noise;
|
||||||
}
|
}
|
||||||
float blueNoise(){
|
|
||||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
|
||||||
}
|
|
||||||
float R2_dither(){
|
float R2_dither(){
|
||||||
|
vec2 coord = gl_FragCoord.xy ;
|
||||||
|
|
||||||
|
#ifdef TAA
|
||||||
|
coord += + (frameCounter%40000) * 2.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter) ;
|
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||||
|
}
|
||||||
|
float blueNoise(){
|
||||||
|
#ifdef TAA
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mat3 inverseMatrix(mat3 m) {
|
mat3 inverseMatrix(mat3 m) {
|
||||||
@ -311,7 +326,8 @@ void main() {
|
|||||||
vec2 tempOffset = offsets[framemod8];
|
vec2 tempOffset = offsets[framemod8];
|
||||||
|
|
||||||
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||||
vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition;
|
vec3 playerpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz;
|
||||||
|
vec3 worldpos = playerpos + cameraPosition;
|
||||||
|
|
||||||
float torchlightmap = lmtexcoord.z;
|
float torchlightmap = lmtexcoord.z;
|
||||||
|
|
||||||
@ -322,8 +338,11 @@ void main() {
|
|||||||
vec3 playerCamPos = cameraPosition;
|
vec3 playerCamPos = cameraPosition;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = max(torchlightmap, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length(worldpos-playerCamPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0));
|
// if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = max(torchlightmap, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length(worldpos-playerCamPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0));
|
||||||
|
if(HELD_ITEM_BRIGHTNESS > 0.0){
|
||||||
|
float pointLight = clamp(1.0-length(worldpos-playerCamPos)/HANDHELD_LIGHT_RANGE,0.0,1.0);
|
||||||
|
torchlightmap = mix(torchlightmap, HELD_ITEM_BRIGHTNESS, pointLight*pointLight);
|
||||||
|
}
|
||||||
#ifdef HAND
|
#ifdef HAND
|
||||||
torchlightmap *= 0.9;
|
torchlightmap *= 0.9;
|
||||||
#endif
|
#endif
|
||||||
@ -331,17 +350,17 @@ void main() {
|
|||||||
|
|
||||||
float lightmap = clamp( (lmtexcoord.w-0.9) * 10.0,0.,1.);
|
float lightmap = clamp( (lmtexcoord.w-0.9) * 10.0,0.,1.);
|
||||||
|
|
||||||
float rainfall = 0.0;
|
// float rainfall = 1.0;
|
||||||
float Puddle_shape = 0.0;
|
// float Puddle_shape = 0.0;
|
||||||
|
|
||||||
#if defined Puddles && defined WORLD && !defined ENTITIES && !defined HAND
|
// #if defined Puddles && defined WORLD && !defined ENTITIES && !defined HAND
|
||||||
rainfall = rainStrength * noPuddleAreas * lightmap;
|
// // rainfall = rainStrength * noPuddleAreas * lightmap;
|
||||||
|
|
||||||
Puddle_shape = clamp(lightmap - exp(-15.0 * pow(texture2D(noisetex, worldpos.xz * (0.020 * Puddle_Size) ).b,5.0)),0.0,1.0);
|
// // Puddle_shape = clamp(lightmap - exp(-15.0 * pow(texture2D(noisetex, worldpos.xz * (0.020 * Puddle_Size) ).b,5.0)),0.0,1.0);
|
||||||
Puddle_shape *= clamp( viewToWorld(normal).y*0.5+0.5,0.0,1.0);
|
// // Puddle_shape *= clamp( viewToWorld(normal).y*0.5+0.5,0.0,1.0);
|
||||||
Puddle_shape *= rainStrength * noPuddleAreas ;
|
// // Puddle_shape *= rainStrength * noPuddleAreas ;
|
||||||
|
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
vec2 adjustedTexCoord = lmtexcoord.xy;
|
vec2 adjustedTexCoord = lmtexcoord.xy;
|
||||||
@ -351,31 +370,38 @@ void main() {
|
|||||||
adjustedTexCoord = fract(vtexcoord.st)*vtexcoordam.pq+vtexcoordam.st;
|
adjustedTexCoord = fract(vtexcoord.st)*vtexcoordam.pq+vtexcoordam.st;
|
||||||
// vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
// vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||||
vec3 viewVector = normalize(tbnMatrix*fragpos);
|
vec3 viewVector = normalize(tbnMatrix*fragpos);
|
||||||
float dist = length(fragpos);
|
float dist = length(playerpos);
|
||||||
|
|
||||||
|
float falloff = min(max(1.0-dist/MAX_OCCLUSION_DISTANCE,0.0) * 2.0,1.0);
|
||||||
|
|
||||||
|
falloff = pow(1.0-pow(1.0-falloff,1.0),2.0);
|
||||||
|
|
||||||
|
// falloff = 1;
|
||||||
|
|
||||||
float maxdist = MAX_OCCLUSION_DISTANCE;
|
float maxdist = MAX_OCCLUSION_DISTANCE;
|
||||||
if(!ifPOM) maxdist = 0.0;
|
if(!ifPOM) maxdist = 0.0;
|
||||||
|
|
||||||
gl_FragDepth = gl_FragCoord.z;
|
gl_FragDepth = gl_FragCoord.z;
|
||||||
if (dist < maxdist) {
|
if (falloff > 0.0) {
|
||||||
|
|
||||||
float depthmap = readNormal(vtexcoord.st).a;
|
float depthmap = readNormal(vtexcoord.st).a;
|
||||||
float used_POM_DEPTH = 1.0;
|
float used_POM_DEPTH = 1.0;
|
||||||
|
float pomdepth = POM_DEPTH*falloff;
|
||||||
|
|
||||||
if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) {
|
if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) {
|
||||||
float noise = blueNoise();
|
float noise = blueNoise();
|
||||||
#ifdef Adaptive_Step_length
|
#ifdef Adaptive_Step_length
|
||||||
vec3 interval = (viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS * POM_DEPTH) * clamp(1.0-pow(depthmap,2),0.1,1.0);
|
vec3 interval = (viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS * pomdepth) * clamp(1.0-pow(depthmap,2),0.1,1.0);
|
||||||
used_POM_DEPTH = 1.0;
|
used_POM_DEPTH = 1.0;
|
||||||
#else
|
#else
|
||||||
vec3 interval = viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS*POM_DEPTH;
|
vec3 interval = viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS*pomdepth;
|
||||||
#endif
|
#endif
|
||||||
vec3 coord = vec3(vtexcoord.st , 1.0);
|
vec3 coord = vec3(vtexcoord.st , 1.0);
|
||||||
|
|
||||||
coord += interval * noise * used_POM_DEPTH;
|
coord += interval * noise * used_POM_DEPTH;
|
||||||
|
|
||||||
float sumVec = noise;
|
float sumVec = noise;
|
||||||
for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - POM_DEPTH + POM_DEPTH * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) {
|
for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - pomdepth + pomdepth * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) {
|
||||||
coord = coord + interval * used_POM_DEPTH;
|
coord = coord + interval * used_POM_DEPTH;
|
||||||
sumVec += used_POM_DEPTH;
|
sumVec += used_POM_DEPTH;
|
||||||
}
|
}
|
||||||
@ -403,7 +429,7 @@ void main() {
|
|||||||
//////////////////////////////// ////////////////////////////////
|
//////////////////////////////// ////////////////////////////////
|
||||||
float textureLOD = bias();
|
float textureLOD = bias();
|
||||||
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color;
|
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color;
|
||||||
|
// Albedo.rgb = vec3(1.0) * min(max(exp(-15.0 * pow(1.0-luma(Albedo.rgb),3.0)) - 0.2,0.0)*5.0,1.0);
|
||||||
#if defined HAND
|
#if defined HAND
|
||||||
if (Albedo.a < 0.1) discard;
|
if (Albedo.a < 0.1) discard;
|
||||||
#endif
|
#endif
|
||||||
@ -483,7 +509,7 @@ void main() {
|
|||||||
NormalTex.xy = NormalTex.xy * 2.0-1.0;
|
NormalTex.xy = NormalTex.xy * 2.0-1.0;
|
||||||
NormalTex.z = sqrt(max(1.0 - dot(NormalTex.xy, NormalTex.xy), 0.0));
|
NormalTex.z = sqrt(max(1.0 - dot(NormalTex.xy, NormalTex.xy), 0.0));
|
||||||
|
|
||||||
normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0-Puddle_shape);
|
normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////// ////////////////////////////////
|
//////////////////////////////// ////////////////////////////////
|
||||||
@ -493,8 +519,8 @@ void main() {
|
|||||||
#ifdef WORLD
|
#ifdef WORLD
|
||||||
vec4 SpecularTex = texture2D_POMSwitch(specular, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD);
|
vec4 SpecularTex = texture2D_POMSwitch(specular, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD);
|
||||||
|
|
||||||
SpecularTex.r = max(SpecularTex.r, rainfall);
|
// SpecularTex.r = max(SpecularTex.r, rainfall);
|
||||||
SpecularTex.g = max(SpecularTex.g, max(Puddle_shape*0.02,0.02));
|
// SpecularTex.g = max(SpecularTex.g, max(Puddle_shape*0.02,0.02));
|
||||||
|
|
||||||
gl_FragData[1].rg = SpecularTex.rg;
|
gl_FragData[1].rg = SpecularTex.rg;
|
||||||
|
|
||||||
@ -543,24 +569,23 @@ void main() {
|
|||||||
//////////////////////////////// ////////////////////////////////
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
#ifdef WORLD
|
#ifdef WORLD
|
||||||
#ifdef Puddles
|
// #ifdef Puddles
|
||||||
float porosity = 0.4;
|
// float porosity = 0.4;
|
||||||
|
|
||||||
#ifdef Porosity
|
// #ifdef Porosity
|
||||||
porosity = SpecularTex.z >= 64.5/255.0 ? 0.0 : (SpecularTex.z*255.0/64.0)*0.65;
|
// porosity = SpecularTex.z >= 64.5/255.0 ? 0.0 : (SpecularTex.z*255.0/64.0)*0.65;
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
if(SpecularTex.g < 229.5/255.0) Albedo.rgb = mix(Albedo.rgb, vec3(0), Puddle_shape*porosity);
|
// // if(SpecularTex.g < 229.5/255.0) Albedo.rgb = mix(Albedo.rgb, vec3(0), Puddle_shape*porosity);
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
// apply noise to lightmaps to reduce banding.
|
// apply noise to lightmaps to reduce banding.
|
||||||
vec2 PackLightmaps = vec2(torchlightmap, lmtexcoord.w);
|
vec2 PackLightmaps = vec2(torchlightmap, lmtexcoord.w);
|
||||||
|
|
||||||
vec4 data1 = clamp( encode(viewToWorld(normal), PackLightmaps), 0.0, 1.0);
|
vec4 data1 = clamp( encode(viewToWorld(normal), PackLightmaps), 0.0, 1.0);
|
||||||
|
|
||||||
gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w));
|
gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w));
|
||||||
|
|
||||||
gl_FragData[2] = vec4(FlatNormals * 0.5 + 0.5, VanillaAO);
|
gl_FragData[2] = vec4(viewToWorld(FlatNormals) * 0.5 + 0.5, VanillaAO);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
@ -83,7 +83,7 @@ flat varying int SIGN;
|
|||||||
// in vec3 at_velocity;
|
// in vec3 at_velocity;
|
||||||
// out vec3 velocity;
|
// out vec3 velocity;
|
||||||
|
|
||||||
|
uniform float nightVision;
|
||||||
|
|
||||||
uniform mat4 gbufferModelView;
|
uniform mat4 gbufferModelView;
|
||||||
uniform mat4 gbufferModelViewInverse;
|
uniform mat4 gbufferModelViewInverse;
|
||||||
@ -198,6 +198,8 @@ void main() {
|
|||||||
|
|
||||||
VanillaAO = 1.0 - clamp(color.a,0,1);
|
VanillaAO = 1.0 - clamp(color.a,0,1);
|
||||||
if (color.a < 0.3) color.a = 1.0; // fix vanilla ao on some custom block models.
|
if (color.a < 0.3) color.a = 1.0; // fix vanilla ao on some custom block models.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////// ----- RANDOM STUFF ----- ///////
|
/////// ----- RANDOM STUFF ----- ///////
|
||||||
// gl_TextureMatrix[0] for animated things like charged creepers
|
// gl_TextureMatrix[0] for animated things like charged creepers
|
||||||
@ -241,6 +243,7 @@ void main() {
|
|||||||
NameTags = 0;
|
NameTags = 0;
|
||||||
|
|
||||||
#ifdef ENTITIES
|
#ifdef ENTITIES
|
||||||
|
|
||||||
// disallow POM to work on item frames.
|
// disallow POM to work on item frames.
|
||||||
if(entityId == ENTITY_ITEM_FRAME) SIGN = 1;
|
if(entityId == ENTITY_ITEM_FRAME) SIGN = 1;
|
||||||
|
|
||||||
@ -297,7 +300,7 @@ void main() {
|
|||||||
mc_Entity.x == BLOCK_AMETHYST_BUD_MEDIUM || mc_Entity.x == BLOCK_AMETHYST_BUD_LARGE || mc_Entity.x == BLOCK_AMETHYST_CLUSTER ||
|
mc_Entity.x == BLOCK_AMETHYST_BUD_MEDIUM || mc_Entity.x == BLOCK_AMETHYST_BUD_LARGE || mc_Entity.x == BLOCK_AMETHYST_CLUSTER ||
|
||||||
mc_Entity.x == BLOCK_BAMBOO || mc_Entity.x == BLOCK_SAPLING || mc_Entity.x == BLOCK_VINE
|
mc_Entity.x == BLOCK_BAMBOO || mc_Entity.x == BLOCK_SAPLING || mc_Entity.x == BLOCK_VINE
|
||||||
) {
|
) {
|
||||||
SSSAMOUNT = 0.75;
|
SSSAMOUNT = 0.0;
|
||||||
}
|
}
|
||||||
// low
|
// low
|
||||||
#ifdef MISC_BLOCK_SSS
|
#ifdef MISC_BLOCK_SSS
|
||||||
@ -328,6 +331,7 @@ void main() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||||
|
|
||||||
#ifdef WAVY_PLANTS
|
#ifdef WAVY_PLANTS
|
||||||
// also use normal, so up/down facing geometry does not get detatched from its model parts.
|
// also use normal, so up/down facing geometry does not get detatched from its model parts.
|
||||||
@ -346,18 +350,24 @@ void main() {
|
|||||||
|
|
||||||
) && abs(position.z) < 64.0
|
) && abs(position.z) < 64.0
|
||||||
){
|
){
|
||||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
|
||||||
vec3 UnalteredWorldpos = worldpos;
|
vec3 UnalteredWorldpos = worldpos;
|
||||||
|
|
||||||
// apply displacement for waving plant blocks
|
// apply displacement for waving plant blocks
|
||||||
worldpos += calcMovePlants(worldpos + cameraPosition) * max(lmtexcoord.w,0.5);
|
worldpos += calcMovePlants(worldpos + cameraPosition) * max(lmtexcoord.w,0.5);
|
||||||
|
|
||||||
|
|
||||||
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
|
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
|
||||||
if(mc_Entity.x == BLOCK_AIR_WAVING) worldpos = UnalteredWorldpos + calcMoveLeaves(worldpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*lmtexcoord.w;
|
if(mc_Entity.x == BLOCK_AIR_WAVING) worldpos = UnalteredWorldpos + calcMoveLeaves(worldpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*lmtexcoord.w;
|
||||||
|
|
||||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PLANET_CURVATURE
|
||||||
|
float curvature = length(worldpos) / (16*8);
|
||||||
|
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||||
|
|
||||||
gl_Position = toClipSpace3(position);
|
gl_Position = toClipSpace3(position);
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,7 +36,6 @@ uniform vec4 entityColor;
|
|||||||
|
|
||||||
flat varying float HELD_ITEM_BRIGHTNESS;
|
flat varying float HELD_ITEM_BRIGHTNESS;
|
||||||
|
|
||||||
const bool colortex4MipmapEnabled = true;
|
|
||||||
uniform sampler2D noisetex;
|
uniform sampler2D noisetex;
|
||||||
uniform sampler2D depthtex1;
|
uniform sampler2D depthtex1;
|
||||||
uniform sampler2D depthtex0;
|
uniform sampler2D depthtex0;
|
||||||
@ -84,11 +83,15 @@ uniform float rainStrength;
|
|||||||
uniform float skyIntensityNight;
|
uniform float skyIntensityNight;
|
||||||
uniform float skyIntensity;
|
uniform float skyIntensity;
|
||||||
uniform ivec2 eyeBrightnessSmooth;
|
uniform ivec2 eyeBrightnessSmooth;
|
||||||
|
uniform float nightVision;
|
||||||
|
|
||||||
|
|
||||||
uniform int frameCounter;
|
uniform int frameCounter;
|
||||||
uniform float frameTimeCounter;
|
uniform float frameTimeCounter;
|
||||||
uniform vec2 texelSize;
|
uniform vec2 texelSize;
|
||||||
uniform int framemod8;
|
uniform int framemod8;
|
||||||
|
uniform float viewWidth;
|
||||||
|
uniform float viewHeight;
|
||||||
|
|
||||||
uniform mat4 gbufferPreviousModelView;
|
uniform mat4 gbufferPreviousModelView;
|
||||||
uniform vec3 previousCameraPosition;
|
uniform vec3 previousCameraPosition;
|
||||||
@ -110,11 +113,18 @@ uniform vec3 nsunColor;
|
|||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
flat varying float Flashing;
|
flat varying float Flashing;
|
||||||
#include "/lib/lightning_stuff.glsl"
|
#include "/lib/lightning_stuff.glsl"
|
||||||
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CLOUDSHADOWSONLY
|
#define CLOUDSHADOWSONLY
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
#else
|
|
||||||
uniform float nightVision;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
@ -132,14 +142,12 @@ uniform vec3 nsunColor;
|
|||||||
|
|
||||||
#include "/lib/diffuse_lighting.glsl"
|
#include "/lib/diffuse_lighting.glsl"
|
||||||
|
|
||||||
float blueNoise(){
|
|
||||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
|
||||||
}
|
|
||||||
vec4 blueNoise(vec2 coord){
|
|
||||||
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
|
||||||
}
|
|
||||||
float interleaved_gradientNoise_temporal(){
|
float interleaved_gradientNoise_temporal(){
|
||||||
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
#ifdef TAA
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
@ -147,20 +155,27 @@ float interleaved_gradientNoise(){
|
|||||||
return noise;
|
return noise;
|
||||||
}
|
}
|
||||||
float R2_dither(){
|
float R2_dither(){
|
||||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
vec2 coord = gl_FragCoord.xy ;
|
||||||
|
|
||||||
|
#ifdef TAA
|
||||||
|
coord += + (frameCounter%40000) * 2.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||||
}
|
}
|
||||||
|
float blueNoise(){
|
||||||
|
#ifdef TAA
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "/lib/TAA_jitter.glsl"
|
#include "/lib/TAA_jitter.glsl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define PW_DEPTH 1.5 //[0.5 1.0 1.5 2.0 2.5 3.0]
|
#define PW_DEPTH 1.5 //[0.5 1.0 1.5 2.0 2.5 3.0]
|
||||||
#define PW_POINTS 2 //[2 4 6 8 16 32]
|
#define PW_POINTS 2 //[2 4 6 8 16 32]
|
||||||
|
|
||||||
@ -239,91 +254,10 @@ float encodeVec2(float x,float y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float invLinZ (float lindepth){
|
|
||||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
|
||||||
}
|
|
||||||
float ld(float dist) {
|
float ld(float dist) {
|
||||||
return (2.0 * near) / (far + near - dist * (far - near));
|
return (2.0 * near) / (far + near - dist * (far - near));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater, inout float reflectLength){
|
|
||||||
|
|
||||||
float quality = mix(15,SSR_STEPS,fresnel);
|
|
||||||
|
|
||||||
// quality = SSR_STEPS;
|
|
||||||
|
|
||||||
vec3 clipPosition = toClipSpace3(position);
|
|
||||||
float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
|
|
||||||
(-near -position.z) / dir.z : far*sqrt(3.);
|
|
||||||
vec3 direction = normalize(toClipSpace3(position+dir*rayLength)-clipPosition); //convert to clip space
|
|
||||||
direction.xy = normalize(direction.xy);
|
|
||||||
|
|
||||||
//get at which length the ray intersects with the edge of the screen
|
|
||||||
vec3 maxLengths = (step(0.,direction)-clipPosition) / direction;
|
|
||||||
float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
|
|
||||||
|
|
||||||
|
|
||||||
vec3 stepv = direction * mult / quality * vec3(RENDER_SCALE,1.0);
|
|
||||||
|
|
||||||
|
|
||||||
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*dither;
|
|
||||||
float minZ = clipPosition.z;
|
|
||||||
float maxZ = spos.z+stepv.z*0.5;
|
|
||||||
|
|
||||||
spos.xy += offsets[framemod8]*texelSize*0.5/RENDER_SCALE;
|
|
||||||
|
|
||||||
float dist = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases
|
|
||||||
for (int i = 0; i <= int(quality); i++) {
|
|
||||||
|
|
||||||
// decode depth buffer
|
|
||||||
// float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0);
|
|
||||||
|
|
||||||
float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0);
|
|
||||||
sp = invLinZ(sp);
|
|
||||||
|
|
||||||
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spos += stepv;
|
|
||||||
//small bias
|
|
||||||
if(inwater) {
|
|
||||||
minZ = maxZ-0.00035/ld(spos.z);
|
|
||||||
}else{
|
|
||||||
minZ = maxZ-0.0001/max(ld(spos.z), (0.0 + position.z*position.z*0.001));
|
|
||||||
}
|
|
||||||
maxZ += stepv.z;
|
|
||||||
|
|
||||||
|
|
||||||
reflectLength += 1.0 / quality; // for shit
|
|
||||||
}
|
|
||||||
|
|
||||||
return vec3(1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) {
|
|
||||||
r = max(pow(r,2.5), 0.0001);
|
|
||||||
|
|
||||||
vec3 h = l + v;
|
|
||||||
float hn = inversesqrt(dot(h, h));
|
|
||||||
|
|
||||||
float dotLH = clamp(dot(h,l)*hn,0.,1.);
|
|
||||||
float dotNH = clamp(dot(h,n)*hn,0.,1.) ;
|
|
||||||
float dotNL = clamp(dot(n,l),0.,1.);
|
|
||||||
float dotNHsq = dotNH*dotNH;
|
|
||||||
|
|
||||||
float denom = dotNHsq * r - dotNHsq + 1.;
|
|
||||||
float D = r / (3.141592653589793 * denom * denom);
|
|
||||||
|
|
||||||
float F = f0 + (1. - f0) * exp2((-5.55473*dotLH-6.98316)*dotLH);
|
|
||||||
float k2 = .25 * r;
|
|
||||||
|
|
||||||
return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uniform float dhFarPlane;
|
uniform float dhFarPlane;
|
||||||
|
|
||||||
#include "/lib/DistantHorizons_projections.glsl"
|
#include "/lib/DistantHorizons_projections.glsl"
|
||||||
@ -426,12 +360,19 @@ void Emission(
|
|||||||
float Emission,
|
float Emission,
|
||||||
float exposure
|
float exposure
|
||||||
){
|
){
|
||||||
float autoBrightnessAdjust = mix(5.0, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
|
// float autoBrightnessAdjust = mix(5.0, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
|
||||||
if( Emission < 254.5/255.0) Lighting = mix(Lighting, Albedo * Emissive_Brightness * autoBrightnessAdjust * 0.1, pow(Emission, Emissive_Curve)); // old method.... idk why
|
if( Emission < 254.5/255.0) Lighting = mix(Lighting, Albedo * 5.0 * Emissive_Brightness, pow(Emission, Emissive_Curve)); // old method.... idk why
|
||||||
}
|
}
|
||||||
|
|
||||||
uniform vec3 eyePosition;
|
uniform vec3 eyePosition;
|
||||||
|
|
||||||
|
#define FORWARD_SPECULAR
|
||||||
|
#define FORWARD_ENVIORNMENT_REFLECTION
|
||||||
|
#define FORWARD_BACKGROUND_REFLECTION
|
||||||
|
#define FORWARD_ROUGH_REFLECTION
|
||||||
|
|
||||||
|
#include "/lib/specular.glsl"
|
||||||
|
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
@ -486,7 +427,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color;
|
gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color;
|
||||||
|
|
||||||
float UnchangedAlpha = gl_FragData[0].a;
|
float UnchangedAlpha = gl_FragData[0].a;
|
||||||
|
|
||||||
|
// gl_FragData[0].a = pow(gl_FragData[0].a,3);
|
||||||
|
|
||||||
#ifdef WhiteWorld
|
#ifdef WhiteWorld
|
||||||
gl_FragData[0].rgb = vec3(0.5);
|
gl_FragData[0].rgb = vec3(0.5);
|
||||||
gl_FragData[0].a = 1.0;
|
gl_FragData[0].a = 1.0;
|
||||||
@ -532,8 +475,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
vec3 worldSpaceNormal = viewToWorld(normal).xyz;
|
vec3 worldSpaceNormal = viewToWorld(normal).xyz;
|
||||||
vec2 TangentNormal = vec2(0); // for refractions
|
vec2 TangentNormal = vec2(0); // for refractions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w);
|
vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w);
|
||||||
mat3 tbnMatrix = mat3(tangent.x, tangent2.x, normal.x,
|
mat3 tbnMatrix = mat3(tangent.x, tangent2.x, normal.x,
|
||||||
tangent.y, tangent2.y, normal.y,
|
tangent.y, tangent2.y, normal.y,
|
||||||
@ -541,17 +482,14 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
|
|
||||||
vec3 NormalTex = vec3(texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).xy,0.0);
|
vec3 NormalTex = vec3(texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).xy,0.0);
|
||||||
NormalTex.xy = NormalTex.xy*2.0-1.0;
|
NormalTex.xy = NormalTex.xy*2.0-1.0;
|
||||||
NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0) ;
|
NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0);
|
||||||
|
|
||||||
// tangent space normals for refraction
|
|
||||||
TangentNormal = NormalTex.xy*0.5+0.5;
|
|
||||||
|
|
||||||
#ifndef HAND
|
#ifndef HAND
|
||||||
if (isWater){
|
if (isWater){
|
||||||
vec3 posxz = (mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz) + cameraPosition;
|
vec3 posxz = (mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz) + cameraPosition;
|
||||||
|
|
||||||
// make the waves flow in the direction the water faces, except for perfectly up facing parts.
|
// make the waves flow in the direction the water faces, except for perfectly up facing parts.
|
||||||
if(abs(worldSpaceNormal.y) < 0.9995) posxz.xz -= (posxz.y + frameTimeCounter*3 * WATER_WAVE_SPEED) * normalize(worldSpaceNormal.xz) ;
|
if(abs(worldSpaceNormal.y) < 0.9995) posxz.xz -= posxz.y + normalize(worldSpaceNormal.xz*10.0) * frameTimeCounter * 3.0 * WATER_WAVE_SPEED;
|
||||||
|
|
||||||
posxz.xyz = getParallaxDisplacement(posxz);
|
posxz.xyz = getParallaxDisplacement(posxz);
|
||||||
vec3 bump = normalize(getWaveNormal(posxz, false));
|
vec3 bump = normalize(getWaveNormal(posxz, false));
|
||||||
@ -560,22 +498,24 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
|
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
|
||||||
|
|
||||||
NormalTex.xyz = bump;
|
NormalTex.xyz = bump;
|
||||||
|
|
||||||
// tangent space normals for refraction
|
|
||||||
TangentNormal = (bump.xy/3.0)*0.5+0.5;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// tangent space normals for refraction
|
||||||
|
TangentNormal = NormalTex.xy;
|
||||||
|
|
||||||
normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0);
|
normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0);
|
||||||
|
|
||||||
gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 1.0);
|
// TangentNormal = clamp(TangentNormal + (blueNoise()*2.0-1.0)*0.005,-1.0,1.0);
|
||||||
|
|
||||||
|
gl_FragData[2] = vec4(encodeVec2(TangentNormal*0.5+0.5), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 1.0);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////// SPECULARS /////////////////////////////////////
|
//////////////////////////////// SPECULARS /////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
vec3 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rga;
|
|
||||||
|
|
||||||
|
vec3 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rga;
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////// DIFFUSE LIGHTING //////////////////////////////
|
//////////////////////////////// DIFFUSE LIGHTING //////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -594,7 +534,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
#else
|
#else
|
||||||
vec3 playerCamPos = cameraPosition;
|
vec3 playerCamPos = cameraPosition;
|
||||||
#endif
|
#endif
|
||||||
lightmap.x = max(lightmap.x, HELD_ITEM_BRIGHTNESS*clamp( pow(max(1.0-length((feetPlayerPos+cameraPosition) - playerCamPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0));
|
|
||||||
|
if(HELD_ITEM_BRIGHTNESS > 0.0){
|
||||||
|
float pointLight = clamp(1.0-length((feetPlayerPos+cameraPosition)-playerCamPos)/HANDHELD_LIGHT_RANGE,0.0,1.0);
|
||||||
|
lightmap.x = mix(lightmap.x , HELD_ITEM_BRIGHTNESS, pointLight*pointLight);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 Indirect_lighting = vec3(0.0);
|
vec3 Indirect_lighting = vec3(0.0);
|
||||||
@ -604,7 +549,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
vec3 Direct_lighting = vec3(0.0);
|
vec3 Direct_lighting = vec3(0.0);
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
vec3 DirectLightColor = lightCol.rgb/80.0;
|
vec3 DirectLightColor = lightCol.rgb/2400.0;
|
||||||
float NdotL = clamp(dot(normal, normalize(WsunVec*mat3(gbufferModelViewInverse))),0.0,1.0); NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
float NdotL = clamp(dot(normal, normalize(WsunVec*mat3(gbufferModelViewInverse))),0.0,1.0); NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
||||||
float Shadows = 1.0;
|
float Shadows = 1.0;
|
||||||
|
|
||||||
@ -619,11 +564,13 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
|
|
||||||
Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
||||||
|
|
||||||
Shadows *= pow(GetCloudShadow(feetPlayerPos),3);
|
#ifdef CLOUDS_SHADOWS
|
||||||
|
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
|
||||||
|
#endif
|
||||||
|
|
||||||
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
||||||
|
|
||||||
vec3 AmbientLightColor = averageSkyCol_Clouds/30.0;
|
vec3 AmbientLightColor = averageSkyCol_Clouds/900.0;
|
||||||
|
|
||||||
vec3 ambientcoefs = worldSpaceNormal / dot(abs(worldSpaceNormal), vec3(1.0));
|
vec3 ambientcoefs = worldSpaceNormal / dot(abs(worldSpaceNormal), vec3(1.0));
|
||||||
float SkylightDir = ambientcoefs.y*1.5;
|
float SkylightDir = ambientcoefs.y*1.5;
|
||||||
@ -635,26 +582,41 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
Indirect_lighting = skyCloudsFromTexLOD2(worldSpaceNormal, colortex4, 6).rgb / 30.0 ;
|
Indirect_lighting = volumetricsFromTex(normalize(worldSpaceNormal), colortex4, 0).rgb / 1200.0 / 1.5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
|
// float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0);
|
||||||
|
// vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds);
|
||||||
|
|
||||||
|
|
||||||
|
// float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
|
||||||
|
// vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
|
||||||
|
|
||||||
|
// float NdotL = clamp(dot(worldSpaceNormal, normalize(-lightPos))*0.5+0.5,0.0,1.0);
|
||||||
|
|
||||||
|
// NdotL *= NdotL;
|
||||||
|
|
||||||
|
// Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL;
|
||||||
|
|
||||||
float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0);
|
float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0);
|
||||||
vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds);
|
vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds);
|
||||||
|
|
||||||
|
|
||||||
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
|
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
|
||||||
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
|
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
|
||||||
|
|
||||||
float NdotL = clamp(dot(worldSpaceNormal, normalize(-lightPos))*0.5+0.5,0.0,1.0);
|
|
||||||
|
|
||||||
NdotL *= NdotL;
|
float end_NdotL = clamp(dot(worldSpaceNormal, normalize(-lightPos))*0.5+0.5,0.0,1.0);
|
||||||
|
end_NdotL *= end_NdotL;
|
||||||
|
|
||||||
Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL;
|
float fogShadow = GetEndFogShadow(feetPlayerPos+cameraPosition, lightPos);
|
||||||
|
float endPhase = endFogPhase(lightPos);
|
||||||
|
|
||||||
vec3 AmbientLightColor = vec3(0.3,0.6,1.0) * 0.5;
|
Direct_lighting += lightColors * endPhase * end_NdotL * fogShadow;
|
||||||
|
|
||||||
|
vec3 AmbientLightColor = vec3(0.3,0.6,1.0) ;
|
||||||
|
|
||||||
Indirect_lighting = AmbientLightColor + 0.7 * AmbientLightColor * dot(worldSpaceNormal, normalize(feetPlayerPos));
|
Indirect_lighting = AmbientLightColor + 0.7 * AmbientLightColor * dot(worldSpaceNormal, normalize(feetPlayerPos));
|
||||||
|
Indirect_lighting *= 0.1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
///////////////////////// BLOCKLIGHT LIGHTING OR LPV LIGHTING OR FLOODFILL COLORED LIGHTING
|
||||||
@ -680,136 +642,66 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
|
|
||||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||||
|
|
||||||
|
#if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3
|
||||||
|
Emission(FinalColor, Albedo, SpecularTex.b, exposure);
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////// SPECULAR LIGHTING /////////////////////////////
|
//////////////////////////////// SPECULAR LIGHTING /////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef DAMAGE_BLOCK_EFFECT
|
#ifdef DAMAGE_BLOCK_EFFECT
|
||||||
#undef WATER_REFLECTIONS
|
#undef FORWARD_SPECULAR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OVERWORLD_SHADER
|
#ifdef FORWARD_SPECULAR
|
||||||
#undef WATER_SUN_SPECULAR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WATER_REFLECTIONS
|
float harcodedF0 = 0.02;
|
||||||
// vec2 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rg;
|
|
||||||
|
|
||||||
// if nothing is chosen, no smoothness and no reflectance
|
// if nothing is chosen, no smoothness and no reflectance
|
||||||
vec2 specularValues = vec2(1.0, 0.0);
|
vec2 specularValues = vec2(1.0, 0.0);
|
||||||
|
|
||||||
// hardcode specular values for select blocks like glass, water, and slime
|
// hardcode specular values for select blocks like glass, water, and slime
|
||||||
if(isReflective) specularValues = vec2(1.0, 0.02);
|
if(isReflective) specularValues = vec2(1.0, harcodedF0);
|
||||||
|
|
||||||
// detect if the specular texture is used, if it is, overwrite hardcoded values
|
// detect if the specular texture is used, if it is, overwrite hardcoded values
|
||||||
if(SpecularTex.r > 0.0 && SpecularTex.g <= 1.0) specularValues = SpecularTex.rg;
|
if(SpecularTex.r > 0.0 && SpecularTex.g <= 1.0) specularValues = SpecularTex.rg;
|
||||||
|
|
||||||
float roughness = pow(1.0-specularValues.r,2.0);
|
float f0 = isReflective ? max(specularValues.g, harcodedF0) : specularValues.g;
|
||||||
float f0 = isReflective ? max(specularValues.g, 0.02) : specularValues.g;
|
|
||||||
|
|
||||||
#ifdef HAND
|
#ifdef HAND
|
||||||
f0 = max(specularValues.g, 0.02);
|
f0 = max(specularValues.g, harcodedF0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// f0 = SpecularTex.g;
|
float roughness = specularValues.r;
|
||||||
// roughness = pow(1.0-specularValues.r,2.0);
|
|
||||||
// f0 = 0.9;
|
|
||||||
// roughness = 0.0;
|
|
||||||
|
|
||||||
vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0);
|
|
||||||
|
|
||||||
// make sure zero alpha is not forced to be full alpha by fresnel on items with funny normal padding
|
|
||||||
if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0;
|
if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0;
|
||||||
|
|
||||||
if (f0 > 0.0){
|
if (f0 > 0.0){
|
||||||
|
if(isReflective) f0 = max(f0, harcodedF0);
|
||||||
|
|
||||||
|
float reflectance = 0.0;
|
||||||
|
|
||||||
if(isReflective) f0 = max(f0, 0.02);
|
#if !defined OVERWORLD_SHADER
|
||||||
|
|
||||||
vec3 Reflections_Final = vec3(0.0);
|
vec3 WsunVec = vec3(0.0);
|
||||||
vec4 Reflections = vec4(0.0);
|
vec3 DirectLightColor = WsunVec;
|
||||||
vec3 BackgroundReflection = FinalColor;
|
float Shadows = 0.0;
|
||||||
vec3 SunReflection = vec3(0.0);
|
|
||||||
float indoors = pow(1.0-pow(1.0-min(max(lightmap.y-0.6,0.0)*3.0,1.0),0.5),2.0);
|
|
||||||
|
|
||||||
vec3 reflectedVector = reflect(normalize(viewPos), normal);
|
|
||||||
float normalDotEye = dot(normal, normalize(viewPos));
|
|
||||||
|
|
||||||
float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
int seed = (frameCounter%40000) + frameCounter*2;
|
|
||||||
float noise = fract(R2_samples(seed).y + (1-blueNoise()));
|
|
||||||
mat3 Basis = CoordBase(viewToWorld(normal));
|
|
||||||
vec3 ViewDir = -normalize(feetPlayerPos)*Basis;
|
|
||||||
vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(roughness), noise);
|
|
||||||
vec3 Ln = reflect(-ViewDir, SamplePoints);
|
|
||||||
vec3 L = Basis * Ln;
|
|
||||||
fresnel = pow(clamp(1.0 + dot(-Ln, SamplePoints),0.0,1.0), 5.0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef SNELLS_WINDOW
|
|
||||||
// snells window looking thing
|
|
||||||
if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fresnel = mix(f0, 1.0, fresnel);
|
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), viewToWorld(normal), roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, false, reflectance);
|
||||||
|
|
||||||
// Sun, Sky, and screen-space reflections
|
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;
|
||||||
#ifdef OVERWORLD_SHADER
|
|
||||||
#ifdef WATER_SUN_SPECULAR
|
// invert the alpha blending darkening on the color so you can interpolate between diffuse and specular and keep buffer blending
|
||||||
SunReflection = Direct_lighting * GGX(normal, -normalize(viewPos), WsunVec*mat3(gbufferModelViewInverse), max(roughness,0.035), f0) * Metals;
|
gl_FragData[0].rgb = clamp(specularReflections / gl_FragData[0].a * 0.1,0.0,65000.0);
|
||||||
#endif
|
|
||||||
#ifdef WATER_BACKGROUND_SPECULAR
|
}else{
|
||||||
if(isEyeInWater == 0 && !isReflectiveEntity) BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0 * Metals;
|
gl_FragData[0].rgb = clamp(FinalColor * 0.1,0.0,65000.0);
|
||||||
#endif
|
|
||||||
|
|
||||||
if(isEyeInWater == 1 && isWater) BackgroundReflection.rgb = exp(-8.0 * vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B)) * clamp(WsunVec.y*lightCol.a,0,1);
|
|
||||||
#else
|
|
||||||
#ifdef WATER_BACKGROUND_SPECULAR
|
|
||||||
if(isEyeInWater == 0) BackgroundReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 * Metals;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SCREENSPACE_REFLECTIONS
|
|
||||||
float reflectLength = 0.0;
|
|
||||||
vec3 rtPos = rayTrace(reflectedVector, viewPos.xyz, interleaved_gradientNoise_temporal(), fresnel, isEyeInWater == 1,reflectLength);
|
|
||||||
if (rtPos.z < 1.0){
|
|
||||||
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
|
||||||
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
|
||||||
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
|
||||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
|
|
||||||
Reflections.a = 1.0;
|
|
||||||
Reflections.rgb = texture2D(colortex5, previousPosition.xy).rgb * Metals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0) * -4),0,1);
|
|
||||||
|
|
||||||
Reflections_Final = mix(mix(FinalColor, BackgroundReflection, indoors), Reflections.rgb, Reflections.a) * fresnel * visibilityFactor;
|
|
||||||
Reflections_Final += SunReflection;
|
|
||||||
|
|
||||||
//correct alpha channel with fresnel
|
|
||||||
float alpha0 = gl_FragData[0].a;
|
|
||||||
|
|
||||||
gl_FragData[0].a = -gl_FragData[0].a * fresnel + gl_FragData[0].a + fresnel;
|
|
||||||
|
|
||||||
// prevent reflections from being darkened by buffer blending
|
|
||||||
gl_FragData[0].rgb = clamp(FinalColor / gl_FragData[0].a*alpha0*(1.0-fresnel) * 0.1 + Reflections_Final / gl_FragData[0].a * 0.1,0.0,65100.0);
|
|
||||||
|
|
||||||
if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.0);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
gl_FragData[0].rgb = FinalColor*0.1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
gl_FragData[0].rgb = FinalColor*0.1;
|
gl_FragData[0].rgb = FinalColor*0.1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3
|
|
||||||
Emission(gl_FragData[0].rgb, Albedo, SpecularTex.b, exposure);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND
|
#if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND
|
||||||
bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > far-16*4 && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0;
|
bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > far-16*4 && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0;
|
||||||
@ -824,16 +716,20 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0);
|
if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0);
|
||||||
#endif
|
#endif
|
||||||
#if DEBUG_VIEW == debug_NORMALS
|
#if DEBUG_VIEW == debug_NORMALS
|
||||||
gl_FragData[0].rgb = normalize(normal.xyz) * 0.1;
|
gl_FragData[0].rgb = viewToWorld(normalize(normal.xyz)) * 0.1;
|
||||||
|
gl_FragData[0].a = 1;
|
||||||
#endif
|
#endif
|
||||||
#if DEBUG_VIEW == debug_INDIRECT
|
#if DEBUG_VIEW == debug_INDIRECT
|
||||||
gl_FragData[0].rgb = Indirect_lighting* 0.1;
|
gl_FragData[0].rgb = Indirect_lighting * 0.1;
|
||||||
#endif
|
#endif
|
||||||
#if DEBUG_VIEW == debug_DIRECT
|
#if DEBUG_VIEW == debug_DIRECT
|
||||||
gl_FragData[0].rgb = Direct_lighting * 0.1;
|
gl_FragData[0].rgb = Direct_lighting * 0.1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[3].a = clamp(lightmap.y,0.0,1.0);
|
// gl_FragData[3].a = clamp(lightmap.y,0.0,1.0);
|
||||||
|
|
||||||
|
gl_FragData[3] = vec4(encodeVec2(lightmap.x, lightmap.y), 1, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,10 +25,11 @@ flat varying float exposure;
|
|||||||
flat varying vec4 lightCol;
|
flat varying vec4 lightCol;
|
||||||
flat varying vec3 WsunVec;
|
flat varying vec3 WsunVec;
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams0;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
varying vec4 normalMat;
|
varying vec4 normalMat;
|
||||||
@ -132,6 +133,15 @@ void main() {
|
|||||||
position = mat3(gbufferModelView) * (displacedPos - cameraPosition) + gbufferModelView[3].xyz;
|
position = mat3(gbufferModelView) * (displacedPos - cameraPosition) + gbufferModelView[3].xyz;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
|
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||||
|
#ifdef PLANET_CURVATURE
|
||||||
|
float curvature = length(worldpos) / (16*8);
|
||||||
|
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||||
|
#endif
|
||||||
|
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||||
|
|
||||||
gl_Position = toClipSpace3(position);
|
gl_Position = toClipSpace3(position);
|
||||||
|
|
||||||
HELD_ITEM_BRIGHTNESS = 0.0;
|
HELD_ITEM_BRIGHTNESS = 0.0;
|
||||||
@ -149,7 +159,6 @@ void main() {
|
|||||||
// water mask
|
// water mask
|
||||||
if(mc_Entity.x == 8.0) {
|
if(mc_Entity.x == 8.0) {
|
||||||
mat = 1.0;
|
mat = 1.0;
|
||||||
gl_Position.z -= 1e-4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// translucent entities
|
// translucent entities
|
||||||
@ -193,8 +202,8 @@ void main() {
|
|||||||
// WsunVec = normalize(LightDir);
|
// WsunVec = normalize(LightDir);
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#if defined Daily_Weather
|
||||||
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);
|
||||||
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,20 +69,20 @@ void main() {
|
|||||||
minimumBrightness = 10.0;
|
minimumBrightness = 10.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float autoBrightnessAdjust = mix(minimumBrightness, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
|
// float autoBrightnessAdjust = mix(minimumBrightness, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
|
||||||
|
|
||||||
#ifdef DISABLE_VANILLA_EMISSIVES
|
#ifdef DISABLE_VANILLA_EMISSIVES
|
||||||
vec3 emissiveColor = vec3(0.0);
|
vec3 emissiveColor = vec3(0.0);
|
||||||
Albedo.a = 0.0;
|
Albedo.a = 0.0;
|
||||||
#else
|
#else
|
||||||
vec3 emissiveColor = Albedo.rgb * color.a * autoBrightnessAdjust;
|
vec3 emissiveColor = Albedo.rgb * color.a ;//* autoBrightnessAdjust;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0] = vec4(emissiveColor*0.1, Albedo.a * sqrt(color.a));
|
gl_FragData[0] = vec4(emissiveColor*0.1, Albedo.a * sqrt(color.a));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENCHANT_GLINT
|
#ifdef ENCHANT_GLINT
|
||||||
float autoBrightnessAdjust = mix(0.1, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
|
// float autoBrightnessAdjust = mix(0.1, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
|
||||||
|
|
||||||
Albedo.rgb = clamp(Albedo.rgb ,0.0,1.0); // for safety
|
Albedo.rgb = clamp(Albedo.rgb ,0.0,1.0); // for safety
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ void main() {
|
|||||||
vec3 GlintColor = vec3(0.0);
|
vec3 GlintColor = vec3(0.0);
|
||||||
Albedo.a = 0.0;
|
Albedo.a = 0.0;
|
||||||
#else
|
#else
|
||||||
vec3 GlintColor = Albedo.rgb * autoBrightnessAdjust * Emissive_Brightness;
|
vec3 GlintColor = Albedo.rgb * Emissive_Brightness;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,11 +21,14 @@ uniform sampler2D depthtex1;
|
|||||||
uniform sampler2D colortex1;
|
uniform sampler2D colortex1;
|
||||||
uniform sampler2D colortex3; // Noise
|
uniform sampler2D colortex3; // Noise
|
||||||
uniform sampler2D colortex6; // Noise
|
uniform sampler2D colortex6; // Noise
|
||||||
|
uniform sampler2D colortex7; // Noise
|
||||||
uniform sampler2D colortex8; // Noise
|
uniform sampler2D colortex8; // Noise
|
||||||
uniform sampler2D colortex14; // Noise
|
uniform sampler2D colortex14; // Noise
|
||||||
|
uniform sampler2D colortex10; // Noise
|
||||||
uniform sampler2D colortex12; // Noise
|
uniform sampler2D colortex12; // Noise
|
||||||
|
uniform sampler2D colortex13; // Noise
|
||||||
uniform sampler2D colortex15; // Noise
|
uniform sampler2D colortex15; // Noise
|
||||||
|
uniform int isEyeInWater;
|
||||||
uniform sampler2D shadow;
|
uniform sampler2D shadow;
|
||||||
|
|
||||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||||
@ -121,30 +124,39 @@ vec2 decodeVec2(float a){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float interleaved_gradientNoise_temporal(){
|
float interleaved_gradientNoise_temporal(){
|
||||||
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
vec2 coord = gl_FragCoord.xy;
|
||||||
|
|
||||||
|
#ifdef TAA
|
||||||
|
coord += (frameCounter*9)%40000;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
}
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
return noise;
|
return noise;
|
||||||
}
|
}
|
||||||
|
|
||||||
float R2_dither(){
|
float R2_dither(){
|
||||||
#ifdef TAA
|
vec2 coord = gl_FragCoord.xy ;
|
||||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
|
||||||
#else
|
#ifdef TAA
|
||||||
vec2 coord = gl_FragCoord.xy;
|
coord += (frameCounter*2)%40000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||||
}
|
}
|
||||||
float blueNoise(){
|
float blueNoise(){
|
||||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
#ifdef TAA
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
vec4 blueNoise(vec2 coord){
|
vec4 blueNoise(vec2 coord){
|
||||||
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
||||||
}
|
}
|
||||||
vec2 R2_samples(int n){
|
vec2 R2_samples(int n){
|
||||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
@ -236,63 +248,53 @@ float convertHandDepth_2(in float depth, bool hand) {
|
|||||||
ndcDepth /= MC_HAND_DEPTH;
|
ndcDepth /= MC_HAND_DEPTH;
|
||||||
return ndcDepth * 0.5 + 0.5;
|
return ndcDepth * 0.5 + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 SSAO(
|
vec2 SSAO(
|
||||||
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
||||||
){
|
){
|
||||||
// if(hand) return vec2(1.0,0.0);
|
|
||||||
int samples = 7;
|
int samples = 7;
|
||||||
float occlusion = 0.0;
|
float occlusion = 0.0;
|
||||||
float sss = 0.0;
|
float sss = 0.0;
|
||||||
|
|
||||||
|
vec3 normalizedNormals = normalize(normal);
|
||||||
|
vec2 jitterOffsets = TAA_Offset*texelSize*0.5 * RENDER_SCALE - texelSize*0.5;
|
||||||
|
|
||||||
float dist = 1.0 + clamp(viewPos.z*viewPos.z/50.0,0,5); // shrink sample size as distance increases
|
// scale the offset radius down as distance increases.
|
||||||
float mulfov2 = gbufferProjection[1][1]/(3 * dist);
|
float linearViewDistance = length(viewPos);
|
||||||
float maxR2 = viewPos.z*viewPos.z*mulfov2*2.0 * 5.0 / mix(4.0, 50.0, clamp(viewPos.z*viewPos.z - 0.1,0,1));
|
float distanceScale = hand ? 30.0 : mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
|
||||||
|
float depthCancelation = (linearViewDistance*linearViewDistance) / distanceScale * 0.5;
|
||||||
#ifdef Ambient_SSS
|
|
||||||
float maxR2_2 = viewPos.z;//*viewPos.z*mulfov2*2.*2./4.0;
|
|
||||||
|
|
||||||
float dist3 = clamp(1-exp( viewPos.z*viewPos.z / -50),0,1);
|
|
||||||
// if(leaves) maxR2_2 = 0.1;
|
|
||||||
// if(leaves) maxR2_2 = mix(10, maxR2_2, dist3);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec2 acc = -(TAA_Offset*(texelSize/2.0))*RENDER_SCALE ;
|
|
||||||
|
|
||||||
// vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg;
|
|
||||||
|
|
||||||
int n = 0;
|
|
||||||
|
|
||||||
float leaf = leaves ? -0.5 : 0.0;
|
float leaf = leaves ? -0.5 : 0.0;
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < samples; i++) {
|
for (int i = 0; i < samples; i++) {
|
||||||
|
|
||||||
// vec2 sampleOffset = (SpiralSample(i, 7, 8 , noise)) * mulfov2 * clamp(0.05 + i*0.095, 0.0,0.3) ;
|
vec2 offsets = CleanSample(i, samples - 1, noise) / distanceScale;
|
||||||
vec2 sampleOffset = CleanSample(i, samples - 1, noise) * mulfov2 * 0.3 ;
|
|
||||||
|
|
||||||
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
|
ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE);
|
||||||
|
|
||||||
|
if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) {
|
||||||
|
|
||||||
|
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
|
||||||
|
|
||||||
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth*RENDER_SCALE.x && offset.y < viewHeight*RENDER_SCALE.y ) {
|
|
||||||
#ifdef DISTANT_HORIZONS
|
#ifdef DISTANT_HORIZONS
|
||||||
float dhdepth = texelFetch2D(dhDepthTex1, offset,0).x;
|
float sampleDHDepth = texelFetch2D(dhDepthTex1, offsetUV, 0).x;
|
||||||
|
vec3 offsetViewPos = toScreenSpace_DH((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth, sampleDHDepth);
|
||||||
#else
|
#else
|
||||||
float dhdepth = 0.0;
|
vec3 offsetViewPos = toScreenSpace(vec3((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 t0 = toScreenSpace_DH((offset*texelSize+acc+0.5*texelSize) * (1.0/RENDER_SCALE), convertHandDepth_2(texelFetch2D(depthtex1, offset,0).x, hand), dhdepth);
|
vec3 viewPosDiff = offsetViewPos - viewPos;
|
||||||
|
float viewPosDiffSquared = dot(viewPosDiff, viewPosDiff);
|
||||||
vec3 vec = (t0.xyz - viewPos);
|
|
||||||
float dsquared = dot(vec, vec);
|
|
||||||
|
|
||||||
if (dsquared > 1e-5){
|
if (viewPosDiffSquared > 1e-5){
|
||||||
|
if(viewPosDiffSquared < depthCancelation){
|
||||||
if( dsquared < maxR2){
|
float NdotV = clamp(dot(viewPosDiff*inversesqrt(viewPosDiffSquared), normalizedNormals),0.0,1.0);
|
||||||
float NdotV = clamp(dot(vec*inversesqrt(dsquared), normalize(normal)),0.,1.);
|
occlusion += NdotV * clamp(1.0-(viewPosDiffSquared/depthCancelation),0.0,1.0);
|
||||||
occlusion += NdotV * clamp(1.0-dsquared/maxR2,0.0,1.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Ambient_SSS
|
#ifdef Ambient_SSS
|
||||||
sss += clamp(leaf - dot(vec, normalize(normal)),0.0,1.0);
|
sss += clamp(0.0 - dot(viewPosDiff, normalizedNormals),0.0,1.0) * exp(-10.0 * occlusion);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
n += 1;
|
n += 1;
|
||||||
@ -302,6 +304,52 @@ vec2 SSAO(
|
|||||||
return max(1.0 - vec2(occlusion*AO_Strength, sss)/n, 0.0);
|
return max(1.0 - vec2(occlusion*AO_Strength, sss)/n, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ScreenSpace_SSS(
|
||||||
|
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
||||||
|
){
|
||||||
|
int samples = 7;
|
||||||
|
float occlusion = 0.0;
|
||||||
|
float sss = 0.0;
|
||||||
|
|
||||||
|
vec3 normalizedNormals = normalize(normal);
|
||||||
|
vec2 jitterOffsets = TAA_Offset*texelSize*0.5 * RENDER_SCALE - texelSize*0.5;
|
||||||
|
|
||||||
|
// scale the offset radius down as distance increases.
|
||||||
|
float linearViewDistance = length(viewPos);
|
||||||
|
float distanceScale = hand ? 30.0 : mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
|
||||||
|
|
||||||
|
float leaf = leaves ? -0.5 : 0.0;
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < samples; i++) {
|
||||||
|
|
||||||
|
vec2 offsets = CleanSample(i, samples - 1, noise) / distanceScale;
|
||||||
|
|
||||||
|
ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE);
|
||||||
|
|
||||||
|
if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) {
|
||||||
|
|
||||||
|
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
float sampleDHDepth = texelFetch2D(dhDepthTex1, offsetUV, 0).x;
|
||||||
|
vec3 offsetViewPos = toScreenSpace_DH((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth, sampleDHDepth);
|
||||||
|
#else
|
||||||
|
vec3 offsetViewPos = toScreenSpace(vec3((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec3 viewPosDiff = offsetViewPos - viewPos;
|
||||||
|
float viewPosDiffSquared = dot(viewPosDiff, viewPosDiff);
|
||||||
|
|
||||||
|
if (viewPosDiffSquared > 1e-5){
|
||||||
|
sss += clamp(leaf - dot(viewPosDiff, normalizedNormals),0.0,1.0);
|
||||||
|
n += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return max(1.0 - sss/n, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
vec4 encode (vec3 n, vec2 lightmaps){
|
vec4 encode (vec3 n, vec2 lightmaps){
|
||||||
n.xy = n.xy / dot(abs(n), vec3(1.0));
|
n.xy = n.xy / dot(abs(n), vec3(1.0));
|
||||||
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
|
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
|
||||||
@ -366,14 +414,59 @@ float sampleDepth(sampler2D depthTex, vec2 texcoord, bool hand){
|
|||||||
return convertHandDepth_2(texture2D(depthTex, texcoord).r, hand);
|
return convertHandDepth_2(texture2D(depthTex, texcoord).r, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flat varying vec3 zMults;
|
||||||
|
|
||||||
|
vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){
|
||||||
|
ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION);
|
||||||
|
ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling;
|
||||||
|
ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION);
|
||||||
|
ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1);
|
||||||
|
|
||||||
|
ivec2 getRadius[5] = ivec2[](
|
||||||
|
ivec2(-1,-1),
|
||||||
|
ivec2( 1, 1),
|
||||||
|
ivec2(-1, 1),
|
||||||
|
ivec2( 1,-1),
|
||||||
|
ivec2( 0, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
float diffThreshold = 0.01;
|
||||||
|
#else
|
||||||
|
float diffThreshold = zMults.x;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec4 RESULT = vec4(0.0);
|
||||||
|
float SUM = 0.0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
|
||||||
|
ivec2 radius = getRadius[i];
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0);
|
||||||
|
#else
|
||||||
|
float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5;
|
||||||
|
|
||||||
|
RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES;
|
||||||
|
|
||||||
|
SUM += EDGES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RESULT / SUM;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* RENDERTARGETS:3,14,12*/
|
#include "/lib/sky_gradient.glsl"
|
||||||
|
|
||||||
|
/* RENDERTARGETS:3,14,12,10*/
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
float noise = R2_dither();
|
float noise = R2_dither();
|
||||||
|
|
||||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||||
|
|
||||||
float z = texture2D(depthtex1,texcoord).x;
|
float z = texture2D(depthtex1,texcoord).x;
|
||||||
@ -389,7 +482,7 @@ void main() {
|
|||||||
|
|
||||||
vec4 SHADOWDATA = vec4(0.0);
|
vec4 SHADOWDATA = vec4(0.0);
|
||||||
|
|
||||||
vec4 data = texture2D(colortex1,texcoord);
|
vec4 data = texelFetch2D(colortex1,ivec2(gl_FragCoord.xy),0);
|
||||||
vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y));
|
vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y));
|
||||||
vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w));
|
vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w));
|
||||||
vec3 normal = mat3(gbufferModelViewInverse) * clamp(worldToView( decode(dataUnpacked0.yw) ),-1.,1.);
|
vec3 normal = mat3(gbufferModelViewInverse) * clamp(worldToView( decode(dataUnpacked0.yw) ),-1.,1.);
|
||||||
@ -437,13 +530,11 @@ void main() {
|
|||||||
gl_FragData[2] = vec4(vec3(0.0), 65000.0);
|
gl_FragData[2] = vec4(vec3(0.0), 65000.0);
|
||||||
|
|
||||||
|
|
||||||
vec3 FlatNormals = texture2D(colortex15,texcoord).rgb * 2.0 - 1.0;
|
vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0);
|
||||||
|
if(z >= 1.0) FlatNormals = normal;
|
||||||
if(z >= 1.0){
|
|
||||||
FlatNormals = normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise);
|
|
||||||
|
vec2 SSAO_SSS = SSAO(viewPos, worldToView(FlatNormals), hand, isLeaf, noise);
|
||||||
|
|
||||||
if(swappedDepth >= 1.0) SSAO_SSS = vec2(1.0,0.0);
|
if(swappedDepth >= 1.0) SSAO_SSS = vec2(1.0,0.0);
|
||||||
|
|
||||||
@ -453,6 +544,21 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------- VOLUMETRICS BEHIND TRANSLUCENTS PASS-THROUGH -------------*/
|
||||||
|
// colortex10 is the history buffer used in reprojection of volumetrics, i can just hijack that.
|
||||||
|
gl_FragData[3] = texture2D(colortex10, texcoord);
|
||||||
|
|
||||||
|
// if(texture2D(colortex7,texcoord).a > 0.0) {
|
||||||
|
// vec4 VL = BilateralUpscale_VLFOG(colortex13, depthtex1, gl_FragCoord.xy - 1.5, ld(z));
|
||||||
|
|
||||||
|
// // gl_FragData[3].rgb += VL.rgb * gl_FragData[3].a;
|
||||||
|
// // gl_FragData[3].a *= VL.a;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
float SpecularTex = texture2D(colortex8,texcoord).z;
|
float SpecularTex = texture2D(colortex8,texcoord).z;
|
||||||
float LabSSS = clamp((-64.0 + SpecularTex * 255.0) / 191.0 ,0.0,1.0);
|
float LabSSS = clamp((-64.0 + SpecularTex * 255.0) / 191.0 ,0.0,1.0);
|
||||||
@ -463,9 +569,7 @@ void main() {
|
|||||||
float minshadowfilt = Min_Shadow_Filter_Radius;
|
float minshadowfilt = Min_Shadow_Filter_Radius;
|
||||||
float maxshadowfilt = Max_Shadow_Filter_Radius;
|
float maxshadowfilt = Max_Shadow_Filter_Radius;
|
||||||
|
|
||||||
// if(lightmap.y < 0.1 && !entities){
|
if(lightmap.y < 0.1) maxshadowfilt = min(maxshadowfilt, minshadowfilt);
|
||||||
// maxshadowfilt = mix(minshadowfilt, maxshadowfilt, vanillAO);
|
|
||||||
// }
|
|
||||||
|
|
||||||
#ifdef BASIC_SHADOW_FILTER
|
#ifdef BASIC_SHADOW_FILTER
|
||||||
if (LabSSS > 0.0 && NdotL < 0.001){
|
if (LabSSS > 0.0 && NdotL < 0.001){
|
||||||
|
@ -12,6 +12,10 @@ uniform vec3 sunPosition;
|
|||||||
uniform mat4 gbufferModelViewInverse;
|
uniform mat4 gbufferModelViewInverse;
|
||||||
|
|
||||||
|
|
||||||
|
flat varying vec3 zMults;
|
||||||
|
|
||||||
|
uniform float far;
|
||||||
|
uniform float near;
|
||||||
|
|
||||||
#include "/lib/util.glsl"
|
#include "/lib/util.glsl"
|
||||||
#include "/lib/res_params.glsl"
|
#include "/lib/res_params.glsl"
|
||||||
@ -26,6 +30,8 @@ void main() {
|
|||||||
WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||||
|
|
||||||
|
|
||||||
|
zMults = vec3(1.0/(far * near),far+near,far-near);
|
||||||
|
|
||||||
#ifdef TAA
|
#ifdef TAA
|
||||||
TAA_Offset = offsets[framemod8];
|
TAA_Offset = offsets[framemod8];
|
||||||
#else
|
#else
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,10 +5,11 @@
|
|||||||
flat varying float Flashing;
|
flat varying float Flashing;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams0;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
flat varying vec3 WsunVec;
|
flat varying vec3 WsunVec;
|
||||||
flat varying vec3 unsigned_WsunVec;
|
flat varying vec3 unsigned_WsunVec;
|
||||||
@ -53,14 +54,14 @@ void main() {
|
|||||||
|
|
||||||
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||||
|
|
||||||
WsunVec = lightCol.a*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
|
||||||
unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||||
|
WsunVec = lightCol.a*unsigned_WsunVec;
|
||||||
|
|
||||||
exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;
|
exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#if defined Daily_Weather
|
||||||
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);
|
||||||
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TAA
|
#ifdef TAA
|
||||||
|
@ -106,7 +106,7 @@ vec2 texcoord = ((gl_FragCoord.xy)*2.0 + 0.5)*texelSize;
|
|||||||
bloom += texture2D_bicubic(colortex6,texcoord/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb * weights[5]; //1/128 res
|
bloom += texture2D_bicubic(colortex6,texcoord/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb * weights[5]; //1/128 res
|
||||||
bloom += texture2D_bicubic(colortex6,texcoord/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb * weights[6]; //1/256 res
|
bloom += texture2D_bicubic(colortex6,texcoord/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb * weights[6]; //1/256 res
|
||||||
|
|
||||||
gl_FragData[0].rgb = bloom * 3.0;
|
gl_FragData[0].rgb = bloom * 2.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0].rgb = clamp(gl_FragData[0].rgb,0.0,65000.);
|
gl_FragData[0].rgb = clamp(gl_FragData[0].rgb,0.0,65000.);
|
||||||
|
@ -14,7 +14,7 @@ uniform sampler2D colortex3;
|
|||||||
// uniform sampler2D colortex6;
|
// uniform sampler2D colortex6;
|
||||||
uniform sampler2D colortex7;
|
uniform sampler2D colortex7;
|
||||||
// uniform sampler2D colortex8; // specular
|
// uniform sampler2D colortex8; // specular
|
||||||
// uniform sampler2D colortex9; // specular
|
uniform sampler2D colortex9; // specular
|
||||||
uniform sampler2D depthtex0;
|
uniform sampler2D depthtex0;
|
||||||
uniform sampler2D depthtex1;
|
uniform sampler2D depthtex1;
|
||||||
uniform sampler2D noisetex;
|
uniform sampler2D noisetex;
|
||||||
@ -72,12 +72,6 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
|||||||
return (near * far) / (depth * (near - far) + far);
|
return (near * far) / (depth * (near - far) + far);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float bloomWeight(){
|
float bloomWeight(){
|
||||||
|
|
||||||
float weights[7] = float[]( 1.0, 1.0/2.0, 1.0/3.0, 1.0/5.5, 1.0/8.0, 1.0/10.0, 1.0/12.0 );
|
float weights[7] = float[]( 1.0, 1.0/2.0, 1.0/3.0, 1.0/5.5, 1.0/8.0, 1.0/10.0, 1.0/12.0 );
|
||||||
@ -91,9 +85,102 @@ float bloomWeight(){
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
vec3 invTonemap(vec3 col){
|
||||||
|
return col/(1-luma(col));
|
||||||
|
}
|
||||||
#define linear_to_srgb(x) (pow(x, vec3(1.0/2.2)))
|
#define linear_to_srgb(x) (pow(x, vec3(1.0/2.2)))
|
||||||
|
|
||||||
|
uniform sampler2D colortex6;
|
||||||
|
|
||||||
|
|
||||||
|
float w0(float a)
|
||||||
|
{
|
||||||
|
return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
float w1(float a)
|
||||||
|
{
|
||||||
|
return (1.0/6.0)*(a*a*(3.0*a - 6.0) + 4.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
float w2(float a)
|
||||||
|
{
|
||||||
|
return (1.0/6.0)*(a*(a*(-3.0*a + 3.0) + 3.0) + 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
float w3(float a)
|
||||||
|
{
|
||||||
|
return (1.0/6.0)*(a*a*a);
|
||||||
|
}
|
||||||
|
|
||||||
|
float g0(float a)
|
||||||
|
{
|
||||||
|
return w0(a) + w1(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
float g1(float a)
|
||||||
|
{
|
||||||
|
return w2(a) + w3(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
float h0(float a)
|
||||||
|
{
|
||||||
|
return -1.0 + w1(a) / (w0(a) + w1(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
float h1(float a)
|
||||||
|
{
|
||||||
|
return 1.0 + w3(a) / (w2(a) + w3(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 texture2D_bicubic(sampler2D tex, vec2 uv)
|
||||||
|
{
|
||||||
|
vec4 texelSize = vec4(texelSize,1.0/texelSize);
|
||||||
|
uv = uv*texelSize.zw;
|
||||||
|
vec2 iuv = floor( uv );
|
||||||
|
vec2 fuv = fract( uv );
|
||||||
|
|
||||||
|
float g0x = g0(fuv.x);
|
||||||
|
float g1x = g1(fuv.x);
|
||||||
|
float h0x = h0(fuv.x);
|
||||||
|
float h1x = h1(fuv.x);
|
||||||
|
float h0y = h0(fuv.y);
|
||||||
|
float h1y = h1(fuv.y);
|
||||||
|
|
||||||
|
vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - 0.5) * texelSize.xy;
|
||||||
|
vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - 0.5) * texelSize.xy;
|
||||||
|
vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - 0.5) * texelSize.xy;
|
||||||
|
vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * texelSize.xy;
|
||||||
|
|
||||||
|
return g0(fuv.y) * (g0x * texture2D(tex, p0) +
|
||||||
|
g1x * texture2D(tex, p1)) +
|
||||||
|
g1(fuv.y) * (g0x * texture2D(tex, p2) +
|
||||||
|
g1x * texture2D(tex, p3));
|
||||||
|
}
|
||||||
|
|
||||||
|
// vec3 lenseFlare(vec2 UV){
|
||||||
|
// float noise = blueNoise();
|
||||||
|
|
||||||
|
// float vignetteLength = 0.2;
|
||||||
|
// float vignette = 0.5+length(texcoord-0.5);//min(max(length(texcoord-0.5) - vignetteLength,0.0) / (1.0/(1.0-vignetteLength)),1.0);
|
||||||
|
|
||||||
|
// float aberrationStrength = vignette;//clamp(CHROMATIC_ABERRATION_STRENGTH * 0.01 * (1.0 - vignette),0.0,0.9) * vignette * 0.75;
|
||||||
|
|
||||||
|
// vec2 centeredUV = texcoord - 0.5;
|
||||||
|
|
||||||
|
// vec3 color = vec3(0.0);
|
||||||
|
// color = texture2D(colortex7, texcoord).rgb;
|
||||||
|
|
||||||
|
// vec2 distortedUV = (centeredUV - (centeredUV ) * aberrationStrength) + 0.5;
|
||||||
|
|
||||||
|
// color += texture2D(colortex7, distortedUV).rgb;
|
||||||
|
// // color.r = texture2D(colortex7, (centeredUV - (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).r;
|
||||||
|
// // color.g = texture2D(colortex7, texcoord).g;
|
||||||
|
// // color.b = texture2D(colortex7, (centeredUV + (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).b;
|
||||||
|
|
||||||
|
// return color;
|
||||||
|
// }
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
/* DRAWBUFFERS:7 */
|
/* DRAWBUFFERS:7 */
|
||||||
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
|
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
|
||||||
@ -132,16 +219,21 @@ void main() {
|
|||||||
|
|
||||||
vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.));
|
vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.));
|
||||||
|
|
||||||
|
vec2 resScale = vec2(1920.,1080.)/clampedRes;
|
||||||
|
vec2 bloomTileUV = (((gl_FragCoord.xy)*2.0 + 0.5)*texelSize/2.0) / clampedRes*vec2(1920.,1080.);
|
||||||
|
|
||||||
#ifdef OLD_BLOOM
|
vec3 bloomTile0 = texture2D_bicubic(colortex3, bloomTileUV/2.).rgb; //1/4 res
|
||||||
vec3 bloom = texture2D(colortex3, texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY ).rgb / 2.0 / 7.0;
|
vec3 bloomTile1 = texture2D_bicubic(colortex6, bloomTileUV/4.).rgb; //1/8 res
|
||||||
float lightScat = clamp((BLOOM_STRENGTH+3) * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette;
|
vec3 bloomTile2 = texture2D_bicubic(colortex6, bloomTileUV/8.+vec2(0.25*resScale.x+2.5*texelSize.x,.0)).rgb; //1/16 res
|
||||||
#else
|
vec3 bloomTile3 = texture2D_bicubic(colortex6, bloomTileUV/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; //1/32 res
|
||||||
vec3 bloom = texture2D(colortex3, texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY ).rgb / 3.0 / bloomWeight();
|
vec3 bloomTile4 = texture2D_bicubic(colortex6, bloomTileUV/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb; //1/64 res
|
||||||
float lightScat = clamp(BLOOM_STRENGTH * 0.5 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette;
|
vec3 bloomTile5 = texture2D_bicubic(colortex6, bloomTileUV/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb; //1/128 res
|
||||||
#endif
|
vec3 bloomTile6 = texture2D_bicubic(colortex6, bloomTileUV/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb; //1/256 res
|
||||||
|
|
||||||
|
float weights[7] = float[]( 1.0, 1.0/2.0, 1.0/3.0, 1.0/5.5, 1.0/8.0, 1.0/10.0, 1.0/12.0 );
|
||||||
|
vec3 bloom = (bloomTile0*weights[0] + bloomTile1*weights[1] + bloomTile2*weights[2] + bloomTile3*weights[3] + bloomTile4*weights[4] + bloomTile5*weights[5] + bloomTile6*weights[6]) / bloomWeight();
|
||||||
|
vec3 fogBloom = (bloomTile0 + bloomTile1 + bloomTile2 + bloomTile3 + bloomTile4 + bloomTile5 + bloomTile6) / 7.0;
|
||||||
|
|
||||||
float VL_abs = texture2D(colortex7, texcoord*RENDER_SCALE).r;
|
|
||||||
|
|
||||||
#ifdef AUTO_EXPOSURE
|
#ifdef AUTO_EXPOSURE
|
||||||
float purkinje = clamp(exposure.a*exposure.a,0.0,1.0) * clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength,0,1);
|
float purkinje = clamp(exposure.a*exposure.a,0.0,1.0) * clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength,0,1);
|
||||||
@ -149,9 +241,12 @@ void main() {
|
|||||||
float purkinje = clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength,0,1);
|
float purkinje = clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength,0,1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
float lightScat = clamp(BLOOM_STRENGTH * 0.3,0.0,1.0) * vignette;
|
||||||
|
float VL_abs = texture2D(colortex7, texcoord*RENDER_SCALE).r;
|
||||||
|
|
||||||
VL_abs = clamp((1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0);
|
VL_abs = clamp((1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0);
|
||||||
|
|
||||||
col = (mix(col, bloom, VL_abs) + bloom * lightScat) * exposure.rgb;
|
col = (mix(col, fogBloom, VL_abs) + bloom*lightScat) * exposure.rgb;
|
||||||
|
|
||||||
float lum = dot(col, vec3(0.15,0.3,0.55));
|
float lum = dot(col, vec3(0.15,0.3,0.55));
|
||||||
float lum2 = dot(col, vec3(0.85,0.7,0.45));
|
float lum2 = dot(col, vec3(0.85,0.7,0.45));
|
||||||
|
@ -13,6 +13,7 @@ uniform float viewWidth;
|
|||||||
uniform float aspectRatio;
|
uniform float aspectRatio;
|
||||||
|
|
||||||
uniform float frameTimeCounter;
|
uniform float frameTimeCounter;
|
||||||
|
uniform int frameCounter;
|
||||||
|
|
||||||
uniform int hideGUI;
|
uniform int hideGUI;
|
||||||
|
|
||||||
@ -134,11 +135,41 @@ vec3 saturationAndCrosstalk(vec3 color){
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float interleaved_gradientNoise(){
|
||||||
|
vec2 coord = gl_FragCoord.xy;
|
||||||
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
|
return noise;
|
||||||
|
}
|
||||||
|
float blueNoise(){
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 chromaticAberration(vec2 UV){
|
||||||
|
float noise = blueNoise() - 0.5;
|
||||||
|
|
||||||
|
vec2 centeredUV = (texcoord - 0.5);
|
||||||
|
// not stretched by aspect ratio; circular by choice :) it makes most the abberation on the left/right of the screen.
|
||||||
|
float vignette = 1.0 - clamp(1.0 - length(centeredUV * vec2(aspectRatio,1.0)) / 200.0,0.0,1.0);
|
||||||
|
|
||||||
|
float aberrationStrength = CHROMATIC_ABERRATION_STRENGTH * vignette;
|
||||||
|
|
||||||
|
vec3 color = vec3(0.0);
|
||||||
|
color.r = texture2D(colortex7, (centeredUV - (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).r;
|
||||||
|
color.g = texture2D(colortex7, texcoord).g;
|
||||||
|
color.b = texture2D(colortex7, (centeredUV + (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).b;
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
/* DRAWBUFFERS:7 */
|
/* DRAWBUFFERS:7 */
|
||||||
|
|
||||||
vec3 color = texture2D(colortex7,texcoord).rgb;
|
#ifdef CHROMATIC_ABERRATION
|
||||||
|
vec3 color = chromaticAberration(texcoord);
|
||||||
|
#else
|
||||||
|
vec3 color = texture2D(colortex7,texcoord).rgb;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONTRAST_ADAPTATIVE_SHARPENING
|
#ifdef CONTRAST_ADAPTATIVE_SHARPENING
|
||||||
color = contrastAdaptiveSharpening(color, texcoord);
|
color = contrastAdaptiveSharpening(color, texcoord);
|
||||||
@ -153,6 +184,6 @@ void main() {
|
|||||||
#ifdef COLOR_GRADING_ENABLED
|
#ifdef COLOR_GRADING_ENABLED
|
||||||
color = colorGrading(color);
|
color = colorGrading(color);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0].rgb = clamp(int8Dither(color, texcoord),0.0,1.0);
|
gl_FragData[0].rgb = clamp(int8Dither(color, texcoord),0.0,1.0);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ uniform sampler2D colortex3;
|
|||||||
// uniform sampler2D colortex4;
|
// uniform sampler2D colortex4;
|
||||||
uniform sampler2D colortex6;
|
uniform sampler2D colortex6;
|
||||||
uniform sampler2D colortex7;
|
uniform sampler2D colortex7;
|
||||||
|
uniform sampler2D colortex10;
|
||||||
|
|
||||||
flat varying vec3 WsunVec;
|
flat varying vec3 WsunVec;
|
||||||
uniform vec3 sunVec;
|
uniform vec3 sunVec;
|
||||||
@ -32,12 +33,21 @@ uniform float near;
|
|||||||
uniform float dhFarPlane;
|
uniform float dhFarPlane;
|
||||||
uniform float dhNearPlane;
|
uniform float dhNearPlane;
|
||||||
|
|
||||||
|
// uniform mat4 gbufferModelViewInverse;
|
||||||
|
// uniform mat4 gbufferModelView;
|
||||||
|
uniform mat4 gbufferPreviousModelView;
|
||||||
|
// uniform mat4 gbufferProjectionInverse;
|
||||||
|
// uniform mat4 gbufferProjection;
|
||||||
|
// uniform mat4 gbufferPreviousProjection;
|
||||||
|
// uniform vec3 cameraPosition;
|
||||||
|
uniform vec3 previousCameraPosition;
|
||||||
|
|
||||||
uniform int frameCounter;
|
uniform int frameCounter;
|
||||||
uniform float frameTimeCounter;
|
uniform float frameTimeCounter;
|
||||||
|
|
||||||
// varying vec2 texcoord;
|
// varying vec2 texcoord;
|
||||||
uniform vec2 texelSize;
|
uniform vec2 texelSize;
|
||||||
// flat varying vec2 TAA_Offset;
|
flat varying vec2 TAA_Offset;
|
||||||
|
|
||||||
uniform int isEyeInWater;
|
uniform int isEyeInWater;
|
||||||
uniform float rainStrength;
|
uniform float rainStrength;
|
||||||
@ -110,17 +120,17 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
|||||||
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
|
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
|
||||||
|
|
||||||
if(LpvFadeF > 0.0){
|
if(LpvFadeF > 0.0){
|
||||||
|
// if(length(lpvSample.xyz) > 1e-5){
|
||||||
|
|
||||||
vec4 lpvSample = SampleLpvLinear(lpvPos);
|
vec3 lighting = SampleLpvLinear(lpvPos).rgb * (LPV_VL_FOG_ILLUMINATION_BRIGHTNESS/100.0);
|
||||||
|
// float density = exp(-5.0 * clamp( 1.0 - length(lpvSample.xyz) / 16.0,0.0,1.0)) * (LPV_VL_FOG_ILLUMINATION_BRIGHTNESS/100.0) * LpvFadeF;
|
||||||
|
float density = exp(-5.0 * (1.0-length(lighting.xyz))) * LpvFadeF;
|
||||||
|
// float density = (1-exp(-1.0-clamp(length(lighting.rgb),0.0,1.0),25) )* LpvFadeF;
|
||||||
|
|
||||||
if(length(lpvSample.xyz) > 1e-5){
|
// float density = 0.01 * LpvFadeF;
|
||||||
vec3 LpvTorchLight = GetLpvBlockLight(lpvSample);
|
|
||||||
|
|
||||||
vec3 lighting = LpvTorchLight;
|
|
||||||
float density = exp(-5.0 * clamp( 1.0 - length(lpvSample.xyz) / 16.0,0.0,1.0)) * (LPV_VL_FOG_ILLUMINATION_BRIGHTNESS/100.0) * LpvFadeF;
|
|
||||||
|
|
||||||
color = lighting - lighting * exp(-density*dd*dL);
|
color = lighting - lighting * exp(-density*dd*dL);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
@ -130,21 +140,38 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
|||||||
float invLinZ (float lindepth){
|
float invLinZ (float lindepth){
|
||||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uniform float nightVision;
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
const bool shadowHardwareFiltering = true;
|
const bool shadowHardwareFiltering = true;
|
||||||
uniform sampler2DShadow shadow;
|
uniform sampler2DShadow shadow;
|
||||||
|
|
||||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||||
uniform sampler2D shadowcolor0;
|
uniform sampler2D shadowcolor0;
|
||||||
uniform sampler2DShadow shadowtex0;
|
uniform sampler2DShadow shadowtex0;
|
||||||
uniform sampler2DShadow shadowtex1;
|
uniform sampler2DShadow shadowtex1;
|
||||||
#endif
|
#endif
|
||||||
flat varying vec3 refractedSunVec;
|
flat varying vec3 refractedSunVec;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// uniform int dhRenderDistance;
|
// uniform int dhRenderDistance;
|
||||||
#define TIMEOFDAYFOG
|
#define TIMEOFDAYFOG
|
||||||
#include "/lib/lightning_stuff.glsl"
|
#include "/lib/lightning_stuff.glsl"
|
||||||
#define CLOUDS_INTERSECT_TERRAIN
|
|
||||||
|
// #define CLOUDS_INTERSECT_TERRAIN
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
|
|
||||||
|
#include "/lib/climate_settings.glsl"
|
||||||
#include "/lib/overworld_fog.glsl"
|
#include "/lib/overworld_fog.glsl"
|
||||||
#endif
|
#endif
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
@ -159,7 +186,9 @@ uniform sampler2D colortex4;
|
|||||||
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
|
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
|
||||||
|
|
||||||
float interleaved_gradientNoise_temporal(){
|
float interleaved_gradientNoise_temporal(){
|
||||||
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
|
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
||||||
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
|
return noise;
|
||||||
}
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
@ -168,15 +197,15 @@ float interleaved_gradientNoise(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
float blueNoise(){
|
float blueNoise(){
|
||||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a+ 1.0/1.6180339887 * frameCounter );
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter );
|
||||||
}
|
}
|
||||||
|
|
||||||
float R2_dither(){
|
float R2_dither(){
|
||||||
#ifdef TAA
|
// #ifdef TAA
|
||||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
||||||
#else
|
// #else
|
||||||
vec2 coord = gl_FragCoord.xy;
|
// vec2 coord = gl_FragCoord.xy;
|
||||||
#endif
|
// #endif
|
||||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||||
}
|
}
|
||||||
@ -226,7 +255,7 @@ void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEn
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEyeDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
vec3 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
||||||
int spCount = 8;
|
int spCount = 8;
|
||||||
|
|
||||||
vec3 start = toShadowSpaceProjected(rayStart);
|
vec3 start = toShadowSpaceProjected(rayStart);
|
||||||
@ -236,35 +265,29 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
|||||||
//limit ray length at 32 blocks for performance and reducing integration error
|
//limit ray length at 32 blocks for performance and reducing integration error
|
||||||
//you can't see above this anyway
|
//you can't see above this anyway
|
||||||
float maxZ = min(rayLength,32.0)/(1e-8+rayLength);
|
float maxZ = min(rayLength,32.0)/(1e-8+rayLength);
|
||||||
dV *= maxZ;
|
|
||||||
vec3 dVWorld = mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
|
|
||||||
rayLength *= maxZ;
|
|
||||||
float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength;
|
|
||||||
|
|
||||||
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
|
||||||
float phase = fogPhase(VdotL) * 5.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
dV *= maxZ;
|
||||||
|
rayLength *= maxZ;
|
||||||
|
|
||||||
|
vec3 dVWorld = mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
|
||||||
|
|
||||||
vec3 absorbance = vec3(1.0);
|
vec3 absorbance = vec3(1.0);
|
||||||
vec3 vL = vec3(0.0);
|
vec3 vL = vec3(0.0);
|
||||||
|
|
||||||
float YFade = pow(normalize(dVWorld).y*0.3+0.7,1.5);
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
float lowlightlevel = clamp(eyeBrightnessSmooth.y/240.0,0.1,1.0);
|
float lowlightlevel = clamp(eyeBrightnessSmooth.y/240.0,0.1,1.0);
|
||||||
|
float phase = fogPhase(VdotL) * 5.0;
|
||||||
#else
|
#else
|
||||||
float lowlightlevel = 1.0;
|
float lowlightlevel = 1.0;
|
||||||
|
float phase = 0.0;
|
||||||
#endif
|
#endif
|
||||||
// lowlightlevel = pow(lowlightlevel,0.5);
|
|
||||||
|
|
||||||
float expFactor = 11.0;
|
float expFactor = 11.0;
|
||||||
for (int i=0;i<spCount;i++) {
|
for (int i=0;i<spCount;i++) {
|
||||||
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
|
float d = (pow(expFactor, float(i+dither.x)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
|
||||||
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0); //step length (derivative)
|
float dd = pow(expFactor, float(i+dither.y)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0); //step length (derivative)
|
||||||
|
|
||||||
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||||
|
|
||||||
vec3 sh = vec3(1.0);
|
vec3 sh = vec3(1.0);
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
@ -276,15 +299,18 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
|||||||
#else
|
#else
|
||||||
float distortFactor = 1.0;
|
float distortFactor = 1.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
||||||
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
||||||
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
||||||
// sh = shadow2D( shadow, pos).x;
|
// sh = shadow2D( shadow, pos).x;
|
||||||
|
|
||||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||||
sh = vec3(shadow2D(shadowtex0, pos).x);
|
sh = vec3(shadow2D(shadowtex0, pos).x);
|
||||||
|
|
||||||
if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){
|
if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){
|
||||||
sh = normalize(texture2D(shadowcolor0, pos.xy).rgb+0.0001);
|
vec4 translucentShadow = texture2D(shadowcolor0, pos.xy);
|
||||||
|
if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sh = vec3(shadow2D(shadow, pos).x);
|
sh = vec3(shadow2D(shadow, pos).x);
|
||||||
@ -292,38 +318,28 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VL_CLOUDS_SHADOWS
|
#ifdef VL_CLOUDS_SHADOWS
|
||||||
sh *= GetCloudShadow_VLFOG(progressW, WsunVec);
|
sh *= GetCloudShadow(progressW, WsunVec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// float bubble = 1.0 - pow(1.0-pow(1.0-min(max(1.0 - length(d*dVWorld) / (16),0.0)*5.0,1.0),2.0),2.0);
|
|
||||||
float bubble = exp( -7.0 * clamp(1.0 - length(d*dVWorld) / 16.0, 0.0,1.0) );
|
|
||||||
float bubble2 = max(pow(length(d*dVWorld)/24,5)*100.0,0.0) + 1;
|
|
||||||
|
|
||||||
float sunCaustics = (waterCaustics(progressW, WsunVec)) * mix(0.25,10.0,bubble) + 0.75;
|
|
||||||
|
|
||||||
vec3 sunMul = exp(-1 * d * waterCoefs * 1.1);
|
|
||||||
vec3 Directlight = ((lightSource* sh) * phase * sunMul * sunCaustics) * lowlightlevel * pow(abs(WsunVec.y),1);
|
|
||||||
#else
|
|
||||||
vec3 Directlight = vec3(0.0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 ambientMul = exp(-1 * d * waterCoefs);
|
|
||||||
vec3 Indirectlight = ambient * ambientMul * YFade * lowlightlevel;
|
|
||||||
|
|
||||||
vec3 light = (Indirectlight + Directlight) * scatterCoef;
|
float bubble = exp2(-10.0 * clamp(1.0 - length(d*dVWorld) / 16.0, 0.0,1.0));
|
||||||
|
float caustics = mix(max(max(waterCaustics(progressW, WsunVec), phase*0.5) * mix(0.5, 200.0, bubble), phase), 1.0, lowlightlevel);
|
||||||
|
|
||||||
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
|
vec3 Directlight = lightSource * sh * phase * caustics*abs(WsunVec.y) * lowlightlevel;
|
||||||
absorbance *= exp(-waterCoefs * dd * rayLength);
|
vec3 Indirectlight = ambient * lowlightlevel;
|
||||||
|
|
||||||
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
vec3 WaterAbsorbance = exp(-waterCoefs * rayLength * d);
|
||||||
vL += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, 1.0);
|
|
||||||
#endif
|
vec3 light = (Indirectlight + Directlight) * WaterAbsorbance * scatterCoef;
|
||||||
|
|
||||||
|
vec3 volumeCoeff = exp(-waterCoefs * rayLength * dd);
|
||||||
|
vL += (light - light * volumeCoeff) / waterCoefs * absorbance;
|
||||||
|
absorbance *= volumeCoeff;
|
||||||
|
|
||||||
}
|
}
|
||||||
inColor += vL;
|
return vL;
|
||||||
}
|
}
|
||||||
// #endif
|
|
||||||
|
|
||||||
vec4 blueNoise(vec2 coord){
|
vec4 blueNoise(vec2 coord){
|
||||||
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
||||||
@ -351,9 +367,130 @@ float encodeVec2(vec2 a){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// uniform int framemod8;
|
uniform int framemod8;
|
||||||
// #include "/lib/TAA_jitter.glsl"
|
#include "/lib/TAA_jitter.glsl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vec3 toClipSpace3Prev(vec3 viewSpacePosition) {
|
||||||
|
return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
|
||||||
|
{
|
||||||
|
vec2 du = vec2(texelSize.x*2., 0.0);
|
||||||
|
vec2 dv = vec2(0.0, texelSize.y*2.);
|
||||||
|
|
||||||
|
vec3 dtl = vec3(texcoord,0.) + vec3(-texelSize, texture2D(depth, texcoord - dv - du).x);
|
||||||
|
vec3 dtr = vec3(texcoord,0.) + vec3( texelSize.x, -texelSize.y, texture2D(depth, texcoord - dv + du).x);
|
||||||
|
vec3 dmc = vec3(texcoord,0.) + vec3( 0.0, 0.0, texture2D(depth, texcoord).x);
|
||||||
|
vec3 dbl = vec3(texcoord,0.) + vec3(-texelSize.x, texelSize.y, texture2D(depth, texcoord + dv - du).x);
|
||||||
|
vec3 dbr = vec3(texcoord,0.) + vec3( texelSize.x, texelSize.y, texture2D(depth, texcoord + dv + du).x);
|
||||||
|
|
||||||
|
vec3 dmin = dmc;
|
||||||
|
dmin = dmin.z > dtr.z ? dtr : dmin;
|
||||||
|
dmin = dmin.z > dtl.z ? dtl : dmin;
|
||||||
|
dmin = dmin.z > dbl.z ? dbl : dmin;
|
||||||
|
dmin = dmin.z > dbr.z ? dbr : dmin;
|
||||||
|
|
||||||
|
#ifdef TAA_UPSCALING
|
||||||
|
dmin.xy = dmin.xy/RENDER_SCALE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return dmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 toClipSpace3Prev_DH( vec3 viewSpacePosition, bool depthCheck ) {
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
mat4 projectionMatrix = depthCheck ? dhPreviousProjection : gbufferPreviousProjection;
|
||||||
|
return projMAD(projectionMatrix, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
|
#else
|
||||||
|
return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 toScreenSpace_DH_special(vec3 POS, bool depthCheck ) {
|
||||||
|
|
||||||
|
vec4 viewPos = vec4(0.0);
|
||||||
|
vec3 feetPlayerPos = vec3(0.0);
|
||||||
|
vec4 iProjDiag = vec4(0.0);
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
if (depthCheck) {
|
||||||
|
iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||||
|
|
||||||
|
feetPlayerPos = POS * 2.0 - 1.0;
|
||||||
|
viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||||
|
viewPos.xyz /= viewPos.w;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||||
|
|
||||||
|
feetPlayerPos = POS * 2.0 - 1.0;
|
||||||
|
viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
|
||||||
|
viewPos.xyz /= viewPos.w;
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return viewPos.xyz;
|
||||||
|
}
|
||||||
|
vec4 VLTemporalFiltering(vec3 viewPos, bool depthCheck, vec4 color){
|
||||||
|
vec2 texcoord = gl_FragCoord.xy * texelSize;
|
||||||
|
|
||||||
|
vec2 VLtexCoord = texcoord/VL_RENDER_RESOLUTION;
|
||||||
|
|
||||||
|
// vec3 closestToCamera = closestToCamera5taps(texcoord, depthtex0);
|
||||||
|
// vec3 viewPos_5tap = toScreenSpace(closestToCamera);
|
||||||
|
|
||||||
|
// get previous frames position stuff for UV
|
||||||
|
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
|
||||||
|
vec3 previousPosition = mat3(gbufferPreviousModelView) * playerPos + gbufferPreviousModelView[3].xyz;
|
||||||
|
previousPosition = toClipSpace3Prev(previousPosition);
|
||||||
|
|
||||||
|
vec2 velocity = previousPosition.xy - VLtexCoord/RENDER_SCALE;
|
||||||
|
previousPosition.xy = VLtexCoord + velocity;
|
||||||
|
|
||||||
|
vec4 currentFrame = color;
|
||||||
|
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return currentFrame;
|
||||||
|
|
||||||
|
// vec4 col0 = currentFrame; // can use this because its the center sample.
|
||||||
|
// vec4 col1 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y));
|
||||||
|
// vec4 col2 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y));
|
||||||
|
// vec4 col3 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, -texelSize.y));
|
||||||
|
// vec4 col4 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, texelSize.y));
|
||||||
|
// vec4 col5 = texture2D(colortex0, VLtexCoord + vec2( 0.0, texelSize.y));
|
||||||
|
// vec4 col6 = texture2D(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y));
|
||||||
|
// vec4 col7 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0));
|
||||||
|
// vec4 col8 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, 0.0));
|
||||||
|
|
||||||
|
// vec4 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8))))))));
|
||||||
|
// vec4 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8))))))));
|
||||||
|
|
||||||
|
// // colMin = 0.5 * (colMin + min(col0,min(col5,min(col6,min(col7,col8)))));
|
||||||
|
// // colMax = 0.5 * (colMax + max(col0,max(col5,max(col6,max(col7,col8)))));
|
||||||
|
|
||||||
|
vec4 frameHistory = texture2D(colortex10, previousPosition.xy*VL_RENDER_RESOLUTION);
|
||||||
|
vec4 clampedFrameHistory = frameHistory;
|
||||||
|
// vec4 clampedFrameHistory = clamp(frameHistory, colMin, colMax);
|
||||||
|
|
||||||
|
float blendFactor = 0.25;
|
||||||
|
blendFactor = clamp(length(velocity/texelSize),blendFactor,0.2);
|
||||||
|
|
||||||
|
// if(min(frameHistory.a,rejection) > 0.0) blendFactor = 1.0;
|
||||||
|
|
||||||
|
return mix(clampedFrameHistory, currentFrame, blendFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
float convertHandDepth(float depth) {
|
||||||
|
float ndcDepth = depth * 2.0 - 1.0;
|
||||||
|
ndcDepth /= MC_HAND_DEPTH;
|
||||||
|
return ndcDepth * 0.5 + 0.5;
|
||||||
|
}
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
@ -362,88 +499,95 @@ float encodeVec2(vec2 a){
|
|||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
|
|
||||||
/* RENDERTARGETS:0,14 */
|
|
||||||
#else
|
|
||||||
/* RENDERTARGETS:0 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float noise_1 = max(1.0 - R2_dither(),0.0015);
|
/* RENDERTARGETS:0 */
|
||||||
|
|
||||||
float noise_2 = blueNoise();
|
float noise_2 = blueNoise();
|
||||||
|
float noise_1 = max(1.0 - R2_dither(),0.0015);
|
||||||
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize + texelSize*0.5;
|
// float noise_2 = interleaved_gradientNoise_temporal();
|
||||||
|
vec2 bnoise = blueNoise(gl_FragCoord.xy ).rg;
|
||||||
|
|
||||||
|
int seed = (frameCounter*5)%40000;
|
||||||
|
vec2 r2_sequence = R2_samples(seed).xy;
|
||||||
|
vec2 BN = fract(r2_sequence + bnoise);
|
||||||
|
|
||||||
|
// vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize + texelSize*0.5;
|
||||||
|
vec2 tc = gl_FragCoord.xy/VL_RENDER_RESOLUTION*texelSize;// + texelSize*0.5;
|
||||||
|
|
||||||
bool iswater = texture2D(colortex7,tc).a > 0.99;
|
bool iswater = texture2D(colortex7,tc).a > 0.99;
|
||||||
|
|
||||||
float z0 = texture2D(depthtex0, tc).x;
|
vec2 jitter = TAA_Offset/VL_RENDER_RESOLUTION*texelSize*0.5;
|
||||||
|
|
||||||
|
float depth = texture2D(depthtex0, tc + jitter).x;
|
||||||
|
|
||||||
|
float z0 = depth < 0.56 ? convertHandDepth(depth) : depth;
|
||||||
|
|
||||||
#ifdef DISTANT_HORIZONS
|
#ifdef DISTANT_HORIZONS
|
||||||
float DH_z0 = texture2D(dhDepthTex,tc).x;
|
float DH_z0 = texture2D(dhDepthTex,tc).x;
|
||||||
#else
|
#else
|
||||||
float DH_z0 = 0.0;
|
float DH_z0 = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE , z0, DH_z0);
|
vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0);
|
||||||
vec3 playerPos_normalized = normalize(mat3(gbufferModelViewInverse) * viewPos0 + gbufferModelViewInverse[3].xyz);
|
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos0 + gbufferModelViewInverse[3].xyz;
|
||||||
|
vec3 playerPos_normalized = normalize(playerPos);
|
||||||
|
|
||||||
|
float dirtAmount = Dirt_Amount;
|
||||||
|
|
||||||
float dirtAmount = Dirt_Amount + 0.01;
|
|
||||||
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
||||||
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
|
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
|
||||||
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;
|
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;
|
||||||
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
|
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
|
||||||
|
|
||||||
vec3 directLightColor = lightCol.rgb/80.0;
|
vec3 directLightColor = lightCol.rgb / 2400.0;
|
||||||
vec3 indirectLightColor = averageSkyCol/30.0;
|
vec3 indirectLightColor = averageSkyCol / 1200.0;
|
||||||
vec3 indirectLightColor_dynamic = averageSkyCol_Clouds/30.0;
|
vec3 indirectLightColor_dynamic = averageSkyCol_Clouds / 1200.0;
|
||||||
|
|
||||||
|
// indirectLightColor_dynamic += MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision*0.02;
|
||||||
|
|
||||||
vec3 cloudDepth = vec3(0.0);
|
#if defined OVERWORLD_SHADER
|
||||||
vec3 fogDepth = vec3(0.0);
|
// z0 = texture2D(depthtex0, tc + jitter/VL_RENDER_RESOLUTION).x;
|
||||||
|
// viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0);
|
||||||
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
|
vec4 VolumetricClouds = GetVolumetricClouds(viewPos0, BN, WsunVec, directLightColor, indirectLightColor);
|
||||||
vec4 VolumetricClouds = renderClouds(viewPos0, vec2(noise_1,noise_2), directLightColor, indirectLightColor, cloudDepth);
|
|
||||||
|
|
||||||
#ifdef CAVE_FOG
|
#ifdef CAVE_FOG
|
||||||
float skyhole = (1.0-pow(clamp(1.0-pow(max(playerPos_normalized.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2)* caveDetection) ;
|
|
||||||
VolumetricClouds.rgb *= skyhole;
|
float skyhole = pow(clamp(1.0-pow(max(playerPos_normalized.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2)* caveDetection;
|
||||||
VolumetricClouds.a = mix(VolumetricClouds.a, 1.0, (1.0-skyhole) * caveDetection);
|
VolumetricClouds.rgb *= 1.0-skyhole;
|
||||||
|
VolumetricClouds.a = mix(VolumetricClouds.a, 1.0, skyhole);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
float atmosphereAlpha = 1.0;
|
float atmosphereAlpha = 1.0;
|
||||||
vec4 VolumetricFog = GetVolumetricFog(viewPos0, vec2(noise_2,noise_1), directLightColor, indirectLightColor, averageSkyCol_Clouds/30.0, atmosphereAlpha);
|
|
||||||
VolumetricClouds.a *= atmosphereAlpha;
|
vec3 sceneColor = texelFetch2D(colortex3,ivec2(tc/texelSize),0).rgb * VolumetricClouds.a + VolumetricClouds.rgb;
|
||||||
|
vec4 VolumetricFog = GetVolumetricFog(viewPos0, BN, directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined NETHER_SHADER || defined END_SHADER
|
#if defined NETHER_SHADER || defined END_SHADER
|
||||||
vec4 VolumetricFog = GetVolumetricFog(viewPos0, noise_1, noise_2);
|
vec4 VolumetricFog = GetVolumetricFog(viewPos0, BN.x, BN.y);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
|
|
||||||
VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a * atmosphereAlpha + VolumetricFog.rgb, VolumetricFog.a);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);
|
#if defined OVERWORLD_SHADER
|
||||||
|
VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a + VolumetricFog.rgb, VolumetricFog.a*VolumetricClouds.a);
|
||||||
|
// VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a + VolumetricFog.rgb, VolumetricFog.a*VolumetricClouds.a);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (isEyeInWater == 1){
|
if (isEyeInWater == 1){
|
||||||
|
vec3 underWaterFog = waterVolumetrics(vec3(0.0), viewPos0, length(viewPos0), BN, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor , dot(normalize(viewPos0), normalize(sunVec* lightCol.a ) ));
|
||||||
float estEyeDepth = clamp(eyeBrightnessSmooth.y/240.0,0.,1.0);
|
|
||||||
// estEyeDepth = pow(estEyeDepth,3.0) * 32.0;
|
|
||||||
estEyeDepth = 0.0;
|
|
||||||
|
|
||||||
// vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
|
|
||||||
|
|
||||||
vec3 vl = vec3(0.0);
|
|
||||||
waterVolumetrics(vl, vec3(0.0), viewPos0, estEyeDepth, estEyeDepth, length(viewPos0), noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor , dot(normalize(viewPos0), normalize(sunVec* lightCol.a ) ));
|
|
||||||
|
|
||||||
gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.);
|
VolumetricFog = vec4(underWaterFog, 1.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
|
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);
|
||||||
gl_FragData[1] = vec4(VolumetricClouds.a,0.0,0.0,0.0);
|
|
||||||
#endif
|
|
||||||
|
// vec4 currentFrame = VolumetricFog;
|
||||||
|
// vec4 previousFrame = texture2D(colortex10, gl_FragCoord.xy * texelSize);
|
||||||
|
|
||||||
|
// vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos0, z0 >= 1.0, VolumetricFog);
|
||||||
|
|
||||||
|
// gl_FragData[1] = temporallyFilteredVL;
|
||||||
|
|
||||||
}
|
}
|
@ -10,10 +10,11 @@ flat varying vec3 averageSkyCol_Clouds;
|
|||||||
flat varying float exposure;
|
flat varying float exposure;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams0;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ void main() {
|
|||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
|
|
||||||
gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_RESOLUTION)*2.0-1.0;
|
gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_RESOLUTION)*2.0-1.0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||||
@ -56,11 +58,11 @@ void main() {
|
|||||||
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#if defined Daily_Weather
|
||||||
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);
|
||||||
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
|
|
||||||
dailyWeatherParams0.a = (texelFetch2D(colortex4,ivec2(3,1),0).x/150.0)/2.0;
|
dailyWeatherParams0.a = texelFetch2D(colortex4,ivec2(3,1),0).x/1500.0;
|
||||||
dailyWeatherParams1.a = (texelFetch2D(colortex4,ivec2(3,1),0).y/150.0)/2.0;
|
dailyWeatherParams1.a = texelFetch2D(colortex4,ivec2(3,1),0).y/1500.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -68,7 +70,7 @@ void main() {
|
|||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
lightCol.rgb = vec3(0.0);
|
lightCol.rgb = vec3(0.0);
|
||||||
averageSkyCol = vec3(0.0);
|
averageSkyCol = vec3(0.0);
|
||||||
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 10.0;
|
averageSkyCol_Clouds = vec3(0.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
@ -78,7 +80,7 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
||||||
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition) ;
|
||||||
|
|
||||||
refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);
|
refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ uniform sampler2D noisetex;
|
|||||||
uniform sampler2D depthtex0;
|
uniform sampler2D depthtex0;
|
||||||
uniform sampler2D depthtex1;
|
uniform sampler2D depthtex1;
|
||||||
|
|
||||||
|
// const bool colortex4MipmapEnabled = true;
|
||||||
#ifdef DISTANT_HORIZONS
|
#ifdef DISTANT_HORIZONS
|
||||||
uniform sampler2D dhDepthTex;
|
uniform sampler2D dhDepthTex;
|
||||||
uniform sampler2D dhDepthTex1;
|
uniform sampler2D dhDepthTex1;
|
||||||
@ -36,8 +37,9 @@ uniform sampler2D colortex15;
|
|||||||
uniform vec2 texelSize;
|
uniform vec2 texelSize;
|
||||||
|
|
||||||
uniform sampler2D colortex4;
|
uniform sampler2D colortex4;
|
||||||
|
uniform float viewHeight;
|
||||||
|
uniform float viewWidth;
|
||||||
|
uniform float nightVision;
|
||||||
uniform vec3 sunVec;
|
uniform vec3 sunVec;
|
||||||
uniform float frameTimeCounter;
|
uniform float frameTimeCounter;
|
||||||
uniform int frameCounter;
|
uniform int frameCounter;
|
||||||
@ -56,6 +58,8 @@ uniform mat4 gbufferPreviousProjection;
|
|||||||
uniform vec3 cameraPosition;
|
uniform vec3 cameraPosition;
|
||||||
uniform vec3 previousCameraPosition;
|
uniform vec3 previousCameraPosition;
|
||||||
|
|
||||||
|
uniform int hideGUI;
|
||||||
|
uniform int dhRenderDistance;
|
||||||
uniform int isEyeInWater;
|
uniform int isEyeInWater;
|
||||||
uniform ivec2 eyeBrightnessSmooth;
|
uniform ivec2 eyeBrightnessSmooth;
|
||||||
uniform ivec2 eyeBrightness;
|
uniform ivec2 eyeBrightness;
|
||||||
@ -69,14 +73,12 @@ uniform float caveDetection;
|
|||||||
#include "/lib/res_params.glsl"
|
#include "/lib/res_params.glsl"
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
#include "/lib/sky_gradient.glsl"
|
|
||||||
#include "/lib/lightning_stuff.glsl"
|
|
||||||
#include "/lib/climate_settings.glsl"
|
#include "/lib/climate_settings.glsl"
|
||||||
#define CLOUDS_INTERSECT_TERRAIN
|
|
||||||
// #define CLOUDSHADOWSONLY
|
|
||||||
// #include "/lib/volumetricClouds.glsl"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "/lib/sky_gradient.glsl"
|
||||||
|
|
||||||
|
uniform float eyeAltitude;
|
||||||
|
|
||||||
|
|
||||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||||
@ -93,28 +95,49 @@ vec3 toLinear(vec3 sRGB){
|
|||||||
}
|
}
|
||||||
vec3 toScreenSpace(vec3 p) {
|
vec3 toScreenSpace(vec3 p) {
|
||||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||||
vec3 p3 = p * 2. - 1.;
|
vec3 playerPos = p * 2. - 1.;
|
||||||
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
|
vec4 fragposition = iProjDiag * playerPos.xyzz + gbufferProjectionInverse[3];
|
||||||
return fragposition.xyz / fragposition.w;
|
return fragposition.xyz / fragposition.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "/lib/DistantHorizons_projections.glsl"
|
#include "/lib/DistantHorizons_projections.glsl"
|
||||||
|
|
||||||
float blueNoise(){
|
|
||||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
|
||||||
}
|
|
||||||
vec4 blueNoise(vec2 coord){
|
|
||||||
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
|
||||||
}
|
|
||||||
vec3 normVec (vec3 vec){
|
|
||||||
return vec*inversesqrt(dot(vec,vec));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
float interleaved_gradientNoise_temporal(){
|
||||||
|
#ifdef TAA
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
return noise;
|
return noise;
|
||||||
}
|
}
|
||||||
|
float R2_dither(){
|
||||||
|
vec2 coord = gl_FragCoord.xy ;
|
||||||
|
|
||||||
|
#ifdef TAA
|
||||||
|
coord += (frameCounter%40000) * 2.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
|
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||||
|
}
|
||||||
|
float blueNoise(){
|
||||||
|
#ifdef TAA
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
|
#else
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
vec4 blueNoise(vec2 coord){
|
||||||
|
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
|
||||||
|
}
|
||||||
|
vec3 normVec (vec3 vec){
|
||||||
|
return vec*inversesqrt(dot(vec,vec));
|
||||||
|
}
|
||||||
|
|
||||||
float DH_ld(float dist) {
|
float DH_ld(float dist) {
|
||||||
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
|
||||||
@ -216,7 +239,8 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardista
|
|||||||
float refractionStrength = isTranslucentEntity ? 0.25 : 1.0 ;
|
float refractionStrength = isTranslucentEntity ? 0.25 : 1.0 ;
|
||||||
|
|
||||||
// Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength );
|
// Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength );
|
||||||
Texcoord = abs(Texcoord + (TangentNormals * mix(0.01, 0.1, pow(clamp(1.0-lineardistance/(32*4),0.0,1.0),2))) * RENDER_SCALE * refractionStrength );
|
// Texcoord = abs(Texcoord + (TangentNormals * mix(0.01, 0.1, pow(clamp(1.0-lineardistance/(32*4),0.0,1.0),2))) * RENDER_SCALE * refractionStrength );
|
||||||
|
Texcoord = abs(Texcoord + TangentNormals * RENDER_SCALE * 0.1 );
|
||||||
|
|
||||||
float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g;
|
float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g;
|
||||||
// float DistortedAlpha = decodeVec2(texelFetch2D(colortex11,ivec2(Texcoord/texelSize),0).b).g;
|
// float DistortedAlpha = decodeVec2(texelFetch2D(colortex11,ivec2(Texcoord/texelSize),0).b).g;
|
||||||
@ -225,17 +249,201 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardista
|
|||||||
Texcoord = mix(Texcoord, UnalteredTexcoord, min(max(0.1-DistortedAlpha,0.0) * 1000.0,1.0)); // remove distortion on non-translucents
|
Texcoord = mix(Texcoord, UnalteredTexcoord, min(max(0.1-DistortedAlpha,0.0) * 1000.0,1.0)); // remove distortion on non-translucents
|
||||||
}
|
}
|
||||||
|
|
||||||
uniform int dhRenderDistance;
|
vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance){
|
||||||
uniform float eyeAltitude;
|
|
||||||
|
// make the tangent space normals match the directions of the texcoord UV, this greatly improves the refraction effect.
|
||||||
|
vec2 UVNormal = vec2(normal.x,-normal.y);
|
||||||
|
|
||||||
|
float refractionMult = 0.3 / (1.0 + linearDistance);
|
||||||
|
float diffractionMult = 0.035;
|
||||||
|
float smudgeMult = 1.0;
|
||||||
|
|
||||||
|
// for diffraction, i wanted to know *when* normals were at an angle, not what the
|
||||||
|
float clampValue = 0.2;
|
||||||
|
vec2 abberationOffset = (clamp(UVNormal,-clampValue, clampValue)/clampValue) * diffractionMult;
|
||||||
|
|
||||||
|
// return vec3(abs(abberationOffset), 0.0);
|
||||||
|
|
||||||
|
#ifdef REFRACTION_SMUDGE
|
||||||
|
vec2 directionalSmudge = abberationOffset * (blueNoise()-0.5) * smudgeMult;
|
||||||
|
#else
|
||||||
|
vec2 directionalSmudge = vec2(0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec2 refractedUV = texcoord - (UVNormal + directionalSmudge)*refractionMult;
|
||||||
|
|
||||||
|
// a max bound around screen edges and edges of the refracted screen
|
||||||
|
vec2 vignetteSides = clamp(min((1.0 - refractedUV)/0.05, refractedUV/0.05)+0.5,0.0,1.0);
|
||||||
|
float vignette = vignetteSides.x*vignetteSides.y;
|
||||||
|
|
||||||
|
refractionMult *= decodeVec2(texelFetch2D(colortex11, ivec2(refractedUV/texelSize),0).b).g > 0.0 ? 1.0 : 0.0;
|
||||||
|
|
||||||
|
vec3 color = vec3(0.0);
|
||||||
|
|
||||||
|
#ifdef FAKE_DISPERSION_EFFECT
|
||||||
|
//// RED
|
||||||
|
refractedUV = clamp(texcoord - ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult ,0.0,1.0);
|
||||||
|
color.r = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).r;
|
||||||
|
//// GREEN
|
||||||
|
refractedUV = clamp(texcoord - (UVNormal + directionalSmudge)*refractionMult ,0,1);
|
||||||
|
color.g = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).g;
|
||||||
|
//// BLUE
|
||||||
|
refractedUV = clamp(texcoord - ((UVNormal - abberationOffset) + directionalSmudge)*refractionMult ,0.0,1.0);
|
||||||
|
color.b = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).b;
|
||||||
|
|
||||||
|
#else
|
||||||
|
refractedUV = clamp(texcoord - UVNormal,0.0,1.0);
|
||||||
|
color = texture2D(colortex3, refractedUV).rgb;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// texcoord = texcoord - (UVNormal+directionalSmudge)*refractionMult*vignette;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 toClipSpace3Prev(vec3 viewSpacePosition) {
|
||||||
|
return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
|
||||||
|
{
|
||||||
|
vec2 du = vec2(texelSize.x*2., 0.0);
|
||||||
|
vec2 dv = vec2(0.0, texelSize.y*2.);
|
||||||
|
|
||||||
|
vec3 dtl = vec3(texcoord,0.) + vec3(-texelSize, texture2D(depth, texcoord - dv - du).x);
|
||||||
|
vec3 dtr = vec3(texcoord,0.) + vec3( texelSize.x, -texelSize.y, texture2D(depth, texcoord - dv + du).x);
|
||||||
|
vec3 dmc = vec3(texcoord,0.) + vec3( 0.0, 0.0, texture2D(depth, texcoord).x);
|
||||||
|
vec3 dbl = vec3(texcoord,0.) + vec3(-texelSize.x, texelSize.y, texture2D(depth, texcoord + dv - du).x);
|
||||||
|
vec3 dbr = vec3(texcoord,0.) + vec3( texelSize.x, texelSize.y, texture2D(depth, texcoord + dv + du).x);
|
||||||
|
|
||||||
|
vec3 dmin = dmc;
|
||||||
|
dmin = dmin.z > dtr.z ? dtr : dmin;
|
||||||
|
dmin = dmin.z > dtl.z ? dtl : dmin;
|
||||||
|
dmin = dmin.z > dbl.z ? dbl : dmin;
|
||||||
|
dmin = dmin.z > dbr.z ? dbr : dmin;
|
||||||
|
|
||||||
|
#ifdef TAA_UPSCALING
|
||||||
|
dmin.xy = dmin.xy/RENDER_SCALE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return dmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 toClipSpace3Prev_DH( vec3 viewSpacePosition, bool depthCheck ) {
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
mat4 projectionMatrix = depthCheck ? dhPreviousProjection : gbufferPreviousProjection;
|
||||||
|
return projMAD(projectionMatrix, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
|
#else
|
||||||
|
return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 toScreenSpace_DH_special(vec3 POS, bool depthCheck ) {
|
||||||
|
|
||||||
|
vec4 viewPos = vec4(0.0);
|
||||||
|
vec3 feetPlayerPos = vec3(0.0);
|
||||||
|
vec4 iProjDiag = vec4(0.0);
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
if (depthCheck) {
|
||||||
|
iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw);
|
||||||
|
|
||||||
|
feetPlayerPos = POS * 2.0 - 1.0;
|
||||||
|
viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3];
|
||||||
|
viewPos.xyz /= viewPos.w;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||||
|
|
||||||
|
feetPlayerPos = POS * 2.0 - 1.0;
|
||||||
|
viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
|
||||||
|
viewPos.xyz /= viewPos.w;
|
||||||
|
|
||||||
|
#ifdef DISTANT_HORIZONS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return viewPos.xyz;
|
||||||
|
}
|
||||||
|
vec3 tonemap(vec3 col){
|
||||||
|
return col/(1+luma(col));
|
||||||
|
}
|
||||||
|
vec3 invTonemap(vec3 col){
|
||||||
|
return col/(1-luma(col));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 VLTemporalFiltering(vec3 viewPos, bool depthCheck, out float DEBUG){
|
||||||
|
vec2 texcoord = ((gl_FragCoord.xy)*2.0 + 0.5)*texelSize/2.0;
|
||||||
|
|
||||||
|
vec2 VLtexCoord = texcoord * VL_RENDER_RESOLUTION;
|
||||||
|
|
||||||
|
// vec3 closestToCamera = closestToCamera5taps(texcoord, depthtex0);
|
||||||
|
// vec3 viewPos_5tap = toScreenSpace(closestToCamera);
|
||||||
|
|
||||||
|
// get previous frames position stuff for UV
|
||||||
|
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
|
||||||
|
vec3 previousPosition = mat3(gbufferPreviousModelView) * playerPos + gbufferPreviousModelView[3].xyz;
|
||||||
|
previousPosition = toClipSpace3Prev(previousPosition);
|
||||||
|
|
||||||
|
vec2 velocity = previousPosition.xy - texcoord/RENDER_SCALE;
|
||||||
|
previousPosition.xy = texcoord + velocity;
|
||||||
|
|
||||||
|
// vec4 currentFrame = texture2D_bicubic(colortex0, VLtexCoord);
|
||||||
|
vec4 currentFrame = texture2D(colortex0, VLtexCoord );
|
||||||
|
// vec4 currentFrame = texelFetch2D(colortex0, ivec2(VLtexCoord/texelSize),0);
|
||||||
|
|
||||||
|
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return currentFrame;
|
||||||
|
|
||||||
|
vec4 col1 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y));
|
||||||
|
vec4 col2 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y));
|
||||||
|
vec4 col3 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, -texelSize.y));
|
||||||
|
vec4 col4 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, texelSize.y));
|
||||||
|
vec4 col5 = texture2D(colortex0, VLtexCoord + vec2( 0.0, texelSize.y));
|
||||||
|
vec4 col6 = texture2D(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y));
|
||||||
|
vec4 col7 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0));
|
||||||
|
vec4 col8 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, 0.0));
|
||||||
|
|
||||||
|
vec4 colMax = max(currentFrame,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8))))))));
|
||||||
|
vec4 colMin = min(currentFrame,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8))))))));
|
||||||
|
|
||||||
|
// colMin = 0.5 * (colMin + min(currentFrame,min(col5,min(col6,min(col7,col8)))));
|
||||||
|
// colMax = 0.5 * (colMax + max(currentFrame,max(col5,max(col6,max(col7,col8)))));
|
||||||
|
|
||||||
|
// vec4 col0 = texture(colortex0, VLtexCoord + vec2( texelSize.x, 0.0));
|
||||||
|
// vec4 col1 = texture(colortex0, VLtexCoord + vec2( 0.0, texelSize.y));
|
||||||
|
// vec4 col2 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0));
|
||||||
|
// vec4 col3 = texture(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y));
|
||||||
|
|
||||||
|
// vec4 colMin = min(currentFrame, min(col0, min(col1, min(col2, col3))));
|
||||||
|
// vec4 colMax = max(currentFrame, max(col0, max(col1, max(col2, col3))));
|
||||||
|
|
||||||
|
vec4 frameHistory = texture2D(colortex10, previousPosition.xy);
|
||||||
|
vec4 clampedFrameHistory = clamp(frameHistory, colMin, colMax);
|
||||||
|
|
||||||
|
float blendingFactor = 0.1;
|
||||||
|
// if((min(max(clampedFrameHistory.a - frameHistory.a,0.0) / 0.0000001, 1.0)) > 0.0) blendingFactor = 1.0;
|
||||||
|
|
||||||
|
// if(abs(clampedFrameHistory.a-frameHistory.a) > 0.1 && abs(currentFrame.a-frameHistory.a) > 0.1) blendingFactor = 1.0;
|
||||||
|
|
||||||
|
// if(abs(currentFrame.a - frameHistory.a) > 0.6) blendingFactor = 1.0;
|
||||||
|
if(abs(clampedFrameHistory.a - frameHistory.a) > 0.1) blendingFactor = 1.0;
|
||||||
|
// blendingFactor = clamp(blendingFactor + abs(clampedFrameHistory.a - frameHistory.a),0.0,1.0);
|
||||||
|
|
||||||
|
// DEBUG = abs(clampedFrameHistory.a - frameHistory.a) > 0.1 ? 0. : 1.0;
|
||||||
|
// DEBUG = clamp(abs(clampedFrameHistory.a - frameHistory.a),0.0,1.0);
|
||||||
|
|
||||||
|
return clamp(mix(clampedFrameHistory, currentFrame, blendingFactor),0.0,65000.0);
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
/* DRAWBUFFERS:73 */
|
/* RENDERTARGETS:7,3,10 */
|
||||||
|
|
||||||
////// --------------- SETUP STUFF --------------- //////
|
////// --------------- SETUP STUFF --------------- //////
|
||||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||||
|
|
||||||
float z = texture2D(depthtex0,texcoord).x;
|
float z = texture2D(depthtex0, texcoord).x;
|
||||||
float z2 = texture2D(depthtex1,texcoord).x;
|
float z2 = texture2D(depthtex1, texcoord).x;
|
||||||
float frDepth = ld(z);
|
float frDepth = ld(z);
|
||||||
|
|
||||||
float swappedDepth = z;
|
float swappedDepth = z;
|
||||||
@ -258,19 +466,13 @@ void main() {
|
|||||||
float DH_depth0 = 0.0;
|
float DH_depth0 = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 fragpos = toScreenSpace_DH(texcoord/RENDER_SCALE-vec2(TAA_Offset)*texelSize*0.5, z, DH_depth0);
|
vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth0);
|
||||||
|
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||||
// vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(TAA_Offset)*texelSize*0.5,z));
|
vec3 playerPos_normalized = normVec(playerPos);
|
||||||
vec3 p3 = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz;
|
vec3 playerPos222 = mat3(gbufferModelViewInverse) * toScreenSpace_DH(texcoord/RENDER_SCALE, 1.0,1.0) + gbufferModelViewInverse[3].xyz ;
|
||||||
vec3 np3 = normVec(p3);
|
|
||||||
|
|
||||||
float linearDistance = length(p3);
|
|
||||||
float linearDistance_cylinder = length(p3.xz);
|
|
||||||
|
|
||||||
// vec3 fragpos_NODH = toScreenSpace(texcoord/RENDER_SCALE-vec2(TAA_Offset)*texelSize*0.5, z);
|
|
||||||
|
|
||||||
// float linearDistance_NODH = length(p3);
|
|
||||||
|
|
||||||
|
float linearDistance = length(playerPos);
|
||||||
|
float linearDistance_cylinder = length(playerPos.xz);
|
||||||
|
|
||||||
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
||||||
float lightleakfixfast = clamp(eyeBrightness.y/240.,0.0,1.0);
|
float lightleakfixfast = clamp(eyeBrightness.y/240.,0.0,1.0);
|
||||||
@ -280,7 +482,7 @@ void main() {
|
|||||||
// bool isOpaque_entity = abs(opaqueMasks-0.45) < 0.01;
|
// bool isOpaque_entity = abs(opaqueMasks-0.45) < 0.01;
|
||||||
|
|
||||||
////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- //////
|
////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- //////
|
||||||
vec4 data = texture2D(colortex11,texcoord).rgba;
|
vec4 data = texelFetch2D(colortex11,ivec2(texcoord/texelSize),0).rgba;
|
||||||
vec4 unpack0 = vec4(decodeVec2(data.r),decodeVec2(data.g)) ;
|
vec4 unpack0 = vec4(decodeVec2(data.r),decodeVec2(data.g)) ;
|
||||||
vec4 unpack1 = vec4(decodeVec2(data.b),0,0) ;
|
vec4 unpack1 = vec4(decodeVec2(data.b),0,0) ;
|
||||||
|
|
||||||
@ -288,7 +490,6 @@ void main() {
|
|||||||
vec2 tangentNormals = unpack0.xy*2.0-1.0;
|
vec2 tangentNormals = unpack0.xy*2.0-1.0;
|
||||||
if(albedo.a < 0.01) tangentNormals = vec2(0.0);
|
if(albedo.a < 0.01) tangentNormals = vec2(0.0);
|
||||||
|
|
||||||
vec4 TranslucentShader = texture2D(colortex2, texcoord);
|
|
||||||
|
|
||||||
////// --------------- UNPACK MISC --------------- //////
|
////// --------------- UNPACK MISC --------------- //////
|
||||||
// 1.0 = water mask
|
// 1.0 = water mask
|
||||||
@ -310,25 +511,36 @@ void main() {
|
|||||||
#else
|
#else
|
||||||
float cloudAlpha = 1.0;
|
float cloudAlpha = 1.0;
|
||||||
#endif
|
#endif
|
||||||
|
float DEBUG = 0.0;
|
||||||
|
vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, z >= 1.0,DEBUG);
|
||||||
|
gl_FragData[2] = temporallyFilteredVL;
|
||||||
|
|
||||||
|
// #ifdef DISTANT_HORIZONS
|
||||||
|
// vec4 vl = BilateralUpscale(colortex0, colortex14, colortex12, gl_FragCoord.xy - 1.5, sqrt(texture2D(colortex12,texcoord).a/65000.0), cloudAlpha);
|
||||||
|
// #else
|
||||||
|
// vec4 vl = BilateralUpscale(colortex0, colortex14, depthtex0, gl_FragCoord.xy - 1.5, frDepth,cloudAlpha);
|
||||||
|
// #endif
|
||||||
|
// vec4 temporallyFilteredVL = vl;
|
||||||
|
|
||||||
|
// vec4 temporallyFilteredVL = texture2D(colortex10, texcoord*VL_RENDER_RESOLUTION);
|
||||||
|
|
||||||
#ifdef DISTANT_HORIZONS
|
|
||||||
vec4 vl = BilateralUpscale(colortex0, colortex14, colortex12, gl_FragCoord.xy - 1.5, sqrt(texture2D(colortex12,texcoord).a/65000.0), cloudAlpha);
|
|
||||||
#else
|
|
||||||
vec4 vl = BilateralUpscale(colortex0, colortex14, depthtex0, gl_FragCoord.xy - 1.5, frDepth,cloudAlpha);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float bloomyFogMult = 1.0;
|
float bloomyFogMult = 1.0;
|
||||||
|
|
||||||
////// --------------- distort texcoords as a refraction effect
|
////// --------------- distort texcoords as a refraction effect
|
||||||
vec2 refractedCoord = texcoord;
|
vec2 refractedCoord = texcoord;
|
||||||
|
|
||||||
#ifdef Refraction
|
|
||||||
ApplyDistortion(refractedCoord, tangentNormals, linearDistance, isEntity);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////// --------------- MAIN COLOR BUFFER
|
////// --------------- MAIN COLOR BUFFER
|
||||||
vec3 color = texture2D(colortex3, refractedCoord).rgb;
|
#ifdef FAKE_REFRACTION_EFFECT
|
||||||
|
// ApplyDistortion(refractedCoord, tangentNormals, linearDistance, isEntity);
|
||||||
|
// vec3 color = texture2D(colortex3, refractedCoord).rgb;
|
||||||
|
vec3 color = doRefractionEffect(refractedCoord, tangentNormals.xy, linearDistance);
|
||||||
|
#else
|
||||||
|
// vec3 color = texture2D(colortex3, refractedCoord).rgb;
|
||||||
|
vec3 color = texelFetch2D(colortex3, ivec2(refractedCoord/texelSize),0).rgb;
|
||||||
|
#endif
|
||||||
|
vec4 TranslucentShader = texture2D(colortex2, texcoord);
|
||||||
|
// color = vec3(texcoord-0.5,0.0) * mat3(gbufferModelViewInverse);
|
||||||
// apply block breaking effect.
|
// apply block breaking effect.
|
||||||
if(albedo.a > 0.01 && !isWater && TranslucentShader.a <= 0.0 && !isEntity) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb;
|
if(albedo.a > 0.01 && !isWater && TranslucentShader.a <= 0.0 && !isEntity) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb;
|
||||||
|
|
||||||
@ -342,7 +554,7 @@ void main() {
|
|||||||
float fog = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance_cylinder / far,0.0)*3.0,1.0) );
|
float fog = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance_cylinder / far,0.0)*3.0,1.0) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fog *= exp(-10.0 * pow(clamp(np3.y,0.0,1.0)*4.0,2.0));
|
fog *= exp(-10.0 * pow(clamp(playerPos_normalized.y,0.0,1.0)*4.0,2.0));
|
||||||
|
|
||||||
fog *= (1.0-caveDetection);
|
fog *= (1.0-caveDetection);
|
||||||
|
|
||||||
@ -351,7 +563,7 @@ void main() {
|
|||||||
#ifdef SKY_GROUND
|
#ifdef SKY_GROUND
|
||||||
vec3 borderFogColor = skyGroundColor;
|
vec3 borderFogColor = skyGroundColor;
|
||||||
#else
|
#else
|
||||||
vec3 borderFogColor = skyFromTex(np3, colortex4)/30.0;
|
vec3 borderFogColor = skyFromTex(playerPos_normalized, colortex4)/30.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
color.rgb = mix(color.rgb, borderFogColor, fog);
|
color.rgb = mix(color.rgb, borderFogColor, fog);
|
||||||
@ -361,7 +573,7 @@ void main() {
|
|||||||
|
|
||||||
if (TranslucentShader.a > 0.0){
|
if (TranslucentShader.a > 0.0){
|
||||||
#ifdef Glass_Tint
|
#ifdef Glass_Tint
|
||||||
if(!isWater) color *= mix(normalize(albedo.rgb+0.0001)*0.9+0.1, vec3(1.0), max(fog, min(max(0.1-albedo.a,0.0) * 1000.0,1.0))) ;
|
if(!isWater) color *= mix(normalize(albedo.rgb+1e-7), vec3(1.0), max(fog, min(max(0.1-albedo.a,0.0) * 10.0,1.0))) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BorderFog
|
#ifdef BorderFog
|
||||||
@ -385,58 +597,50 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
cavefogCol *= 1.0-pow(1.0-pow(1.0 - max(1.0 - linearDistance/far,0.0),2.0),CaveFogFallOff);
|
cavefogCol *= 1.0-pow(1.0-pow(1.0 - max(1.0 - linearDistance/far,0.0),2.0),CaveFogFallOff);
|
||||||
cavefogCol *= exp(-7.0*clamp(normalize(np3).y*0.5+0.5,0.0,1.0)) * 0.999 + 0.001;
|
cavefogCol *= exp(-7.0*clamp(normalize(playerPos_normalized).y*0.5+0.5,0.0,1.0)) * 0.999 + 0.001;
|
||||||
|
|
||||||
float skyhole = pow(clamp(1.0-pow(max(np3.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2);
|
cavefogCol *= 0.3;
|
||||||
|
|
||||||
|
float skyhole = pow(clamp(1.0-pow(max(playerPos_normalized.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2);
|
||||||
|
|
||||||
color.rgb = mix(color.rgb + cavefogCol * caveDetection, cavefogCol, z >= 1.0 ? skyhole * caveDetection : 0.0);
|
color.rgb = mix(color.rgb + cavefogCol * caveDetection, cavefogCol, z >= 1.0 ? skyhole * caveDetection : 0.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
|
||||||
// create a point that "glows" but in worldspace.
|
|
||||||
|
|
||||||
// this is not correct but whatever
|
|
||||||
float CenterdotV = dot(normalize(vec3(0.0,400.0,0.0) - cameraPosition), normalize(p3 + cameraPosition));
|
|
||||||
|
|
||||||
float distanceFadeOff = pow(min(max(length(cameraPosition)-300.0,0.0)/100.0,1.0),2.0);
|
|
||||||
|
|
||||||
color.rgb += vec3(0.1,0.5,1.0) * (exp2(-10.0 * max(-CenterdotV*0.5+0.5,0.0)) + exp(-150.0 * max(-CenterdotV*0.5+0.5,0.0))) * distanceFadeOff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
////// --------------- underwater fog
|
////// --------------- underwater fog
|
||||||
if (isEyeInWater == 1){
|
if (isEyeInWater == 1){
|
||||||
float dirtAmount = Dirt_Amount + 0.01;
|
float dirtAmount = Dirt_Amount;
|
||||||
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
||||||
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
|
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
|
||||||
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;
|
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;
|
||||||
|
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
|
||||||
|
|
||||||
vec3 absorbColor = exp(-totEpsilon*linearDistance);
|
vec3 absorption = exp(-2.0 * totEpsilon * linearDistance);
|
||||||
vec3 maxAbsorb = exp(-8.0 * totEpsilon);
|
vec3 fixedAbsorption = exp(-30.0 * totEpsilon) ;
|
||||||
|
vec3 finalAbsorption = (absorption + fixedAbsorption * 5.0 * (1.0 + nightVision*10));
|
||||||
|
// vec3 finalAbsorption = absorption;
|
||||||
|
|
||||||
|
linearDistance = length(vec3(playerPos.x,max(-playerPos.y,0.0),playerPos.z));
|
||||||
|
|
||||||
|
// in vanilla, the water fog has a max distance of ~7 chunks
|
||||||
|
float fogfade = max(1.0 - linearDistance / min(far, 16.0*7.0), 0.0);
|
||||||
|
fogfade *= fogfade;
|
||||||
|
// fogfade = exp(-5.0* (1.0-fogfade));
|
||||||
|
|
||||||
|
color.rgb = mix(fixedAbsorption, color.rgb * finalAbsorption, fogfade);
|
||||||
|
// color.rgb = color.rgb * finalAbsorption;
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
|
||||||
|
|
||||||
linearDistance = length(vec3(p3.x,max(-p3.y,0.0),p3.z));
|
|
||||||
float fogfade = exp(-0.001*(linearDistance*linearDistance));
|
|
||||||
vec3 thresholdAbsorbedColor = mix(maxAbsorb, absorbColor, clamp(dot(absorbColor,vec3(0.33333)),0.0,1.0));
|
|
||||||
color.rgb = mix(vec3(1.0) * clamp(WsunVec.y,0,1) * pow(normalize(np3).y*0.3+0.7,1.5) * maxAbsorb, color.rgb * thresholdAbsorbedColor, clamp(fogfade,0.0,1.0));
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
color.rgb *= absorbColor;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bloomyFogMult *= 0.4;
|
bloomyFogMult *= 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// --------------- BLEND FOG INTO SCENE
|
////// --------------- BLEND FOG INTO SCENE
|
||||||
//////////// apply VL fog over opaque and translucents
|
//////////// apply VL fog over opaque and translucents
|
||||||
|
|
||||||
color *= vl.a*cloudAlpha ;
|
bloomyFogMult *= temporallyFilteredVL.a;
|
||||||
color += vl.rgb;
|
color *= temporallyFilteredVL.a;
|
||||||
bloomyFogMult *= mix(vl.a,vl.a*0.5 + 0.5, rainStrength);
|
color += temporallyFilteredVL.rgb;
|
||||||
|
|
||||||
////// --------------- VARIOUS FOG EFFECTS (in front of volumetric fog)
|
////// --------------- VARIOUS FOG EFFECTS (in front of volumetric fog)
|
||||||
//////////// blindness, nightvision, liquid fogs and misc fogs
|
//////////// blindness, nightvision, liquid fogs and misc fogs
|
||||||
@ -449,12 +653,13 @@ void main() {
|
|||||||
|
|
||||||
////// --------------- lava.
|
////// --------------- lava.
|
||||||
if (isEyeInWater == 2){
|
if (isEyeInWater == 2){
|
||||||
color.rgb = vec3(4.0,0.5,0.1);
|
color.rgb = mix(color.rgb, vec3(0.1,0.0,0.0), 1.0-exp(-10.0*clamp(linearDistance*0.5,0.,1.))*0.5 );
|
||||||
|
bloomyFogMult = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////// --------------- powdered snow
|
///////// --------------- powdered snow
|
||||||
if (isEyeInWater == 3){
|
if (isEyeInWater == 3){
|
||||||
color.rgb = mix(color.rgb,vec3(10,15,20),clamp(linearDistance*0.5,0.,1.));
|
color.rgb = mix(color.rgb,vec3(0.5,0.75,1.0),clamp(linearDistance*0.5,0.,1.));
|
||||||
bloomyFogMult = 0.0;
|
bloomyFogMult = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,23 +667,30 @@ void main() {
|
|||||||
color.rgb *= mix(1.0,clamp( exp(pow(linearDistance*(blindness*0.2),2) * -5),0.,1.) , blindness);
|
color.rgb *= mix(1.0,clamp( exp(pow(linearDistance*(blindness*0.2),2) * -5),0.,1.) , blindness);
|
||||||
|
|
||||||
//////// --------------- darkness effect
|
//////// --------------- darkness effect
|
||||||
color.rgb *= mix(1.0, (1.0-darknessLightFactor*2.0) * clamp(1.0-pow(length(fragpos)*(darknessFactor*0.07),2.0),0.0,1.0), darknessFactor);
|
color.rgb *= mix(1.0, (1.0-darknessLightFactor*2.0) * clamp(1.0-pow(length(viewPos)*(darknessFactor*0.07),2.0),0.0,1.0), darknessFactor);
|
||||||
|
|
||||||
////// --------------- FINALIZE
|
////// --------------- FINALIZE
|
||||||
#ifdef display_LUT
|
#ifdef display_LUT
|
||||||
vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb / 30;
|
|
||||||
|
|
||||||
if(luma(thingy) > 0.0){
|
// if(hideGUI == 0){
|
||||||
color.rgb = thingy;
|
vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/150),0).rgb /1200.0;
|
||||||
vl.a = 1.0;
|
|
||||||
}
|
if(luma(thingy) > 0.0){
|
||||||
|
color.rgb = thingy;
|
||||||
|
// // vl.a = 1.0;
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
#if defined OVERWORLD_SHADER
|
||||||
|
|
||||||
|
if( hideGUI == 1) color.rgb = skyCloudsFromTex(playerPos_normalized, colortex4).rgb/1200.0;
|
||||||
|
#else
|
||||||
|
if( hideGUI == 1) color.rgb = volumetricsFromTex(playerPos_normalized, colortex4, 0.0).rgb/1200.0;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
// color.rgb = vec3(DEBUG);
|
||||||
// if(texcoord.x > 0.5 )color.rgb = skyCloudsFromTex(np3, colortex4).rgb/30.0;
|
|
||||||
|
|
||||||
gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog
|
gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog
|
||||||
gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0);
|
gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0);
|
||||||
// gl_FragData[1].rgb = vec3(tangentNormals.xy,0.0) ;
|
// gl_FragData[1].rgb = vec3(tangentNormals.xy,0.0) * 0.1 ;
|
||||||
// gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ;
|
// gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ;
|
||||||
// gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0;
|
// gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0;
|
||||||
// gl_FragData[1].rgb = 1-(texcoord.x > 0.5 ? vec3(TranslucentShader.a) : vec3(data.a));
|
// gl_FragData[1].rgb = 1-(texcoord.x > 0.5 ? vec3(TranslucentShader.a) : vec3(data.a));
|
||||||
|
@ -37,7 +37,7 @@ void main() {
|
|||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
#ifdef BorderFog
|
#ifdef BorderFog
|
||||||
skyGroundColor = texelFetch2D(colortex4,ivec2(1,37),0).rgb / 30.0 * Sky_Brightness;
|
skyGroundColor = texelFetch2D(colortex4,ivec2(1,37),0).rgb / 1200.0 * Sky_Brightness;
|
||||||
#endif
|
#endif
|
||||||
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,7 @@ const int colortex6Format = R11F_G11F_B10F; // additionnal buffer for bloom (c
|
|||||||
const int colortex7Format = RGBA8; // Final output, transparencies id (gbuffer->composite4)
|
const int colortex7Format = RGBA8; // Final output, transparencies id (gbuffer->composite4)
|
||||||
const int colortex8Format = RGBA8; // Specular Texture
|
const int colortex8Format = RGBA8; // Specular Texture
|
||||||
const int colortex9Format = RGBA8; // rain in alpha
|
const int colortex9Format = RGBA8; // rain in alpha
|
||||||
const int colortex10Format = RGBA16; // resourcepack Skies
|
const int colortex10Format = RGBA16F; // resourcepack Skies
|
||||||
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
|
const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals
|
||||||
const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEPTHs
|
const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEPTHs
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ const bool colortex6Clear = false;
|
|||||||
const bool colortex7Clear = false;
|
const bool colortex7Clear = false;
|
||||||
const bool colortex8Clear = false;
|
const bool colortex8Clear = false;
|
||||||
const bool colortex9Clear = true;
|
const bool colortex9Clear = true;
|
||||||
const bool colortex10Clear = true;
|
const bool colortex10Clear = false;
|
||||||
const bool colortex11Clear = true;
|
const bool colortex11Clear = true;
|
||||||
const bool colortex12Clear = false;
|
const bool colortex12Clear = false;
|
||||||
const bool colortex13Clear = false;
|
const bool colortex13Clear = false;
|
||||||
@ -41,11 +41,11 @@ const bool colortex15Clear = false;
|
|||||||
|
|
||||||
#ifdef SCREENSHOT_MODE
|
#ifdef SCREENSHOT_MODE
|
||||||
/*
|
/*
|
||||||
const int colortex5Format = RGBA32F;// TAA buffer (everything)
|
const int colortex5Format = RGBA32F; //TAA buffer (everything)
|
||||||
*/
|
*/
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
const int colortex5Format = R11F_G11F_B10F; // TAA buffer (everything)
|
const int colortex5Format = RGBA16F; //TAA buffer (everything)
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -67,6 +67,7 @@ uniform vec2 texelSize;
|
|||||||
uniform float frameTimeCounter;
|
uniform float frameTimeCounter;
|
||||||
uniform float viewHeight;
|
uniform float viewHeight;
|
||||||
uniform float viewWidth;
|
uniform float viewWidth;
|
||||||
|
|
||||||
uniform vec3 previousCameraPosition;
|
uniform vec3 previousCameraPosition;
|
||||||
uniform mat4 gbufferPreviousModelView;
|
uniform mat4 gbufferPreviousModelView;
|
||||||
|
|
||||||
@ -213,6 +214,24 @@ vec4 smoothfilter(in sampler2D tex, in vec2 uv)
|
|||||||
|
|
||||||
return texture2D(tex, uv);
|
return texture2D(tex, uv);
|
||||||
}
|
}
|
||||||
|
vec2 smoothfilterUV(in vec2 uv)
|
||||||
|
{
|
||||||
|
vec2 textureResolution = vec2(viewWidth,viewHeight);
|
||||||
|
uv = uv*textureResolution + 0.5;
|
||||||
|
vec2 iuv = floor( uv );
|
||||||
|
vec2 fuv = fract( uv );
|
||||||
|
|
||||||
|
#ifndef SMOOTHESTSTEP_INTERPOLATION
|
||||||
|
uv = iuv + (fuv*fuv)*(3.0-2.0*fuv);
|
||||||
|
#endif
|
||||||
|
#ifdef SMOOTHESTSTEP_INTERPOLATION
|
||||||
|
uv = iuv + fuv*fuv*fuv*(fuv*(fuv*6.0-15.0)+10.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uv = (uv - 0.5)/textureResolution;
|
||||||
|
|
||||||
|
return uv;
|
||||||
|
}
|
||||||
//approximation from SMAA presentation from siggraph 2016
|
//approximation from SMAA presentation from siggraph 2016
|
||||||
vec3 FastCatmulRom(sampler2D colorTex, vec2 texcoord, vec4 rtMetrics, float sharpenAmount)
|
vec3 FastCatmulRom(sampler2D colorTex, vec2 texcoord, vec4 rtMetrics, float sharpenAmount)
|
||||||
{
|
{
|
||||||
@ -231,15 +250,14 @@ vec3 FastCatmulRom(sampler2D colorTex, vec2 texcoord, vec4 rtMetrics, float shar
|
|||||||
vec2 w12 = w1 + w2;
|
vec2 w12 = w1 + w2;
|
||||||
vec2 tc12 = rtMetrics.xy * (centerPosition + w2 / w12);
|
vec2 tc12 = rtMetrics.xy * (centerPosition + w2 / w12);
|
||||||
vec3 centerColor = texture2D(colorTex, vec2(tc12.x, tc12.y)).rgb;
|
vec3 centerColor = texture2D(colorTex, vec2(tc12.x, tc12.y)).rgb;
|
||||||
|
|
||||||
vec2 tc0 = rtMetrics.xy * (centerPosition - 1.0);
|
vec2 tc0 = rtMetrics.xy * (centerPosition - 1.0);
|
||||||
vec2 tc3 = rtMetrics.xy * (centerPosition + 2.0);
|
vec2 tc3 = rtMetrics.xy * (centerPosition + 2.0);
|
||||||
vec4 color = vec4(texture2D(colorTex, vec2(tc12.x, tc0.y )).rgb, 1.0) * (w12.x * w0.y ) +
|
vec4 color = vec4(texture2D(colorTex, vec2(tc12.x, tc0.y )).rgb, 1.0) * (w12.x * w0.y ) +
|
||||||
vec4(texture2D(colorTex, vec2(tc0.x, tc12.y)).rgb, 1.0) * (w0.x * w12.y) +
|
vec4(texture2D(colorTex, vec2(tc0.x, tc12.y)).rgb, 1.0) * (w0.x * w12.y) +
|
||||||
vec4(centerColor, 1.0) * (w12.x * w12.y) +
|
vec4(centerColor, 1.0) * (w12.x * w12.y) +
|
||||||
vec4(texture2D(colorTex, vec2(tc3.x, tc12.y)).rgb, 1.0) * (w3.x * w12.y) +
|
vec4(texture2D(colorTex, vec2(tc3.x, tc12.y)).rgb, 1.0) * (w3.x * w12.y) +
|
||||||
vec4(texture2D(colorTex, vec2(tc12.x, tc3.y )).rgb, 1.0) * (w12.x * w3.y );
|
vec4(texture2D(colorTex, vec2(tc12.x, tc3.y )).rgb, 1.0) * (w12.x * w3.y );
|
||||||
|
|
||||||
return color.rgb/color.a;
|
return color.rgb/color.a;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -314,6 +332,24 @@ vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth,
|
|||||||
return dmin;
|
return dmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 RGB2YCoCg(vec3 RGB)
|
||||||
|
{
|
||||||
|
vec3 o;
|
||||||
|
o.x = 0.25*RGB.r + 0.5*RGB.g + 0.25*RGB.b;
|
||||||
|
o.y = 0.5*RGB.r - 0.5*RGB.b;
|
||||||
|
o.z = -0.25*RGB.r + 0.5*RGB.g - 0.25*RGB.b;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 YCoCg2RGB(vec3 YCoCg)
|
||||||
|
{
|
||||||
|
vec3 o;
|
||||||
|
o.r = YCoCg.x + YCoCg.y - YCoCg.z;
|
||||||
|
o.g = YCoCg.x + YCoCg.z;
|
||||||
|
o.b = YCoCg.x - YCoCg.y - YCoCg.z;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
vec4 computeTAA(vec2 texcoord, bool hand){
|
vec4 computeTAA(vec2 texcoord, bool hand){
|
||||||
|
|
||||||
vec2 jitter = offsets[framemod8]*texelSize*0.5;
|
vec2 jitter = offsets[framemod8]*texelSize*0.5;
|
||||||
@ -340,9 +376,9 @@ vec4 computeTAA(vec2 texcoord, bool hand){
|
|||||||
|
|
||||||
vec2 velocity = previousPosition.xy - closestToCamera.xy;
|
vec2 velocity = previousPosition.xy - closestToCamera.xy;
|
||||||
previousPosition.xy = texcoord + velocity;
|
previousPosition.xy = texcoord + velocity;
|
||||||
|
|
||||||
// sample current frame, and make sure it is de-jittered
|
// sample current frame, and make sure it is de-jittered
|
||||||
vec3 currentFrame = smoothfilter(colortex3, adjTC + jitter).rgb;
|
// vec3 currentFrame = smoothfilter(colortex3, adjTC + jitter).rgb;
|
||||||
|
vec3 currentFrame = texelFetch2D(colortex3, ivec2((adjTC + jitter)/texelSize), 0).rgb;
|
||||||
|
|
||||||
//reject history if off-screen and early exit
|
//reject history if off-screen and early exit
|
||||||
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return vec4(currentFrame, 1.0);
|
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return vec4(currentFrame, 1.0);
|
||||||
@ -366,14 +402,13 @@ vec4 computeTAA(vec2 texcoord, bool hand){
|
|||||||
vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8))))))));
|
vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8))))))));
|
||||||
vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8))))))));
|
vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8))))))));
|
||||||
|
|
||||||
vec3 colMax5 = max(col0,max(col5,max(col6,max(col7,col8))));
|
colMin = 0.5 * (colMin + min(col0,min(col5,min(col6,min(col7,col8)))));
|
||||||
vec3 colMin5 = min(col0,min(col5,min(col6,min(col7,col8))));
|
colMax = 0.5 * (colMax + max(col0,max(col5,max(col6,max(col7,col8)))));
|
||||||
|
|
||||||
colMin = 0.5 * (colMin + colMin5);
|
|
||||||
colMax = 0.5 * (colMax + colMax5);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DAMAGE_TAKEN_EFFECT
|
#ifdef DAMAGE_TAKEN_EFFECT
|
||||||
// when this triggers, use current frame UV to sample history, for a funny trailing effect.
|
////// when this triggers, use current frame UV to sample history, for a funny trailing effect.
|
||||||
if(CriticalDamageTaken > 0.01) previousPosition.xy = texcoord;
|
if(CriticalDamageTaken > 0.01) previousPosition.xy = texcoord;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -383,14 +418,17 @@ vec4 computeTAA(vec2 texcoord, bool hand){
|
|||||||
float blendingFactor = BLEND_FACTOR;
|
float blendingFactor = BLEND_FACTOR;
|
||||||
if(hand) blendingFactor = clamp(length(velocity/texelSize),blendingFactor,1.0);
|
if(hand) blendingFactor = clamp(length(velocity/texelSize),blendingFactor,1.0);
|
||||||
|
|
||||||
//Increases blending factor when far from AABB, reduces ghosting
|
////// Increases blending factor when far from AABB, reduces ghosting
|
||||||
blendingFactor = min(blendingFactor + luma(min(max(clampedframeHistory - frameHistory,0.0) / frameHistory, 1.0)),1.0);
|
// blendingFactor = min(blendingFactor + luma(min(max(clampedframeHistory-frameHistory,0.0) / frameHistory, 1.0)),1.0);
|
||||||
|
// blendingFactor = min(blendingFactor + luma(abs(clampedframeHistory - frameHistory)/clampedframeHistory) ,1.0);
|
||||||
|
|
||||||
// Blend current pixel with clamped history, apply fast tonemap beforehand to reduce flickering
|
// if(luma(abs(clampedframeHistory - frameHistory)) > 0.01) blendingFactor = 1.0;
|
||||||
|
|
||||||
|
////// Blend current pixel with clamped history, apply fast tonemap beforehand to reduce flickering
|
||||||
vec3 finalResult = invTonemap(mix(tonemap(clampedframeHistory), tonemap(currentFrame), blendingFactor));
|
vec3 finalResult = invTonemap(mix(tonemap(clampedframeHistory), tonemap(currentFrame), blendingFactor));
|
||||||
|
|
||||||
#ifdef DAMAGE_TAKEN_EFFECT
|
#ifdef DAMAGE_TAKEN_EFFECT
|
||||||
// when this triggers, do a funny trailing effect.
|
////// when this triggers, do a funny trailing effect.
|
||||||
if(CriticalDamageTaken > 0.01) finalResult = mix(finalResult, frameHistory, sqrt(CriticalDamageTaken)*0.8);
|
if(CriticalDamageTaken > 0.01) finalResult = mix(finalResult, frameHistory, sqrt(CriticalDamageTaken)*0.8);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SCREENSHOT_MODE
|
#ifdef SCREENSHOT_MODE
|
||||||
@ -418,14 +456,10 @@ void main() {
|
|||||||
|
|
||||||
// vec4 color = TAA_hq(hand);
|
// vec4 color = TAA_hq(hand);
|
||||||
|
|
||||||
vec4 color = computeTAA(texcoord, hand);
|
vec4 color = computeTAA(smoothfilterUV(texcoord), hand);
|
||||||
|
|
||||||
// gl_FragData[0] = clamp(color, 0.0, 65000.0);
|
// gl_FragData[0] = clamp(color, 0.0, 65000.0);
|
||||||
|
|
||||||
#if DEBUG_VIEW == debug_TEMPORAL_REPROJECTION
|
|
||||||
color.rgb = texture2D(colortex3, taauTC).rgb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SCREENSHOT_MODE
|
#ifdef SCREENSHOT_MODE
|
||||||
gl_FragData[0] = clamp(color, 0.0, 65000.0);
|
gl_FragData[0] = clamp(color, 0.0, 65000.0);
|
||||||
#else
|
#else
|
||||||
|
@ -64,11 +64,18 @@ vec3 toShadowSpaceProjected(vec3 p3){
|
|||||||
|
|
||||||
return p3;
|
return p3;
|
||||||
}
|
}
|
||||||
|
float interleaved_gradientNoise_temporal(){
|
||||||
|
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y) + 1.0/1.6180339887 * frameCounter);
|
||||||
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)+frameCounter/1.6180339887);
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
return noise;
|
return noise;
|
||||||
}
|
}
|
||||||
|
float R2_dither(){
|
||||||
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||||
|
return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter) ;
|
||||||
|
}
|
||||||
float blueNoise(){
|
float blueNoise(){
|
||||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
}
|
}
|
||||||
@ -123,6 +130,7 @@ float invLinZ (float lindepth){
|
|||||||
}
|
}
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
|
|
||||||
|
uniform sampler2D colortex4;
|
||||||
// uniform sampler2D colortex12;
|
// uniform sampler2D colortex12;
|
||||||
// const bool shadowHardwareFiltering = true;
|
// const bool shadowHardwareFiltering = true;
|
||||||
uniform sampler2DShadow shadow;
|
uniform sampler2DShadow shadow;
|
||||||
@ -135,11 +143,27 @@ float invLinZ (float lindepth){
|
|||||||
uniform sampler2DShadow shadowtex1;
|
uniform sampler2DShadow shadowtex1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEST
|
// #define TEST
|
||||||
#define TIMEOFDAYFOG
|
#define TIMEOFDAYFOG
|
||||||
#include "/lib/lightning_stuff.glsl"
|
#include "/lib/lightning_stuff.glsl"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
flat varying vec4 CurrentFrame_dailyWeatherParams0;
|
||||||
|
flat varying vec4 CurrentFrame_dailyWeatherParams1;
|
||||||
|
|
||||||
|
|
||||||
|
#define VL_CLOUDS_DEFERRED
|
||||||
|
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
|
#include "/lib/climate_settings.glsl"
|
||||||
#include "/lib/overworld_fog.glsl"
|
#include "/lib/overworld_fog.glsl"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -165,23 +189,16 @@ vec2 R2_samples(float n){
|
|||||||
return fract(alpha * n);
|
return fract(alpha * n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uniform float dayChangeSmooth;
|
||||||
|
uniform bool worldTimeChangeCheck;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
/* DRAWBUFFERS:4 */
|
/* DRAWBUFFERS:4 */
|
||||||
|
|
||||||
gl_FragData[0] = vec4(0.0);
|
gl_FragData[0] = vec4(0.0);
|
||||||
|
|
||||||
float mixhistory = 0.06;
|
float mixhistory = 0.06;
|
||||||
|
|
||||||
float accumuteSpeed = texelFetch2D(colortex4, ivec2(5,5), 0).r/150.0;
|
|
||||||
|
|
||||||
vec2 pixelPos6 = vec2(5,5);
|
|
||||||
|
|
||||||
if (gl_FragCoord.x > pixelPos6.x && gl_FragCoord.x < pixelPos6.x + 1 && gl_FragCoord.y > pixelPos6.y && gl_FragCoord.y < pixelPos6.y + 1){
|
|
||||||
mixhistory = 0.1;
|
|
||||||
gl_FragData[0] = vec4(1,0,0,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
|
|
||||||
@ -194,12 +211,12 @@ if (gl_FragCoord.x > pixelPos6.x && gl_FragCoord.x < pixelPos6.x + 1 && gl_FragC
|
|||||||
#ifdef Daily_Weather
|
#ifdef Daily_Weather
|
||||||
ivec2 pixelPos = ivec2(0,0);
|
ivec2 pixelPos = ivec2(0,0);
|
||||||
if (gl_FragCoord.x > 1 && gl_FragCoord.x < 4 && gl_FragCoord.y > 1 && gl_FragCoord.y < 2){
|
if (gl_FragCoord.x > 1 && gl_FragCoord.x < 4 && gl_FragCoord.y > 1 && gl_FragCoord.y < 2){
|
||||||
|
|
||||||
|
mixhistory = clamp(dayChangeSmooth*dayChangeSmooth*dayChangeSmooth*0.1, frameTime*0.1, 1.0);
|
||||||
|
|
||||||
mixhistory = 0.005;
|
if(gl_FragCoord.x < 2) gl_FragData[0] = vec4(CurrentFrame_dailyWeatherParams0.rgb * 10.0,1.0);
|
||||||
|
if(gl_FragCoord.x > 2) gl_FragData[0] = vec4(CurrentFrame_dailyWeatherParams1.rgb * 10.0,1.0);
|
||||||
if(gl_FragCoord.x < 2) gl_FragData[0] = vec4(dailyWeatherParams0.rgb * 2.0,1.0);
|
if(gl_FragCoord.x > 3) gl_FragData[0] = vec4(CurrentFrame_dailyWeatherParams0.a * 10.0, CurrentFrame_dailyWeatherParams1.a * 10.0, 0.0, 1.0);
|
||||||
if(gl_FragCoord.x > 2) gl_FragData[0] = vec4(dailyWeatherParams1.rgb * 2.0,1.0);
|
|
||||||
if(gl_FragCoord.x > 3) gl_FragData[0] = vec4(dailyWeatherParams0.a * 2.0, dailyWeatherParams1.a * 2.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -267,7 +284,9 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
|
|||||||
sky *= vec3(0.0, 0.18, 0.35);
|
sky *= vec3(0.0, 0.18, 0.35);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0] = vec4(sky / 4000.0, 1.0);
|
gl_FragData[0] = vec4(sky / 4000.0 , 1.0);
|
||||||
|
|
||||||
|
if(worldTimeChangeCheck) mixhistory = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// --- Sky + clouds + fog
|
/// --- Sky + clouds + fog
|
||||||
@ -275,27 +294,31 @@ 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);
|
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
|
||||||
vec3 viewVector = cartToSphere(p);
|
vec3 viewVector = cartToSphere(p);
|
||||||
|
|
||||||
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition) ;// * ( float(sunElevation > 1e-5)*2.0-1.0 );
|
vec3 viewPos = mat3(gbufferModelView)*viewVector*1024.0;
|
||||||
|
float noise = interleaved_gradientNoise_temporal();
|
||||||
|
|
||||||
|
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition + gbufferModelViewInverse[3].xyz) ;// * ( float(sunElevation > 1e-5)*2.0-1.0 );
|
||||||
|
|
||||||
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
|
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
|
||||||
sky = mix(dot(sky, vec3(0.333)) * vec3(0.5), sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5));
|
sky = mix(averageSkyCol_Clouds * AmbientLightTint * 0.25, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0));
|
||||||
|
|
||||||
vec3 suncol = lightSourceColor;
|
vec3 suncol = lightSourceColor;
|
||||||
|
|
||||||
#ifdef ambientLight_only
|
#ifdef ambientLight_only
|
||||||
suncol = vec3(0.0);
|
suncol = vec3(0.0);
|
||||||
#endif
|
#endif
|
||||||
|
float rejection = 1.0;
|
||||||
vec3 cloudDepth = vec3(0.0);
|
vec4 volumetricClouds = GetVolumetricClouds(viewPos, vec2(noise, 1.0-noise), WsunVec, suncol*2.5, skyGroundCol/30.0);
|
||||||
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*2.0, skyGroundCol/30.0, cloudDepth);
|
|
||||||
|
|
||||||
float atmosphereAlpha = 1.0;
|
|
||||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*2.0, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha);
|
|
||||||
|
|
||||||
sky = sky*clouds.a + clouds.rgb / 5.0;
|
float atmosphereAlpha = 1.0;
|
||||||
sky *= atmosphereAlpha;
|
vec4 volumetricFog = GetVolumetricFog(viewPos, vec2(noise, 1.0-noise), suncol*2.5, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha, volumetricClouds.rgb);
|
||||||
sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0;
|
|
||||||
|
sky = sky * volumetricClouds.a + volumetricClouds.rgb / 5.0;
|
||||||
|
sky = sky * volumetricFog.a + volumetricFog.rgb / 5.0;
|
||||||
|
|
||||||
gl_FragData[0] = vec4(sky,1.0);
|
gl_FragData[0] = vec4(sky,1.0);
|
||||||
|
|
||||||
|
if(worldTimeChangeCheck) mixhistory = 1.0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -306,14 +329,15 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
|||||||
if (gl_FragCoord.x > (fogPos.x - fogPos.x*0.22) && gl_FragCoord.y > 0.4 && gl_FragCoord.x < 535){
|
if (gl_FragCoord.x > (fogPos.x - fogPos.x*0.22) && gl_FragCoord.y > 0.4 && gl_FragCoord.x < 535){
|
||||||
vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.2,1.2);
|
vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.2,1.2);
|
||||||
vec3 viewVector = cartToSphere(p);
|
vec3 viewVector = cartToSphere(p);
|
||||||
|
float noise = interleaved_gradientNoise_temporal();
|
||||||
|
|
||||||
vec3 BackgroundColor = vec3(0.0);
|
vec3 BackgroundColor = vec3(0.0);
|
||||||
|
|
||||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., fract(frameCounter/1.6180339887), fract(frameCounter/2.6180339887));
|
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., noise, 1.0-noise);
|
||||||
|
|
||||||
BackgroundColor += VL_Fog.rgb/5.0;
|
BackgroundColor += VL_Fog.rgb;
|
||||||
|
|
||||||
gl_FragData[0] = vec4(BackgroundColor, 1.0);
|
gl_FragData[0] = vec4(BackgroundColor*8.0, 1.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -371,12 +395,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
|||||||
|
|
||||||
|
|
||||||
//Temporally accumulate sky and light values
|
//Temporally accumulate sky and light values
|
||||||
vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb;
|
vec3 frameHistory = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb;
|
||||||
vec3 curr = gl_FragData[0].rgb*150.;
|
vec3 currentFrame = gl_FragData[0].rgb*150.;
|
||||||
|
|
||||||
if(accumuteSpeed < 1.0) mixhistory = 1.0;
|
|
||||||
|
|
||||||
gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.);
|
gl_FragData[0].rgb = clamp(mix(frameHistory, currentFrame, mixhistory),0.0,65000.);
|
||||||
|
|
||||||
//Exposure values
|
//Exposure values
|
||||||
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||||
|
@ -23,8 +23,13 @@ flat varying float rodExposure;
|
|||||||
flat varying float avgL2;
|
flat varying float avgL2;
|
||||||
flat varying float centerDepth;
|
flat varying float centerDepth;
|
||||||
|
|
||||||
flat varying vec4 dailyWeatherParams0;
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#endif
|
||||||
|
uniform int hideGUI;
|
||||||
|
flat varying vec4 CurrentFrame_dailyWeatherParams0;
|
||||||
|
flat varying vec4 CurrentFrame_dailyWeatherParams1;
|
||||||
|
|
||||||
uniform sampler2D colortex4;
|
uniform sampler2D colortex4;
|
||||||
uniform sampler2D colortex6;
|
uniform sampler2D colortex6;
|
||||||
@ -146,10 +151,13 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// maximum control of color and luminance
|
// maximum control of color and luminance
|
||||||
vec3 minimumlight = vec3(0.5,0.75,1.0) * (min(MIN_LIGHT_AMOUNT,0.0025) + nightVision);
|
|
||||||
// vec3 minimumlight = vec3(0.5,0.75,1.0) * nightVision;
|
// vec3 minimumlight = vec3(0.5,0.75,1.0) * nightVision;
|
||||||
averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,2.5) * (1.0-rainStrength*0.7), minimumlight);
|
// averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,2.5) * (1.0-rainStrength*0.7), minimumlight);
|
||||||
averageSkyCol = max(averageSkyCol * PLANET_GROUND_BRIGHTNESS, minimumlight);
|
|
||||||
|
|
||||||
|
vec3 minimumlight = vec3(0.02) * 0.2 * MIN_LIGHT_AMOUNT + nightVision * 0.05;
|
||||||
|
averageSkyCol_Clouds = max(normalize(averageSkyCol_Clouds + 1e-6) * min(luma(averageSkyCol_Clouds) * 3.0,2.5),0.0);
|
||||||
|
averageSkyCol = max(averageSkyCol * PLANET_GROUND_BRIGHTNESS,0.0) + max(minimumlight, 0.02 * 0.2);
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
/// --- SUNLIGHT/MOONLIGHT STUFF --- ///
|
/// --- SUNLIGHT/MOONLIGHT STUFF --- ///
|
||||||
@ -165,7 +173,8 @@ void main() {
|
|||||||
sunColor = sunColorBase/4000.0 * skyAbsorb;
|
sunColor = sunColorBase/4000.0 * skyAbsorb;
|
||||||
moonColor = moonColorBase/4000.0;
|
moonColor = moonColorBase/4000.0;
|
||||||
|
|
||||||
lightSourceColor = (sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis) ;
|
// lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
|
||||||
|
lightSourceColor = sunColor * sunVis + moonColor * moonVis;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -213,8 +222,39 @@ void main() {
|
|||||||
vec4(DAY9_l0_density, DAY9_l1_density, DAY9_l2_density, DAY9_cfog_density)
|
vec4(DAY9_l0_density, DAY9_l1_density, DAY9_l2_density, DAY9_cfog_density)
|
||||||
);
|
);
|
||||||
|
|
||||||
dailyWeatherParams0 = weatherParameters_A[dayCounter];
|
|
||||||
dailyWeatherParams1 = weatherParameters_B[dayCounter];
|
|
||||||
|
CurrentFrame_dailyWeatherParams0 = weatherParameters_A[dayCounter];
|
||||||
|
CurrentFrame_dailyWeatherParams1 = weatherParameters_B[dayCounter];
|
||||||
|
|
||||||
|
vec4 rainyWeatherParameters_A[3] = vec4[](
|
||||||
|
// vec4(DAY0_l0_coverage, DAY0_l1_coverage, DAY0_l2_coverage, DAY0_ufog_density),
|
||||||
|
vec4(1.3,0.0,0.0,0.0),
|
||||||
|
vec4(0.5,0.0,0.0,0.0),
|
||||||
|
vec4(0.0,0.0,0.0,0.0)
|
||||||
|
);
|
||||||
|
vec4 rainyWeatherParameters_B[3] = vec4[](
|
||||||
|
// vec4(DAY7_l0_density, DAY7_l1_density, DAY7_l2_density, DAY7_cfog_density),
|
||||||
|
vec4(0.1,0.0,0.0,0.0),
|
||||||
|
vec4(0.1,0.0,0.0,0.0),
|
||||||
|
vec4(0.0,0.0,0.0,0.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// if(hideGUI == 1){
|
||||||
|
// CurrentFrame_dailyWeatherParams0 = rainyWeatherParameters_A[worldDay%2];
|
||||||
|
// CurrentFrame_dailyWeatherParams1 = rainyWeatherParameters_B[worldDay%2];
|
||||||
|
// } else {
|
||||||
|
// CurrentFrame_dailyWeatherParams0 = vec4(0.5,0.0,0.0,0.0);
|
||||||
|
// CurrentFrame_dailyWeatherParams1 = vec4(0.1,0.5,0.0,0.0);
|
||||||
|
// }
|
||||||
|
|
||||||
|
#if defined Daily_Weather
|
||||||
|
dailyWeatherParams0 = vec4(sqrt(texelFetch2D(colortex4,ivec2(1,1),0).rgb/ 1500.0), 0.0);
|
||||||
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
|
|
||||||
|
dailyWeatherParams0.a = texelFetch2D(colortex4,ivec2(3,1),0).x/1500.0;
|
||||||
|
dailyWeatherParams1.a = texelFetch2D(colortex4,ivec2(3,1),0).y/1500.0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -235,7 +275,7 @@ void main() {
|
|||||||
vec2 ij = R2_samples((frameCounter%2000)*maxITexp+i);
|
vec2 ij = R2_samples((frameCounter%2000)*maxITexp+i);
|
||||||
vec2 tc = 0.5 + (ij-0.5) * 0.7;
|
vec2 tc = 0.5 + (ij-0.5) * 0.7;
|
||||||
vec3 sp = texture2D(colortex6, tc/16. * resScale+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb;
|
vec3 sp = texture2D(colortex6, tc/16. * resScale+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb;
|
||||||
avgExp += log(luma(sp));
|
avgExp += log(sqrt(luma(sp)));
|
||||||
avgB += log(min(dot(sp,vec3(0.07,0.22,0.71)),8e-2));
|
avgB += log(min(dot(sp,vec3(0.07,0.22,0.71)),8e-2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,13 +287,16 @@ void main() {
|
|||||||
float L = max(avgBrightness,1e-8);
|
float L = max(avgBrightness,1e-8);
|
||||||
float keyVal = 1.03-2.0/(log(L*4000/150.*8./3.0+1.0)/log(10.0)+2.0);
|
float keyVal = 1.03-2.0/(log(L*4000/150.*8./3.0+1.0)/log(10.0)+2.0);
|
||||||
float expFunc = 0.5+0.5*tanh(log(L));
|
float expFunc = 0.5+0.5*tanh(log(L));
|
||||||
float targetExposure = 0.18/log2(L*2.5+1.045)*0.62;
|
|
||||||
|
float targetExposure = 1.0/log(L+1.05);
|
||||||
|
// float targetExposure = 0.35/log(L+1.05);
|
||||||
|
// float targetExposure = 0.18/log2(L*2.5+1.045)*0.62;
|
||||||
|
|
||||||
avgL2 = clamp(mix(avgB,texelFetch2D(colortex4,ivec2(10,37),0).b,0.985),0.00003051757,65000.0);
|
avgL2 = clamp(mix(avgB,texelFetch2D(colortex4,ivec2(10,37),0).b,0.985),0.00003051757,65000.0);
|
||||||
float targetrodExposure = max(0.012/log2(avgL2+1.002)-0.1,0.0)*1.2;
|
float targetrodExposure = max(0.012/log2(avgL2+1.002)-0.1,0.0)*1.2;
|
||||||
|
|
||||||
|
|
||||||
exposure = max(targetExposure*EXPOSURE_MULTIPLIER, 0.0);
|
exposure = max(targetExposure, 0.0);
|
||||||
// exposure = mix(0.0, 1.0, min(targetExposure,1.0));
|
// exposure = mix(0.0, 1.0, min(targetExposure,1.0));
|
||||||
// exposure = 1;
|
// exposure = 1;
|
||||||
|
|
||||||
|
@ -100,6 +100,17 @@ uniform int dhRenderDistance;
|
|||||||
|
|
||||||
#define CLOUDS_INTERSECT_TERRAIN
|
#define CLOUDS_INTERSECT_TERRAIN
|
||||||
uniform float eyeAltitude;
|
uniform float eyeAltitude;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
|
|
||||||
|
|
||||||
@ -116,7 +127,6 @@ uniform float eyeAltitude;
|
|||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
/* DRAWBUFFERS:0 */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#include "/lib/settings.glsl"
|
#include "/lib/settings.glsl"
|
||||||
|
|
||||||
// uniform int dhRenderDistance;
|
// uniform int dhRenderDistance;
|
||||||
#if defined Daily_Weather
|
|
||||||
flat varying vec4 dailyWeatherParams0;
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
#endif
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
flat varying vec3 averageSkyCol;
|
flat varying vec3 averageSkyCol;
|
||||||
flat varying vec3 sunColor;
|
flat varying vec3 sunColor;
|
||||||
@ -32,8 +34,8 @@ void main() {
|
|||||||
gl_Position.xy = (gl_Position.xy*0.5+0.5)*clamp(CLOUDS_QUALITY+0.01,0.0,1.0)*2.0-1.0;
|
gl_Position.xy = (gl_Position.xy*0.5+0.5)*clamp(CLOUDS_QUALITY+0.01,0.0,1.0)*2.0-1.0;
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#if defined Daily_Weather
|
||||||
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);
|
||||||
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
#include "/lib/settings.glsl"
|
#include "/lib/settings.glsl"
|
||||||
|
|
||||||
uniform sampler2D colortex7;
|
uniform sampler2D colortex7;
|
||||||
|
uniform sampler2D colortex5;
|
||||||
|
uniform sampler2D colortex6;
|
||||||
uniform sampler2D colortex14;
|
uniform sampler2D colortex14;
|
||||||
uniform sampler2D depthtex0;
|
uniform sampler2D depthtex0;
|
||||||
|
uniform sampler2D depthtex1;
|
||||||
uniform sampler2D depthtex2;
|
uniform sampler2D depthtex2;
|
||||||
uniform sampler2D noisetex;
|
uniform sampler2D noisetex;
|
||||||
|
|
||||||
varying vec2 texcoord;
|
varying vec2 texcoord;
|
||||||
uniform vec2 texelSize;
|
uniform vec2 texelSize;
|
||||||
uniform float frameTimeCounter;
|
uniform float frameTimeCounter;
|
||||||
|
uniform int frameCounter;
|
||||||
uniform float viewHeight;
|
uniform float viewHeight;
|
||||||
uniform float viewWidth;
|
uniform float viewWidth;
|
||||||
uniform float aspectRatio;
|
uniform float aspectRatio;
|
||||||
@ -19,12 +23,19 @@ uniform int hideGUI;
|
|||||||
#include "/lib/color_dither.glsl"
|
#include "/lib/color_dither.glsl"
|
||||||
#include "/lib/res_params.glsl"
|
#include "/lib/res_params.glsl"
|
||||||
|
|
||||||
|
uniform float near;
|
||||||
|
uniform float far;
|
||||||
|
float ld(float dist) {
|
||||||
|
return (2.0 * near) / (far + near - dist * (far - near));
|
||||||
|
}
|
||||||
float interleaved_gradientNoise(){
|
float interleaved_gradientNoise(){
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||||
return noise;
|
return noise;
|
||||||
}
|
}
|
||||||
|
float blueNoise(){
|
||||||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||||
|
}
|
||||||
|
|
||||||
#include "/lib/gameplay_effects.glsl"
|
#include "/lib/gameplay_effects.glsl"
|
||||||
|
|
||||||
@ -53,14 +64,20 @@ uniform mat4 gbufferPreviousModelView;
|
|||||||
|
|
||||||
#include "/lib/util.glsl"
|
#include "/lib/util.glsl"
|
||||||
#include "/lib/projections.glsl"
|
#include "/lib/projections.glsl"
|
||||||
|
vec3 tonemap(vec3 col){
|
||||||
|
return col/(1+luma(col));
|
||||||
|
}
|
||||||
|
vec3 invTonemap(vec3 col){
|
||||||
|
return col/(1-luma(col));
|
||||||
|
}
|
||||||
|
|
||||||
vec3 doMotionBlur(vec2 texcoord, float depth, float noise){
|
vec3 doMotionBlur(vec2 texcoord, float depth, float noise, bool hand){
|
||||||
|
|
||||||
float samples = 4.0;
|
float samples = 4.0;
|
||||||
vec3 color = vec3(0.0);
|
vec3 color = vec3(0.0);
|
||||||
|
|
||||||
float blurMult = 1.0;
|
float blurMult = 1.0;
|
||||||
if(depth < 0.56) blurMult = 0.0;
|
if(hand) blurMult = 0.0;
|
||||||
|
|
||||||
vec3 viewPos = toScreenSpace(vec3(texcoord, depth));
|
vec3 viewPos = toScreenSpace(vec3(texcoord, depth));
|
||||||
viewPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
|
viewPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
|
||||||
@ -71,8 +88,9 @@ vec3 doMotionBlur(vec2 texcoord, float depth, float noise){
|
|||||||
vec2 velocity = texcoord - previousPosition.xy;
|
vec2 velocity = texcoord - previousPosition.xy;
|
||||||
|
|
||||||
// thank you Capt Tatsu for letting me use these
|
// thank you Capt Tatsu for letting me use these
|
||||||
velocity = (velocity / (1.0 + length(velocity))) * 0.05 * blurMult * MOTION_BLUR_STRENGTH;
|
velocity = (velocity / (1.0 + length(velocity)) ) * 0.05 * blurMult * MOTION_BLUR_STRENGTH;
|
||||||
texcoord = texcoord - velocity*(samples*0.5 + noise);
|
texcoord = texcoord - velocity*(samples*0.5 + noise);
|
||||||
|
|
||||||
vec2 screenEdges = 2.0/vec2(viewWidth, viewHeight);
|
vec2 screenEdges = 2.0/vec2(viewWidth, viewHeight);
|
||||||
|
|
||||||
for (int i = 0; i < int(samples); i++) {
|
for (int i = 0; i < int(samples); i++) {
|
||||||
@ -81,23 +99,53 @@ vec3 doMotionBlur(vec2 texcoord, float depth, float noise){
|
|||||||
color += texture2D(colortex7, clamp(texcoord, screenEdges, 1.0-screenEdges)).rgb;
|
color += texture2D(colortex7, clamp(texcoord, screenEdges, 1.0-screenEdges)).rgb;
|
||||||
|
|
||||||
}
|
}
|
||||||
// return vec3(texcoord,0.0);
|
|
||||||
return color / samples;
|
return color / samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float convertHandDepth_2(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;
|
||||||
|
}
|
||||||
|
|
||||||
uniform sampler2D shadowcolor1;
|
uniform sampler2D shadowcolor1;
|
||||||
|
|
||||||
|
float doVignette( in vec2 texcoord, in float noise){
|
||||||
|
|
||||||
|
float vignette = 1.0-clamp(1.0-length(texcoord-0.5),0.0,1.0);
|
||||||
|
|
||||||
|
// vignette = pow(1.0-pow(1.0-vignette,3),5);
|
||||||
|
vignette *= vignette*vignette;
|
||||||
|
vignette = 1.0-vignette;
|
||||||
|
vignette *= vignette*vignette*vignette*vignette;
|
||||||
|
|
||||||
|
// stop banding
|
||||||
|
vignette = vignette + vignette*(noise-0.5)*0.01;
|
||||||
|
|
||||||
|
return mix(1.0, vignette, VIGNETTE_STRENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
float depth = texture2D(depthtex0,texcoord*RENDER_SCALE).r;
|
float noise = blueNoise();
|
||||||
float noise = interleaved_gradientNoise();
|
|
||||||
|
|
||||||
#ifdef MOTION_BLUR
|
#ifdef MOTION_BLUR
|
||||||
vec3 COLOR = doMotionBlur(texcoord, depth, noise);
|
float depth = texture2D(depthtex0, texcoord*RENDER_SCALE).r;
|
||||||
|
bool hand = depth < 0.56;
|
||||||
|
float depth2 = convertHandDepth_2(depth, hand);
|
||||||
|
|
||||||
|
vec3 COLOR = doMotionBlur(texcoord, depth2, noise, hand);
|
||||||
#else
|
#else
|
||||||
vec3 COLOR = texture2D(colortex7,texcoord).rgb;
|
vec3 COLOR = texture2D(colortex7,texcoord).rgb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VIGNETTE
|
||||||
|
COLOR *= doVignette(texcoord, noise);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT || defined WATER_ON_CAMERA_EFFECT
|
#if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT || defined WATER_ON_CAMERA_EFFECT
|
||||||
// for making the fun, more fun
|
// for making the fun, more fun
|
||||||
applyGameplayEffects(COLOR, texcoord, noise);
|
applyGameplayEffects(COLOR, texcoord, noise);
|
||||||
@ -108,10 +156,19 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG_VIEW == debug_SHADOWMAP
|
#if DEBUG_VIEW == debug_SHADOWMAP
|
||||||
|
vec2 shadowUV = texcoord * vec2(2.0, 1.0) ;
|
||||||
|
|
||||||
vec2 shadowUV = texcoord * vec2(2.0, 1.0);
|
// shadowUV -= vec2(0.5,0.0);
|
||||||
|
// float zoom = 0.1;
|
||||||
|
// shadowUV = ((shadowUV-0.5) - (shadowUV-0.5)*zoom) + 0.5;
|
||||||
|
|
||||||
if(shadowUV.x < 1.0 && shadowUV.y < 1.0 && hideGUI == 1)COLOR = texture2D(shadowcolor1,shadowUV).rgb;
|
if(shadowUV.x < 1.0 && shadowUV.y < 1.0 && hideGUI == 1) COLOR = texture2D(shadowcolor1,shadowUV).rgb;
|
||||||
|
#endif
|
||||||
|
#if DEBUG_VIEW == debug_DEPTHTEX0
|
||||||
|
COLOR = vec3(ld(texture2D(depthtex0, texcoord*RENDER_SCALE).r));
|
||||||
|
#endif
|
||||||
|
#if DEBUG_VIEW == debug_DEPTHTEX1
|
||||||
|
COLOR = vec3(ld(texture2D(depthtex1, texcoord*RENDER_SCALE).r));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
// #if defined END_SHADER || defined NETHER_SHADER
|
// #if defined END_SHADER || defined NETHER_SHADER
|
||||||
#undef IS_LPV_ENABLED
|
#undef IS_LPV_ENABLED
|
||||||
// #endif
|
// #endif
|
||||||
#ifndef OVERWORLD_SHADER
|
|
||||||
uniform float nightVision;
|
uniform float nightVision;
|
||||||
#endif
|
|
||||||
|
|
||||||
flat varying vec4 lightCol;
|
flat varying vec4 lightCol;
|
||||||
flat varying vec3 averageSkyCol;
|
flat varying vec3 averageSkyCol;
|
||||||
@ -90,14 +88,33 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
|||||||
flat varying vec3 refractedSunVec;
|
flat varying vec3 refractedSunVec;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Daily_Weather
|
||||||
|
flat varying vec4 dailyWeatherParams0;
|
||||||
|
flat varying vec4 dailyWeatherParams1;
|
||||||
|
#else
|
||||||
|
vec4 dailyWeatherParams0 = vec4(CloudLayer0_coverage, CloudLayer1_coverage, CloudLayer2_coverage, 0.0);
|
||||||
|
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define TIMEOFDAYFOG
|
#define TIMEOFDAYFOG
|
||||||
#include "/lib/lightning_stuff.glsl"
|
#include "/lib/lightning_stuff.glsl"
|
||||||
|
|
||||||
#define CLOUDS_INTERSECT_TERRAIN
|
#define CLOUDS_INTERSECT_TERRAIN
|
||||||
// #define CLOUDSHADOWSONLY
|
// #define CLOUDSHADOWSONLY
|
||||||
#include "/lib/volumetricClouds.glsl"
|
#include "/lib/volumetricClouds.glsl"
|
||||||
|
#include "/lib/climate_settings.glsl"
|
||||||
#include "/lib/overworld_fog.glsl"
|
#include "/lib/overworld_fog.glsl"
|
||||||
|
|
||||||
|
// float fogPhase(float lightPoint){
|
||||||
|
// float linear = 1.0 - clamp(lightPoint*0.5+0.5,0.0,1.0);
|
||||||
|
// float linear2 = 1.0 - clamp(lightPoint,0.0,1.0);
|
||||||
|
|
||||||
|
// float exponential = exp2(pow(linear,0.3) * -15.0 ) * 1.5;
|
||||||
|
// exponential += sqrt(exp2(sqrt(linear) * -12.5));
|
||||||
|
|
||||||
|
// return exponential;
|
||||||
|
// }
|
||||||
#endif
|
#endif
|
||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
uniform sampler2D colortex4;
|
uniform sampler2D colortex4;
|
||||||
@ -190,7 +207,7 @@ float fogPhase2(float lightPoint){
|
|||||||
return exponential;
|
return exponential;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL, float lightleakFix){
|
||||||
int spCount = rayMarchSampleCount;
|
int spCount = rayMarchSampleCount;
|
||||||
|
|
||||||
vec3 start = toShadowSpaceProjected(rayStart);
|
vec3 start = toShadowSpaceProjected(rayStart);
|
||||||
@ -207,8 +224,12 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
|||||||
|
|
||||||
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
||||||
vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
|
vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
|
||||||
|
|
||||||
|
// vec3 dVWorld = -mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
|
||||||
|
|
||||||
vec3 newabsorbance = exp(-rayLength * waterCoefs); // No need to take the integrated value
|
// vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
||||||
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
float phase = fogPhase(VdotL) * 5.0;
|
float phase = fogPhase(VdotL) * 5.0;
|
||||||
#else
|
#else
|
||||||
@ -218,13 +239,14 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
|||||||
vec3 vL = vec3(0.0);
|
vec3 vL = vec3(0.0);
|
||||||
|
|
||||||
ambient = max(ambient * (normalize(wpos).y*0.3+0.7),0.0);
|
ambient = max(ambient * (normalize(wpos).y*0.3+0.7),0.0);
|
||||||
|
|
||||||
float expFactor = 11.0;
|
float expFactor = 11.0;
|
||||||
for (int i=0;i<spCount;i++) {
|
for (int i=0;i<spCount;i++) {
|
||||||
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||||
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
|
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
|
||||||
|
|
||||||
vec3 progressW = start.xyz+cameraPosition+dVWorld;
|
// progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||||
|
|
||||||
|
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||||
|
|
||||||
vec3 sh = vec3(1.0);
|
vec3 sh = vec3(1.0);
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
@ -255,24 +277,67 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VL_CLOUDS_SHADOWS
|
#ifdef VL_CLOUDS_SHADOWS
|
||||||
sh *= GetCloudShadow_VLFOG(progressW,WsunVec);
|
sh *= GetCloudShadow(progressW, WsunVec);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 sunMul = exp(-estSunDepth * d * waterCoefs * 1.1);
|
vec3 sunAbsorbance = exp(-waterCoefs * estSunDepth * d);
|
||||||
vec3 ambientMul = exp(-estEndDepth * d * waterCoefs );
|
vec3 ambientAbsorbance = exp(-waterCoefs * estEndDepth * d);
|
||||||
|
|
||||||
vec3 Directlight = ((lightSource * sh) * phase * sunMul) ;
|
vec3 Directlight = lightSource * sh * phase * sunAbsorbance;
|
||||||
vec3 Indirectlight = max(ambient * ambientMul, vec3(0.01,0.2,0.4) * ambientMul * MIN_LIGHT_AMOUNT * 0.03) ;
|
vec3 Indirectlight = ambient * ambientAbsorbance;
|
||||||
|
|
||||||
vec3 light = (Indirectlight + Directlight) * scatterCoef;
|
vec3 light = (Indirectlight + Directlight) * scatterCoef;
|
||||||
|
|
||||||
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
|
vec3 volumeCoeff = exp(-waterCoefs * dd * rayLength);
|
||||||
absorbance *= exp(-waterCoefs * dd * rayLength);
|
vL += (light - light * volumeCoeff) / waterCoefs * absorbance;
|
||||||
|
absorbance *= volumeCoeff;
|
||||||
}
|
}
|
||||||
// inColor += vL;
|
|
||||||
return vec4( vL, dot(newabsorbance,vec3(0.335)));
|
return vec4(vL, dot(absorbance,vec3(0.335)));
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){
|
||||||
|
inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value
|
||||||
|
int spCount = rayMarchSampleCount;
|
||||||
|
vec3 start = toShadowSpaceProjected(rayStart);
|
||||||
|
vec3 end = toShadowSpaceProjected(rayEnd);
|
||||||
|
vec3 dV = (end-start);
|
||||||
|
//limit ray length at 32 blocks for performance and reducing integration error
|
||||||
|
//you can't see above this anyway
|
||||||
|
float maxZ = min(rayLength,32.0)/(1e-8+rayLength);
|
||||||
|
dV *= maxZ;
|
||||||
|
vec3 dVWorld = -mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
|
||||||
|
rayLength *= maxZ;
|
||||||
|
estEndDepth *= maxZ;
|
||||||
|
estSunDepth *= maxZ;
|
||||||
|
vec3 absorbance = vec3(1.0);
|
||||||
|
vec3 vL = vec3(0.0);
|
||||||
|
float phase = phaseg(VdotL, Dirt_Mie_Phase);
|
||||||
|
float expFactor = 11.0;
|
||||||
|
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
||||||
|
for (int i=0;i<spCount;i++) {
|
||||||
|
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||||
|
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
|
||||||
|
vec3 spPos = start.xyz + dV*d;
|
||||||
|
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||||
|
//project into biased shadowmap space
|
||||||
|
float distortFactor = calcDistort(spPos.xy);
|
||||||
|
vec3 pos = vec3(spPos.xy*distortFactor, spPos.z);
|
||||||
|
float sh = 1.0;
|
||||||
|
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
||||||
|
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
||||||
|
sh = shadow2D( shadow, pos).x;
|
||||||
|
}
|
||||||
|
vec3 ambientMul = exp(-estEndDepth * d * waterCoefs * 1.1);
|
||||||
|
vec3 sunMul = exp(-estSunDepth * d * waterCoefs);
|
||||||
|
vec3 light = (sh * lightSource*8./150./3.0 * phase * sunMul + ambientMul * ambient)*scatterCoef;
|
||||||
|
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs *absorbance;
|
||||||
|
absorbance *= exp(-dd * rayLength * waterCoefs);
|
||||||
|
}
|
||||||
|
inColor += vL;
|
||||||
|
}
|
||||||
|
*/
|
||||||
vec2 decodeVec2(float a){
|
vec2 decodeVec2(float a){
|
||||||
const vec2 constant1 = 65535. / vec2( 256., 65536.);
|
const vec2 constant1 = 65535. / vec2( 256., 65536.);
|
||||||
const float constant2 = 256. / 255.;
|
const float constant2 = 256. / 255.;
|
||||||
@ -293,13 +358,16 @@ void main() {
|
|||||||
|
|
||||||
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
|
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
|
||||||
|
|
||||||
bool iswater = texture2D(colortex7,tc).a > 0.99;
|
float alpha = texture2D(colortex7,tc).a ;
|
||||||
|
float blendedAlpha = texture2D(colortex2, tc).a;
|
||||||
|
|
||||||
|
|
||||||
|
bool iswater = alpha > 0.99;
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
///////////////// BEHIND OF TRANSLUCENTS /////////////////
|
///////////////// BEHIND OF TRANSLUCENTS /////////////////
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if(texture2D(colortex2, tc).a > 0.0 || iswater){
|
if(blendedAlpha > 0.0 || iswater){
|
||||||
|
|
||||||
float noise_1 = R2_dither();
|
float noise_1 = R2_dither();
|
||||||
float noise_2 = blueNoise();
|
float noise_2 = blueNoise();
|
||||||
@ -322,78 +390,106 @@ void main() {
|
|||||||
|
|
||||||
// vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
|
// vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
|
||||||
|
|
||||||
float dirtAmount = Dirt_Amount + 0.1;
|
float dirtAmount = Dirt_Amount ;
|
||||||
// float dirtAmount = Dirt_Amount + 0.01;
|
// float dirtAmount = Dirt_Amount + 0.01;
|
||||||
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
|
||||||
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
|
vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B);
|
||||||
vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon;
|
vec3 totEpsilon = dirtEpsilon * dirtAmount + waterEpsilon;
|
||||||
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
|
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
|
||||||
|
|
||||||
#ifdef BIOME_TINT_WATER
|
#ifdef BIOME_TINT_WATER
|
||||||
// yoink the biome tint written in this buffer for water only.
|
// yoink the biome tint written in this buffer for water only.
|
||||||
if(iswater){
|
if(iswater){
|
||||||
vec2 translucentdata = texture2D(colortex11,tc).gb;
|
vec2 translucentdata = texelFetch2D(colortex11,ivec2(tc/texelSize),0).gb;
|
||||||
vec3 wateralbedo = normalize(vec3(decodeVec2(translucentdata.x),decodeVec2(translucentdata.y).x)+0.00001) * 0.5 + 0.5;
|
vec3 wateralbedo = normalize(vec3(decodeVec2(translucentdata.x),decodeVec2(translucentdata.y).x)+0.00001) * 0.5 + 0.5;
|
||||||
scatterCoef = dirtAmount * wateralbedo / 3.14;
|
scatterCoef = dirtAmount * wateralbedo / 3.14;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 directLightColor = lightCol.rgb/80.0;
|
// vec3 directLightColor = lightCol.rgb / 2400.0;
|
||||||
vec3 indirectLightColor = averageSkyCol/30.0;
|
// vec3 indirectLightColor = averageSkyCol / 1500.0;
|
||||||
vec3 indirectLightColor_dynamic = averageSkyCol_Clouds/30.0;
|
// vec3 indirectLightColor_dynamic = averageSkyCol_Clouds / 900.0;
|
||||||
|
|
||||||
|
vec3 directLightColor = lightCol.rgb / 2400.0;
|
||||||
|
vec3 indirectLightColor = averageSkyCol / 1200.0;
|
||||||
|
vec3 indirectLightColor_dynamic = averageSkyCol_Clouds / 900.0;
|
||||||
|
|
||||||
|
|
||||||
vec3 viewPos1 = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z);
|
vec3 viewPos1 = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z);
|
||||||
vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0);
|
vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0);
|
||||||
vec3 playerPos = normalize(mat3(gbufferModelViewInverse) * viewPos1);
|
|
||||||
|
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos1;
|
||||||
|
vec3 playerPos0 = mat3(gbufferModelViewInverse) * viewPos0;
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
// vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a);
|
// vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a);
|
||||||
|
|
||||||
vec2 lightmap = vec2(0.0,texture2D(colortex14, tc).a);
|
// vec2 lightmap = vec2(0.0,texture2D(colortex14, tc).a);
|
||||||
|
|
||||||
|
vec2 lightmap = decodeVec2(texelFetch2D(colortex14,ivec2(tc/texelSize),0).x);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DISTANT_HORIZONS
|
#ifdef DISTANT_HORIZONS
|
||||||
if(z >= 1.0) lightmap.y = 0.99;
|
if(z >= 1.0) lightmap.y = 0.99;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a);
|
vec2 lightmap = decodeVec2(texelFetch2D(colortex14,ivec2(tc/texelSize),0).a);
|
||||||
lightmap.y = 1.0;
|
lightmap.y = 1.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float Vdiff = distance(viewPos1, viewPos0) * 2.0;
|
// float Vdiff = distance(viewPos1, viewPos0) * 2.0;
|
||||||
float VdotU = playerPos.y;
|
// float VdotU = playerPos.y;
|
||||||
float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane
|
// float estimatedDepth = Vdiff * abs(VdotU); //assuming water plane
|
||||||
float estimatedSunDepth = estimatedDepth / abs(WsunVec.y); //assuming water plane
|
|
||||||
|
|
||||||
indirectLightColor_dynamic *= ambient_brightness * pow(1.0-pow(1.0-lightmap.y,0.5),3.0) ;
|
float Vdiff = distance(viewPos1, viewPos0);
|
||||||
// float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) ;
|
float estimatedDepth = Vdiff * abs(normalize(playerPos).y);
|
||||||
// indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * TorchBrightness_autoAdjust * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * 2.0;
|
float estimatedSunDepth = (Vdiff * 0.5) / abs(WsunVec.y); //assuming water plane
|
||||||
|
Vdiff *= 2.0;
|
||||||
vec3 cloudDepth = vec3(0.0);
|
|
||||||
vec4 VolumetricFog2 = vec4(0,0,0,1);
|
|
||||||
vec4 VolumetricClouds = vec4(0,0,0,1);
|
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
// Vdiff = Vdiff * (1.0 - clamp(exp(-Vdiff),0.0,1.0)) + max(estimatedDepth - 1.0,0.0);
|
||||||
if(!iswater){
|
// estimatedDepth = max(estimatedDepth - 1.0,0.0);
|
||||||
|
|
||||||
|
indirectLightColor_dynamic *= ambient_brightness * lightmap.y*lightmap.y;
|
||||||
|
|
||||||
#if defined CLOUDS_INTERSECT_TERRAIN
|
indirectLightColor_dynamic += MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision*0.02;
|
||||||
VolumetricClouds = renderClouds(viewPos1, vec2(noise_1,noise_2), directLightColor, indirectLightColor, cloudDepth);
|
|
||||||
#endif
|
indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) ;
|
||||||
|
|
||||||
|
vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0);
|
||||||
|
|
||||||
|
if(!iswater){
|
||||||
|
#ifdef OVERWORLD_SHADER
|
||||||
|
vec4 VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1, noise_2), WsunVec, directLightColor, indirectLightColor);
|
||||||
|
|
||||||
|
|
||||||
float atmosphereAlpha = 1.0;
|
float atmosphereAlpha = 1.0;
|
||||||
VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor,indirectLightColor_dynamic, atmosphereAlpha);
|
vec4 VolumetricFog = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb);
|
||||||
VolumetricClouds.a *= atmosphereAlpha;
|
|
||||||
|
finalVolumetrics = VolumetricClouds;
|
||||||
|
|
||||||
|
// VolumetricClouds.a *= atmosphereAlpha;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined CLOUDS_INTERSECT_TERRAIN
|
#if defined NETHER_SHADER || defined END_SHADER
|
||||||
VolumetricFog2 = vec4(VolumetricClouds.rgb * VolumetricFog2.a * atmosphereAlpha + VolumetricFog2.rgb, VolumetricFog2.a*VolumetricClouds.a);
|
vec4 VolumetricFog = GetVolumetricFog(viewPos1, noise_1, noise_2);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
// #if defined OVERWORLD_SHADER
|
||||||
|
// vec4 VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a + VolumetricFog.rgb, VolumetricFog.a*VolumetricClouds.a);
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
finalVolumetrics.rgb = finalVolumetrics.rgb * VolumetricFog.a + VolumetricFog.rgb;
|
||||||
|
finalVolumetrics.a *= VolumetricFog.a;
|
||||||
|
}
|
||||||
|
|
||||||
vec4 underwaterVlFog = vec4(0,0,0,1);
|
vec4 underwaterVlFog = vec4(0,0,0,1);
|
||||||
if(iswater) underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor* (1.0-caveDetection), dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) );
|
|
||||||
|
|
||||||
vec4 fogFinal = vec4(underwaterVlFog.rgb * VolumetricFog2.a + VolumetricFog2.rgb, VolumetricFog2.a * underwaterVlFog.a);
|
float lightleakfix = clamp(lightmap.y + (1-caveDetection),0.0,1.0);
|
||||||
|
if(iswater && isEyeInWater != 1) underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ,lightleakfix);
|
||||||
|
|
||||||
|
finalVolumetrics.rgb += underwaterVlFog.rgb;
|
||||||
|
|
||||||
gl_FragData[0] = clamp(fogFinal, 0.0, 65000.0);
|
gl_FragData[0] = clamp(finalVolumetrics, 0.0, 65000.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,10 +6,11 @@ flat varying vec4 lightCol;
|
|||||||
flat varying vec3 averageSkyCol;
|
flat varying vec3 averageSkyCol;
|
||||||
flat varying vec3 averageSkyCol_Clouds;
|
flat varying vec3 averageSkyCol_Clouds;
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#ifdef Daily_Weather
|
||||||
flat varying vec4 dailyWeatherParams0;
|
flat varying vec4 dailyWeatherParams0;
|
||||||
flat varying vec4 dailyWeatherParams1;
|
flat varying vec4 dailyWeatherParams1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
flat varying vec3 WsunVec;
|
flat varying vec3 WsunVec;
|
||||||
flat varying vec3 refractedSunVec;
|
flat varying vec3 refractedSunVec;
|
||||||
@ -56,11 +57,11 @@ void main() {
|
|||||||
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||||
|
|
||||||
#if defined Daily_Weather
|
#if defined Daily_Weather
|
||||||
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams0 = vec4(texelFetch2D(colortex4,ivec2(1,1),0).rgb / 1500.0, 0.0);
|
||||||
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0)/2.0, 0.0);
|
dailyWeatherParams1 = vec4(texelFetch2D(colortex4,ivec2(2,1),0).rgb / 1500.0, 0.0);
|
||||||
|
|
||||||
dailyWeatherParams0.a = (texelFetch2D(colortex4,ivec2(3,1),0).x/150.0)/2.0;
|
dailyWeatherParams0.a = texelFetch2D(colortex4,ivec2(3,1),0).x/1500.0;
|
||||||
dailyWeatherParams1.a = (texelFetch2D(colortex4,ivec2(3,1),0).y/150.0)/2.0;
|
dailyWeatherParams1.a = texelFetch2D(colortex4,ivec2(3,1),0).y/1500.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -68,7 +69,7 @@ void main() {
|
|||||||
#ifdef NETHER_SHADER
|
#ifdef NETHER_SHADER
|
||||||
lightCol.rgb = vec3(0.0);
|
lightCol.rgb = vec3(0.0);
|
||||||
averageSkyCol = vec3(0.0);
|
averageSkyCol = vec3(0.0);
|
||||||
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 5.0;
|
averageSkyCol_Clouds = volumetricsFromTex(vec3(0.0,1.0,0.0), colortex4, 6).rgb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef END_SHADER
|
#ifdef END_SHADER
|
||||||
|
@ -389,12 +389,14 @@ screen.World = World
|
|||||||
option.SSR_STEPS = SSR Quality
|
option.SSR_STEPS = SSR Quality
|
||||||
option.WATER_SUN_SPECULAR = Sun/Moon Reflections
|
option.WATER_SUN_SPECULAR = Sun/Moon Reflections
|
||||||
option.WATER_BACKGROUND_SPECULAR = Sky/Fog Reflections
|
option.WATER_BACKGROUND_SPECULAR = Sky/Fog Reflections
|
||||||
option.Refraction = Refraction In Water/Glass
|
option.FAKE_REFRACTION_EFFECT = Refraction In Water/Glass
|
||||||
option.Dirt_Amount = Dirt Amount
|
option.Dirt_Amount = Dirt Amount
|
||||||
option.Water_Top_Layer = Ocean Y coordinate
|
option.Water_Top_Layer = Ocean Y coordinate
|
||||||
option.WATER_WAVE_STRENGTH = Wave Strength
|
option.WATER_WAVE_STRENGTH = Wave Strength
|
||||||
option.SNELLS_WINDOW = Snell's Window
|
option.SNELLS_WINDOW = Snell's Window
|
||||||
|
option.MINIMUM_WATER_ABSORBANCE = Minimum Water Absorbance
|
||||||
|
value.MINIMUM_WATER_ABSORBANCE.-1 = AUTO
|
||||||
|
|
||||||
screen.Water_fog_color = Water Fog Settings
|
screen.Water_fog_color = Water Fog Settings
|
||||||
option.Dirt_Scatter_R = Scatter Red (dirt)
|
option.Dirt_Scatter_R = Scatter Red (dirt)
|
||||||
option.Dirt_Scatter_G = Scatter Green (dirt)
|
option.Dirt_Scatter_G = Scatter Green (dirt)
|
||||||
@ -417,6 +419,7 @@ screen.Post_Processing = Post Processing
|
|||||||
screen.TAA_OPTIONS = Anti-Aliasing Settings
|
screen.TAA_OPTIONS = Anti-Aliasing Settings
|
||||||
option.SCREENSHOT_MODE = Screenshot Mode
|
option.SCREENSHOT_MODE = Screenshot Mode
|
||||||
option.TAA = TAA
|
option.TAA = TAA
|
||||||
|
option.RESPONSIVE_TAA = Responsive TAA §a(SET BLEND FACTOR TO 0.25 WHEN THIS IS ENABLED)
|
||||||
option.BLEND_FACTOR = Blend Factor
|
option.BLEND_FACTOR = Blend Factor
|
||||||
option.TAA_UPSCALING = Temporal Upscaling
|
option.TAA_UPSCALING = Temporal Upscaling
|
||||||
option.SCALE_FACTOR = Scale Factor
|
option.SCALE_FACTOR = Scale Factor
|
||||||
@ -627,7 +630,7 @@ screen.World.comment = Configure settings for various things that happen in the
|
|||||||
option.SSR_STEPS.comment = Configure the quality of the screen-space reflections on translucent things. §aPERFORMANCE COST:§r medium to high
|
option.SSR_STEPS.comment = Configure the quality of the screen-space reflections on translucent things. §aPERFORMANCE COST:§r medium to high
|
||||||
option.WATER_SUN_SPECULAR.comment = Toggle the sun and moon reflections on translucent things. §aPERFORMANCE COST:§r low
|
option.WATER_SUN_SPECULAR.comment = Toggle the sun and moon reflections on translucent things. §aPERFORMANCE COST:§r low
|
||||||
option.WATER_BACKGROUND_SPECULAR.comment = Toggle the sky and fog reflections on translucent things. §aPERFORMANCE COST:§r low to medium
|
option.WATER_BACKGROUND_SPECULAR.comment = Toggle the sky and fog reflections on translucent things. §aPERFORMANCE COST:§r low to medium
|
||||||
option.Refraction.comment = Toggle refraction on translucent things. §bWhat is this?§r If you look at water, you can see the light refracting distorts what is in it. §aPERFORMANCE COST:§r low
|
option.FAKE_REFRACTION_EFFECT.comment = Toggle refraction on translucent things. §bWhat is this?§r If you look at water, you can see the light refracting distorts what is in it. §aPERFORMANCE COST:§r low
|
||||||
option.Dirt_Amount.comment = Configure how much dirt is in water. This controls how much fog is within water.
|
option.Dirt_Amount.comment = Configure how much dirt is in water. This controls how much fog is within water.
|
||||||
option.Water_Top_Layer.comment = Configure the Y coordinate at which the ocean should be in the world.
|
option.Water_Top_Layer.comment = Configure the Y coordinate at which the ocean should be in the world.
|
||||||
|
|
||||||
@ -735,4 +738,5 @@ option.DISTANT_HORIZONS_SHADOWMAP.comment = §cTHIS SETTING WILL DESTROY PERFOR
|
|||||||
option.TOGGLE_VL_FOG = Toggle Volumetric Fog
|
option.TOGGLE_VL_FOG = Toggle Volumetric Fog
|
||||||
option.TOGGLE_VL_FOG.comment = one big button to just turn all the fog off.
|
option.TOGGLE_VL_FOG.comment = one big button to just turn all the fog off.
|
||||||
|
|
||||||
option.TRANSLUCENT_COLORED_SHADOWS.comment = §bWhat is this?§r This effect allows translucent things like stained glass to color the sunlight as it passes through it. §aPERFORMANCE COST:§r medium
|
option.TRANSLUCENT_COLORED_SHADOWS.comment = §bWhat is this?§r This effect allows translucent things like stained glass to color the sunlight as it passes through it. §aPERFORMANCE COST:§r medium
|
||||||
|
option.MINIMUM_WATER_ABSORBANCE.comment = §bWhat is this?§r This controls how "clear" the water is in shallow areas. AUTO allows water to be clear outdoors, but adjust to be at a minimum value of 7 when indoors, to make it clearly visible. §dTHIS SETTING DOES NOT IMPACT UNDER-WATER VISUALS.
|
@ -216,7 +216,7 @@ screen.World = Mundo
|
|||||||
option.SSR_STEPS = Qualidade do SSR
|
option.SSR_STEPS = Qualidade do SSR
|
||||||
option.WATER_SUN_SPECULAR = Reflexos do Sol/Lua
|
option.WATER_SUN_SPECULAR = Reflexos do Sol/Lua
|
||||||
option.WATER_BACKGROUND_SPECULAR = Reflexos do Céu/Névoa
|
option.WATER_BACKGROUND_SPECULAR = Reflexos do Céu/Névoa
|
||||||
option.Refraction = Refração na Água/Vidro
|
option.FAKE_REFRACTION_EFFECT = Refração na Água/Vidro
|
||||||
option.Dirt_Amount = Quantidade de Sujeira
|
option.Dirt_Amount = Quantidade de Sujeira
|
||||||
option.Water_Top_Layer = Coordenada Y do Oceano
|
option.Water_Top_Layer = Coordenada Y do Oceano
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ screen.World.comment = Ajuste configurações para váriadas coisas que acontece
|
|||||||
option.SSR_STEPS.comment = Ajuste a qualiade dos reflexos em coisas translúcidas. §aCUSTO DE PERFORMANCE:§r Médio pra Alto
|
option.SSR_STEPS.comment = Ajuste a qualiade dos reflexos em coisas translúcidas. §aCUSTO DE PERFORMANCE:§r Médio pra Alto
|
||||||
option.WATER_SUN_SPECULAR.comment = Habilita reflexos da lua e do sol em coisas translúcidas. §aCUSTO DE PERFORMANCE:§r Baixo
|
option.WATER_SUN_SPECULAR.comment = Habilita reflexos da lua e do sol em coisas translúcidas. §aCUSTO DE PERFORMANCE:§r Baixo
|
||||||
option.WATER_BACKGROUND_SPECULAR.comment = Habilita reflexos do céu e névoa em coisas translúcidas. §aCUSTO DE PERFORMANCE:§r Baixo para Médio
|
option.WATER_BACKGROUND_SPECULAR.comment = Habilita reflexos do céu e névoa em coisas translúcidas. §aCUSTO DE PERFORMANCE:§r Baixo para Médio
|
||||||
option.Refraction.comment = Habilita refração em coisas translúcidas. §bO Que é Isso?§r Olhe para a água e você vai perceber a refração da luz distorcendo as coisas dentro dela. §aCUSTO DE PERFORMANCE:§r Baixo
|
option.FAKE_REFRACTION_EFFECT.comment = Habilita refração em coisas translúcidas. §bO Que é Isso?§r Olhe para a água e você vai perceber a refração da luz distorcendo as coisas dentro dela. §aCUSTO DE PERFORMANCE:§r Baixo
|
||||||
option.Dirt_Amount.comment = Ajusta quanta sujeira tem na água. Isso controla quanta névoa tem dentro da água.
|
option.Dirt_Amount.comment = Ajusta quanta sujeira tem na água. Isso controla quanta névoa tem dentro da água.
|
||||||
option.Water_Top_Layer.comment = Ajusta a coordenada Y que oceano deve estar no mundo.
|
option.Water_Top_Layer.comment = Ajusta a coordenada Y que oceano deve estar no mundo.
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ screen.World = Мир
|
|||||||
option.SSR_STEPS = Качество SSR
|
option.SSR_STEPS = Качество SSR
|
||||||
option.WATER_SUN_SPECULAR = Отражения солнца/луны
|
option.WATER_SUN_SPECULAR = Отражения солнца/луны
|
||||||
option.WATER_BACKGROUND_SPECULAR = Отражения неба/тумана
|
option.WATER_BACKGROUND_SPECULAR = Отражения неба/тумана
|
||||||
option.Refraction = Преломление в воде/стекле
|
option.FAKE_REFRACTION_EFFECT = Преломление в воде/стекле
|
||||||
option.Dirt_Amount = Количество грязи
|
option.Dirt_Amount = Количество грязи
|
||||||
option.Water_Top_Layer = Координата океана Y
|
option.Water_Top_Layer = Координата океана Y
|
||||||
option.WATER_WAVE_STRENGTH = Сила волны
|
option.WATER_WAVE_STRENGTH = Сила волны
|
||||||
@ -653,7 +653,7 @@ screen.World.comment = Настраивайте параметры для раз
|
|||||||
option.SSR_STEPS.comment = Настройте качество отражения в пространстве экрана на полупрозрачных объектах. §aНАГРУЗКА:§r от средней до высокой
|
option.SSR_STEPS.comment = Настройте качество отражения в пространстве экрана на полупрозрачных объектах. §aНАГРУЗКА:§r от средней до высокой
|
||||||
option.WATER_SUN_SPECULAR.comment = Переключайте отражения солнца и луны на полупрозрачных объектах. §aНАГРУЗКА:§r низкая
|
option.WATER_SUN_SPECULAR.comment = Переключайте отражения солнца и луны на полупрозрачных объектах. §aНАГРУЗКА:§r низкая
|
||||||
option.WATER_BACKGROUND_SPECULAR.comment = Переключайте отражения неба и тумана на полупрозрачных объектах. §aНАГРУЗКА:§r от низкой до средней
|
option.WATER_BACKGROUND_SPECULAR.comment = Переключайте отражения неба и тумана на полупрозрачных объектах. §aНАГРУЗКА:§r от низкой до средней
|
||||||
option.Refraction.comment = Переключите преломление на полупрозрачных объектах. §bЧто это?§r Если вы посмотрите на воду, то увидите, что преломление света искажает то, что в ней находится. §aНАГРУЗКА:§r низкая
|
option.FAKE_REFRACTION_EFFECT.comment = Переключите преломление на полупрозрачных объектах. §bЧто это?§r Если вы посмотрите на воду, то увидите, что преломление света искажает то, что в ней находится. §aНАГРУЗКА:§r низкая
|
||||||
option.Dirt_Amount.comment = Настройте количество грязи в воде. Это определяет количество тумана в воде
|
option.Dirt_Amount.comment = Настройте количество грязи в воде. Это определяет количество тумана в воде
|
||||||
option.Water_Top_Layer.comment = Настройте координату Y, в которой должен находиться океан в мире
|
option.Water_Top_Layer.comment = Настройте координату Y, в которой должен находиться океан в мире
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ screen.World = 世界
|
|||||||
option.SSR_STEPS = SSR 采样值
|
option.SSR_STEPS = SSR 采样值
|
||||||
option.WATER_SUN_SPECULAR = 日月反射
|
option.WATER_SUN_SPECULAR = 日月反射
|
||||||
option.WATER_BACKGROUND_SPECULAR = 天空/雾气反射
|
option.WATER_BACKGROUND_SPECULAR = 天空/雾气反射
|
||||||
option.Refraction = 折射 (水体/玻璃)
|
option.FAKE_REFRACTION_EFFECT = 折射 (水体/玻璃)
|
||||||
option.Dirt_Amount = 水体浑浊程度
|
option.Dirt_Amount = 水体浑浊程度
|
||||||
option.Water_Top_Layer = 海平面 Y 轴坐标
|
option.Water_Top_Layer = 海平面 Y 轴坐标
|
||||||
option.WATER_WAVE_STRENGTH = 水波强度
|
option.WATER_WAVE_STRENGTH = 水波强度
|
||||||
@ -599,7 +599,7 @@ screen.World.comment = 配置多种会在主世界发生的效果, 从摇摆植
|
|||||||
option.SSR_STEPS.comment = 配置半透明方块的屏幕空间反射质量. §a性能消耗水平:§r 中偏高.
|
option.SSR_STEPS.comment = 配置半透明方块的屏幕空间反射质量. §a性能消耗水平:§r 中偏高.
|
||||||
option.WATER_SUN_SPECULAR.comment = 半透明方块的日月反射开关. §a性能消耗水平:§r 低.
|
option.WATER_SUN_SPECULAR.comment = 半透明方块的日月反射开关. §a性能消耗水平:§r 低.
|
||||||
option.WATER_BACKGROUND_SPECULAR.comment = 半透明方块的天空和雾气反射开关. §a性能消耗水平:§r 低偏中.
|
option.WATER_BACKGROUND_SPECULAR.comment = 半透明方块的天空和雾气反射开关. §a性能消耗水平:§r 低偏中.
|
||||||
option.Refraction.comment = 半透明折射开关. §b这啥?§r 如果你观察水体, 可以看到光的折射会扭曲了水中的内容. §a性能消耗水平:§r 低.
|
option.FAKE_REFRACTION_EFFECT.comment = 半透明折射开关. §b这啥?§r 如果你观察水体, 可以看到光的折射会扭曲了水中的内容. §a性能消耗水平:§r 低.
|
||||||
option.Dirt_Amount.comment = 配置水中污物含量. 这可以控制水雾量.
|
option.Dirt_Amount.comment = 配置水中污物含量. 这可以控制水雾量.
|
||||||
option.Water_Top_Layer.comment = 配置海平面在世界中的 Y 坐标.
|
option.Water_Top_Layer.comment = 配置海平面在世界中的 Y 坐标.
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
|||||||
position += increment * (0.34*noise);
|
position += increment * (0.34*noise);
|
||||||
|
|
||||||
vec2 phaseSun = sky_phase(dot(viewVector, sunVector), 0.8);
|
vec2 phaseSun = sky_phase(dot(viewVector, sunVector), 0.8);
|
||||||
vec2 phaseMoon = sky_phase(dot(viewVector, moonVector), 0.8);
|
vec2 phaseMoon = sky_phase(dot(viewVector, moonVector), 0.8) ;
|
||||||
|
|
||||||
vec3 scatteringSun = vec3(0.0);
|
vec3 scatteringSun = vec3(0.0);
|
||||||
vec3 scatteringMoon = vec3(0.0);
|
vec3 scatteringMoon = vec3(0.0);
|
||||||
@ -128,7 +128,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
|||||||
transmittance = vec3(1.0);
|
transmittance = vec3(1.0);
|
||||||
|
|
||||||
float high_sun = clamp(pow(sunVector.y+0.6,5),0.0,1.0) * 3.0; // make sunrise less blue, and allow sunset to be bluer
|
float high_sun = clamp(pow(sunVector.y+0.6,5),0.0,1.0) * 3.0; // make sunrise less blue, and allow sunset to be bluer
|
||||||
float low_sun = clamp(((1.0-abs(sunVector.y))*3.) - high_sun,1.0,1.8) ;
|
float low_sun = clamp(((1.0-abs(sunVector.y))*3.) - high_sun,1.0,2.0) ;
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < iSteps; ++i, position += increment) {
|
for (int i = 0; i < iSteps; ++i, position += increment) {
|
||||||
@ -144,7 +144,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
|||||||
#ifdef ORIGINAL_CHOCAPIC_SKY
|
#ifdef ORIGINAL_CHOCAPIC_SKY
|
||||||
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector, jSteps) * planetGround;
|
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector, jSteps) * planetGround;
|
||||||
#else
|
#else
|
||||||
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector*0.5+0.1, jSteps) * planetGround;
|
scatteringSun += sky_coefficientsScattering * (stepAirmass.xy * phaseSun) * stepScatteringVisible * sky_transmittance(position, sunVector, jSteps) * planetGround;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
scatteringMoon += sky_coefficientsScattering * (stepAirmass.xy * phaseMoon) * stepScatteringVisible * sky_transmittance(position, moonVector, jSteps) * planetGround;
|
scatteringMoon += sky_coefficientsScattering * (stepAirmass.xy * phaseMoon) * stepScatteringVisible * sky_transmittance(position, moonVector, jSteps) * planetGround;
|
||||||
@ -159,7 +159,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
|||||||
transmittance *= stepTransmittance;
|
transmittance *= stepTransmittance;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 scattering = scatteringSun * sunColorBase + scatteringAmbient * background + scatteringMoon*moonColorBase ;
|
vec3 scattering = scatteringAmbient * background + scatteringSun * sunColorBase + scatteringMoon*moonColorBase * 0.5;
|
||||||
|
|
||||||
return scattering;
|
return scattering;
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,19 @@ void GriAndEminShadowFix(
|
|||||||
float MinimumValue = 0.05;
|
float MinimumValue = 0.05;
|
||||||
|
|
||||||
// give a tiny boost to the distance mulitplier when shadowmap resolution is below 2048.0
|
// give a tiny boost to the distance mulitplier when shadowmap resolution is below 2048.0
|
||||||
float ResMultiplier = 1.0 + (shadowDistance/8.0)*(1.0 - min(shadowMapResolution,2048)/2048.0)*0.3;
|
// float ResMultiplier = 1.0 + (shadowDistance/8.0)*(1.0 - min(shadowMapResolution,2048)/2048.0)*0.3;
|
||||||
|
|
||||||
float DistanceMultiplier = max(1.0 - max(1.0 - length(WorldPos) / shadowDistance, 0.0), MinimumValue) * ResMultiplier;
|
// float DistanceMultiplier = max(1.0 - max(1.0 - length(WorldPos) / shadowDistance, 0.0), MinimumValue) * ResMultiplier;
|
||||||
|
float theDistance = max(1.0 - length(WorldPos) / shadowDistance,0.0);
|
||||||
vec3 Bias = FlatNormal * DistanceMultiplier;
|
float DistanceMultiplier = mix(0.5, 0.05, theDistance);
|
||||||
|
float DistanceMultiplier2 = mix(1.0, 0.02, theDistance);
|
||||||
|
|
||||||
|
vec3 Bias = (FlatNormal * DistanceMultiplier + WsunVec * DistanceMultiplier2);
|
||||||
|
|
||||||
// stop lightleaking by zooming up, centered on blocks
|
// stop lightleaking by zooming up, centered on blocks
|
||||||
vec2 scale = vec2(0.5); scale.y *= 0.5;
|
vec2 scale = vec2(0.5); scale.y *= 0.5;
|
||||||
vec3 zoomShadow = scale.y - scale.x * fract(WorldPos + cameraPosition + Bias*scale.y);
|
vec3 zoomShadow = scale.y - scale.x * fract(WorldPos + cameraPosition + Bias*scale.y*0.1);
|
||||||
if(SkyLightmap < 0.1) Bias = zoomShadow;
|
if(SkyLightmap < 0.1 && isEyeInWater != 1 && VanillaAO > 0.0) Bias = zoomShadow;
|
||||||
|
|
||||||
WorldPos += Bias;
|
WorldPos += Bias;
|
||||||
}
|
}
|
@ -1,33 +1,40 @@
|
|||||||
const vec2[8] offsets = vec2[8](
|
// swap out jitter pattern to be a 4 frame pattern instead of an 8 frame halton sequence
|
||||||
vec2( 1.0, -3.0)/8.0,
|
#ifdef RESPONSIVE_TAA
|
||||||
vec2(-1.0, 3.0)/8.0,
|
const vec2[4] offsets = vec2[4](
|
||||||
vec2( 5.0, 1.0)/8.0,
|
|
||||||
vec2(-3.0, -5.0)/8.0,
|
|
||||||
vec2(-5.0, 5.0)/8.0,
|
|
||||||
vec2(-7.0, -1.0)/8.0,
|
|
||||||
vec2( 3.0, 7.0)/8.0,
|
|
||||||
vec2( 7.0, 7.0)/8.0
|
|
||||||
);
|
|
||||||
|
|
||||||
// const vec2[4] offsets = vec2[4](
|
// vec2( 0.0, -1.0),
|
||||||
// vec2( 0.0, -1.0), // right bottom
|
// vec2( 1.0, 0.0),
|
||||||
// vec2( 1.0, 0.0), // left top
|
// vec2( 0.0, 1.0),
|
||||||
// vec2( 0.0, 1.0), // right top
|
// vec2(-1.0, 0.0)
|
||||||
// vec2(-1.0, 0.0) // left bottom
|
|
||||||
// );
|
// vec2(-1.0, -7.0)/8.0,
|
||||||
// const vec2[4] offsets = vec2[4](
|
// vec2( 7.0, -1.0)/8.0,
|
||||||
// vec2(0.0),
|
// vec2( 1.0, 7.0)/8.0,
|
||||||
// vec2(0.0),
|
// vec2(-7.0, 1.0)/8.0
|
||||||
// vec2(0.0),
|
|
||||||
// vec2(0.0)
|
vec2(-0.125, -0.875),
|
||||||
// );
|
vec2( 0.875, -0.125),
|
||||||
// const vec2[8] offsets = vec2[8](
|
vec2( 0.125, 0.875),
|
||||||
// vec2(0.0),
|
vec2(-0.875, 0.125)
|
||||||
// vec2(0.0),
|
|
||||||
// vec2(0.0),
|
|
||||||
// vec2(0.0),
|
// vec2(-7.0, 1.0)/8.0,
|
||||||
// vec2(0.0),
|
// vec2( 7.0, -1.0)/8.0,
|
||||||
// vec2(0.0),
|
// vec2( 1.0, 7.0)/8.0,
|
||||||
// vec2(0.0),
|
// vec2(-1.0, -7.0)/8.0
|
||||||
// vec2(0.0)
|
|
||||||
// );
|
);
|
||||||
|
#else
|
||||||
|
|
||||||
|
const vec2[8] offsets = vec2[8](
|
||||||
|
vec2( 1.0, -3.0)/8.0,
|
||||||
|
vec2(-1.0, 3.0)/8.0,
|
||||||
|
vec2( 5.0, 1.0)/8.0,
|
||||||
|
vec2(-3.0, -5.0)/8.0,
|
||||||
|
vec2(-5.0, 5.0)/8.0,
|
||||||
|
vec2(-7.0, -1.0)/8.0,
|
||||||
|
vec2( 3.0, 7.0)/8.0,
|
||||||
|
vec2( 7.0, 7.0)/8.0
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
@ -122,7 +122,6 @@
|
|||||||
///////////////////////////// BIOME SPECIFICS /////////////////////////////////
|
///////////////////////////// BIOME SPECIFICS /////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
uniform float nightVision;
|
|
||||||
|
|
||||||
uniform float isJungles;
|
uniform float isJungles;
|
||||||
uniform float isSwamps;
|
uniform float isSwamps;
|
||||||
@ -144,7 +143,7 @@
|
|||||||
BiomeColors.b = isSwamps*SWAMP_B + isJungles*JUNGLE_B + isDarkForests*DARKFOREST_B + sandStorm*0.3 + snowStorm*1.0;
|
BiomeColors.b = isSwamps*SWAMP_B + isJungles*JUNGLE_B + isDarkForests*DARKFOREST_B + sandStorm*0.3 + snowStorm*1.0;
|
||||||
|
|
||||||
// insure the biome colors are locked to the fog shape and lighting, but not its orignal color.
|
// insure the biome colors are locked to the fog shape and lighting, but not its orignal color.
|
||||||
BiomeColors *= max(dot(FinalFogColor,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
BiomeColors *= max(dot(FinalFogColor,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025);
|
||||||
|
|
||||||
// these range 0.0-1.0. they will never overlap.
|
// these range 0.0-1.0. they will never overlap.
|
||||||
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
||||||
@ -184,8 +183,8 @@
|
|||||||
// DirectLightCol = BiomeColors * max(dot(DirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
// DirectLightCol = BiomeColors * max(dot(DirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
||||||
// IndirectLightCol = BiomeColors * max(dot(IndirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
// IndirectLightCol = BiomeColors * max(dot(IndirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
||||||
|
|
||||||
DirectLightCol = BiomeColors * max(dot(DirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
DirectLightCol = BiomeColors * max(dot(DirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 );
|
||||||
IndirectLightCol = BiomeColors * max(dot(IndirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
IndirectLightCol = BiomeColors * max(dot(IndirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 );
|
||||||
|
|
||||||
// these range 0.0-1.0. they will never overlap.
|
// these range 0.0-1.0. they will never overlap.
|
||||||
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
||||||
|
@ -70,11 +70,17 @@ return x/(1.0+x);
|
|||||||
vec3 ACESFilm( vec3 x )
|
vec3 ACESFilm( vec3 x )
|
||||||
{
|
{
|
||||||
x*=0.9;
|
x*=0.9;
|
||||||
|
// float a = 2.51f;
|
||||||
|
// float b = 0.03f;
|
||||||
|
// float c = 2.43f;
|
||||||
|
// float d = 0.59f;
|
||||||
|
// float e = 0.14f;
|
||||||
|
// slower rate to bright color
|
||||||
float a = 2.51f;
|
float a = 2.51f;
|
||||||
float b = 0.03f;
|
float b = 0.03f;
|
||||||
float c = 2.43f;
|
float c = 2.43f;
|
||||||
float d = 0.59f;
|
float d = 0.95f;
|
||||||
float e = 0.14f;
|
float e = 0.12f;
|
||||||
return (x*(a*x+b))/(x*(c*x+d)+e);
|
return (x*(a*x+b))/(x*(c*x+d)+e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +247,7 @@ vec3 agxLook(vec3 val) {
|
|||||||
vec3 slope = vec3(1.0);
|
vec3 slope = vec3(1.0);
|
||||||
vec3 power = vec3(1.0);
|
vec3 power = vec3(1.0);
|
||||||
float sat = 1.25;
|
float sat = 1.25;
|
||||||
|
|
||||||
// ASC CDL
|
// ASC CDL
|
||||||
val = pow(val * slope + offset, power);
|
val = pow(val * slope + offset, power);
|
||||||
return luma + sat * (val - luma);
|
return luma + sat * (val - luma);
|
||||||
|
@ -25,13 +25,29 @@ vec3 doBlockLightLighting(
|
|||||||
vec3 lightColor, float lightmap, float exposureValue,
|
vec3 lightColor, float lightmap, float exposureValue,
|
||||||
vec3 playerPos, vec3 lpvPos
|
vec3 playerPos, vec3 lpvPos
|
||||||
){
|
){
|
||||||
|
lightmap = clamp(lightmap,0.0,1.0);
|
||||||
|
|
||||||
float lightmapCurve = pow(1.0-sqrt(1.0-clamp(lightmap,0.0,1.0)),2.0) * 2.0;
|
float lightmapBrightspot = min(max(lightmap-0.7,0.0)*3.3333,1.0);
|
||||||
|
lightmapBrightspot *= lightmapBrightspot*lightmapBrightspot;
|
||||||
|
|
||||||
|
float lightmapLight = 1.0-sqrt(1.0-lightmap);
|
||||||
|
lightmapLight *= lightmapLight;
|
||||||
|
|
||||||
|
float lightmapCurve = mix(lightmapLight, 2.0, lightmapBrightspot);
|
||||||
|
|
||||||
|
// lightmapCurve = lightmap*lightmap;
|
||||||
|
|
||||||
|
// float lightmapCurve = (exp(-15.0 * (1.0-lightmap))*10.0 + lightmap*pow(1.0-pow(1.0-lightmap,2.0),2.0))*0.5;
|
||||||
|
// float lightmapCurve = (pow(min(max(lightmap-0.6, 0.0) * 2.5,1.0),4.0) * 10.0 + lightmap*pow(1.0-pow(1.0-lightmap,2.0),2.0))*0.5;
|
||||||
|
// float lightmapCurve = pow(1.0-pow(1.0-lightmap,2.0),2.0);
|
||||||
|
|
||||||
vec3 blockLight = lightColor * lightmapCurve; //;
|
vec3 blockLight = lightColor * lightmapCurve;
|
||||||
|
|
||||||
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
||||||
vec4 lpvSample = SampleLpvLinear(lpvPos);
|
vec4 lpvSample = SampleLpvLinear(lpvPos);
|
||||||
|
#ifdef VANILLA_LIGHTMAP_MASK
|
||||||
|
lpvSample.rgb *= lightmapCurve;
|
||||||
|
#endif
|
||||||
vec3 lpvBlockLight = GetLpvBlockLight(lpvSample);
|
vec3 lpvBlockLight = GetLpvBlockLight(lpvSample);
|
||||||
|
|
||||||
// create a smooth falloff at the edges of the voxel volume.
|
// create a smooth falloff at the edges of the voxel volume.
|
||||||
@ -41,7 +57,7 @@ vec3 doBlockLightLighting(
|
|||||||
voxelRangeFalloff = 1.0 - pow(1.0-pow(voxelRangeFalloff,1.5),3.0);
|
voxelRangeFalloff = 1.0 - pow(1.0-pow(voxelRangeFalloff,1.5),3.0);
|
||||||
|
|
||||||
// outside the voxel volume, lerp to vanilla lighting as a fallback
|
// outside the voxel volume, lerp to vanilla lighting as a fallback
|
||||||
blockLight = mix(blockLight, lpvBlockLight/5.0, voxelRangeFalloff);
|
blockLight = mix(blockLight, lpvSample.rgb, voxelRangeFalloff);
|
||||||
|
|
||||||
#ifdef Hand_Held_lights
|
#ifdef Hand_Held_lights
|
||||||
// create handheld lightsources
|
// create handheld lightsources
|
||||||
@ -56,8 +72,8 @@ vec3 doBlockLightLighting(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// try to make blocklight have consistent visiblity in different light levels.
|
// try to make blocklight have consistent visiblity in different light levels.
|
||||||
float autoBrightness = mix(1.0, 30.0, clamp(exp(-10.0*exposureValue),0.0,1.0));
|
// float autoBrightness = mix(0.5, 1.0, clamp(exp(-10.0*exposureValue),0.0,1.0));
|
||||||
blockLight *= autoBrightness;
|
// blockLight *= autoBrightness;
|
||||||
|
|
||||||
return blockLight * TORCH_AMOUNT;
|
return blockLight * TORCH_AMOUNT;
|
||||||
}
|
}
|
||||||
@ -66,11 +82,14 @@ vec3 doIndirectLighting(
|
|||||||
vec3 lightColor, vec3 minimumLightColor, float lightmap
|
vec3 lightColor, vec3 minimumLightColor, float lightmap
|
||||||
){
|
){
|
||||||
|
|
||||||
|
// float lightmapCurve = pow(1.0-pow(1.0-lightmap,2.0),2.0);
|
||||||
|
// float lightmapCurve = lightmap*lightmap;
|
||||||
float lightmapCurve = (pow(lightmap,15.0)*2.0 + pow(lightmap,2.5))*0.5;
|
float lightmapCurve = (pow(lightmap,15.0)*2.0 + pow(lightmap,2.5))*0.5;
|
||||||
|
|
||||||
vec3 indirectLight = lightColor * lightmapCurve * ambient_brightness * 0.7;
|
vec3 indirectLight = lightColor * lightmapCurve * ambient_brightness * 0.7;
|
||||||
|
|
||||||
indirectLight += minimumLightColor * max(MIN_LIGHT_AMOUNT*0.01, nightVision * 0.1);
|
// indirectLight = max(indirectLight, minimumLightColor * (MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision));
|
||||||
|
indirectLight += minimumLightColor * (MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision*0.02);
|
||||||
|
|
||||||
return indirectLight;
|
return indirectLight;
|
||||||
}
|
}
|
@ -168,12 +168,15 @@ float fogShape(in vec3 pos){
|
|||||||
|
|
||||||
float endFogPhase(vec3 LightPos){
|
float endFogPhase(vec3 LightPos){
|
||||||
|
|
||||||
float mie = exp(length(LightPos) / -150);
|
// float mie = exp(length(LightPos) / -150);
|
||||||
mie *= mie;
|
// mie *= mie;
|
||||||
mie *= mie;
|
// mie *= mie;
|
||||||
mie *= 100;
|
// mie *= 100;
|
||||||
|
|
||||||
return mie;
|
// float mie = 1.0 - clamp(1.0 - length(LightPos) / 100.0,0.0,1.0);
|
||||||
|
float mie = exp(length(LightPos) / -50.0);
|
||||||
|
|
||||||
|
return (mie*10.0)*(mie*10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 LightSourceColors(float vortexBounds, float lightningflash){
|
vec3 LightSourceColors(float vortexBounds, float lightningflash){
|
||||||
@ -197,13 +200,13 @@ vec3 LightSourceLighting(vec3 startPos, vec3 lightPos, float noise, float densit
|
|||||||
float shadow = 0.0;
|
float shadow = 0.0;
|
||||||
|
|
||||||
for (int j = 0; j < 3; j++){
|
for (int j = 0; j < 3; j++){
|
||||||
vec3 shadowSamplePos = startPos - lightPos * (0.05 + j * (0.25 + noise*0.15));
|
vec3 shadowSamplePos = startPos - lightPos * (0.05 + j * (0.25 + 0*0.15));
|
||||||
shadow += fogShape(shadowSamplePos);
|
shadow += fogShape(shadowSamplePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 finalLighting = lightColor * phase * exp(shadow * -10.0);
|
|
||||||
|
|
||||||
finalLighting += lightColor * phase*phase * (1.0-exp((shadow*shadow*shadow) * vec3(0.6,2.0,2) * -1)) * (1.0 - exp(-density*density));
|
vec3 finalLighting = lightColor * phase * exp(-7.0 * shadow) ;
|
||||||
|
finalLighting += lightColor * phase*phase * (1.0 - exp( -shadow * vec3(0.6,2.0,2))) * (1.0 - exp(-density*density));
|
||||||
|
|
||||||
return finalLighting;
|
return finalLighting;
|
||||||
}
|
}
|
||||||
@ -246,9 +249,9 @@ vec4 GetVolumetricFog(
|
|||||||
|
|
||||||
// float phsething = phaseEND(CenterdotV, 0.35) + phaseEND(CenterdotV, 0.85) ;
|
// float phsething = phaseEND(CenterdotV, 0.35) + phaseEND(CenterdotV, 0.85) ;
|
||||||
|
|
||||||
float skyPhase = 0.5 + pow(clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),4.0)*5.0;
|
float skyPhase = (0.5 + pow(clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),4.0)*5.0) * 0.1;
|
||||||
|
|
||||||
vec3 hazeColor = normalize(gl_Fog.color.rgb) * 0.1;
|
vec3 hazeColor = normalize(gl_Fog.color.rgb + 1e-6) * 0.1;
|
||||||
|
|
||||||
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
|
float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0;
|
||||||
|
|
||||||
@ -258,7 +261,7 @@ vec4 GetVolumetricFog(
|
|||||||
|
|
||||||
for (int i = 0; i < SAMPLECOUNT; i++) {
|
for (int i = 0; i < SAMPLECOUNT; i++) {
|
||||||
float d = (pow(expFactor, float(i+dither)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
float d = (pow(expFactor, float(i+dither)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||||
float dd = pow(expFactor, float(i+dither)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
float dd = pow(expFactor, float(i+dither2)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
||||||
|
|
||||||
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||||
|
|
||||||
@ -268,7 +271,7 @@ vec4 GetVolumetricFog(
|
|||||||
// determine where the vortex area ends and chaotic lightning area begins.
|
// determine where the vortex area ends and chaotic lightning area begins.
|
||||||
float vortexBounds = clamp(vortexBoundRange - length(progressW), 0.0,1.0);
|
float vortexBounds = clamp(vortexBoundRange - length(progressW), 0.0,1.0);
|
||||||
vec3 lightPosition = LightSourcePosition(progressW, cameraPosition, vortexBounds);
|
vec3 lightPosition = LightSourcePosition(progressW, cameraPosition, vortexBounds);
|
||||||
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
|
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash) * 0.25;
|
||||||
|
|
||||||
float volumeDensity = fogShape(progressW);
|
float volumeDensity = fogShape(progressW);
|
||||||
|
|
||||||
@ -281,9 +284,9 @@ vec4 GetVolumetricFog(
|
|||||||
|
|
||||||
float volumeCoeff = exp(-stormDensity*dd*dL);
|
float volumeCoeff = exp(-stormDensity*dd*dL);
|
||||||
|
|
||||||
|
vec3 lightsources = LightSourceLighting(progressW, lightPosition, dither, volumeDensity, lightColors, vortexBounds);
|
||||||
vec3 lightsources = LightSourceLighting(progressW, lightPosition, dither2, volumeDensity, lightColors, vortexBounds);
|
vec3 indirect = vec3(0.5,0.75,1.0) * 0.2 * (exp((volumeDensity*volumeDensity) * -50) * 0.9 + 0.1) * 0.1;
|
||||||
vec3 indirect = vec3(0.5,0.75,1.0) * 0.2 * (exp((volumeDensity*volumeDensity) * -50) * 0.9 + 0.1);
|
|
||||||
vec3 stormLighting = indirect + lightsources;
|
vec3 stormLighting = indirect + lightsources;
|
||||||
|
|
||||||
color += (stormLighting - stormLighting*volumeCoeff) * absorbance;
|
color += (stormLighting - stormLighting*volumeCoeff) * absorbance;
|
||||||
@ -337,7 +340,7 @@ vec4 GetVolumetricFog(
|
|||||||
return vec4(color, absorbance);
|
return vec4(color, absorbance);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetCloudShadow(vec3 WorldPos, vec3 LightPos){
|
float GetEndFogShadow(vec3 WorldPos, vec3 LightPos){
|
||||||
float Shadow = 0.0;
|
float Shadow = 0.0;
|
||||||
|
|
||||||
for (int i=0; i < 3; i++){
|
for (int i=0; i < 3; i++){
|
||||||
@ -347,5 +350,5 @@ float GetCloudShadow(vec3 WorldPos, vec3 LightPos){
|
|||||||
Shadow += fogShape(shadowSamplePos)*END_STORM_DENSTIY;
|
Shadow += fogShape(shadowSamplePos)*END_STORM_DENSTIY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return clamp(exp2(Shadow * -5.0),0.0,1.0);
|
return clamp(exp2(Shadow * -10.0),0.0,1.0);
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ vec3 cosineHemisphereSample(vec2 Xi){
|
|||||||
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
|
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
|
vec3 TangentToWorld(vec3 N, vec3 H){
|
||||||
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
||||||
vec3 T = normalize(cross(UpVector, N));
|
vec3 T = normalize(cross(UpVector, N));
|
||||||
vec3 B = cross(N, T);
|
vec3 B = cross(N, T);
|
||||||
@ -92,67 +92,6 @@ vec4 BilateralUpscale_SSAO(sampler2D tex, sampler2D depth, vec2 coord, float ref
|
|||||||
return RESULT / SUM;
|
return RESULT / SUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 SSAO(
|
|
||||||
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
|
||||||
){
|
|
||||||
if(hand) return vec2(1.0,0.0);
|
|
||||||
int samples = 7;
|
|
||||||
float occlusion = 0.0;
|
|
||||||
float sss = 0.0;
|
|
||||||
|
|
||||||
|
|
||||||
float dist = 1.0 + clamp(viewPos.z*viewPos.z/50.0,0,5); // shrink sample size as distance increases
|
|
||||||
float mulfov2 = gbufferProjection[1][1]/(3 * dist);
|
|
||||||
float maxR2 = viewPos.z*viewPos.z*mulfov2*2.*5/50.0;
|
|
||||||
|
|
||||||
#ifdef Ambient_SSS
|
|
||||||
float maxR2_2 = viewPos.z*viewPos.z*mulfov2*2.*2./50.0;
|
|
||||||
|
|
||||||
float dist3 = clamp(1-exp( viewPos.z*viewPos.z / -50),0,1);
|
|
||||||
if(leaves) maxR2_2 = mix(10, maxR2_2, dist3);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
|
|
||||||
|
|
||||||
int n = 0;
|
|
||||||
for (int i = 0; i < samples; i++) {
|
|
||||||
|
|
||||||
// vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * 0.2 * mulfov2;
|
|
||||||
|
|
||||||
vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * clamp(0.05 + i*0.095, 0.0,0.3) * mulfov2;
|
|
||||||
|
|
||||||
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
|
|
||||||
|
|
||||||
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth*RENDER_SCALE.x && offset.y < viewHeight*RENDER_SCALE.y ) {
|
|
||||||
#ifdef DISTANT_HORIZONS
|
|
||||||
float dhdepth = texelFetch2D(dhDepthTex1, offset,0).x;
|
|
||||||
#else
|
|
||||||
float dhdepth = 0.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec3 t0 = toScreenSpace_DH((offset*texelSize+acc+0.5*texelSize) * (1.0/RENDER_SCALE), texelFetch2D(depthtex1, offset,0).x, dhdepth);
|
|
||||||
vec3 vec = (t0.xyz - viewPos);
|
|
||||||
float dsquared = dot(vec, vec);
|
|
||||||
|
|
||||||
if (dsquared > 1e-5){
|
|
||||||
if (dsquared < maxR2){
|
|
||||||
float NdotV = clamp(dot(vec*inversesqrt(dsquared), normalize(normal)),0.,1.);
|
|
||||||
occlusion += NdotV * clamp(1.0-dsquared/maxR2,0.0,1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Ambient_SSS
|
|
||||||
if(dsquared > maxR2_2){
|
|
||||||
float NdotV = 1.0 - clamp(dot(vec*dsquared, normalize(normal)),0.,1.);
|
|
||||||
sss += max((NdotV - (1.0-NdotV)) * clamp(1.0-maxR2_2/dsquared,0.0,1.0) ,0.0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
n += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return max(1.0 - vec2(occlusion, sss)/n, 0.0);
|
|
||||||
}
|
|
||||||
float ScreenSpace_SSS(
|
float ScreenSpace_SSS(
|
||||||
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
vec3 viewPos, vec3 normal, bool hand, bool leaves, float noise
|
||||||
){
|
){
|
||||||
@ -210,40 +149,79 @@ vec3 rayTrace_GI(vec3 dir,vec3 position,float dither, float quality){
|
|||||||
direction.xy = normalize(direction.xy);
|
direction.xy = normalize(direction.xy);
|
||||||
|
|
||||||
//get at which length the ray intersects with the edge of the screen
|
//get at which length the ray intersects with the edge of the screen
|
||||||
vec3 maxLengths = (step(0.0,direction)-clipPosition) / direction;
|
vec3 maxLengths = (step(0.,direction)-clipPosition) / direction;
|
||||||
float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
|
float mult = maxLengths.y;
|
||||||
|
|
||||||
vec3 stepv = (direction * mult) / quality*vec3(RENDER_SCALE,1.0);
|
vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0);
|
||||||
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*dither;
|
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) ;
|
||||||
|
|
||||||
spos.xy += TAA_Offset*texelSize*0.5*RENDER_SCALE ;
|
spos.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE;
|
||||||
|
|
||||||
float minZ = spos.z;
|
spos += stepv*dither;
|
||||||
float maxZ = spos.z;
|
|
||||||
|
float biasdist = clamp(position.z*position.z/50.0,1,2); // shrink sample size as distance increases
|
||||||
|
|
||||||
for(int i = 0; i < int(quality); i++){
|
for(int i = 0; i < int(quality); i++){
|
||||||
if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1);
|
|
||||||
|
|
||||||
#ifdef UseQuarterResDepth
|
#ifdef UseQuarterResDepth
|
||||||
float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0));
|
float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0);
|
||||||
#else
|
#else
|
||||||
float sp = texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r;
|
float sp = linZ(texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float currZ = linZ(spos.z);
|
float currZ = linZ(spos.z);
|
||||||
float nextZ = linZ(sp);
|
|
||||||
|
|
||||||
if(nextZ < currZ && (sp <= max(minZ,maxZ) && sp >= min(minZ,maxZ))) return vec3(spos.xy/RENDER_SCALE,sp);
|
|
||||||
|
|
||||||
float biasamount = 0.00005;
|
|
||||||
|
|
||||||
minZ = maxZ - biasamount / currZ;
|
|
||||||
maxZ += stepv.z;
|
|
||||||
|
|
||||||
|
if( sp < currZ) {
|
||||||
|
float dist = abs(sp-currZ)/currZ;
|
||||||
|
if (abs(dist) < biasdist*0.05) return vec3(spos.xy, invLinZ(sp))/vec3(RENDER_SCALE,1.0);
|
||||||
|
}
|
||||||
spos += stepv;
|
spos += stepv;
|
||||||
}
|
}
|
||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
|
// vec3 rayTrace_GI(vec3 dir,vec3 position,float dither, float quality){
|
||||||
|
|
||||||
|
// vec3 clipPosition = toClipSpace3(position);
|
||||||
|
// float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
|
||||||
|
// (-near -position.z) / dir.z : far*sqrt(3.);
|
||||||
|
// vec3 direction = normalize(toClipSpace3(position+dir*rayLength)-clipPosition); //convert to clip space
|
||||||
|
// direction.xy = normalize(direction.xy);
|
||||||
|
|
||||||
|
// //get at which length the ray intersects with the edge of the screen
|
||||||
|
// vec3 maxLengths = (step(0.0,direction)-clipPosition) / direction;
|
||||||
|
// float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
|
||||||
|
|
||||||
|
// vec3 stepv = (direction * mult) / quality*vec3(RENDER_SCALE,1.0);
|
||||||
|
// vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0);
|
||||||
|
|
||||||
|
// spos.xy += TAA_Offset*texelSize*0.5*RENDER_SCALE ;
|
||||||
|
|
||||||
|
// spos += stepv*dither;
|
||||||
|
|
||||||
|
// float minZ = spos.z;
|
||||||
|
// float maxZ = spos.z;
|
||||||
|
|
||||||
|
// for(int i = 0; i < int(quality); i++){
|
||||||
|
// if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1);
|
||||||
|
|
||||||
|
// #ifdef UseQuarterResDepth
|
||||||
|
// float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0));
|
||||||
|
// #else
|
||||||
|
// float sp = texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// float currZ = linZ(spos.z);
|
||||||
|
// float nextZ = linZ(sp);
|
||||||
|
|
||||||
|
// if(nextZ < currZ && (sp <= max(minZ,maxZ) && sp >= min(minZ,maxZ))) return vec3(spos.xy/RENDER_SCALE,sp);
|
||||||
|
|
||||||
|
// float biasamount = 0.00005;
|
||||||
|
|
||||||
|
// minZ = maxZ - biasamount / currZ;
|
||||||
|
// maxZ += stepv.z;
|
||||||
|
|
||||||
|
// spos += stepv;
|
||||||
|
// }
|
||||||
|
// return vec3(1.1);
|
||||||
|
// }
|
||||||
float convertHandDepth_3(in float depth, bool hand) {
|
float convertHandDepth_3(in float depth, bool hand) {
|
||||||
if(!hand) return depth;
|
if(!hand) return depth;
|
||||||
|
|
||||||
@ -301,7 +279,7 @@ vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes, bool hand){
|
|||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool hand){
|
vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool hand, inout float CURVE ){
|
||||||
|
|
||||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position;
|
vec3 worldpos = mat3(gbufferModelViewInverse) * position;
|
||||||
|
|
||||||
@ -324,12 +302,12 @@ vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool ha
|
|||||||
|
|
||||||
int iterations = min(int(min(len, mult*len)-2), maxSteps);
|
int iterations = min(int(min(len, mult*len)-2), maxSteps);
|
||||||
|
|
||||||
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0);// + stepv*noise;
|
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*(noise-0.5);
|
||||||
spos.xy += TAA_Offset*texelSize*0.5*RENDER_SCALE;
|
spos.xy += TAA_Offset*texelSize*0.5*RENDER_SCALE;
|
||||||
|
|
||||||
float minZ = spos.z;
|
float minZ = spos.z;
|
||||||
float maxZ = spos.z;
|
float maxZ = spos.z;
|
||||||
|
CURVE = 0.0;
|
||||||
for(int i = 0; i < iterations; i++){
|
for(int i = 0; i < iterations; i++){
|
||||||
if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1);
|
if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1);
|
||||||
|
|
||||||
@ -349,8 +327,9 @@ vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool ha
|
|||||||
minZ = maxZ-biasamount / currZ;
|
minZ = maxZ-biasamount / currZ;
|
||||||
maxZ += stepv.z;
|
maxZ += stepv.z;
|
||||||
|
|
||||||
spos += stepv*(noise*0.25+0.75);
|
spos += stepv;
|
||||||
|
|
||||||
|
CURVE += 1.0/iterations;
|
||||||
}
|
}
|
||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
@ -378,24 +357,30 @@ vec3 ApplySSRT(
|
|||||||
vec3 radiance2 = vec3(0.0);
|
vec3 radiance2 = vec3(0.0);
|
||||||
vec3 occlusion2 = vec3(0.0);
|
vec3 occlusion2 = vec3(0.0);
|
||||||
vec3 skycontribution2 = unchangedIndirect;
|
vec3 skycontribution2 = unchangedIndirect;
|
||||||
|
float CURVE = 1.0;
|
||||||
vec3 bouncedLight = vec3(0.0);
|
vec3 bouncedLight = vec3(0.0);
|
||||||
for (int i = 0; i < nrays; i++){
|
for (int i = 0; i < nrays; i++){
|
||||||
int seed = (frameCounter%40000)*nrays+i;
|
int seed = (frameCounter%40000)*nrays+i;
|
||||||
vec2 ij = fract(R2_samples(seed) + noise.xy);
|
vec2 ij = fract(R2_samples(seed) + noise.xy);
|
||||||
vec3 rayDir = TangentToWorld(normal, normalize(cosineHemisphereSample(ij)), lightmap);
|
vec3 rayDir = TangentToWorld(normal, normalize(cosineHemisphereSample(ij)));
|
||||||
|
|
||||||
#ifdef HQ_SSGI
|
#ifdef HQ_SSGI
|
||||||
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, noise.z, 50.); // ssr rt
|
vec3 rayHit = rayTrace_GI( mat3(gbufferModelView) * rayDir, viewPos, noise.z, 50.); // ssr rt
|
||||||
#else
|
#else
|
||||||
vec3 rayHit = RT_alternate(mat3(gbufferModelView)*rayDir, viewPos, noise.z, 10., isLOD); // choc sspt
|
vec3 rayHit = RT_alternate(mat3(gbufferModelView)*rayDir, viewPos, noise.z, 10., isLOD, CURVE); // choc sspt
|
||||||
|
|
||||||
|
|
||||||
|
/// RAAAAAAAAAAAAAAAAAAAAAAAAGHH
|
||||||
|
// CURVE = (1.0-exp(-5.0*(1.0-CURVE)));
|
||||||
|
CURVE = 1.0-pow(1.0-pow(1.0-CURVE,2.0),5.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
skycontribution = doIndirectLighting(pow(skyCloudsFromTexLOD(rayDir, colortex4, 0).rgb/30.0, vec3(0.7)) * 2.5, minimumLightColor, lightmap) + blockLightColor;
|
// skycontribution = doIndirectLighting(pow(skyCloudsFromTexLOD(rayDir, colortex4, 0).rgb/1200.0, vec3(0.7)) * 2.5, minimumLightColor, lightmap) + blockLightColor;
|
||||||
|
skycontribution = doIndirectLighting(skyCloudsFromTex(rayDir, colortex4).rgb/1200.0, minimumLightColor, lightmap) + blockLightColor;
|
||||||
#else
|
#else
|
||||||
skycontribution = pow(skyCloudsFromTexLOD2(rayDir, colortex4, 6).rgb / 30.0, vec3(0.7)) + blockLightColor;
|
skycontribution = volumetricsFromTex(rayDir, colortex4, 6).rgb / 1200.0 + blockLightColor;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
@ -413,18 +398,18 @@ vec3 ApplySSRT(
|
|||||||
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
||||||
|
|
||||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){
|
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){
|
||||||
bouncedLight = texture2D(colortex5, previousPosition.xy).rgb * GI_Strength;
|
bouncedLight = texture2D(colortex5, previousPosition.xy).rgb * GI_Strength * CURVE;
|
||||||
|
|
||||||
radiance += bouncedLight;
|
radiance += bouncedLight;
|
||||||
radiance2 += bouncedLight;
|
radiance2 += bouncedLight;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
occlusion += skycontribution;
|
occlusion += skycontribution * CURVE;
|
||||||
occlusion2 += skycontribution2;
|
occlusion2 += skycontribution2 * CURVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// return unchangedIndirect * CURVE;
|
||||||
if(isLOD) return max(radiance/nrays, 0.0);
|
if(isLOD) return max(radiance/nrays, 0.0);
|
||||||
|
|
||||||
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
#ifdef SKY_CONTRIBUTION_IN_SSRT
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
// LPV block brightness scale
|
// LPV block brightness scale. just 1.0/15.0
|
||||||
const float LpvBlockBrightness = 1.0;
|
const float LpvBlockBrightness = 0.066666;
|
||||||
|
|
||||||
|
|
||||||
float lpvCurve(float values) {
|
float lpvCurve(float values) {
|
||||||
// return values;
|
#ifdef VANILLA_LIGHTMAP_MASK
|
||||||
return pow(1.0 - sqrt(1.0-values), 2.0);
|
return sqrt(values);
|
||||||
|
#else
|
||||||
|
return values*values;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
||||||
@ -17,6 +20,8 @@ vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
|||||||
vec3 hsv = RgbToHsv(lpvSample.rgb);
|
vec3 hsv = RgbToHsv(lpvSample.rgb);
|
||||||
hsv.z = lpvCurve(hsv.b) * LpvBlockSkyRange.x;
|
hsv.z = lpvCurve(hsv.b) * LpvBlockSkyRange.x;
|
||||||
lpvSample.rgb = HsvToRgb(hsv);
|
lpvSample.rgb = HsvToRgb(hsv);
|
||||||
|
|
||||||
|
lpvSample.rgb = clamp(lpvSample.rgb/15.0,0.0,1.0);
|
||||||
|
|
||||||
return lpvSample;
|
return lpvSample;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ vec4 GetVolumetricFog(
|
|||||||
|
|
||||||
/// ------------- RAYMARCHING STUFF ------------- \\\
|
/// ------------- RAYMARCHING STUFF ------------- \\\
|
||||||
|
|
||||||
int SAMPLECOUNT = 10;
|
int SAMPLECOUNT = 16;
|
||||||
|
|
||||||
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
||||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||||
@ -62,14 +62,14 @@ vec4 GetVolumetricFog(
|
|||||||
vec3 color = vec3(0.0);
|
vec3 color = vec3(0.0);
|
||||||
float absorbance = 1.0;
|
float absorbance = 1.0;
|
||||||
|
|
||||||
vec3 hazeColor = normalize(gl_Fog.color.rgb);
|
vec3 hazeColor = normalize(gl_Fog.color.rgb + 1e-6) * 0.25;
|
||||||
|
|
||||||
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
||||||
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) / 5.0;
|
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) / 5.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < SAMPLECOUNT; i++) {
|
for (int i = 0; i < SAMPLECOUNT; i++) {
|
||||||
float d = (pow(expFactor, float(i+dither)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
float d = (pow(expFactor, float(i+dither2)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||||
float dd = pow(expFactor, float(i+dither)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
float dd = pow(expFactor, float(i+dither)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
||||||
|
|
||||||
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||||
@ -80,7 +80,7 @@ vec4 GetVolumetricFog(
|
|||||||
float plumeDensity = min(densityVol * pow(min(max(100.0-progressW.y,0.0)/30.0,1.0),4.0), pow(clamp(1.0 - length(progressW-cameraPosition)/far,0.0,1.0),5.0) * NETHER_PLUME_DENSITY);
|
float plumeDensity = min(densityVol * pow(min(max(100.0-progressW.y,0.0)/30.0,1.0),4.0), pow(clamp(1.0 - length(progressW-cameraPosition)/far,0.0,1.0),5.0) * NETHER_PLUME_DENSITY);
|
||||||
float plumeVolumeCoeff = exp(-plumeDensity*dd*dL);
|
float plumeVolumeCoeff = exp(-plumeDensity*dd*dL);
|
||||||
|
|
||||||
vec3 lighting = vec3(1.0,0.4,0.2) * exp(-15.0*densityVol);
|
vec3 lighting = vec3(1.0,0.4,0.2)*0.25 * exp(-15.0*densityVol);
|
||||||
|
|
||||||
color += (lighting - lighting * plumeVolumeCoeff) * absorbance;
|
color += (lighting - lighting * plumeVolumeCoeff) * absorbance;
|
||||||
absorbance *= plumeVolumeCoeff;
|
absorbance *= plumeVolumeCoeff;
|
||||||
@ -98,7 +98,7 @@ vec4 GetVolumetricFog(
|
|||||||
float ceilingSmokeDensity = 0.001 * pow(min(max(progressW.y-40.0,0.0)/50.0,1.0),3.0);
|
float ceilingSmokeDensity = 0.001 * pow(min(max(progressW.y-40.0,0.0)/50.0,1.0),3.0);
|
||||||
float ceilingSmokeVolumeCoeff = exp(-ceilingSmokeDensity*dd*dL);
|
float ceilingSmokeVolumeCoeff = exp(-ceilingSmokeDensity*dd*dL);
|
||||||
|
|
||||||
vec3 ceilingSmoke = vec3(1.0);
|
vec3 ceilingSmoke = vec3(0.1);
|
||||||
|
|
||||||
color += (ceilingSmoke - ceilingSmoke*ceilingSmokeVolumeCoeff) * (absorbance*0.5+0.5);
|
color += (ceilingSmoke - ceilingSmoke*ceilingSmokeVolumeCoeff) * (absorbance*0.5+0.5);
|
||||||
absorbance *= ceilingSmokeVolumeCoeff;
|
absorbance *= ceilingSmokeVolumeCoeff;
|
||||||
|
@ -44,7 +44,7 @@ float cloudVol(in vec3 pos, float maxDistance ){
|
|||||||
|
|
||||||
FogDensities(medium_gradientFog, cloudyFog, rainyFog, maxDistance, dailyWeatherParams0.a, dailyWeatherParams1.a);
|
FogDensities(medium_gradientFog, cloudyFog, rainyFog, maxDistance, dailyWeatherParams0.a, dailyWeatherParams1.a);
|
||||||
|
|
||||||
return uniformFog + medium_gradientFog + cloudyFog + rainyFog;
|
return uniformFog + medium_gradientFog + cloudyFog;
|
||||||
}
|
}
|
||||||
|
|
||||||
float phaseRayleigh(float cosTheta) {
|
float phaseRayleigh(float cosTheta) {
|
||||||
@ -52,23 +52,29 @@ float phaseRayleigh(float cosTheta) {
|
|||||||
return cosTheta * mul_add.x + mul_add.y; // optimized version from [Elek09], divided by 4 pi for energy conservation
|
return cosTheta * mul_add.x + mul_add.y; // optimized version from [Elek09], divided by 4 pi for energy conservation
|
||||||
}
|
}
|
||||||
float fogPhase(float lightPoint){
|
float fogPhase(float lightPoint){
|
||||||
float linear = 1.0 - clamp(lightPoint*0.5+0.5,0.0,1.0);
|
float linear = clamp(-lightPoint*0.5+0.5,0.0,1.0);
|
||||||
float linear2 = 1.0 - clamp(lightPoint,0.0,1.0);
|
float linear2 = 1.0 - clamp(lightPoint,0.0,1.0);
|
||||||
|
|
||||||
float exponential = exp2(pow(linear,0.3) * -15.0 ) * 1.5;
|
float exponential = exp2(pow(linear,0.3) * -15.0 ) * 1.5;
|
||||||
exponential += sqrt(exp2(sqrt(linear) * -12.5));
|
exponential += sqrt(exp2(sqrt(linear) * -12.5));
|
||||||
|
|
||||||
|
// float exponential = 1.0 / (linear * 10.0 + 0.05);
|
||||||
|
|
||||||
return exponential;
|
return exponential;
|
||||||
}
|
}
|
||||||
|
float phaseCloudFog(float x, float g){
|
||||||
|
float gg = g * g;
|
||||||
|
return (gg * -0.25 + 0.25) * pow(-2.0 * (g * x) + (gg + 1.0), -1.5) / 3.14;
|
||||||
|
}
|
||||||
uniform ivec2 eyeBrightness;
|
uniform ivec2 eyeBrightness;
|
||||||
vec4 GetVolumetricFog(
|
vec4 GetVolumetricFog(
|
||||||
vec3 viewPosition,
|
in vec3 viewPosition,
|
||||||
vec2 dither,
|
in vec2 dither,
|
||||||
vec3 LightColor,
|
in vec3 LightColor,
|
||||||
vec3 AmbientColor,
|
in vec3 AmbientColor,
|
||||||
vec3 AveragedAmbientColor,
|
in vec3 AveragedAmbientColor,
|
||||||
inout float atmosphereAlpha
|
inout float atmosphereAlpha,
|
||||||
|
inout vec3 sceneColor
|
||||||
){
|
){
|
||||||
#ifndef TOGGLE_VL_FOG
|
#ifndef TOGGLE_VL_FOG
|
||||||
return vec4(0.0,0.0,0.0,1.0);
|
return vec4(0.0,0.0,0.0,1.0);
|
||||||
@ -101,8 +107,7 @@ vec4 GetVolumetricFog(
|
|||||||
dV *= maxLength;
|
dV *= maxLength;
|
||||||
dVWorld *= maxLength;
|
dVWorld *= maxLength;
|
||||||
|
|
||||||
float dL_alternate = length(dVWorld);
|
float dL = length(dVWorld)/8.0;
|
||||||
float dL = dL_alternate/8.0;
|
|
||||||
|
|
||||||
vec3 progress = start.xyz;
|
vec3 progress = start.xyz;
|
||||||
vec3 progressW = vec3(0.0);
|
vec3 progressW = vec3(0.0);
|
||||||
@ -111,17 +116,23 @@ vec4 GetVolumetricFog(
|
|||||||
/// ------------- COLOR/LIGHTING STUFF ------------- \\\
|
/// ------------- COLOR/LIGHTING STUFF ------------- \\\
|
||||||
|
|
||||||
vec3 color = vec3(0.0);
|
vec3 color = vec3(0.0);
|
||||||
float totalAbsorbance = 1.0;
|
vec3 finalAbsorbance = vec3(1.0);
|
||||||
|
|
||||||
|
// float totalAbsorbance = 1.0;
|
||||||
|
vec3 totalAbsorbance = vec3(1.0);
|
||||||
|
|
||||||
float fogAbsorbance = 1.0;
|
float fogAbsorbance = 1.0;
|
||||||
float atmosphereAbsorbance = 1.0;
|
// float atmosphereAbsorbance = 1.0;
|
||||||
|
vec3 atmosphereAbsorbance = vec3(1.0);
|
||||||
|
|
||||||
vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec;
|
vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec;
|
||||||
float SdotV = dot(sunVec, normalize(viewPosition))*lightCol.a;
|
float SdotV = dot(sunVec, normalize(viewPosition))*lightCol.a;
|
||||||
|
|
||||||
///// ----- fog lighting
|
///// ----- fog lighting
|
||||||
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
||||||
float sunPhase = fogPhase(SdotV) * 5.0;
|
float sunPhase = fogPhase(SdotV)*5.0;// phaseCloudFog(SdotV, 0.9) + phaseCloudFog(SdotV, 0.85) + phaseCloudFog(SdotV, 0.5) * 5.0;
|
||||||
float skyPhase = pow(clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),4.0)*5.0;
|
float sunPhase2 = (phaseCloudFog(SdotV, 0.85) + phaseCloudFog(SdotV, 0.5)) * 5.0;
|
||||||
|
float skyPhase = 2.0 + pow(1.0-pow(1.0-clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),2.0),5.0)*2.0 ;//pow(clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),4.0)*5.0;
|
||||||
float rayL = phaseRayleigh(SdotV);
|
float rayL = phaseRayleigh(SdotV);
|
||||||
|
|
||||||
vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5) ;
|
vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5) ;
|
||||||
@ -130,7 +141,7 @@ vec4 GetVolumetricFog(
|
|||||||
vec3 skyLightPhased = AmbientColor;
|
vec3 skyLightPhased = AmbientColor;
|
||||||
vec3 LightSourcePhased = LightColor;
|
vec3 LightSourcePhased = LightColor;
|
||||||
|
|
||||||
skyLightPhased *= 1.0 + skyPhase;
|
skyLightPhased *= skyPhase;
|
||||||
LightSourcePhased *= sunPhase;
|
LightSourcePhased *= sunPhase;
|
||||||
|
|
||||||
#ifdef ambientLight_only
|
#ifdef ambientLight_only
|
||||||
@ -143,12 +154,6 @@ vec4 GetVolumetricFog(
|
|||||||
float inBiome = BiomeVLFogColors(biomeDirect, biomeIndirect);
|
float inBiome = BiomeVLFogColors(biomeDirect, biomeIndirect);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISTANT_HORIZONS
|
|
||||||
float atmosphereMult = 1.0;
|
|
||||||
#else
|
|
||||||
float atmosphereMult = 1.5;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RAYMARCH_CLOUDS_WITH_FOG
|
#ifdef RAYMARCH_CLOUDS_WITH_FOG
|
||||||
vec3 SkyLightColor = AmbientColor;
|
vec3 SkyLightColor = AmbientColor;
|
||||||
vec3 LightSourceColor = LightColor;
|
vec3 LightSourceColor = LightColor;
|
||||||
@ -174,14 +179,16 @@ vec4 GetVolumetricFog(
|
|||||||
float lightLevelZero = pow(clamp(eyeBrightnessSmooth.y/240.0 ,0.0,1.0),3.0);
|
float lightLevelZero = pow(clamp(eyeBrightnessSmooth.y/240.0 ,0.0,1.0),3.0);
|
||||||
|
|
||||||
// SkyLightColor *= lightLevelZero*0.9 + 0.1;
|
// SkyLightColor *= lightLevelZero*0.9 + 0.1;
|
||||||
|
vec3 finalsceneColor = vec3(0.0);
|
||||||
|
|
||||||
for (int i = 0; i < SAMPLECOUNT; i++) {
|
for (int i = 0; i < SAMPLECOUNT; i++) {
|
||||||
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||||
float dd = pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
float dd = pow(expFactor, float(i+dither.y)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
||||||
|
|
||||||
progress = start.xyz + d*dV;
|
progress = start.xyz + d*dV;
|
||||||
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||||
|
|
||||||
|
// if(length(progressW-cameraPosition) > cloudDepth) break;
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
//------ SAMPLE SHADOWS FOR FOG EFFECTS
|
//------ SAMPLE SHADOWS FOR FOG EFFECTS
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
@ -212,7 +219,7 @@ vec4 GetVolumetricFog(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VL_CLOUDS_SHADOWS
|
#ifdef VL_CLOUDS_SHADOWS
|
||||||
sh *= GetCloudShadow_VLFOG(progressW, WsunVec * lightCol.a);
|
sh *= GetCloudShadow(progressW, WsunVec*lightCol.a);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PER_BIOME_ENVIRONMENT
|
#ifdef PER_BIOME_ENVIRONMENT
|
||||||
@ -237,10 +244,9 @@ vec4 GetVolumetricFog(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz);
|
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz);
|
||||||
vec3 lighting = DirectLight + indirectLight * (lightLevelZero*0.99 + 0.01) + Lightning;
|
vec3 lighting = DirectLight + indirectLight;// * (lightLevelZero*0.99 + 0.01) + Lightning;
|
||||||
|
|
||||||
color += (lighting - lighting * fogVolumeCoeff) * fogAbsorbance;
|
color += (lighting - lighting * fogVolumeCoeff) * totalAbsorbance;
|
||||||
fogAbsorbance *= fogVolumeCoeff;
|
|
||||||
|
|
||||||
// kill fog absorbance when in caves.
|
// kill fog absorbance when in caves.
|
||||||
totalAbsorbance *= mix(1.0, fogVolumeCoeff, lightLevelZero);
|
totalAbsorbance *= mix(1.0, fogVolumeCoeff, lightLevelZero);
|
||||||
@ -252,26 +258,32 @@ vec4 GetVolumetricFog(
|
|||||||
#else
|
#else
|
||||||
float cloudPlaneCutoff = 1.0;
|
float cloudPlaneCutoff = 1.0;
|
||||||
#endif
|
#endif
|
||||||
|
// maximum range for atmosphere haze, basically.
|
||||||
|
float planetVolume = 1.0 - exp(clamp(1.0 - length(progressW-cameraPosition) / (16*150), 0.0,1.0) * -10);
|
||||||
|
|
||||||
// just air
|
// just air
|
||||||
vec2 airCoef = exp2(-max(progressW.y-SEA_LEVEL,0.0)/vec2(8.0e3, 1.2e3)*vec2(6.,7.0)) * (24.0 * atmosphereMult) * Haze_amount * cloudPlaneCutoff;
|
vec2 airCoef = (exp2(-max(progressW.y-SEA_LEVEL,0.0)/vec2(8.0e3, 1.2e3)*vec2(6.,7.0)) * 192.0 * Haze_amount) * cloudPlaneCutoff * planetVolume;
|
||||||
|
|
||||||
// Pbr for air, yolo mix between mie and rayleigh for water droplets
|
// Pbr for air, yolo mix between mie and rayleigh for water droplets
|
||||||
vec3 rL = rC*airCoef.x;
|
vec3 rL = rC*airCoef.x;
|
||||||
vec3 m = mC*(airCoef.y+densityVol*300.0);
|
vec3 m = mC*(airCoef.y+densityVol*300.0);
|
||||||
|
|
||||||
// calculate the atmosphere haze seperately and purely additive to color, do not contribute to absorbtion.
|
// calculate the atmosphere haze seperately and purely additive to color, do not contribute to absorbtion.
|
||||||
vec3 atmosphereVolumeCoeff = exp(-(rL+m)*dd*dL_alternate);
|
vec3 atmosphereVolumeCoeff = exp(-(rL+m)*dd*dL);
|
||||||
|
// vec3 Atmosphere = LightSourcePhased * sh * (rayL*rL + sunPhase*m) + AveragedAmbientColor * (rL+m);
|
||||||
vec3 Atmosphere = (LightSourcePhased * sh * (rayL*rL + sunPhase*m) + AveragedAmbientColor * (rL+m) * (lightLevelZero*0.99 + 0.01)) * inACave;
|
vec3 Atmosphere = (LightSourcePhased * sh * (rayL*rL + sunPhase*m) + AveragedAmbientColor * (rL+m) * (lightLevelZero*0.99 + 0.01)) * inACave;
|
||||||
color += (Atmosphere - Atmosphere * atmosphereVolumeCoeff) / (rL+m+1e-6) * atmosphereAbsorbance * totalAbsorbance;
|
color += (Atmosphere - Atmosphere * atmosphereVolumeCoeff) / (rL+m+1e-6) * atmosphereAbsorbance;
|
||||||
atmosphereAbsorbance *= dot(atmosphereVolumeCoeff, vec3(0.33333));
|
|
||||||
|
|
||||||
|
// finalsceneColor = sceneColor * totalAbsorbance;
|
||||||
|
|
||||||
|
atmosphereAbsorbance *= atmosphereVolumeCoeff*fogVolumeCoeff;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
//------ LPV FOG EFFECT
|
//------ LPV FOG EFFECT
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
|
||||||
color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * TorchBrightness_autoAdjust * totalAbsorbance;
|
color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * totalAbsorbance;
|
||||||
#endif
|
#endif
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
//------ STUPID RENDER CLOUDS AS FOG EFFECT
|
//------ STUPID RENDER CLOUDS AS FOG EFFECT
|
||||||
@ -333,271 +345,13 @@ vec4 GetVolumetricFog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (totalAbsorbance < 1e-5) break;
|
// if (totalAbsorbance < 1e-5) break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
atmosphereAlpha = atmosphereAbsorbance;
|
|
||||||
|
// sceneColor = finalsceneColor;
|
||||||
|
|
||||||
|
// atmosphereAlpha = atmosphereAbsorbance;
|
||||||
|
|
||||||
return vec4(color, totalAbsorbance);
|
return vec4(color, totalAbsorbance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// vec4 GetVolumetricFog(
|
|
||||||
// vec3 viewPosition,
|
|
||||||
// vec2 dither,
|
|
||||||
// vec3 LightColor,
|
|
||||||
// vec3 AmbientColor
|
|
||||||
// ){
|
|
||||||
|
|
||||||
// #ifndef TOGGLE_VL_FOG
|
|
||||||
// return vec4(0.0,0.0,0.0,1.0);
|
|
||||||
// #endif
|
|
||||||
// int SAMPLECOUNT = VL_SAMPLES;
|
|
||||||
// /// ------------- RAYMARCHING STUFF ------------- \\\
|
|
||||||
|
|
||||||
// //project pixel position into projected shadowmap space
|
|
||||||
|
|
||||||
// vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
|
||||||
// vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
|
|
||||||
// fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
|
|
||||||
|
|
||||||
// //project view origin into projected shadowmap space
|
|
||||||
// vec3 start = toShadowSpaceProjected(vec3(0.0));
|
|
||||||
|
|
||||||
// //rayvector into projected shadow map space
|
|
||||||
// //we can use a projected vector because its orthographic projection
|
|
||||||
// //however we still have to send it to curved shadow map space every step
|
|
||||||
// vec3 dV = fragposition - start;
|
|
||||||
// vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
|
||||||
|
|
||||||
// #ifdef DISTANT_HORIZONS
|
|
||||||
// float maxLength = min(length(dVWorld), max(dhFarPlane-1000,0.0))/length(dVWorld);
|
|
||||||
// SAMPLECOUNT += SAMPLECOUNT;
|
|
||||||
// #else
|
|
||||||
// float maxLength = min(length(dVWorld), far)/length(dVWorld);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// dV *= maxLength;
|
|
||||||
// dVWorld *= maxLength;
|
|
||||||
|
|
||||||
// float dL = length(dVWorld);
|
|
||||||
// float mult = length(dVWorld)/25;
|
|
||||||
|
|
||||||
// vec3 progress = start.xyz;
|
|
||||||
// vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition;
|
|
||||||
|
|
||||||
// vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
|
|
||||||
// float SdotV = dot(sunVec,normalize(viewPosition))*lightCol.a;
|
|
||||||
|
|
||||||
|
|
||||||
// /// ------------- COLOR/LIGHTING STUFF ------------- \\\
|
|
||||||
|
|
||||||
// vec3 color = vec3(0.0);
|
|
||||||
// vec3 absorbance = vec3(1.0);
|
|
||||||
|
|
||||||
// ///// ----- fog lighting
|
|
||||||
// //Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
|
||||||
// float mie = fogPhase(SdotV) * 5.0;
|
|
||||||
// float rayL = phaseRayleigh(SdotV);
|
|
||||||
|
|
||||||
// vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5);
|
|
||||||
// vec3 mC = vec3(fog_coefficientMieR*1e-6, fog_coefficientMieG*1e-6, fog_coefficientMieB*1e-6);
|
|
||||||
|
|
||||||
// vec3 skyLightPhased = AmbientColor;
|
|
||||||
// vec3 LightSourcePhased = LightColor;
|
|
||||||
|
|
||||||
// #ifdef ambientLight_only
|
|
||||||
// LightSourcePhased = vec3(0.0);
|
|
||||||
// #endif
|
|
||||||
// #ifdef PER_BIOME_ENVIRONMENT
|
|
||||||
// vec3 biomeDirect = LightSourcePhased;
|
|
||||||
// vec3 biomeIndirect = skyLightPhased;
|
|
||||||
// float inBiome = BiomeVLFogColors(biomeDirect, biomeIndirect);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// skyLightPhased = max(skyLightPhased + skyLightPhased*(normalize(wpos).y*0.9+0.1),0.0);
|
|
||||||
// LightSourcePhased *= mie;
|
|
||||||
|
|
||||||
// // float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
|
||||||
|
|
||||||
// float lightleakfix = 1.0 - caveDetection;
|
|
||||||
|
|
||||||
// #ifdef RAYMARCH_CLOUDS_WITH_FOG
|
|
||||||
// vec3 SkyLightColor = AmbientColor;
|
|
||||||
// vec3 LightSourceColor = LightColor;
|
|
||||||
|
|
||||||
// #ifdef ambientLight_only
|
|
||||||
// LightSourceColor = vec3(0.0);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// float shadowStep = 200.0;
|
|
||||||
|
|
||||||
// vec3 dV_Sun = WsunVec*shadowStep;
|
|
||||||
|
|
||||||
// float mieDay = phaseg(SdotV, 0.75);
|
|
||||||
// float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
|
|
||||||
|
|
||||||
// vec3 directScattering = LightSourceColor * mieDay * 3.14;
|
|
||||||
// vec3 directMultiScattering = LightSourceColor * mieDayMulti * 3.14;
|
|
||||||
|
|
||||||
// vec3 sunIndirectScattering = LightSourceColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(viewPosition)), 0.5) * 3.14;
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
|
|
||||||
// #ifdef DISTANT_HORIZONS
|
|
||||||
// float atmosphereMult = 1.0;
|
|
||||||
// #else
|
|
||||||
// float atmosphereMult = 1.5;
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// float expFactor = 11.0;
|
|
||||||
// for (int i=0;i<SAMPLECOUNT;i++) {
|
|
||||||
// float d = (pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
|
||||||
// float dd = pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
|
||||||
// progress = start.xyz + d*dV;
|
|
||||||
// progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
|
||||||
|
|
||||||
// // float curvature = 1-exp(-25*pow(clamp(1.0 - length(progressW - cameraPosition)/(32*80),0.0,1.0),2));
|
|
||||||
|
|
||||||
// //project into biased shadowmap space
|
|
||||||
// #ifdef DISTORT_SHADOWMAP
|
|
||||||
// float distortFactor = calcDistort(progress.xy);
|
|
||||||
// #else
|
|
||||||
// float distortFactor = 1.0;
|
|
||||||
// #endif
|
|
||||||
// vec3 pos = vec3(progress.xy*distortFactor, progress.z);
|
|
||||||
|
|
||||||
// vec3 sh = vec3(1.0);
|
|
||||||
|
|
||||||
// if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
|
||||||
// pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
|
||||||
|
|
||||||
// #ifdef TRANSLUCENT_COLORED_SHADOWS
|
|
||||||
// sh = vec3(shadow2D(shadowtex0, pos).x);
|
|
||||||
|
|
||||||
// if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){
|
|
||||||
// vec4 translucentShadow = texture2D(shadowcolor0, pos.xy);
|
|
||||||
// if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001);
|
|
||||||
// }
|
|
||||||
// #else
|
|
||||||
// sh = vec3(shadow2D(shadow, pos).x);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// }
|
|
||||||
// vec3 sh2 = sh;
|
|
||||||
|
|
||||||
// #ifdef VL_CLOUDS_SHADOWS
|
|
||||||
// // if(clamp(progressW.y - CloudLayer1_height,0.0,1.0) < 1.0 && clamp(progressW.y-50,0.0,1.0) > 0.0)
|
|
||||||
// sh *= GetCloudShadow_VLFOG(progressW, WsunVec);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
|
|
||||||
// #ifdef PER_BIOME_ENVIRONMENT
|
|
||||||
// float maxDistance = inBiome * min(max(1.0 - length(d*dVWorld.xz)/(32*8),0.0)*2.0,1.0);
|
|
||||||
// float densityVol = cloudVol(progressW, maxDistance) * lightleakfix;
|
|
||||||
// #else
|
|
||||||
// float densityVol = cloudVol(progressW, 0.0) * lightleakfix;
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// //Water droplets(fog)
|
|
||||||
// float density = densityVol*300.0;
|
|
||||||
|
|
||||||
// ///// ----- main fog lighting
|
|
||||||
|
|
||||||
// //Just air
|
|
||||||
// vec2 airCoef = exp(-max(progressW.y - SEA_LEVEL, 0.0) / vec2(8.0e3, 1.2e3) * vec2(6.,7.0)) * (atmosphereMult * 24.0) * Haze_amount * clamp(CloudLayer0_height - progressW.y + max(eyeAltitude-(CloudLayer0_height-50),0),0.0,1.0);
|
|
||||||
|
|
||||||
// //Pbr for air, yolo mix between mie and rayleigh for water droplets
|
|
||||||
// vec3 rL = rC*airCoef.x;
|
|
||||||
// vec3 m = (airCoef.y+density) * mC;
|
|
||||||
|
|
||||||
// #ifdef PER_BIOME_ENVIRONMENT
|
|
||||||
// vec3 Atmosphere = mix(skyLightPhased, biomeDirect, maxDistance) * (rL + m); // not pbr so just make the atmosphere also dense fog heh
|
|
||||||
// vec3 DirectLight = mix(LightSourcePhased, biomeIndirect, maxDistance) * sh * (rL*rayL + m);
|
|
||||||
// #else
|
|
||||||
// vec3 Atmosphere = skyLightPhased * (rL + m); // not pbr so just make the atmosphere also dense fog heh
|
|
||||||
// vec3 DirectLight = LightSourcePhased * sh * (rL*rayL + m);
|
|
||||||
// #endif
|
|
||||||
// vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz) * (rL + m);
|
|
||||||
|
|
||||||
// vec3 foglighting = (Atmosphere + DirectLight + Lightning) * lightleakfix;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// color += (foglighting - foglighting * exp(-(rL+m)*dd*dL)) / ((rL+m)+0.00000001)*absorbance;
|
|
||||||
// absorbance *= clamp(exp(-(rL+m)*dd*dL),0.0,1.0);
|
|
||||||
|
|
||||||
// #ifdef RAYMARCH_CLOUDS_WITH_FOG
|
|
||||||
// //////////////////////////////////////////
|
|
||||||
// ///// ----- cloud part
|
|
||||||
// //////////////////////////////////////////
|
|
||||||
// // curvature = clamp(1.0 - length(progressW - cameraPosition)/(32*128),0.0,1.0);
|
|
||||||
|
|
||||||
|
|
||||||
// float otherlayer = max(progressW.y - (CloudLayer0_height+99.5), 0.0) > 0.0 ? 0.0 : 1.0;
|
|
||||||
|
|
||||||
// float DUAL_MIN_HEIGHT = otherlayer > 0.0 ? CloudLayer0_height : CloudLayer1_height;
|
|
||||||
// float DUAL_MAX_HEIGHT = DUAL_MIN_HEIGHT + 100.0;
|
|
||||||
|
|
||||||
// float DUAL_DENSITY = otherlayer > 0.0 ? CloudLayer0_density : CloudLayer1_density;
|
|
||||||
|
|
||||||
// if(clamp(progressW.y - DUAL_MAX_HEIGHT,0.0,1.0) < 1.0 && clamp(progressW.y - DUAL_MIN_HEIGHT,0.0,1.0) > 0.0){
|
|
||||||
|
|
||||||
// float DUAL_MIN_HEIGHT_2 = otherlayer > 0.0 ? CloudLayer0_height : CloudLayer1_height;
|
|
||||||
// float DUAL_MAX_HEIGHT_2 = DUAL_MIN_HEIGHT + 100.0;
|
|
||||||
|
|
||||||
// float cumulus = GetCumulusDensity(-1, progressW, 1, CloudLayer0_height, CloudLayer1_height);
|
|
||||||
// float fadedDensity = DUAL_DENSITY * clamp(exp( (progressW.y - (DUAL_MAX_HEIGHT - 75)) / 9.0 ),0.0,1.0);
|
|
||||||
|
|
||||||
// float muE = cumulus*fadedDensity;
|
|
||||||
// float directLight = 0.0;
|
|
||||||
// for (int j=0; j < 3; j++){
|
|
||||||
// vec3 shadowSamplePos = progressW + dV_Sun * (0.1 + j * (0.1 + dither.y*0.05));
|
|
||||||
// float shadow = GetCumulusDensity(-1, shadowSamplePos, 0, DUAL_MIN_HEIGHT, DUAL_MAX_HEIGHT) * DUAL_DENSITY;
|
|
||||||
|
|
||||||
// directLight += shadow;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// shadows cast from one layer to another
|
|
||||||
// /// large cumulus -> small cumulus
|
|
||||||
// #if defined CloudLayer1 && defined CloudLayer0
|
|
||||||
// if(otherlayer > 0.0) directLight += LAYER1_DENSITY * 2.0 * GetCumulusDensity(1, progressW + dV_Sun/abs(dV_Sun.y) * max((LAYER1_minHEIGHT+70*dither.y) - progressW.y,0.0), 0, LAYER1_minHEIGHT, LAYER1_maxHEIGHT);
|
|
||||||
// #endif
|
|
||||||
// // // altostratus -> cumulus
|
|
||||||
// // #ifdef CloudLayer2
|
|
||||||
// // vec3 HighAlt_shadowPos = rayProgress + dV_Sun/abs(dV_Sun.y) * max(LAYER2_HEIGHT - rayProgress.y,0.0);
|
|
||||||
// // float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) * CloudLayer2_density;
|
|
||||||
// // directLight += HighAlt_shadow;
|
|
||||||
// // #endif
|
|
||||||
|
|
||||||
|
|
||||||
// float skyScatter = clamp(((DUAL_MAX_HEIGHT - 20 - progressW.y) / 275.0) * (0.5+DUAL_DENSITY),0.0,1.0);
|
|
||||||
// float distantfade = 1- exp( -10*pow(clamp(1.0 - length(progressW - cameraPosition)/(32*65),0.0,1.0),2));
|
|
||||||
// vec3 cloudlighting = DoCloudLighting(cloudDensity * cumulus, SkyLightColor, skyScatter, directLight, directScattering*sh2, directMultiScattering*sh2, 1);
|
|
||||||
|
|
||||||
// color += max(cloudlighting - cloudlighting*exp(-muE*dd*dL),0.0) * absorbance;
|
|
||||||
// absorbance *= max(exp(-muE*dd*dL),0.0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// if (min(dot(absorbance,vec3(0.335)),1.0) < 1e-5) break;
|
|
||||||
// }
|
|
||||||
// return vec4(color, min(dot(absorbance,vec3(0.335)),1.0));
|
|
||||||
// }
|
|
@ -9,31 +9,28 @@
|
|||||||
// #define Vanilla_like_water
|
// #define Vanilla_like_water
|
||||||
#define WATER_WAVE_STRENGTH 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]
|
#define WATER_WAVE_STRENGTH 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]
|
||||||
#define WATER_WAVE_SPEED 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]
|
#define WATER_WAVE_SPEED 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]
|
||||||
#define Dirt_Amount 0.14 // [0.0 0.04 0.08 0.12 0.16 0.2 0.24 0.28 0.32 0.36 0.4 0.44 0.48 0.52 0.56 0.6 0.64 0.68 0.72 0.76 0.8 0.84 0.88 0.92 0.96 1.0 1.04 1.08 1.12 1.16 1.2 1.24 1.28 1.32 1.36 1.4 1.44 1.48 1.52 1.56 1.6 1.64 1.68 1.72 1.76 1.8 1.84 1.88 1.92 1.96 2.0 ]
|
#define Dirt_Amount 0.14 // [0.0 0.04 0.08 0.12 0.16 0.2 0.24 0.28 0.32 0.36 0.4 0.44 0.48 0.52 0.56 0.6 0.64 0.68 0.72 0.76 0.8 0.84 0.88 0.92 0.96 1.0 1.04 1.08 1.12 1.16 1.2 1.24 1.28 1.32 1.36 1.4 1.44 1.48 1.52 1.56 1.6 1.64 1.68 1.72 1.76 1.8 1.84 1.88 1.92 1.96 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||||
|
|
||||||
#define Dirt_Scatter_R 0.7 // [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 ]
|
#define Dirt_Scatter_R 0.6 // [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 ]
|
||||||
#define Dirt_Scatter_G 0.7 // [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 ]
|
#define Dirt_Scatter_G 0.9 // [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 ]
|
||||||
#define Dirt_Scatter_B 0.7 // [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 ]
|
#define Dirt_Scatter_B 0.9 // [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 ]
|
||||||
#define Dirt_Absorb_R 0.65 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ]
|
#define Dirt_Absorb_R 1.0 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ]
|
||||||
#define Dirt_Absorb_G 0.85 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ]
|
#define Dirt_Absorb_G 1.0 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ]
|
||||||
#define Dirt_Absorb_B 1.05 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ]
|
#define Dirt_Absorb_B 1.0 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ]
|
||||||
#define Water_Absorb_R 0.2629 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ]
|
#define Water_Absorb_R 0.25 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ]
|
||||||
#define Water_Absorb_G 0.0565 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ]
|
#define Water_Absorb_G 0.05 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ]
|
||||||
#define Water_Absorb_B 0.01011 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ]
|
#define Water_Absorb_B 0.01 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ]
|
||||||
|
|
||||||
|
#define MINIMUM_WATER_ABSORBANCE -1 // [-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 60 70 80 90 100]
|
||||||
#define rayMarchSampleCount 2 // [1 2 3 4 6 8 12 16 32 64]
|
#define rayMarchSampleCount 2 // [1 2 3 4 6 8 12 16 32 64]
|
||||||
#define Water_Top_Layer 62.90 // [0.90 1.90 2.90 3.90 4.90 5.90 6.90 7.90 8.90 9.90 10.90 11.90 12.90 13.90 14.90 15.90 16.90 17.90 18.90 19.90 20.90 21.90 22.90 23.90 24.90 25.90 26.90 27.90 28.90 29.90 30.90 31.90 32.90 33.90 34.90 35.90 36.90 37.90 38.90 39.90 40.90 41.90 42.90 43.90 44.90 45.90 46.90 47.90 48.90 49.90 50.90 51.90 52.90 53.90 54.90 55.90 56.90 57.90 58.90 59.90 60.90 61.90 62.90 63.90 64.90 65.90 66.90 67.90 68.90 69.90 70.90 71.90 72.90 73.90 74.90 75.90 76.90 77.90 78.90 79.90 80.90 81.90 82.90 83.90 84.90 85.90 86.90 87.90 88.90 89.90 90.90 91.90 92.90 93.90 94.90 95.90 96.90 97.90 98.90 99.90 100.90 101.90 102.90 103.90 104.90 105.90 106.90 107.90 108.90 109.90 110.90 111.90 112.90 113.90 114.90 115.90 116.90 117.90 118.90 119.90 120.90 121.90 122.90 123.90 124.90 125.90 126.90 127.90 128.90 129.90 130.90 131.90 132.90 133.90 134.90 135.90 136.90 137.90 138.90 139.90 140.90 141.90 142.90 143.90 144.90 145.90 146.90 147.90 148.90 149.90 150.90 151.90 152.90 153.90 154.90 155.90 156.90 157.90 158.90 159.90 160.90 161.90 162.90 163.90 164.90 165.90 166.90 167.90 168.90 169.90 170.90 171.90 172.90 173.90 174.90 175.90 176.90 177.90 178.90 179.90 180.90 181.90 182.90 183.90 184.90 185.90 186.90 187.90 188.90 189.90 190.90 191.90 192.90 193.90 194.90 195.90 196.90 197.90 198.90 199.90]
|
#define Water_Top_Layer 62.90 // [0.90 1.90 2.90 3.90 4.90 5.90 6.90 7.90 8.90 9.90 10.90 11.90 12.90 13.90 14.90 15.90 16.90 17.90 18.90 19.90 20.90 21.90 22.90 23.90 24.90 25.90 26.90 27.90 28.90 29.90 30.90 31.90 32.90 33.90 34.90 35.90 36.90 37.90 38.90 39.90 40.90 41.90 42.90 43.90 44.90 45.90 46.90 47.90 48.90 49.90 50.90 51.90 52.90 53.90 54.90 55.90 56.90 57.90 58.90 59.90 60.90 61.90 62.90 63.90 64.90 65.90 66.90 67.90 68.90 69.90 70.90 71.90 72.90 73.90 74.90 75.90 76.90 77.90 78.90 79.90 80.90 81.90 82.90 83.90 84.90 85.90 86.90 87.90 88.90 89.90 90.90 91.90 92.90 93.90 94.90 95.90 96.90 97.90 98.90 99.90 100.90 101.90 102.90 103.90 104.90 105.90 106.90 107.90 108.90 109.90 110.90 111.90 112.90 113.90 114.90 115.90 116.90 117.90 118.90 119.90 120.90 121.90 122.90 123.90 124.90 125.90 126.90 127.90 128.90 129.90 130.90 131.90 132.90 133.90 134.90 135.90 136.90 137.90 138.90 139.90 140.90 141.90 142.90 143.90 144.90 145.90 146.90 147.90 148.90 149.90 150.90 151.90 152.90 153.90 154.90 155.90 156.90 157.90 158.90 159.90 160.90 161.90 162.90 163.90 164.90 165.90 166.90 167.90 168.90 169.90 170.90 171.90 172.90 173.90 174.90 175.90 176.90 177.90 178.90 179.90 180.90 181.90 182.90 183.90 184.90 185.90 186.90 187.90 188.90 189.90 190.90 191.90 192.90 193.90 194.90 195.90 196.90 197.90 198.90 199.90]
|
||||||
|
|
||||||
#define Refraction
|
#define FAKE_REFRACTION_EFFECT
|
||||||
|
#define FAKE_DISPERSION_EFFECT
|
||||||
|
#define REFRACTION_SMUDGE
|
||||||
|
|
||||||
#define SSR_STEPS 30 // [10 15 20 25 30 35 40 50 100 200 400]
|
#define SSR_STEPS 30 // [10 15 20 25 30 35 40 50 100 200 400]
|
||||||
#define USE_QUARTER_RES_DEPTH
|
#define USE_QUARTER_RES_DEPTH
|
||||||
#define WATER_REFLECTIONS
|
|
||||||
#define WATER_BACKGROUND_SPECULAR
|
|
||||||
#define WATER_SUN_SPECULAR
|
|
||||||
#define SCREENSPACE_REFLECTIONS
|
|
||||||
// #define WATER_HQ_SMOOTHNESS
|
|
||||||
|
|
||||||
#define SNELLS_WINDOW
|
#define SNELLS_WINDOW
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
@ -80,7 +77,7 @@
|
|||||||
// ----- INDIRECT LIGHT RELATED SETTINGS ----- //
|
// ----- 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 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.0 ]
|
#define MIN_LIGHT_AMOUNT 0.5 // [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 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.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_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 AmbientLight_R 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]
|
#define AmbientLight_R 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]
|
||||||
@ -94,11 +91,11 @@
|
|||||||
#define TORCH_B 0.65 // [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]
|
#define TORCH_B 0.65 // [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]
|
||||||
|
|
||||||
#define Hand_Held_lights
|
#define Hand_Held_lights
|
||||||
#define HANDHELD_LIGHT_RANGE 10 // [1 2 3 4 5 6 7 8 9 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255]
|
#define HANDHELD_LIGHT_RANGE 16 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255]
|
||||||
|
|
||||||
#define indirect_effect 1 // [0 1 2 3 4]
|
#define indirect_effect 1 // [0 1 2 3 4]
|
||||||
|
|
||||||
#define AO_in_sunlight
|
// #define AO_in_sunlight
|
||||||
#define AO_Strength 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 AO_Strength 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 SKY_CONTRIBUTION_IN_SSRT
|
// #define SKY_CONTRIBUTION_IN_SSRT
|
||||||
@ -145,7 +142,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
|||||||
#define VPS_Search_Samples 4 // [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32]
|
#define VPS_Search_Samples 4 // [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32]
|
||||||
#define Min_Shadow_Filter_Radius 5.0 // [0.0 1.0 2.0 3.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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
#define Min_Shadow_Filter_Radius 5.0 // [0.0 1.0 2.0 3.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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
||||||
#define Max_Shadow_Filter_Radius 30.0 // [0.0 1.0 2.0 3.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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
#define Max_Shadow_Filter_Radius 30.0 // [0.0 1.0 2.0 3.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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
||||||
#define Max_Filter_Depth 35.0 // [0.1 1.0 2.0 3.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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 220.0]
|
#define Max_Filter_Depth 15.0 // [0.1 1.0 2.0 3.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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 220.0]
|
||||||
|
|
||||||
#define BASIC_SHADOW_FILTER
|
#define BASIC_SHADOW_FILTER
|
||||||
#define SHADOW_FILTER_SAMPLE_COUNT 13 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ]
|
#define SHADOW_FILTER_SAMPLE_COUNT 13 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ]
|
||||||
@ -191,7 +188,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
|||||||
|
|
||||||
#define RainFog_amount 0.1 // [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]
|
#define RainFog_amount 0.1 // [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]
|
||||||
|
|
||||||
#define BLOOMY_FOG 1.5 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
|
#define BLOOMY_FOG 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
|
||||||
#define BLOOM_STRENGTH 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0]
|
#define BLOOM_STRENGTH 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0]
|
||||||
|
|
||||||
#define CAVE_FOG
|
#define CAVE_FOG
|
||||||
@ -260,14 +257,9 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
|||||||
// ----- LABPBR MATERIALS RELATED SETTINGS ----- //
|
// ----- LABPBR MATERIALS RELATED SETTINGS ----- //
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
// #define Specular_Reflections
|
|
||||||
// #define Screen_Space_Reflections
|
|
||||||
// #define Sky_reflection
|
|
||||||
// #define Rough_reflections
|
|
||||||
#define Dynamic_SSR_quality
|
|
||||||
#define Sun_specular_Strength 1 // [0 1 2 3 4 5 6 7 8 9 10]
|
#define Sun_specular_Strength 1 // [0 1 2 3 4 5 6 7 8 9 10]
|
||||||
#define reflection_quality 30 // [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 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 80.0 85.0 90.0 95.0 100.0 ]
|
#define reflection_quality 30 // [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 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 80.0 85.0 90.0 95.0 100.0 ]
|
||||||
#define Roughness_Threshold 1.5 // [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 Roughness_Threshold 0.3 // [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.00]
|
||||||
|
|
||||||
#ifdef Specular_Reflections
|
#ifdef Specular_Reflections
|
||||||
#define LIGHTSOURCE_REFLECTION
|
#define LIGHTSOURCE_REFLECTION
|
||||||
@ -326,7 +318,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
|||||||
#define sunColorG 0.91 // [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 ]
|
#define sunColorG 0.91 // [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 ]
|
||||||
#define sunColorB 0.81 // [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 ]
|
#define sunColorB 0.81 // [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 ]
|
||||||
|
|
||||||
#define moon_illuminance 50.0 //[0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 150.0 200.0 300.0 400.0 500.0 600.0 700.0 800.0 900.0 1000.0 2000.0 3000.0 4000.0 5000.0 6000.0 7000.0 8000.0 9000.0 10000.0 11000.0 12000.0 13000.0 14000.0 15000.0 20000.0 30000.0 40000.0 50000.0 60000.0 70000.0 80000.0 90000.0 100000.0 150000.0 200000.0 250000.0 300000.0 400000.0 500000.0]
|
#define moon_illuminance 600.0 //[0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 150.0 200.0 300.0 400.0 500.0 600.0 700.0 800.0 900.0 1000.0 2000.0 3000.0 4000.0 5000.0 6000.0 7000.0 8000.0 9000.0 10000.0 11000.0 12000.0 13000.0 14000.0 15000.0 20000.0 30000.0 40000.0 50000.0 60000.0 70000.0 80000.0 90000.0 100000.0 150000.0 200000.0 250000.0 300000.0 400000.0 500000.0]
|
||||||
#define Moon_temp 15000 // [1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 4500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 15000 20000 25000 50000]
|
#define Moon_temp 15000 // [1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 4500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 15000 20000 25000 50000]
|
||||||
#define moonColorR 0.9080 //[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 ]
|
#define moonColorR 0.9080 //[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 ]
|
||||||
#define moonColorG 0.9121 //[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 ]
|
#define moonColorG 0.9121 //[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 ]
|
||||||
@ -512,12 +504,14 @@ uniform int moonPhase;
|
|||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
#define TAA
|
#define TAA
|
||||||
// #define SCREENSHOT_MODE
|
// #define RESPONSIVE_TAA
|
||||||
// #define TAA_UPSCALING
|
// #define TAA_UPSCALING
|
||||||
#define BLEND_FACTOR 0.12 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00]
|
// #define SCREENSHOT_MODE
|
||||||
#define CLOSEST_VELOCITY
|
#ifdef SCREENSHOT_MODE
|
||||||
//#define NO_CLIP
|
#undef RESPONSIVE_TAA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BLEND_FACTOR 0.125 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.125 0.14 0.16 0.18 0.20 0.25 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00]
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
@ -582,6 +576,9 @@ const vec3 HIGHLIGHTS_TARGET = length(vec3(HIGHLIGHTS_GRADE_R, HIGHLIGHTS_GRADE_
|
|||||||
#define Manual_exposure_value 1.0 // [0.000553 0.000581 0.000611 0.000642 0.000675 0.000710 0.000746 0.000784 0.000825 0.000867 0.000911 0.000958 0.001007 0.001059 0.001113 0.001170 0.001230 0.001294 0.001360 0.001430 0.001503 0.001580 0.001661 0.001746 0.001836 0.001930 0.002029 0.002133 0.002242 0.002357 0.002478 0.002605 0.002739 0.002879 0.003027 0.003182 0.003345 0.003517 0.003697 0.003887 0.004086 0.004296 0.004516 0.004748 0.004991 0.005247 0.005516 0.005799 0.006096 0.006409 0.006737 0.007083 0.007446 0.007828 0.008229 0.008651 0.009095 0.009561 0.010051 0.010567 0.011108 0.011678 0.012277 0.012906 0.013568 0.014264 0.014995 0.015764 0.016572 0.017422 0.018315 0.019254 0.020241 0.021279 0.022370 0.023517 0.024723 0.025991 0.027323 0.028724 0.030197 0.031745 0.033373 0.035084 0.036883 0.038774 0.040762 0.042852 0.045049 0.047358 0.049787 0.052339 0.055023 0.057844 0.060810 0.063927 0.067205 0.070651 0.074273 0.078081 0.082084 0.086293 0.090717 0.095369 0.100258 0.105399 0.110803 0.116484 0.122456 0.128734 0.135335 0.142274 0.149568 0.157237 0.165298 0.173773 0.182683 0.192049 0.201896 0.212247 0.223130 0.234570 0.246596 0.259240 0.272531 0.286504 0.301194 0.316636 0.332871 0.349937 0.367879 0.386741 0.406569 0.427414 0.449328 0.472366 0.496585 0.522045 0.548811 0.576949 0.606530 0.637628 0.670320 0.704688 0.740818 0.778800 0.818730 0.860707 0.904837 0.951229 1.0 1.051271 1.105170 1.161834 1.221402 1.284025 1.349858 1.419067 1.491824 1.568312 1.648721 1.733253 1.822118 1.915540 2.013752 2.117000 2.225540 2.339646 2.459603 2.585709 2.718281 2.857651 3.004166 3.158192 3.320116 3.490342 3.669296 3.857425 4.055199 4.263114 4.481689 4.711470 4.953032 5.206979 5.473947 5.754602 6.049647 6.359819 6.685894 7.028687 7.389056 7.767901 8.166169 8.584858 9.025013 9.487735 9.974182 10.48556 11.02317 11.58834 12.18249 ]
|
#define Manual_exposure_value 1.0 // [0.000553 0.000581 0.000611 0.000642 0.000675 0.000710 0.000746 0.000784 0.000825 0.000867 0.000911 0.000958 0.001007 0.001059 0.001113 0.001170 0.001230 0.001294 0.001360 0.001430 0.001503 0.001580 0.001661 0.001746 0.001836 0.001930 0.002029 0.002133 0.002242 0.002357 0.002478 0.002605 0.002739 0.002879 0.003027 0.003182 0.003345 0.003517 0.003697 0.003887 0.004086 0.004296 0.004516 0.004748 0.004991 0.005247 0.005516 0.005799 0.006096 0.006409 0.006737 0.007083 0.007446 0.007828 0.008229 0.008651 0.009095 0.009561 0.010051 0.010567 0.011108 0.011678 0.012277 0.012906 0.013568 0.014264 0.014995 0.015764 0.016572 0.017422 0.018315 0.019254 0.020241 0.021279 0.022370 0.023517 0.024723 0.025991 0.027323 0.028724 0.030197 0.031745 0.033373 0.035084 0.036883 0.038774 0.040762 0.042852 0.045049 0.047358 0.049787 0.052339 0.055023 0.057844 0.060810 0.063927 0.067205 0.070651 0.074273 0.078081 0.082084 0.086293 0.090717 0.095369 0.100258 0.105399 0.110803 0.116484 0.122456 0.128734 0.135335 0.142274 0.149568 0.157237 0.165298 0.173773 0.182683 0.192049 0.201896 0.212247 0.223130 0.234570 0.246596 0.259240 0.272531 0.286504 0.301194 0.316636 0.332871 0.349937 0.367879 0.386741 0.406569 0.427414 0.449328 0.472366 0.496585 0.522045 0.548811 0.576949 0.606530 0.637628 0.670320 0.704688 0.740818 0.778800 0.818730 0.860707 0.904837 0.951229 1.0 1.051271 1.105170 1.161834 1.221402 1.284025 1.349858 1.419067 1.491824 1.568312 1.648721 1.733253 1.822118 1.915540 2.013752 2.117000 2.225540 2.339646 2.459603 2.585709 2.718281 2.857651 3.004166 3.158192 3.320116 3.490342 3.669296 3.857425 4.055199 4.263114 4.481689 4.711470 4.953032 5.206979 5.473947 5.754602 6.049647 6.359819 6.685894 7.028687 7.389056 7.767901 8.166169 8.584858 9.025013 9.487735 9.974182 10.48556 11.02317 11.58834 12.18249 ]
|
||||||
#define Exposure_Speed 1.0 // [0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0 4.0 5.0]
|
#define Exposure_Speed 1.0 // [0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0 4.0 5.0]
|
||||||
|
|
||||||
|
#define MINUMUM_EXPOSURE 0.1 // [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]
|
||||||
|
#define MAXIMUM_EXPOSURE 0.1 // [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]
|
||||||
|
|
||||||
#define Fake_purkinje
|
#define Fake_purkinje
|
||||||
#define Purkinje_strength 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]
|
#define Purkinje_strength 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]
|
||||||
#define Purkinje_R 0.4 // [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]
|
#define Purkinje_R 0.4 // [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]
|
||||||
@ -593,12 +590,19 @@ const vec3 HIGHLIGHTS_TARGET = length(vec3(HIGHLIGHTS_GRADE_R, HIGHLIGHTS_GRADE_
|
|||||||
// #define AEROCHROME_WOOL_ENABLED // Technically wool things should be affected but it affects a lot of builds and stuff
|
// #define AEROCHROME_WOOL_ENABLED // Technically wool things should be affected but it affects a lot of builds and stuff
|
||||||
#define AEROCHROME_PINKNESS 0.3 // How pink it is from red [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
#define AEROCHROME_PINKNESS 0.3 // How pink it is from red [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||||
const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631), AEROCHROME_PINKNESS);
|
const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631), AEROCHROME_PINKNESS);
|
||||||
|
|
||||||
// #define CAMERA_GRIDLINES
|
// #define CAMERA_GRIDLINES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #define MOTION_BLUR
|
// #define MOTION_BLUR
|
||||||
#define MOTION_BLUR_STRENGTH 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 3.0 4.0 5.0]
|
#define MOTION_BLUR_STRENGTH 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 3.0 4.0 5.0]
|
||||||
|
|
||||||
|
// #define CHROMATIC_ABERRATION
|
||||||
|
#define CHROMATIC_ABERRATION_STRENGTH 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 3.0 4.0 5.0]
|
||||||
|
|
||||||
|
// #define VIGNETTE
|
||||||
|
#define VIGNETTE_STRENGTH 0.5 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// ----- GAMEPLAY POST EFFECT RELATED SETTINGS ----- //
|
// ----- GAMEPLAY POST EFFECT RELATED SETTINGS ----- //
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
@ -699,6 +703,10 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||||
|
|
||||||
#define OLD_CAVE_DETECTION
|
#define OLD_CAVE_DETECTION
|
||||||
|
#define FORCE_TRANSLUCENT_GLASS
|
||||||
|
|
||||||
|
// #define PLANET_CURVATURE
|
||||||
|
#define CURVATURE_AMOUNT 1.0 // [-10.0 -9.0 -8.0 -7.0 -6.0 -5.0 -4.0 -3.0 -2.0 -1.9 -1.8 -1.7 -1.6 -1.5 -1.4 -1.3 -1.2 -1.1 -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 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// ----- DISTANT HORIZONS SETTINGS ----- //
|
// ----- DISTANT HORIZONS SETTINGS ----- //
|
||||||
@ -708,7 +716,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
#define DISTORT_SHADOWMAP
|
#define DISTORT_SHADOWMAP
|
||||||
// #define DISTANT_HORIZONS_SHADOWMAP
|
// #define DISTANT_HORIZONS_SHADOWMAP
|
||||||
#ifdef DISTANT_HORIZONS_SHADOWMAP
|
#ifdef DISTANT_HORIZONS_SHADOWMAP
|
||||||
// #undef DISTORT_SHADOWMAP
|
#undef DISTORT_SHADOWMAP
|
||||||
|
|
||||||
const float shadowNearPlane = -1.0;
|
const float shadowNearPlane = -1.0;
|
||||||
const float shadowFarPlane = -1.0;
|
const float shadowFarPlane = -1.0;
|
||||||
@ -716,11 +724,12 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
|
|
||||||
// #define DH_SHADOWPROJECTIONTWEAK
|
// #define DH_SHADOWPROJECTIONTWEAK
|
||||||
#define DH_OVERDRAW_PREVENTION
|
#define DH_OVERDRAW_PREVENTION
|
||||||
#define OVERDRAW_MAX_DISTANCE 0 // [0 32 48 64 80 96 112 128 144 160 176 192 208 224 240 256]
|
#define OVERDRAW_MAX_DISTANCE 128 // [0 32 48 64 80 96 112 128 144 160 176 192 208 224 240 256]
|
||||||
|
|
||||||
#define DH_AMBIENT_OCCLUSION
|
#define DH_AMBIENT_OCCLUSION
|
||||||
#define DH_SUBSURFACE_SCATTERING
|
#define DH_SUBSURFACE_SCATTERING
|
||||||
#define DH_SCREENSPACE_REFLECTIONS
|
#define DH_SCREENSPACE_REFLECTIONS
|
||||||
|
#define DH_NOISE_TEXTURE
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// ----- FLOODFILL [LPV] SETTINGS ----- //
|
// ----- FLOODFILL [LPV] SETTINGS ----- //
|
||||||
@ -728,7 +737,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
|
|
||||||
//#define LPV_ENABLED
|
//#define LPV_ENABLED
|
||||||
#define LPV_SIZE 7 // [6 7 8]
|
#define LPV_SIZE 7 // [6 7 8]
|
||||||
#define LPV_SATURATION 100 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]
|
#define LPV_SATURATION 50 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]
|
||||||
#define LPV_TINT_SATURATION 100 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]
|
#define LPV_TINT_SATURATION 100 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]
|
||||||
#define LPV_NORMAL_STRENGTH 50 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]
|
#define LPV_NORMAL_STRENGTH 50 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]
|
||||||
#define LPV_NORMAL_OFFSET
|
#define LPV_NORMAL_OFFSET
|
||||||
@ -749,6 +758,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ruining parts of the effect to make it more like vanilla floodfill
|
||||||
|
// #define VANILLA_LIGHTMAP_MASK
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// ----- DEBUG SETTINGS ----- //
|
// ----- DEBUG SETTINGS ----- //
|
||||||
@ -763,10 +774,13 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
#define debug_VIEW_POSITION 6
|
#define debug_VIEW_POSITION 6
|
||||||
#define debug_DH_WATER_BLENDING 7
|
#define debug_DH_WATER_BLENDING 7
|
||||||
#define debug_FILTERED_STUFF 8
|
#define debug_FILTERED_STUFF 8
|
||||||
#define debug_TEMPORAL_REPROJECTION 9
|
#define debug_DEPTHTEX0 9
|
||||||
#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING debug_FILTERED_STUFF debug_TEMPORAL_REPROJECTION]
|
#define debug_DEPTHTEX1 10
|
||||||
|
#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING debug_FILTERED_STUFF debug_DEPTHTEX0 debug_DEPTHTEX1]
|
||||||
|
|
||||||
|
#if DEBUG_VIEW == debug_DEPTHTEX0 || DEBUG_VIEW == debug_DEPTHTEX1
|
||||||
|
#undef TAA
|
||||||
|
#endif
|
||||||
// fix settings
|
// fix settings
|
||||||
#ifdef DH_SCREENSPACE_REFLECTIONS
|
#ifdef DH_SCREENSPACE_REFLECTIONS
|
||||||
#endif
|
#endif
|
||||||
@ -793,4 +807,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
|||||||
#ifdef LPV_VL_FOG_ILLUMINATION
|
#ifdef LPV_VL_FOG_ILLUMINATION
|
||||||
#endif
|
#endif
|
||||||
#ifdef OLD_CAVE_DETECTION
|
#ifdef OLD_CAVE_DETECTION
|
||||||
|
#endif
|
||||||
|
#ifdef FORCE_TRANSLUCENT_GLASS
|
||||||
#endif
|
#endif
|
@ -28,7 +28,7 @@ vec3 drawMoon(vec3 PlayerPos, vec3 WorldSunVec, vec3 Color, inout vec3 occludeSt
|
|||||||
|
|
||||||
vec3 LightDir = phase[moonPhase];
|
vec3 LightDir = phase[moonPhase];
|
||||||
|
|
||||||
return Shape * pow(clamp(dot(sunNormal,LightDir)/5,0.0,1.5),5) * Color + clamp(Shape * 4.0 * pow(shape2/200,2.0),0.0,1.0)*0.004;
|
return Shape * pow(clamp(dot(sunNormal,LightDir)/5,0.0,1.5),5) * Color * 10.0 + clamp(Shape * 4.0 * pow(shape2/200,2.0),0.0,1.0)*0.004;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float pi = 3.141592653589793238462643383279502884197169;
|
const float pi = 3.141592653589793238462643383279502884197169;
|
||||||
@ -134,27 +134,73 @@ vec4 texture2D_bicubic_offset(sampler2D tex, vec2 uv, float noise, float scale)
|
|||||||
|
|
||||||
vec2 sphereToCarte(vec3 dir) {
|
vec2 sphereToCarte(vec3 dir) {
|
||||||
float lonlat = clamp(atan(-dir.x, -dir.z), -pi, pi);
|
float lonlat = clamp(atan(-dir.x, -dir.z), -pi, pi);
|
||||||
return vec2(lonlat * (0.5/pi) +0.5,0.5*dir.y+0.5);
|
return vec2(lonlat * (0.5/pi) +0.5, 0.5*dir.y+0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 skyFromTex(vec3 pos,sampler2D sampler){
|
vec3 skyFromTex(vec3 pos,sampler2D sampler){
|
||||||
|
|
||||||
vec2 p = sphereToCarte(pos);
|
vec2 p = sphereToCarte(pos);
|
||||||
|
|
||||||
|
vec2 clampUV = vec2(1.0);
|
||||||
|
p = clamp(p*2.0-1.0, -clampUV, clampUV)*0.5+0.5;
|
||||||
|
|
||||||
return texture2D(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb;
|
return texture2D(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb;
|
||||||
}
|
}
|
||||||
vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
|
vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
|
||||||
vec2 p = sphereToCarte(pos);
|
vec2 p = sphereToCarte(pos);
|
||||||
|
|
||||||
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb;
|
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 skyCloudsFromTex(vec3 pos,sampler2D sampler){
|
vec4 skyCloudsFromTex(vec3 pos,sampler2D sampler){
|
||||||
|
|
||||||
vec2 p = sphereToCarte(pos);
|
vec2 p = sphereToCarte(pos);
|
||||||
return texture2D(sampler,p*texelSize*256.+vec2(18.5+257.,1.5)*texelSize);
|
|
||||||
}
|
vec2 uv = clamp(p, 0.0, 1.0) * texelSize*256. + vec2(18.5+257.,1.5)*texelSize;
|
||||||
vec4 skyCloudsFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
|
|
||||||
vec2 p = sphereToCarte(pos);
|
return texture2D(sampler, uv);
|
||||||
return texture2DLod(sampler,p*texelSize*256. + vec2(18.5 + 257., 1.5)*texelSize,LOD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 skyCloudsFromTexLOD2(vec3 pos,sampler2D sampler, float LOD){
|
vec4 skyCloudsFromTexBLUR(vec3 pos,sampler2D sampler, float scaler){
|
||||||
|
|
||||||
vec2 p = sphereToCarte(pos);
|
vec2 p = sphereToCarte(pos);
|
||||||
return texture2DLod(sampler,p*texelSize*256. + vec2(256.0 - 256.0*0.12,1.5)*texelSize,LOD);
|
vec2 scaleA = texelSize*256.;
|
||||||
|
vec2 scaleB = vec2(18.5+257.,1.5)*texelSize;
|
||||||
|
vec2 posi = p;
|
||||||
|
|
||||||
|
vec2 uv = clamp(posi, 0.0, 1.0)*scaleA + scaleB;
|
||||||
|
|
||||||
|
|
||||||
|
vec4 color = texture2D(sampler, uv);
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 skyCloudsFromTexLOD(vec3 pos,sampler2D sampler, float roughness){
|
||||||
|
vec2 p = sphereToCarte(pos);
|
||||||
|
|
||||||
|
roughness = (1-pow(1-roughness,3));
|
||||||
|
|
||||||
|
float Y = min(max(p.y-0.5,0)*50.0,1);
|
||||||
|
p = mix(p, ((p-0.5) - (p-0.5)*roughness) + 0.5, Y);
|
||||||
|
|
||||||
|
// p = ((p-0.5) - (p-0.5)*roughness) + 0.5;
|
||||||
|
|
||||||
|
vec2 clampUV = vec2(1.0);
|
||||||
|
p = clamp(p*2.0-1.0, -clampUV, clampUV)*0.5+0.5;
|
||||||
|
|
||||||
|
vec2 uv = p*texelSize*256.+vec2(18.5+257.,1.5)*texelSize;
|
||||||
|
|
||||||
|
return texture2D(sampler, uv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vec4 volumetricsFromTex(vec3 pos,sampler2D sampler, float LOD){
|
||||||
|
vec2 p = sphereToCarte(pos);
|
||||||
|
|
||||||
|
p = clamp(p, 0.0, 1.0);
|
||||||
|
|
||||||
|
vec2 uv = p*texelSize*256. + vec2(256.0 - 256.0*0.12,1.5)*texelSize;
|
||||||
|
|
||||||
|
return texture2DLod(sampler, uv, LOD);
|
||||||
}
|
}
|
@ -1,13 +1,13 @@
|
|||||||
uniform int framemod8;
|
// uniform int framemod8;
|
||||||
|
|
||||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
// const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||||
vec2(-1.,3.)/8.,
|
// vec2(-1.,3.)/8.,
|
||||||
vec2(5.0,1.)/8.,
|
// vec2(5.0,1.)/8.,
|
||||||
vec2(-3,-5.)/8.,
|
// vec2(-3,-5.)/8.,
|
||||||
vec2(-5.,5.)/8.,
|
// vec2(-5.,5.)/8.,
|
||||||
vec2(-7.,-1.)/8.,
|
// vec2(-7.,-1.)/8.,
|
||||||
vec2(3,7.)/8.,
|
// vec2(3,7.)/8.,
|
||||||
vec2(7.,-7.)/8.);
|
// vec2(7.,-7.)/8.);
|
||||||
|
|
||||||
vec3 lerp(vec3 X, vec3 Y, float A){
|
vec3 lerp(vec3 X, vec3 Y, float A){
|
||||||
return X * (1.0 - A) + Y * A;
|
return X * (1.0 - A) + Y * A;
|
||||||
@ -23,9 +23,9 @@ float square(float x){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
vec3 toClipSpace3(vec3 viewSpacePosition) {
|
// vec3 toClipSpace3(vec3 viewSpacePosition) {
|
||||||
return projMAD(gbufferProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
// return projMAD(gbufferProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||||
}
|
// }
|
||||||
float invLinZ (float lindepth){
|
float invLinZ (float lindepth){
|
||||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||||
}
|
}
|
||||||
@ -61,7 +61,89 @@ vec2 R2_Sample(int n){
|
|||||||
return fract(alpha * n);
|
return fract(alpha * n);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, bool hand, inout float reflectLength){
|
float fma(float a,float b,float c){
|
||||||
|
return a * b + c;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 SampleVNDFGGX(
|
||||||
|
vec3 viewerDirection, // Direction pointing towards the viewer, oriented such that +Z corresponds to the surface normal
|
||||||
|
float alpha, // Roughness parameter along X and Y of the distribution
|
||||||
|
vec2 xy // Pair of uniformly distributed numbers in [0, 1)
|
||||||
|
) {
|
||||||
|
|
||||||
|
// Transform viewer direction to the hemisphere configuration
|
||||||
|
viewerDirection = normalize(vec3( alpha * 0.5 * viewerDirection.xy, viewerDirection.z));
|
||||||
|
|
||||||
|
// Sample a reflection direction off the hemisphere
|
||||||
|
const float tau = 6.2831853; // 2 * pi
|
||||||
|
float phi = tau * xy.x;
|
||||||
|
|
||||||
|
float cosTheta = fma(1.0 - xy.y, 1.0 + viewerDirection.z, -viewerDirection.z);
|
||||||
|
float sinTheta = sqrt(clamp(1.0 - cosTheta * cosTheta, 0.0, 1.0));
|
||||||
|
|
||||||
|
sinTheta = clamp(sinTheta,0.0,1.0);
|
||||||
|
cosTheta = clamp(cosTheta,sinTheta*0.5,1.0);
|
||||||
|
|
||||||
|
|
||||||
|
vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * sinTheta, cosTheta);
|
||||||
|
|
||||||
|
// Evaluate halfway direction
|
||||||
|
// This gives the normal on the hemisphere
|
||||||
|
vec3 halfway = reflected + viewerDirection;
|
||||||
|
|
||||||
|
// Transform the halfway direction back to hemiellispoid configuation
|
||||||
|
// This gives the final sampled normal
|
||||||
|
return normalize(vec3(alpha * halfway.xy, halfway.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 GGX(vec3 n, vec3 v, vec3 l, float r, vec3 f0, vec3 metalAlbedoTint) {
|
||||||
|
r = max(pow(r,2.5), 0.0001);
|
||||||
|
|
||||||
|
vec3 h = normalize(l + v);
|
||||||
|
float hn = inversesqrt(dot(h, h));
|
||||||
|
|
||||||
|
float dotLH = clamp(dot(h,l)*hn,0.,1.);
|
||||||
|
float dotNH = clamp(dot(h,n)*hn,0.,1.) ;
|
||||||
|
float dotNL = clamp(dot(n,l),0.,1.);
|
||||||
|
float dotNHsq = dotNH*dotNH;
|
||||||
|
|
||||||
|
float denom = dotNHsq * r - dotNHsq + 1.;
|
||||||
|
float D = r / (3.141592653589793 * denom * denom);
|
||||||
|
|
||||||
|
vec3 F = (f0 + (1. - f0) * exp2((-5.55473*dotLH-6.98316)*dotLH)) * metalAlbedoTint;
|
||||||
|
float k2 = .25 * r;
|
||||||
|
|
||||||
|
return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
|
||||||
|
}
|
||||||
|
|
||||||
|
float shlickFresnelRoughness(float XdotN, float roughness){
|
||||||
|
|
||||||
|
float shlickFresnel = clamp(1.0 + XdotN,0.0,1.0);
|
||||||
|
|
||||||
|
// shlickFresnel = pow(1.0-pow(1.0-shlickFresnel, mix(1.0,2.1,roughness)), mix(5.0,3.0,roughness));
|
||||||
|
// shlickFresnel = mix(0.0, mix(1.0,0.065,1-pow(1-roughness,3.5)), shlickFresnel);
|
||||||
|
|
||||||
|
|
||||||
|
// float curves = 1.0-exp(-1.3*roughness);
|
||||||
|
// float brightness = 1.0-exp(-4.0*roughness);
|
||||||
|
|
||||||
|
float curves = exp(-4.0*pow(1-(roughness),2.5));
|
||||||
|
float brightness = exp(-3.0*pow(1-sqrt(roughness),3.50));
|
||||||
|
|
||||||
|
|
||||||
|
shlickFresnel = pow(1.0-pow(1.0-shlickFresnel, mix(1.0, 1.9, curves)),mix(5.0, 2.6, curves));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
shlickFresnel = mix(0.0, mix(1.0,0.065, brightness) , clamp(shlickFresnel,0.0,1.0));
|
||||||
|
|
||||||
|
return shlickFresnel;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, bool hand, inout float reflectionLength, float fresnel){
|
||||||
|
|
||||||
|
float biasAmount = 0.00005;//mix(0.00035, 0.00005, pow(fresnel,0.01));
|
||||||
|
|
||||||
vec3 clipPosition = toClipSpace3(position);
|
vec3 clipPosition = toClipSpace3(position);
|
||||||
float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
|
float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
|
||||||
@ -75,108 +157,282 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo
|
|||||||
|
|
||||||
vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0);
|
vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0);
|
||||||
|
|
||||||
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*dither;
|
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*(dither-0.5);
|
||||||
|
|
||||||
|
#ifndef FORWARD_SPECULAR
|
||||||
|
spos.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE;
|
||||||
|
#endif
|
||||||
|
|
||||||
float minZ = spos.z;
|
float minZ = spos.z;
|
||||||
float maxZ = spos.z;
|
float maxZ = spos.z;
|
||||||
|
|
||||||
spos.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE;
|
|
||||||
float depthcancleoffset = pow(1.0-(quality/reflection_quality),1.0);
|
|
||||||
|
|
||||||
float dist = 1.0 + clamp(position.z*position.z/50.0,0.0,2.0); // shrink sample size as distance increases
|
|
||||||
for (int i = 0; i <= int(quality); i++) {
|
for (int i = 0; i <= int(quality); i++) {
|
||||||
|
|
||||||
// float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0));
|
|
||||||
|
|
||||||
// if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ) ) return vec3(spos.xy/RENDER_SCALE,sp);
|
|
||||||
|
|
||||||
// spos += stepv;
|
|
||||||
|
|
||||||
// //small bias
|
|
||||||
// float biasamount = (0.0002 + 0.0015*pow(depthcancleoffset,5) ) / dist;
|
|
||||||
|
|
||||||
// if(hand) biasamount = 0.00035;
|
|
||||||
|
|
||||||
// minZ = maxZ-biasamount / ld(spos.z);
|
|
||||||
// maxZ += stepv.z;
|
|
||||||
|
|
||||||
|
|
||||||
float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0));
|
float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0));
|
||||||
|
|
||||||
float currZ = linZ(spos.z);
|
float currZ = linZ(spos.z);
|
||||||
float nextZ = linZ(sp);
|
float nextZ = linZ(sp);
|
||||||
|
|
||||||
// if(nextZ < currZ) {
|
// if(abs(nextZ-currZ) < mix(0.005,0.5,currZ*currZ) && sp < max(minZ,maxZ) && sp > min(minZ,maxZ)) return vec3(spos.xy/RENDER_SCALE,sp);
|
||||||
if(abs(nextZ-currZ)/currZ < 0.15 && sp <= max(minZ,maxZ) && sp >= min(minZ,maxZ)) return vec3(spos.xy/RENDER_SCALE,sp);
|
if(sp < max(minZ,maxZ) && sp > min(minZ,maxZ)) return vec3(spos.xy/RENDER_SCALE,sp);
|
||||||
// }
|
|
||||||
float biasamount = 0.005;
|
minZ = maxZ-biasAmount / currZ;
|
||||||
minZ = maxZ-biasamount / linZ(spos.z);
|
|
||||||
maxZ += stepv.z;
|
maxZ += stepv.z;
|
||||||
|
|
||||||
spos += stepv;
|
spos += stepv;
|
||||||
|
|
||||||
reflectLength += 1.0 / quality; // for shit
|
reflectionLength += 1.0 / quality;
|
||||||
|
|
||||||
}
|
}
|
||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float fma(float a,float b,float c){
|
vec4 screenSpaceReflections(
|
||||||
return a * b + c;
|
vec3 reflectedVector,
|
||||||
|
vec3 viewPos,
|
||||||
|
float noise,
|
||||||
|
|
||||||
|
bool isHand,
|
||||||
|
float roughness,
|
||||||
|
float fresnel
|
||||||
|
|
||||||
|
){
|
||||||
|
vec4 reflection = vec4(0.0);
|
||||||
|
|
||||||
|
float reflectionLength = 0.0;
|
||||||
|
float quality = 30.0f;//mix(10.0f, 30.0f, fresnel);
|
||||||
|
|
||||||
|
vec3 raytracePos = rayTraceSpeculars(reflectedVector, viewPos, noise, quality, isHand, reflectionLength, fresnel);
|
||||||
|
|
||||||
|
if (raytracePos.z >= 1.0) return reflection;
|
||||||
|
|
||||||
|
// use higher LOD as the reflection goes on, to blur it. this helps denoise a little.
|
||||||
|
|
||||||
|
float value = 0.1;
|
||||||
|
reflectionLength = min(max(reflectionLength - value, 0.0)/(1.0-value), 1.0);
|
||||||
|
|
||||||
|
float LOD = mix(0.0, 6.0*(1.0-exp(-15.0*sqrt(roughness))), 1.0-pow(1.0-reflectionLength,5.0));
|
||||||
|
// float LOD = mix(0.0, 6.0*pow(roughness,0.1), 1.0-pow(1.0-reflectionLength,5.0));
|
||||||
|
|
||||||
|
// float LOD = clamp(pow(reflectionLength, pow(1.0-sqrt(roughness),5.0) * 3.0) * 6.0, 0.0, 6.0*pow(roughness,0.1));
|
||||||
|
|
||||||
|
|
||||||
|
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(raytracePos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
||||||
|
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
||||||
|
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
|
||||||
|
|
||||||
|
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
|
||||||
|
reflection.a = 1.0;
|
||||||
|
|
||||||
|
#ifdef FORWARD_RENDERED_SPECULAR
|
||||||
|
// vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.));
|
||||||
|
// vec2 resScale = vec2(1920.,1080.)/clampedRes;
|
||||||
|
// vec2 bloomTileUV = (((previousPosition.xy/texelSize)*2.0 + 0.5)*texelSize/2.0) / clampedRes*vec2(1920.,1080.);
|
||||||
|
// reflection.rgb = texture2D(colortex6, bloomTileUV / 4.0).rgb;
|
||||||
|
reflection.rgb = texture2D(colortex5, previousPosition.xy).rgb;
|
||||||
|
#else
|
||||||
|
reflection.rgb = texture2DLod(colortex5, previousPosition.xy, LOD).rgb;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// reflection.rgb = vec3(LOD/6);
|
||||||
|
|
||||||
|
// vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.));
|
||||||
|
// vec2 resScale = vec2(1920.,1080.)/clampedRes;
|
||||||
|
// vec2 bloomTileUV = (((previousPosition.xy/texelSize)*2.0 + 0.5)*texelSize/2.0) / clampedRes*vec2(1920.,1080.);
|
||||||
|
|
||||||
|
// vec2 bloomTileoffsetUV[6] = vec2[](
|
||||||
|
// bloomTileUV / 4.,
|
||||||
|
// bloomTileUV / 8. + vec2(0.25*resScale.x+2.5*texelSize.x, .0),
|
||||||
|
// bloomTileUV / 16. + vec2(0.375*resScale.x+4.5*texelSize.x, .0),
|
||||||
|
// bloomTileUV / 32. + vec2(0.4375*resScale.x+6.5*texelSize.x, .0),
|
||||||
|
// bloomTileUV / 64. + vec2(0.46875*resScale.x+8.5*texelSize.x, .0),
|
||||||
|
// bloomTileUV / 128. + vec2(0.484375*resScale.x+10.5*texelSize.x, .0)
|
||||||
|
// );
|
||||||
|
// // reflectLength = pow(1-pow(1-reflectLength,2),5) * 6;
|
||||||
|
// reflectLength = (exp(-4*(1-reflectLength))) * 6;
|
||||||
|
// Reflections.rgb = texture2D(colortex6, bloomTileoffsetUV[0]).rgb;
|
||||||
|
|
||||||
|
return reflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// thank you Zombye | the paper: https://ggx-research.github.io/publication/2023/06/09/publication-ggx.html
|
float getReflectionVisibility(float f0, float roughness){
|
||||||
vec3 SampleVNDFGGX(
|
|
||||||
vec3 viewerDirection, // Direction pointing towards the viewer, oriented such that +Z corresponds to the surface normal
|
|
||||||
vec2 alpha, // Roughness parameter along X and Y of the distribution
|
|
||||||
float xy // Pair of uniformly distributed numbers in [0, 1)
|
|
||||||
) {
|
|
||||||
// alpha *= alpha;
|
|
||||||
// Transform viewer direction to the hemisphere configuration
|
|
||||||
viewerDirection = normalize(vec3(alpha * viewerDirection.xy, viewerDirection.z));
|
|
||||||
|
|
||||||
// Sample a reflection direction off the hemisphere
|
// the goal is to determine if the reflection is even visible.
|
||||||
const float tau = 6.2831853; // 2 * pi
|
// if it reaches a point in smoothness or reflectance where it is not visible, allow it to interpolate to diffuse lighting.
|
||||||
float phi = tau * xy;
|
float thresholdValue = Roughness_Threshold;
|
||||||
|
|
||||||
float cosTheta = fma(1.0 - xy, 1.0 + viewerDirection.z, -viewerDirection.z) ;
|
if(thresholdValue < 0.01) return 0.0;
|
||||||
float sinTheta = sqrt(clamp(1.0 - cosTheta * cosTheta, 0.0, 1.0));
|
|
||||||
|
|
||||||
// xonk note, i dont know what im doing but this kinda does what i want so whatever
|
// the visibility gradient should only happen for dialectric materials. because metal is always shiny i guess or something
|
||||||
float attemptTailClamp = clamp(sinTheta,max(cosTheta-0.25,0), cosTheta);
|
float dialectrics = max(f0*255.0 - 26.0,0.0)/229.0;
|
||||||
float attemptTailClamp2 = clamp(cosTheta,max(sinTheta-0.25,0), sinTheta);
|
float value = 0.35; // so to a value you think is good enough.
|
||||||
|
float thresholdA = min(max( (1.0-dialectrics) - value, 0.0)/value, 1.0);
|
||||||
|
|
||||||
vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * attemptTailClamp2, attemptTailClamp);
|
// use perceptual smoothness instead of linear roughness. it just works better i guess
|
||||||
// vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * sinTheta, cosTheta);
|
float smoothness = 1.0-sqrt(roughness);
|
||||||
|
value = thresholdValue; // this one is typically want you want to scale.
|
||||||
|
float thresholdB = min(max(smoothness - value, 0.0)/value, 1.0);
|
||||||
|
|
||||||
|
// preserve super smooth reflections. if thresholdB's value is really high, then fully smooth, low f0 materials would be removed (like water).
|
||||||
|
value = 0.1; // super low so only the smoothest of materials are includes.
|
||||||
|
float thresholdC = 1.0-min(max(value - (1.0-smoothness), 0.0)/value, 1.0);
|
||||||
|
|
||||||
|
float visibilityGradient = max(thresholdA*thresholdC - thresholdB,0.0);
|
||||||
|
|
||||||
// Evaluate halfway direction
|
// a curve to make the gradient look smooth/nonlinear. just preference
|
||||||
// This gives the normal on the hemisphere
|
visibilityGradient = 1.0-visibilityGradient;
|
||||||
vec3 halfway = reflected + viewerDirection;
|
visibilityGradient *=visibilityGradient;
|
||||||
|
visibilityGradient = 1.0-visibilityGradient;
|
||||||
|
visibilityGradient *=visibilityGradient;
|
||||||
|
|
||||||
// Transform the halfway direction back to hemiellispoid configuation
|
return visibilityGradient;
|
||||||
// This gives the final sampled normal
|
|
||||||
return normalize(vec3(alpha * halfway.xy, halfway.z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) {
|
// derived from N and K from labPBR wiki https://shaderlabs.org/wiki/LabPBR_Material_Standard
|
||||||
r = max(pow(r,2.5), 0.0001);
|
// using ((1.0 - N)^2 + K^2) / ((1.0 + N)^2 + K^2)
|
||||||
|
vec3 HCM_F0 [8] = vec3[](
|
||||||
|
vec3(0.531228825312, 0.51235724246, 0.495828545714),// iron
|
||||||
|
vec3(0.944229966045, 0.77610211732, 0.373402004593),// gold
|
||||||
|
vec3(0.912298031535, 0.91385063144, 0.919680580954),// Aluminum
|
||||||
|
vec3(0.55559681715, 0.55453707574, 0.554779427513),// Chrome
|
||||||
|
vec3(0.925952196272, 0.72090163805, 0.504154241735),// Copper
|
||||||
|
vec3(0.632483812932, 0.62593707362, 0.641478899539),// Lead
|
||||||
|
vec3(0.678849234658, 0.64240055565, 0.588409633571),// Platinum
|
||||||
|
vec3(0.961999998804, 0.94946811207, 0.922115710997) // Silver
|
||||||
|
);
|
||||||
|
|
||||||
vec3 h = l + v;
|
vec3 specularReflections(
|
||||||
float hn = inversesqrt(dot(h, h));
|
|
||||||
|
|
||||||
float dotLH = clamp(dot(h,l)*hn,0.,1.);
|
in vec3 viewPos, // toScreenspace(vec3(screenUV, depth)
|
||||||
float dotNH = clamp(dot(h,n)*hn,0.,1.) ;
|
in vec3 playerPos, // normalized
|
||||||
float dotNL = clamp(dot(n,l),0.,1.);
|
in vec3 lightPos, // should be in world space
|
||||||
float dotNHsq = dotNH*dotNH;
|
in vec3 noise, // x = bluenoise y = interleaved gradient noise
|
||||||
|
|
||||||
float denom = dotNHsq * r - dotNHsq + 1.;
|
in vec3 normal, // normals in world space
|
||||||
float D = r / (3.141592653589793 * denom * denom);
|
in float roughness, // red channel of specular texture _S
|
||||||
|
in float f0, // green channel of specular texture _S
|
||||||
|
in vec3 albedo,
|
||||||
|
in vec3 diffuseLighting,
|
||||||
|
in vec3 lightColor, // should contain the light's color and shadows.
|
||||||
|
|
||||||
float F = f0 + (1. - f0) * exp2((-5.55473*dotLH-6.98316)*dotLH);
|
in float lightmap, // in anything other than world0, this should be 1.0;
|
||||||
float k2 = .25 * r;
|
in bool isHand // mask for the hand
|
||||||
|
|
||||||
return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2);
|
#ifdef FORWARD_SPECULAR
|
||||||
|
, inout float reflectanceForAlpha
|
||||||
|
#else
|
||||||
|
, bool isWater
|
||||||
|
#endif
|
||||||
|
){
|
||||||
|
#ifdef FORWARD_RENDERED_SPECULAR
|
||||||
|
lightmap = pow(min(max(lightmap-0.6,0.0)*2.5,1.0),2.0);
|
||||||
|
#else
|
||||||
|
lightmap = clamp((lightmap-0.8)*7.0, 0.0,1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
roughness = 1.0 - roughness;
|
||||||
|
roughness *= roughness;
|
||||||
|
|
||||||
|
f0 = f0 == 0.0 ? 0.02 : f0;
|
||||||
|
|
||||||
|
// f0 = 0.9;
|
||||||
|
// roughness = 0.0;
|
||||||
|
|
||||||
|
bool isMetal = f0 > 229.5/255.0;
|
||||||
|
|
||||||
|
// #ifndef FORWARD_RENDERED_SPECULAR
|
||||||
|
// // underwater, convert from f0 air, to ior, then back to f0 water
|
||||||
|
// if(!isMetal || isWater){
|
||||||
|
// f0 = 2.0 / (1.0 - sqrt(f0)) - 1.0;
|
||||||
|
// f0 = clamp(pow((1.33 - f0) / (1.33 + f0), 2.0),0.0,1.0);
|
||||||
|
// }
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// get reflected vector
|
||||||
|
mat3 basis = CoordBase(normal);
|
||||||
|
vec3 viewDir = -playerPos*basis;
|
||||||
|
|
||||||
|
#if defined FORWARD_ROUGH_REFLECTION || defined DEFERRED_ROUGH_REFLECTION
|
||||||
|
vec3 samplePoints = SampleVNDFGGX(viewDir, roughness, noise.xy);
|
||||||
|
vec3 reflectedVector_L = basis * reflect(-normalize(viewDir), samplePoints);
|
||||||
|
|
||||||
|
// get reflectance and f0/HCM values
|
||||||
|
// float shlickFresnel = pow(clamp(1.0 + dot(-reflectedVector, samplePoints),0.0,1.0),5.0);
|
||||||
|
#else
|
||||||
|
vec3 reflectedVector_L = reflect(playerPos, normal);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float shlickFresnel = shlickFresnelRoughness(dot(-normalize(viewDir), vec3(0.0,0.0,1.0)), roughness);
|
||||||
|
|
||||||
|
// #if defined FORWARD_RENDERED_SPECULAR && defined SNELLS_WINDOW
|
||||||
|
// if(isEyeInWater == 1) shlickFresnel = mix(shlickFresnel, 1.0, min(max(0.97 - (1-shlickFresnel),0.0)/(1-0.97),1.0));
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// F0 < 230 dialectrics
|
||||||
|
// F0 >= 230 hardcoded metal f0
|
||||||
|
// F0 == 255 use albedo for f0
|
||||||
|
albedo = f0 == 1.0 ? sqrt(albedo) : albedo;
|
||||||
|
vec3 metalAlbedoTint = isMetal ? albedo : vec3(1.0);
|
||||||
|
// get F0 values for hardcoded metals.
|
||||||
|
vec3 hardCodedMetalsF0 = f0 == 1.0 ? albedo : HCM_F0[int(clamp(f0*255.0 - 229.5,0.0,7.0))];
|
||||||
|
vec3 reflectance = isMetal ? hardCodedMetalsF0 : vec3(f0);
|
||||||
|
vec3 F0 = (reflectance + (1.0-reflectance) * shlickFresnel) * metalAlbedoTint;
|
||||||
|
|
||||||
|
#if defined FORWARD_SPECULAR
|
||||||
|
reflectanceForAlpha = clamp(dot(F0, vec3(0.3333333)), 0.0,1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec3 specularReflections = diffuseLighting;
|
||||||
|
|
||||||
|
float reflectionVisibilty = getReflectionVisibility(f0, roughness);
|
||||||
|
|
||||||
|
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION || defined DEFERRED_ENVIORNMENT_REFLECTION || defined FORWARD_ENVIORNMENT_REFLECTION
|
||||||
|
if(reflectionVisibilty < 1.0){
|
||||||
|
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION
|
||||||
|
#if !defined OVERWORLD_SHADER && !defined FORWARD_SPECULAR
|
||||||
|
vec3 backgroundReflection = volumetricsFromTex(reflectedVector_L, colortex4, roughness).rgb / 1200.0;
|
||||||
|
#else
|
||||||
|
vec3 backgroundReflection = skyCloudsFromTex(reflectedVector_L, colortex4).rgb / 1200.0;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined DEFERRED_ENVIORNMENT_REFLECTION || defined FORWARD_ENVIORNMENT_REFLECTION
|
||||||
|
vec4 enviornmentReflection = screenSpaceReflections(mat3(gbufferModelView) * reflectedVector_L, viewPos, noise.y, isHand, roughness, shlickFresnel);
|
||||||
|
// darkening for metals.
|
||||||
|
vec3 DarkenedDiffuseLighting = isMetal ? diffuseLighting * (1.0-enviornmentReflection.a) * (1.0-lightmap) : diffuseLighting;
|
||||||
|
#else
|
||||||
|
// darkening for metals.
|
||||||
|
vec3 DarkenedDiffuseLighting = isMetal ? diffuseLighting * (1.0-lightmap) : diffuseLighting;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// composite all the different reflections together
|
||||||
|
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION
|
||||||
|
specularReflections = mix(DarkenedDiffuseLighting, backgroundReflection, lightmap);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined DEFERRED_ENVIORNMENT_REFLECTION || defined FORWARD_ENVIORNMENT_REFLECTION
|
||||||
|
specularReflections = mix(specularReflections, enviornmentReflection.rgb, enviornmentReflection.a);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
specularReflections = mix(DarkenedDiffuseLighting, specularReflections, F0);
|
||||||
|
|
||||||
|
// lerp back to diffuse lighting if the reflection has not been deemed visible enough
|
||||||
|
specularReflections = mix(specularReflections, diffuseLighting, reflectionVisibilty);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined OVERWORLD_SHADER
|
||||||
|
vec3 lightSourceReflection = Sun_specular_Strength * lightColor * GGX(normal, -playerPos, lightPos, roughness, reflectance, metalAlbedoTint);
|
||||||
|
specularReflections += lightSourceReflection;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return specularReflections;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void DoSpecularReflections(
|
void DoSpecularReflections(
|
||||||
inout vec3 Output,
|
inout vec3 Output,
|
||||||
|
|
||||||
@ -199,43 +455,70 @@ void DoSpecularReflections(
|
|||||||
vec3 Background_Reflection = Output;
|
vec3 Background_Reflection = Output;
|
||||||
vec3 Lightsource_Reflection = vec3(0.0);
|
vec3 Lightsource_Reflection = vec3(0.0);
|
||||||
vec4 SS_Reflections = vec4(0.0);
|
vec4 SS_Reflections = vec4(0.0);
|
||||||
|
float reflectLength = 0.0;
|
||||||
|
|
||||||
Lightmap = clamp((Lightmap-0.8)*7.0, 0.0,1.0);
|
Lightmap = clamp((Lightmap-0.8)*7.0, 0.0,1.0);
|
||||||
|
|
||||||
Roughness = 1.0 - Roughness; Roughness *= Roughness;
|
Roughness = 1.0 - Roughness; Roughness *= Roughness;
|
||||||
F0 = F0 == 0.0 ? 0.02 : F0;
|
F0 = F0 == 0.0 ? 0.02 : F0;
|
||||||
|
|
||||||
|
// F0 = 230.0/255.0;
|
||||||
|
// Roughness = 0.0;
|
||||||
|
|
||||||
|
// F0 = 230.0/255.0;
|
||||||
|
bool isMetal = F0 > 229.5/255.0;
|
||||||
|
|
||||||
|
// underwater, convert from f0 air, to ior, then back to f0 water
|
||||||
|
// if(!isMetal){
|
||||||
|
// F0 = 2.0 / (1.0 - sqrt(F0)) - 1.0;
|
||||||
|
// F0 = clamp(pow((1.33 - F0) / (1.33 + F0), 2.0),0.0,1.0);
|
||||||
|
// }
|
||||||
// Roughness = 0.0;
|
// Roughness = 0.0;
|
||||||
// F0 = 0.9;
|
|
||||||
|
|
||||||
mat3 Basis = CoordBase(Normal);
|
mat3 Basis = CoordBase(Normal);
|
||||||
vec3 ViewDir = -WorldPos*Basis;
|
vec3 ViewDir = -WorldPos*Basis;
|
||||||
|
|
||||||
#ifdef Rough_reflections
|
#ifdef Rough_reflections
|
||||||
vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(Roughness), Noise.x);
|
vec3 SamplePoints = SampleVNDFGGX(ViewDir, Roughness, Noise.xy);
|
||||||
|
// vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(0.1), Noise.x);
|
||||||
if(Hand) SamplePoints = vec3(0.0,0.0,1.0);
|
if(Hand) SamplePoints = vec3(0.0,0.0,1.0);
|
||||||
#else
|
#else
|
||||||
vec3 SamplePoints = vec3(0.0,0.0,1.0);
|
vec3 SamplePoints = vec3(0.0,0.0,1.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
vec3 Ln = reflect(-ViewDir, SamplePoints);
|
vec3 Ln = reflect(-ViewDir, SamplePoints);
|
||||||
vec3 L = Basis * Ln;
|
vec3 L = Basis * Ln;
|
||||||
|
|
||||||
float Fresnel = pow(clamp(1.0 + dot(-Ln, SamplePoints),0.0,1.0), 5.0); // Schlick's approximation
|
float Fresnel = pow(clamp(1.0 + dot(-Ln, SamplePoints),0.0,1.0),5.0); // Schlick's approximation
|
||||||
|
// F0 < 230 dialectrics
|
||||||
|
// F0 >= 230 hardcoded metal f0
|
||||||
|
// F0 == 255 use albedo for f0
|
||||||
|
Albedo = F0 == 1.0 ? sqrt(Albedo) : Albedo;
|
||||||
|
|
||||||
float RayContribution = lerp(F0, 1.0, Fresnel); // ensure that when the angle is 0 that the correct F0 is used.
|
vec3 metalAlbedoTint = isMetal ? Albedo : vec3(1.0);
|
||||||
|
// metalAlbedoTint = vec3(1.0);
|
||||||
|
// get F0 values for hardcoded metals.
|
||||||
|
vec3 hardCodedMetalsF0 = F0 == 1.0 ? Albedo : HCM_F0[int(max(F0*255.0 - 229.5,0.0))];
|
||||||
|
|
||||||
#ifdef Rough_reflections
|
vec3 reflectance = isMetal ? hardCodedMetalsF0 : vec3(F0);
|
||||||
if(Hand) RayContribution = RayContribution * pow(1.0-Roughness,F0 > 229.5/255.0 ? 1.0 : 3.0);
|
|
||||||
#else
|
vec3 f0 = (reflectance + (1.0-reflectance) * Fresnel) * metalAlbedoTint;
|
||||||
RayContribution = RayContribution * pow(1.0-Roughness,3.0);
|
|
||||||
#endif
|
// reflectance = mix(vec3(F0), vec3(1.0), Fresnel);
|
||||||
|
|
||||||
|
// vec3 reflectance = mix(R0, vec3(1.0), Fresnel); // ensure that when the angle is 0 that the correct F0 is used.
|
||||||
|
|
||||||
|
// #ifdef Rough_reflections
|
||||||
|
// if(Hand) Fresnel = Fresnel * pow(1.0-Roughness,F0 > 229.5/255.0 ? 1.0 : 3.0);
|
||||||
|
// #else
|
||||||
|
// Fresnel = Fresnel * pow(1.0-Roughness,3.0);
|
||||||
|
// #endif
|
||||||
|
|
||||||
bool hasReflections = Roughness_Threshold == 1.0 ? true : F0 * (1.0 - Roughness * Roughness_Threshold) > 0.01;
|
bool hasReflections = Roughness_Threshold == 1.0 ? true : F0 * (1.0 - Roughness * Roughness_Threshold) > 0.01;
|
||||||
|
|
||||||
// mulitply all reflections by the albedo if it is a metal.
|
// mulitply all reflections by the albedo if it is a metal.
|
||||||
// vec3 Metals = F0 > 229.5/255.0 ? lerp(normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3), vec3(1.0), Fresnel * pow(1.0-Roughness,25.0)) : vec3(1.0);
|
// vec3 Metals = F0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0);
|
||||||
vec3 Metals = F0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0);
|
|
||||||
// vec3 Metals = F0 > 229.5/255.0 ? Albedo : vec3(1.0);
|
// vec3 Metals = F0 > 229.5/255.0 ? Albedo : vec3(1.0);
|
||||||
|
|
||||||
// --------------- BACKGROUND REFLECTIONS
|
// --------------- BACKGROUND REFLECTIONS
|
||||||
@ -243,31 +526,33 @@ void DoSpecularReflections(
|
|||||||
#ifdef Sky_reflection
|
#ifdef Sky_reflection
|
||||||
|
|
||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
if(hasReflections) Background_Reflection = (skyCloudsFromTex(L, colortex4).rgb / 30.0) * Metals ;
|
if(hasReflections) Background_Reflection = (skyCloudsFromTex(L, colortex4).rgb / 1200.0) ;
|
||||||
#else
|
#else
|
||||||
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD2(L, colortex4, sqrt(Roughness) * 6.0).rgb / 30.0) * Metals;
|
if(hasReflections) Background_Reflection = (volumetricsFromTex(L, colortex4, sqrt(Roughness) * 6.0).rgb / 1200.0) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// take fresnel and lightmap levels into account and write to the final color
|
// take fresnel and lightmap levels into account and write to the final color
|
||||||
Final_Reflection = lerp(Output, Background_Reflection, Lightmap * RayContribution);
|
// the minimum color being the output is for when the background reflection color is close to dark, it will fallback to a dimmed diffuse
|
||||||
|
// Final_Reflection = mix(Output, Background_Reflection, Lightmap * reflectance);
|
||||||
|
Final_Reflection = mix(Output, mix(isMetal ? vec3(0.0) : Output, Background_Reflection, f0 * Lightmap), Lightmap);
|
||||||
|
// Final_Reflection = Background_Reflection * reflectance;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// --------------- SCREENSPACE REFLECTIONS
|
// --------------- SCREENSPACE REFLECTIONS
|
||||||
// apply screenspace reflections to the final color and mask out background reflections.
|
// apply screenspace reflections to the final color and mask out background reflections.
|
||||||
#ifdef Screen_Space_Reflections
|
#ifdef Screen_Space_Reflections
|
||||||
if(hasReflections){
|
if(hasReflections){
|
||||||
#ifdef Dynamic_SSR_quality
|
|
||||||
float SSR_Quality = lerp(reflection_quality, 6.0, RayContribution); // Scale quality with ray contribution
|
float SSR_Quality =reflection_quality;// mix(6.0, reflection_quality, Fresnel); // Scale quality with fresnel
|
||||||
#else
|
|
||||||
float SSR_Quality = reflection_quality;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float reflectLength = 0.0;
|
|
||||||
vec3 RaytracePos = rayTraceSpeculars(mat3(gbufferModelView) * L, FragPos, Noise.y, float(SSR_Quality), Hand, reflectLength);
|
vec3 RaytracePos = rayTraceSpeculars(mat3(gbufferModelView) * L, FragPos, Noise.y, float(SSR_Quality), Hand, reflectLength);
|
||||||
float LOD = clamp(pow(reflectLength, pow(1.0-sqrt(Roughness),5.0) * 3.0) * 6.0, 0.0, 6.0); // use higher LOD as the reflection goes on, to blur it. this helps denoise a little.
|
float LOD = clamp(pow(reflectLength, pow(1.0-sqrt(Roughness),5.0) * 3.0) * 6.0, 0.0, 6.0); // use higher LOD as the reflection goes on, to blur it. this helps denoise a little.
|
||||||
|
// float LOD = clamp((1-pow(clamp(1.0-reflectLength,0,1),5.0)) * 6.0, 0.0, 6.0); // use higher LOD as the reflection goes on, to blur it. this helps denoise a little.
|
||||||
|
|
||||||
if(Roughness <= 0.0) LOD = 0.0;
|
if(Roughness <= 0.0) LOD = 0.0;
|
||||||
|
|
||||||
|
// LOD = 0.0;
|
||||||
|
|
||||||
if (RaytracePos.z < 1.0){
|
if (RaytracePos.z < 1.0){
|
||||||
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(RaytracePos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(RaytracePos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
|
||||||
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
||||||
@ -275,25 +560,26 @@ void DoSpecularReflections(
|
|||||||
|
|
||||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
|
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
|
||||||
SS_Reflections.a = 1.0;
|
SS_Reflections.a = 1.0;
|
||||||
SS_Reflections.rgb = texture2DLod(colortex5, previousPosition.xy, LOD).rgb * Metals;
|
SS_Reflections.rgb = texture2DLod(colortex5, previousPosition.xy, LOD).rgb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make sure it takes the fresnel into account for SSR.
|
// make sure it takes the fresnel into account for SSR.
|
||||||
SS_Reflections.rgb = lerp(Output, SS_Reflections.rgb, RayContribution);
|
SS_Reflections.rgb = mix(isMetal ? vec3(0.0) : Output, SS_Reflections.rgb, f0);
|
||||||
|
|
||||||
// occlude the background with the SSR and write to the final color.
|
// occlude the background with the SSR and write to the final color.
|
||||||
Final_Reflection = lerp(Final_Reflection, SS_Reflections.rgb, SS_Reflections.a);
|
Final_Reflection = mix(Final_Reflection, SS_Reflections.rgb, SS_Reflections.a);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Final_Reflection = mix(mix(Output,Background_Reflection,Lightmap), SS_Reflections.rgb, SS_Reflections.a) * RayContribution;
|
|
||||||
|
|
||||||
// --------------- LIGHTSOURCE REFLECTIONS
|
// --------------- LIGHTSOURCE REFLECTIONS
|
||||||
// slap the main lightsource reflections to the final color.
|
// slap the main lightsource reflections to the final color.
|
||||||
#ifdef LIGHTSOURCE_REFLECTION
|
#ifdef LIGHTSOURCE_REFLECTION
|
||||||
Lightsource_Reflection = Diffuse * GGX(Normal, -WorldPos, LightPos, Roughness, F0) * Metals;
|
Lightsource_Reflection = Diffuse * GGX(Normal, -WorldPos, LightPos, Roughness, reflectance, metalAlbedoTint) * Sun_specular_Strength;
|
||||||
Final_Reflection += Lightsource_Reflection * Sun_specular_Strength ;
|
Final_Reflection += Lightsource_Reflection;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Output = Final_Reflection;
|
Output = Final_Reflection;
|
||||||
}
|
|
||||||
|
// Output = exp(-100 * (reflectLength*reflectLength*reflectLength)) * vec3(1.0);
|
||||||
|
}
|
||||||
|
*/
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
5
shaders/world0/dh_generic.fsh
Normal file
5
shaders/world0/dh_generic.fsh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#version 330 compatibility
|
||||||
|
|
||||||
|
#define OVERWORLD_SHADER
|
||||||
|
|
||||||
|
#include "/dimensions/DH_generic.fsh"
|
5
shaders/world0/dh_generic.vsh
Normal file
5
shaders/world0/dh_generic.vsh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#version 330 compatibility
|
||||||
|
|
||||||
|
#define OVERWORLD_SHADER
|
||||||
|
|
||||||
|
#include "/dimensions/DH_generic.vsh"
|
@ -20,7 +20,16 @@ float blueNoise(){
|
|||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
|
|
||||||
|
vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
|
||||||
|
|
||||||
|
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||||
|
if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gl_FragData[0] = shadowColor;
|
||||||
|
|
||||||
|
// gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
|
||||||
|
|
||||||
#ifdef Stochastic_Transparent_Shadows
|
#ifdef Stochastic_Transparent_Shadows
|
||||||
if(gl_FragData[0].a < blueNoise()) { discard; return;}
|
if(gl_FragData[0].a < blueNoise()) { discard; return;}
|
||||||
|
@ -152,6 +152,8 @@ void main() {
|
|||||||
color = gl_Color;
|
color = gl_Color;
|
||||||
|
|
||||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
|
|
||||||
|
|
||||||
// playerpos = vec4(0.0);
|
// playerpos = vec4(0.0);
|
||||||
// playerpos = gbufferModelViewInverse * (gl_ModelViewMatrix * gl_Vertex);
|
// playerpos = gbufferModelViewInverse * (gl_ModelViewMatrix * gl_Vertex);
|
||||||
|
|
||||||
@ -202,9 +204,9 @@ void main() {
|
|||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
#if defined IS_LPV_ENABLED || defined WAVY_PLANTS
|
// #if defined IS_LPV_ENABLED || defined WAVY_PLANTS || !defined PLANET_CURVATURE
|
||||||
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
|
||||||
PopulateShadowVoxel(playerpos);
|
PopulateShadowVoxel(playerpos);
|
||||||
@ -231,6 +233,7 @@ void main() {
|
|||||||
|
|
||||||
int blockId = int(mc_Entity.x + 0.5);
|
int blockId = int(mc_Entity.x + 0.5);
|
||||||
|
|
||||||
|
vec3 worldpos = playerpos;
|
||||||
#ifdef WAVY_PLANTS
|
#ifdef WAVY_PLANTS
|
||||||
// also use normal, so up/down facing geometry does not get detatched from its model parts.
|
// also use normal, so up/down facing geometry does not get detatched from its model parts.
|
||||||
bool InterpolateFromBase = gl_MultiTexCoord0.t < max(mc_midTexCoord.t, abs(viewToWorld(normalize(gl_NormalMatrix * gl_Normal)).y));
|
bool InterpolateFromBase = gl_MultiTexCoord0.t < max(mc_midTexCoord.t, abs(viewToWorld(normalize(gl_NormalMatrix * gl_Normal)).y));
|
||||||
@ -248,7 +251,6 @@ void main() {
|
|||||||
|
|
||||||
) && length(position.xy) < 24.0
|
) && length(position.xy) < 24.0
|
||||||
){
|
){
|
||||||
vec3 worldpos = playerpos;
|
|
||||||
|
|
||||||
// apply displacement for waving plant blocks
|
// apply displacement for waving plant blocks
|
||||||
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
|
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
|
||||||
@ -256,11 +258,16 @@ void main() {
|
|||||||
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
|
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
|
||||||
if(blockId == BLOCK_AIR_WAVING) worldpos = playerpos + calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
|
if(blockId == BLOCK_AIR_WAVING) worldpos = playerpos + calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
|
||||||
|
|
||||||
position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PLANET_CURVATURE
|
||||||
|
float curvature = length(worldpos) / (16*8);
|
||||||
|
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz;
|
||||||
|
|
||||||
#ifdef DISTORT_SHADOWMAP
|
#ifdef DISTORT_SHADOWMAP
|
||||||
if (entityId == ENTITY_SSS_MEDIUM || entityId == ENTITY_SLIME)
|
if (entityId == ENTITY_SSS_MEDIUM || entityId == ENTITY_SLIME)
|
||||||
position.xyz = position.xyz - normalize(gl_NormalMatrix * gl_Normal) * 0.25;
|
position.xyz = position.xyz - normalize(gl_NormalMatrix * gl_Normal) * 0.25;
|
||||||
|
Loading…
Reference in New Issue
Block a user