add flashlight effects. add TAA jitter toggle for DH LOD, force responsive TAA jitter on DH. add adjustable health thresholds for damage effects..

This commit is contained in:
Xonk
2025-02-25 17:42:55 -05:00
parent 8a62fff7a2
commit 0ea061c891
18 changed files with 359 additions and 234 deletions

View File

@ -16,6 +16,8 @@ uniform int framemod8;
#include "/lib/bokeh.glsl"
#endif
uniform int framemod4_DH;
#define DH_TAA_OVERRIDE
#include "/lib/TAA_jitter.glsl"
@ -25,8 +27,8 @@ void main() {
#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;
#if defined TAA && defined DH_TAA_JITTER
gl_Position.xy += offsets[framemod4_DH] * gl_Position.w*texelSize;
#endif
pos = gl_ModelViewMatrix * gl_Vertex;

View File

@ -23,6 +23,8 @@ uniform float far;
#include "/lib/bokeh.glsl"
#endif
uniform int framemod4_DH;
#define DH_TAA_OVERRIDE
#include "/lib/TAA_jitter.glsl"
@ -85,9 +87,8 @@ void main() {
#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;
#if defined TAA && defined DH_TAA_JITTER
gl_Position.xy += offsets[framemod4_DH] * gl_Position.w*texelSize;
#endif
lightmapCoords = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;

View File

@ -44,6 +44,8 @@ uniform float far;
#endif
uniform int framemod4_DH;
#define DH_TAA_OVERRIDE
#include "/lib/TAA_jitter.glsl"
@ -117,8 +119,8 @@ void main() {
#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;
#if defined TAA && defined DH_TAA_JITTER
gl_Position.xy += offsets[framemod4_DH] * gl_Position.w*texelSize;
#endif
#if DOF_QUALITY == 5

View File

@ -47,13 +47,12 @@ uniform sampler2D colortex4;
uniform sampler3D texLpv2;
#endif
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 gbufferModelView;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
uniform vec3 cameraPosition;
// uniform mat4 gbufferProjectionInverse;
// uniform mat4 gbufferModelViewInverse;
// uniform mat4 gbufferModelView;
// uniform mat4 shadowModelView;
// uniform mat4 shadowProjection;
// uniform vec3 cameraPosition;
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
@ -68,6 +67,8 @@ uniform float waterEnteredAltitude;
flat varying float HELD_ITEM_BRIGHTNESS;
uniform mat4 gbufferPreviousModelView;
uniform vec3 previousCameraPosition;
#include "/lib/util.glsl"
@ -96,6 +97,7 @@ flat varying float HELD_ITEM_BRIGHTNESS;
#include "/lib/lpv_render.glsl"
#endif
#include "/lib/projections.glsl"
#include "/lib/diffuse_lighting.glsl"
#include "/lib/sky_gradient.glsl"
@ -105,12 +107,12 @@ vec3 toLinear(vec3 sRGB){
// #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 p3 = p * 2. - 1.;
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
return fragposition.xyz / fragposition.w;
}
// vec3 toScreenSpace(vec3 p) {
// vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
// vec3 p3 = p * 2. - 1.;
// vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
// return fragposition.xyz / fragposition.w;
// }
uniform int framemod8;
@ -284,6 +286,7 @@ void main() {
vec2 adjustedTexCoord = lmtexcoord.xy;
#ifdef POM
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(0.0));
vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition;
vec3 normal = normalMat.xyz;

View File

@ -1,5 +1,7 @@
#include "/lib/settings.glsl"
#undef FLASHLIGHT_BOUNCED_INDIRECT
// #if defined END_SHADER || defined NETHER_SHADER
// #undef IS_LPV_ENABLED
// #endif
@ -33,7 +35,6 @@ uniform vec4 entityColor;
#endif
flat varying float HELD_ITEM_BRIGHTNESS;
#if defined ENTITIES && defined IS_IRIS
flat varying int NAMETAG;
@ -46,6 +47,7 @@ uniform sampler2D depthtex0;
#ifdef DISTANT_HORIZONS
uniform sampler2D dhDepthTex1;
#endif
uniform sampler2D colortex7;
uniform sampler2D colortex12;
uniform sampler2D colortex13;
@ -400,16 +402,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 FragCoord = gl_FragCoord.xyz;
#ifdef HAND
convertHandDepth(FragCoord.z);
#endif
vec2 tempOffset = offsets[framemod8];
vec3 viewPos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0));
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// MATERIAL MASKS ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@ -660,6 +658,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
vec4 flashLightSpecularData = vec4(0.0);
#ifdef FLASHLIGHT
Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), viewToWorld(normalize(normal)), flashLightSpecularData, false);
#endif
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
#if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3
@ -712,7 +715,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif
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, isHand, reflectance);
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, isHand, reflectance, flashLightSpecularData);
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;

View File

@ -91,6 +91,7 @@ uniform mat4 gbufferPreviousModelView;
// uniform vec3 cameraPosition;
uniform vec3 previousCameraPosition;
uniform float updateFadeTime;
// uniform float centerDepthSmooth;
// uniform float far;
uniform float near;
@ -120,6 +121,7 @@ flat varying vec3 WsunVec;
flat varying vec3 unsigned_WsunVec;
flat varying vec3 WmoonVec;
flat varying float exposure;
flat varying vec3 albedoSmooth;
#ifdef IS_LPV_ENABLED
uniform int heldItemId;
@ -152,6 +154,7 @@ float convertHandDepth_2(in float depth, bool hand) {
#include "/lib/Shadow_Params.glsl"
#include "/lib/Shadows.glsl"
#include "/lib/stars.glsl"
#include "/lib/sky_gradient.glsl"
#ifdef OVERWORLD_SHADER
@ -174,31 +177,6 @@ float convertHandDepth_2(in float depth, bool hand) {
#include "/lib/lpv_render.glsl"
#endif
#include "/lib/diffuse_lighting.glsl"
float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near));
}
#include "/lib/sky_gradient.glsl"
vec3 decode (vec2 encn){
vec3 n = vec3(0.0);
encn = encn * 2.0 - 1.0;
n.xy = abs(encn);
n.z = 1.0 - n.x - n.y;
n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn;
return clamp(normalize(n.xyz),-1.0,1.0);
}
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
#include "/lib/end_fog.glsl"
// #define DEFERRED_SPECULAR
#define DEFERRED_ENVIORNMENT_REFLECTION
#define DEFERRED_BACKGROUND_REFLECTION
@ -214,8 +192,29 @@ vec2 decodeVec2(float a){
#endif
#include "/lib/specular.glsl"
#include "/lib/diffuse_lighting.glsl"
#include "/lib/end_fog.glsl"
#include "/lib/DistantHorizons_projections.glsl"
float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near));
}
vec3 decode (vec2 encn){
vec3 n = vec3(0.0);
encn = encn * 2.0 - 1.0;
n.xy = abs(encn);
n.z = 1.0 - n.x - n.y;
n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn;
return clamp(normalize(n.xyz),-1.0,1.0);
}
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
float DH_ld(float dist) {
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
}
@ -405,6 +404,59 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
return vec2(Shadow, SSS / steps);
}
float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise){
float steps = 16.0;
float Shadow = 1.0;
float SSS = 0.0;
// isSSS = true;
float _near = near; float _far = far*4.0;
if (depthCheck) {
_near = dhNearPlane;
_far = dhFarPlane;
}
vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck);
//prevents the ray from going behind the camera
float rayLength = ((viewPos.z + lightDir.z * _far*sqrt(3.)) > -_near) ?
(-_near -viewPos.z) / lightDir.z : _far*sqrt(3.);
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - clipPosition; //convert to clip space
direction.xyz = direction.xyz / max(abs(direction.x)/0.0005, abs(direction.y)/0.0005); //fixed step size
float Stepmult = 6.0;
vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0);
vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise;
for (int i = 0; i < int(steps); i++) {
float samplePos = texture2D(depthtex2, screenPos.xy).x;
#ifdef DISTANT_HORIZONS
if(depthCheck) samplePos = texture2D(dhDepthTex1, screenPos.xy).x;
#endif
if(samplePos < screenPos.z){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
// vec2 linearZ = vec2(swapperlinZ(screenPos.z, _near, _far), swapperlinZ(samplePos, _near, _far));
// float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x;
// if (calcthreshold < 0.035)
Shadow = 0.0;
}
screenPos += rayDir;
}
return Shadow;
}
void Emission(
inout vec3 Lighting,
vec3 Albedo,
@ -605,7 +657,7 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve);//* (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));
scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak
@ -622,8 +674,8 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
float scatterDepth = pow(Scattering,3.5);
scatterDepth = 1-pow(1-scatterDepth,5);
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -1.0 * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));// * pow(Density, LabSSS_Curve);
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve);
#endif
// scatter *= 1.0 + exp(-7.0*(-playerPosNormalized.y*0.5+0.5));
@ -643,8 +695,8 @@ void applyPuddles(
float halfWet = min(wetnessAmount,1.0);
float fullWet = clamp(wetnessAmount - 2.0,0.0,1.0);
// halfWet = 0.0;
// fullWet = 0.0;
// halfWet = 1.0;
// fullWet = 1.0;
float noise = texture2D(noisetex, worldPos.xz * 0.02).b;
@ -678,6 +730,7 @@ void applyPuddles(
// albedo = mix(albedo, vec3(1.0), snow);
}
void main() {
vec3 DEBUG = vec3(1.0);
@ -686,15 +739,18 @@ void main() {
vec2 texcoord = (gl_FragCoord.xy*texelSize);
float noise_2 = R2_dither();
vec2 bnoise = blueNoise(gl_FragCoord.xy ).rg;
// #ifdef TAA
vec2 bnoise = blueNoise(gl_FragCoord.xy).rg;
#ifdef TAA
int seed = (frameCounter*5)%40000;
vec2 r2_sequence = R2_samples(seed).xy;
vec2 BN = fract(r2_sequence + bnoise);
float noise = BN.y;
// #else
// float noise = fract(R2_samples(3).y + bnoise.y);
// #endif
#else
int seed = 600;
#endif
vec2 r2_sequence = R2_samples(seed).xy;
vec2 BN = fract(r2_sequence + bnoise);
float noise = BN.y;
// float z0 = texture2D(depthtex0,texcoord).x;
// float z = texture2D(depthtex1,texcoord).x;
@ -912,7 +968,7 @@ void main() {
if( nightVision > 0.0 ) Absorbtion += exp(-totEpsilon * 25.0) * nightVision;
// apply caustics to the lighting, and make sure they dont look weird
DirectLightColor *= mix(1.0, waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS + 0.25, clamp(estimatedDepth,0,1));
DirectLightColor *= mix(1.0, waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS, clamp(estimatedDepth,0,1));
}
@ -1133,6 +1189,17 @@ void main() {
vec3 blockLightColor = doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
Indirect_lighting += blockLightColor;
vec4 flashLightSpecularData = vec4(0.0);
#ifdef FLASHLIGHT
vec3 newViewPos = viewPos;
float flashlightshadows = SSRT_FlashLight_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, newViewPos, interleaved_gradientNoise_temporal());
Indirect_lighting += calculateFlashlight(texcoord, viewPos, albedoSmooth, slopednormal, flashLightSpecularData, hand);
#endif
/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// EFFECTS FOR INDIRECT /////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
@ -1247,7 +1314,7 @@ void main() {
vec3 specularNormal = slopednormal;
if (dot(slopednormal, (feetPlayerPos_normalized)) > 0.0) specularNormal = FlatNormals;
FINAL_COLOR = specularReflections(viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, specularNormal, SpecularTex.r, SpecularTex.g, albedo, FINAL_COLOR, shadowColor, lightmap.y, hand, isWater || (!isWater && isEyeInWater == 1));
FINAL_COLOR = specularReflections(viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, specularNormal, SpecularTex.r, SpecularTex.g, albedo, FINAL_COLOR, shadowColor, lightmap.y, hand, isWater || (!isWater && isEyeInWater == 1), flashLightSpecularData);
#endif
gl_FragData[0].rgb = FINAL_COLOR;
@ -1318,6 +1385,7 @@ void main() {
}
////// DEBUG VIEW STUFF
#if DEBUG_VIEW == debug_SHADOWMAP
gl_FragData[0].rgb = vec3(1.0) * (Shadows * 0.9 + 0.1);

View File

@ -17,6 +17,7 @@ flat varying vec3 unsigned_WsunVec;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 moonCol;
flat varying vec3 albedoSmooth;
flat varying float exposure;
@ -58,6 +59,10 @@ void main() {
moonCol = texelFetch2D(colortex4,ivec2(9,37),0).rgb;
#if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT
albedoSmooth = texelFetch2D(colortex4,ivec2(15.5,2.5),0).rgb;
#endif
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);

View File

@ -13,7 +13,6 @@ uniform sampler2D noisetex;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
// const bool colortex4MipmapEnabled = true;
#ifdef DISTANT_HORIZONS
uniform sampler2D dhDepthTex;
uniform sampler2D dhDepthTex1;
@ -80,19 +79,21 @@ uniform float caveDetection;
uniform float eyeAltitude;
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
float ld(float depth) {
return 1.0 / (zMults.y - depth * zMults.z); // (-depth * (far - near)) = (2.0 * near)/ld - far - near
}
float luma(vec3 color) {
return dot(color,vec3(0.21, 0.72, 0.07));
}
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 playerPos = p * 2. - 1.;
@ -102,7 +103,6 @@ vec3 toScreenSpace(vec3 p) {
#include "/lib/DistantHorizons_projections.glsl"
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);
@ -110,11 +110,13 @@ float interleaved_gradientNoise_temporal(){
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(){
vec2 coord = gl_FragCoord.xy ;
@ -125,6 +127,7 @@ float R2_dither(){
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);
@ -132,9 +135,11 @@ float blueNoise(){
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));
}
@ -142,67 +147,20 @@ vec3 normVec (vec3 vec){
float DH_ld(float dist) {
return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
}
float DH_inv_ld (float lindepth){
return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
}
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
return (near * far) / (depth * (near - far) + far);
}
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
vec4 BilateralUpscale(sampler2D tex, sampler2D tex2, sampler2D depth, vec2 coord, float referenceDepth, inout float CLOUDALPHA){
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 < 5; 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;
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
CLOUDALPHA += texelFetch2D(tex2, posColor + radius + pos, 0).x * EDGES;
#endif
SUM += EDGES;
}
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
CLOUDALPHA = CLOUDALPHA / SUM;
#endif
return RESULT / SUM;
}
vec3 decode (vec2 encn){
vec3 n = vec3(0.0);
@ -213,12 +171,12 @@ vec3 decode (vec2 encn){
return clamp(normalize(n.xyz),-1.0,1.0);
}
vec3 worldToView(vec3 worldPos) {
vec4 pos = vec4(worldPos, 0.0);
pos = gbufferModelView * pos;
return pos.xyz;
}
vec3 viewToWorld(vec3 viewPosition) {
vec4 pos;
pos.xyz = viewPosition;
@ -227,28 +185,6 @@ vec3 viewToWorld(vec3 viewPosition) {
return pos.xyz;
}
/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595
void applyContrast(inout vec3 color, float contrast){
color = ((color - 0.5) * max(contrast, 0.0)) + 0.5;
}
void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardistance, bool isTranslucentEntity){
vec2 UnalteredTexcoord = Texcoord;
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 * 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(texelFetch2D(colortex11,ivec2(Texcoord/texelSize),0).b).g;
// float DistortedAlpha = texelFetch2D(colortex2,ivec2(Texcoord/texelSize),0).a;
Texcoord = mix(Texcoord, UnalteredTexcoord, min(max(0.1-DistortedAlpha,0.0) * 1000.0,1.0)); // remove distortion on non-translucents
}
vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance, bool isReflectiveEntity){
// make the tangent space normals match the directions of the texcoord UV, this greatly improves the refraction effect.
@ -376,12 +312,6 @@ vec3 toScreenSpace_DH_special(vec3 POS, bool depthCheck ) {
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 ;
@ -494,7 +424,6 @@ void main() {
if(albedo.a < 0.01) tangentNormals = vec2(0.0);
////// --------------- UNPACK MISC --------------- //////
// 1.0 = water mask
// 0.9 = entity mask
@ -509,26 +438,19 @@ void main() {
////// --------------- get volumetrics
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
float cloudAlpha = 0.0;
#else
float cloudAlpha = 1.0;
#endif
float DEBUG = 0.0;
vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, z >= 1.0,DEBUG);
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;
// temporallyFilteredVL = texture2D(colortex0, texcoord*VL_RENDER_RESOLUTION);
float bloomyFogMult = 1.0;
////// --------------- distort texcoords as a refraction effect
@ -648,8 +570,6 @@ void main() {
color += temporallyFilteredVL.rgb ;
#endif
// color.rgb = vec3(nameTagMask);
////// --------------- VARIOUS FOG EFFECTS (in front of volumetric fog)
//////////// blindness, nightvision, liquid fogs and misc fogs
@ -679,23 +599,22 @@ void main() {
////// --------------- FINALIZE
#ifdef display_LUT
// if(hideGUI == 0){
vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/150),0).rgb /1200.0;
float zoomLevel = 1.0;
vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/zoomLevel),0).rgb /1200.0;
if(luma(thingy) > 0.0){
color.rgb = thingy;
// // vl.a = 1.0;
bloomyFogMult = 1.0;
}
// }
#if defined OVERWORLD_SHADER
#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
// color.rgb = vec3(DEBUG);
// color.rgb = testThing.rgb;
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);

View File

@ -25,6 +25,17 @@ flat varying float centerDepth;
uniform sampler2D noisetex;
uniform sampler2D colortex1;
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
uniform float frameTime;
uniform int frameCounter;
uniform float frameTimeCounter;
@ -42,6 +53,7 @@ uniform mat4 shadowModelViewI;
uniform mat4 shadowProjection;
uniform float sunElevation;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform vec3 cameraPosition;
// uniform float far;
uniform ivec2 eyeBrightnessSmooth;
@ -254,15 +266,29 @@ float mixhistory = 0.06;
#else
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(lightSourceColor,1.0);
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(sunColor,1.0);
if (gl_FragCoord.x > 9. && gl_FragCoord.x < 10. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(moonColor,1.0);
// if (gl_FragCoord.x > 16. && gl_FragCoord.x < 17. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
// gl_FragData[0] = vec4(rayleighAborbance,1.0);
#endif
#if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT
// sample center pixel of albedo color, and interpolate it overtime.
if (gl_FragCoord.x > 15 && gl_FragCoord.x < 16 && gl_FragCoord.y > 2 && gl_FragCoord.y < 3){
mixhistory = 0.01;
vec3 data = texelFetch2D(colortex1, ivec2(0.5/texelSize), 0).rgb;
vec3 decodeAlbedo = vec3(decodeVec2(data.x).x,decodeVec2(data.y).x, decodeVec2(data.z).x);
vec3 albedo = toLinear(decodeAlbedo);
albedo = normalize(albedo + 1e-7) * (dot(albedo,vec3(0.21, 0.72, 0.07))*0.5+0.5);
gl_FragData[0] = vec4(albedo,1.0);
}
#endif
////////////////////////////////
/// --- ATMOSPHERE IMAGE --- ///
////////////////////////////////
@ -301,7 +327,12 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
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 );
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition + gbufferModelViewInverse[3].xyz);// * ( float(sunElevation > 1e-5)*2.0-1.0 );
vec3 WmoonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition + gbufferModelViewInverse[3].xyz);// * ( );
if(dot(-WmoonVec, WsunVec) < 0.9999) WmoonVec = -WmoonVec;
WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0-1.0 ,0,1));
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
sky = mix(averageSkyCol_Clouds * AmbientLightTint * 0.25, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0));

View File

@ -48,6 +48,9 @@ uniform ivec2 eyeBrightnessSmooth;
uniform float eyeAltitude;
uniform float caveDetection;
uniform mat4 gbufferPreviousModelView;
uniform vec3 previousCameraPosition;
#define DHVLFOG
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
@ -440,7 +443,7 @@ void main() {
indirectLightColor_dynamic += MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision*0.02;
indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) ;
indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * TORCH_AMOUNT;
vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0);

View File

@ -1,31 +1,12 @@
// swap out jitter pattern to be a 4 frame pattern instead of an 8 frame halton sequence
#ifdef RESPONSIVE_TAA
#if defined RESPONSIVE_TAA || defined DH_TAA_OVERRIDE
const vec2[4] offsets = vec2[4](
// vec2( 0.0, -1.0),
// vec2( 1.0, 0.0),
// vec2( 0.0, 1.0),
// vec2(-1.0, 0.0)
// vec2(-1.0, -7.0)/8.0,
// vec2( 7.0, -1.0)/8.0,
// vec2( 1.0, 7.0)/8.0,
// vec2(-7.0, 1.0)/8.0
vec2(-0.125, -0.875),
vec2( 0.875, -0.125),
vec2( 0.125, 0.875),
vec2(-0.875, 0.125)
// vec2(-7.0, 1.0)/8.0,
// vec2( 7.0, -1.0)/8.0,
// vec2( 1.0, 7.0)/8.0,
// vec2(-1.0, -7.0)/8.0
);
#else
const vec2[8] offsets = vec2[8](
vec2( 1.0, -3.0)/8.0,
vec2(-1.0, 3.0)/8.0,
@ -36,5 +17,4 @@
vec2( 3.0, 7.0)/8.0,
vec2( 7.0, 7.0)/8.0
);
#endif

View File

@ -87,3 +87,47 @@ vec3 doIndirectLighting(
return indirectLight;
}
uniform float centerDepthSmooth;
vec3 calculateFlashlight(in vec2 texcoord, in vec3 viewPos, in vec3 albedo, in vec3 normal, out vec4 flashLightSpecularData, bool hand){
vec3 shiftedViewPos = viewPos + vec3(-0.25, 0.2, 0.0);
vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos; + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition) * 3.0;
shiftedViewPos = mat3(gbufferPreviousModelView) * shiftedPlayerPos + gbufferPreviousModelView[3].xyz;
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7);
float linearDistance = length(shiftedPlayerPos);
float shiftedLinearDistance = length(scaledViewPos);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-10.0 * lightFalloff),0.0);
#if defined FLASHLIGHT_SPECULAR && (defined DEFERRED_SPECULAR || defined FORWARD_SPECULAR)
float flashLightSpecular = lightFalloff * exp2(-7.0*shiftedLinearDistance*shiftedLinearDistance);
flashLightSpecularData = vec4(normalize(shiftedPlayerPos), flashLightSpecular);
#endif
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
float lenseDirt = texture2D(noisetex, scaledViewPos * 0.2 + 0.1).b;
float lenseShape = (pow(abs(pow(abs(projectedCircle-1.0),2.0)*2.0 - 0.5),2.0) + lenseDirt*0.2) * 10.0;
float offsetNdotL = clamp(dot(-normal, normalize(shiftedPlayerPos)),0,1);
vec3 flashlightDiffuse = vec3(1.0) * lightFalloff * offsetNdotL * pow(1.0-pow(1.0-projectedCircle,2),2) * lenseShape;
if(hand){
flashlightDiffuse = vec3(0.0);
flashLightSpecularData = vec4(0.0);
}
#ifdef FLASHLIGHT_BOUNCED_INDIRECT
float lightWidth = 1.0+linearDistance*3.0;
vec3 pointPos = mat3(gbufferModelViewInverse) * (toScreenSpace(vec3(texcoord, centerDepthSmooth)) + vec3(-0.25, 0.2, 0.0));
float flashLightHitPoint = distance(pointPos, shiftedPlayerPos);
float indirectFlashLight = exp(-10.0 * (1.0 - clamp(1.0-length(shiftedViewPos.xy)/lightWidth,0.0,1.0)) );
indirectFlashLight *= pow(clamp(1.0-flashLightHitPoint/lightWidth,0,1),2.0);
flashlightDiffuse += albedo/150.0 * indirectFlashLight * lightFalloff;
#endif
return flashlightDiffuse * vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B);
}

View File

@ -299,38 +299,21 @@ vec4 GetVolumetricFog(
color += (hazeLighting - hazeLighting*exp(-hazeDensity*dd*dL)) * absorbance;
// // determine where the vortex area ends and chaotic lightning area begins.
// float vortexBounds = clamp(vortexBoundRange - length(progressW), 0.0,1.0);
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION
vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7);
float linearDistance = length(shiftedPlayerPos);
float shiftedLinearDistance = length(scaledViewPos);
// vec3 lightPosition = LightSourcePosition(progressW, cameraPosition, vortexBounds);
// vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-30.0 * lightFalloff),0.0);
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
// volumeDensity += max(1.0 - length(vec3(lightPosition.x,lightPosition.y*2,lightPosition.z))/50,0.0) * vortexBounds;
vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5;
// float clearArea = 1.0-min(max(1.0 - length(progressW - cameraPosition) / 100,0.0),1.0);
// float density = min(volumeDensity * clearArea, END_STORM_DENSTIY);
// ///// ----- air lighting, the haze
// float distanceFog = max(1.0 - length(progressW - cameraPosition) / max(far, 32.0 * 13.0),0.0);
// float hazeDensity = min(exp2(distanceFog * -25)+0.0005,1.0);
// vec3 hazeColor = vec3(0.3,0.75,1.0) * 0.3;
// color += (hazeColor - hazeColor*exp(-hazeDensity*dd*dL)) * absorbance;
// ///// ----- main lighting
// vec3 voidLighting = vec3(1.0,0.0,0.8) * 0.1 * (1-exp(volumeDensity * -25)) * max(exp2(-1 * sqrt(max(progressW.y - -60,0.0))),0.0) ;
// vec3 ambient = vec3(0.5,0.75,1.0) * 0.2 * (exp((volumeDensity*volumeDensity) * -50) * 0.9 + 0.1);
// float shadows = 0;
// vec3 lightsources = LightSourceLighting(progressW, lightPosition, dither2, volumeDensity, lightColors, vortexBounds);
// vec3 lighting = lightsources + ambient + voidLighting;
// #ifdef THE_ORB
// density += min(50.0*max(1.0 - length(lightPosition)/10,0.0),1.0);
// #endif
// ///// ----- blend
// color += (lighting - lighting*exp(-(density)*dd*dL)) * absorbance;
// absorbance *= exp(-max(density,hazeDensity)*dd*dL);
color += (flashlightGlow - flashlightGlow * exp(-max(stormDensity,0.005)*dd*dL)) * absorbance;
#endif
//------ LPV FOG EFFECT
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT

View File

@ -103,6 +103,22 @@ vec4 GetVolumetricFog(
color += (ceilingSmoke - ceilingSmoke*ceilingSmokeVolumeCoeff) * (absorbance*0.5+0.5);
absorbance *= ceilingSmokeVolumeCoeff;
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION
vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7);
float linearDistance = length(shiftedPlayerPos);
float shiftedLinearDistance = length(scaledViewPos);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-30.0 * lightFalloff),0.0);
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5;
color += (flashlightGlow - flashlightGlow * exp(-max(plumeDensity,0.005)*dd*dL)) * absorbance;
#endif
//------ LPV FOG EFFECT
#if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT
color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * TorchBrightness_autoAdjust * absorbance;

View File

@ -231,6 +231,22 @@ vec4 GetVolumetricFog(
color += (lighting - lighting * fogVolumeCoeff) * totalAbsorbance;
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION
vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7);
float linearDistance = length(shiftedPlayerPos);
float shiftedLinearDistance = length(scaledViewPos);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-30.0 * lightFalloff),0.0);
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5;
color += (flashlightGlow - flashlightGlow * exp(-max(fogDensity,0.005)*dd*dL)) * totalAbsorbance;
#endif
// kill fog absorbance when in caves.
totalAbsorbance *= mix(1.0, fogVolumeCoeff, lightLevelZero);
//------------------------------------
@ -261,7 +277,6 @@ vec4 GetVolumetricFog(
atmosphereAbsorbance *= atmosphereVolumeCoeff*fogVolumeCoeff;
//------------------------------------
//------ LPV FOG EFFECT
//------------------------------------

View File

@ -618,6 +618,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#ifdef IS_IRIS
#define DAMAGE_TAKEN_EFFECT
#define LOW_HEALTH_EFFECT
#define LOW_HEALTH_EFFECT_START 6.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]
#define CRITICALLY_LOW_HEALTH_EFFECT_START 2.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]
#endif
#define WATER_ON_CAMERA_EFFECT
@ -630,6 +632,33 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#ifdef WATER_ON_CAMERA_EFFECT
#endif
// #define FLASHLIGHT
#define FLASHLIGHT_SPECULAR
#define FLASHLIGHT_BOUNCED_INDIRECT
// #define FLASHLIGHT_FOG_ILLUMINATION
#define FLASHLIGHT_RANGE 32 // [ 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 FLASHLIGHT_SIZE 2.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 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0]
#define FLASHLIGHT_R 1.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 FLASHLIGHT_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 1.0]
#define FLASHLIGHT_B 0.8 // [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]
#ifdef FLASHLIGHT
#endif
#ifdef FLASHLIGHT_SPECULAR
#endif
#ifdef FLASHLIGHT_BOUNCED_INDIRECT
#endif
#ifdef FLASHLIGHT_FOG_ILLUMINATION
#endif
#if !defined FLASHLIGHT
#undef FLASHLIGHT_SPECULAR
#endif
#if defined FLASHLIGHT
#undef Hand_Held_lights
#endif
/////////////////////////////////////////
@ -740,6 +769,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define DH_SUBSURFACE_SCATTERING
#define DH_SCREENSPACE_REFLECTIONS
#define DH_NOISE_TEXTURE
#define DH_TAA_JITTER
///////////////////////////////////////////
// ----- FLOODFILL [LPV] SETTINGS ----- //
@ -792,6 +822,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#undef TAA
#endif
// fix settings
#ifdef DH_TAA_JITTER
#endif
#ifdef DH_SCREENSPACE_REFLECTIONS
#endif
#ifdef DH_SUBSURFACE_SCATTERING

View File

@ -288,6 +288,9 @@ vec3 specularReflections(
#else
, bool isWater
#endif
,in vec4 flashLight_stuff
){
#ifdef FORWARD_RENDERED_SPECULAR
lightmap = pow(min(max(lightmap-0.6,0.0)*2.5,1.0),2.0);
@ -316,7 +319,7 @@ vec3 specularReflections(
// get reflectance and f0/HCM values
// float shlickFresnel = pow(clamp(1.0 + dot(-reflectedVector, samplePoints),0.0,1.0),5.0);
if(isHand) reflectedVector_L = reflect(playerPos, normal);
reflectedVector_L = isHand ? reflect(playerPos, normal) : reflectedVector_L;
#else
vec3 reflectedVector_L = reflect(playerPos, normal);
#endif
@ -389,5 +392,10 @@ vec3 specularReflections(
specularReflections += lightSourceReflection;
#endif
#if defined FLASHLIGHT_SPECULAR
vec3 flashLightReflection = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * flashLight_stuff.a * GGX(normal, -flashLight_stuff.xyz, -flashLight_stuff.xyz, roughness, reflectance, metalAlbedoTint);
specularReflections += flashLightReflection;
#endif
return specularReflections;
}

File diff suppressed because one or more lines are too long