mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-26 10:12:54 +08:00
improve water waves and underwater fog colors. add support for viveCraft hand with the flashlight/handheld light (more vivecraft support is planned for the future). tweak time of day fog labels. clean a little code.
This commit is contained in:
@ -130,7 +130,7 @@ vec4 applyNoise(in vec4 fragColor, const in vec3 viewPos, const in float viewDis
|
||||
// ideally, close = higher steps and far = lower steps
|
||||
float highestSteps = NOISE_RESOLUTION;
|
||||
float lowestSteps = 2.0;
|
||||
float transitionLength = 16.0 * 8.0; // distance it takes to reach the lowest steps from the highest. measured in meters/blocks.
|
||||
float transitionLength = 16.0 * 16.0; // distance it takes to reach the lowest steps from the highest. measured in meters/blocks.
|
||||
|
||||
float transitionGradient = clamp((length(viewPos - cameraPosition) - (far+32.0)) / transitionLength,0.0,1.0);
|
||||
transitionGradient = sqrt(transitionGradient);// make the gradient appear smoother and less sudden when approaching low steps.
|
||||
|
@ -300,7 +300,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
vec3 bump = normalize(getWaveNormal(waterPos, playerPos, true));
|
||||
|
||||
float bumpmult = 10.0 * WATER_WAVE_STRENGTH;
|
||||
float bumpmult = WATER_WAVE_STRENGTH;
|
||||
|
||||
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
varying vec4 lmtexcoord;
|
||||
varying vec4 color;
|
||||
flat varying float exposure;
|
||||
|
||||
#ifdef LINES
|
||||
flat varying int SELECTION_BOX;
|
||||
@ -460,7 +459,7 @@ void main() {
|
||||
const vec3 lpvPos = vec3(0.0);
|
||||
#endif
|
||||
|
||||
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
|
||||
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, feetPlayerPos, lpvPos);
|
||||
|
||||
#ifdef LINES
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb);
|
||||
|
@ -78,6 +78,13 @@ uniform float rainStrength;
|
||||
uniform sampler2D noisetex;//depth
|
||||
uniform sampler2D depthtex0;
|
||||
|
||||
#if defined VIVECRAFT
|
||||
uniform bool vivecraftIsVR;
|
||||
uniform vec3 vivecraftRelativeMainHandPos;
|
||||
uniform vec3 vivecraftRelativeOffHandPos;
|
||||
uniform mat4 vivecraftRelativeMainHandRot;
|
||||
uniform mat4 vivecraftRelativeOffHandRot;
|
||||
#endif
|
||||
|
||||
uniform vec4 entityColor;
|
||||
|
||||
@ -350,13 +357,22 @@ void main() {
|
||||
vec3 playerCamPos = cameraPosition;
|
||||
#endif
|
||||
|
||||
#ifdef VIVECRAFT
|
||||
if (vivecraftIsVR) {
|
||||
playerCamPos = cameraPosition - vivecraftRelativeMainHandPos;
|
||||
}
|
||||
#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){
|
||||
float pointLight = clamp(1.0-length(worldpos-playerCamPos)/HANDHELD_LIGHT_RANGE,0.0,1.0);
|
||||
torchlightmap = mix(torchlightmap, HELD_ITEM_BRIGHTNESS, pointLight*pointLight);
|
||||
|
||||
float pointLight = 1-clamp(1.0-length(worldpos-playerCamPos)/HANDHELD_LIGHT_RANGE,-0.999,1.0);
|
||||
|
||||
torchlightmap = mix(torchlightmap, HELD_ITEM_BRIGHTNESS, pointLight);
|
||||
}
|
||||
|
||||
#ifdef HAND
|
||||
torchlightmap *= 0.9;
|
||||
// torchlightmap *= 0.9;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -428,6 +444,7 @@ void main() {
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
float textureLOD = bias();
|
||||
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD) * color;
|
||||
|
||||
#if defined HAND
|
||||
if (Albedo.a < 0.1) discard;
|
||||
#endif
|
||||
|
@ -75,10 +75,6 @@ varying vec3 flatnormal;
|
||||
varying vec3 shitnormal;
|
||||
#endif
|
||||
|
||||
|
||||
flat varying float exposure;
|
||||
|
||||
|
||||
uniform vec3 sunVec;
|
||||
uniform float near;
|
||||
// uniform float far;
|
||||
@ -150,6 +146,7 @@ uniform float waterEnteredAltitude;
|
||||
#define FORWARD_BACKGROUND_REFLECTION
|
||||
#define FORWARD_ROUGH_REFLECTION
|
||||
|
||||
|
||||
#ifdef FORWARD_SPECULAR
|
||||
#endif
|
||||
#ifdef FORWARD_ENVIORNMENT_REFLECTION
|
||||
@ -200,14 +197,16 @@ float blueNoise(){
|
||||
varying vec3 viewVector;
|
||||
vec3 getParallaxDisplacement(vec3 waterPos, vec3 playerPos) {
|
||||
|
||||
float waterHeight = getWaterHeightmap(waterPos.xy) ;
|
||||
waterHeight = exp(-20*sqrt(waterHeight));
|
||||
// waterHeight *= 5.0;
|
||||
float largeWaves = texture2D(noisetex, waterPos.xy / 600.0 ).b;
|
||||
float largeWavesCurved = pow(1.0-pow(1.0-largeWaves,2.5),4.5);
|
||||
|
||||
float waterHeight = getWaterHeightmap(waterPos.xy, largeWaves, largeWavesCurved);
|
||||
// waterHeight = exp(-20.0*sqrt(waterHeight));
|
||||
waterHeight = exp(-7.0*exp(-7.0*waterHeight)) * 0.25;
|
||||
|
||||
vec3 parallaxPos = waterPos;
|
||||
|
||||
parallaxPos.xy += (viewVector.xy / -viewVector.z) * waterHeight;
|
||||
// parallaxPos.xz -= (viewVector.xy / viewVector.z) * waterHeight;
|
||||
|
||||
return parallaxPos;
|
||||
}
|
||||
@ -375,14 +374,13 @@ void convertHandDepth(inout float depth) {
|
||||
ndcDepth /= MC_HAND_DEPTH;
|
||||
depth = ndcDepth * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
void Emission(
|
||||
inout vec3 Lighting,
|
||||
vec3 Albedo,
|
||||
float Emission,
|
||||
float exposure
|
||||
float Emission
|
||||
){
|
||||
// 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 * 5.0 * Emissive_Brightness, 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));
|
||||
}
|
||||
|
||||
uniform vec3 eyePosition;
|
||||
@ -406,7 +404,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
vec3 viewPos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0));
|
||||
|
||||
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// MATERIAL MASKS ////////////////////////////////
|
||||
@ -438,8 +435,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
float UnchangedAlpha = gl_FragData[0].a;
|
||||
|
||||
// gl_FragData[0].a = pow(gl_FragData[0].a,3);
|
||||
|
||||
#ifdef WhiteWorld
|
||||
gl_FragData[0].rgb = vec3(0.5);
|
||||
gl_FragData[0].a = 1.0;
|
||||
@ -502,18 +497,15 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
vec3 flowDir = normalize(worldSpaceNormal*10.0) * frameTimeCounter * 2.0 * WATER_WAVE_SPEED;
|
||||
|
||||
vec2 newPos = playerPos.xy + cameraPosition.xy + abs(flowDir.xz);
|
||||
newPos = mix(newPos, playerPos.zy + cameraPosition.zy + abs(flowDir.zx), clamp(abs(worldSpaceNormal.x),0,1));
|
||||
newPos = mix(newPos, playerPos.xz + cameraPosition.xz, clamp(abs(worldSpaceNormal.y),0,1));
|
||||
newPos = mix(newPos, playerPos.zy + cameraPosition.zy + abs(flowDir.zx), clamp(abs(worldSpaceNormal.x),0.0,1.0));
|
||||
newPos = mix(newPos, playerPos.xz + cameraPosition.xz, clamp(abs(worldSpaceNormal.y),0.0,1.0));
|
||||
waterPos.xy = newPos;
|
||||
|
||||
// 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 + normalize(worldSpaceNormal.xz*10.0) * frameTimeCounter * 3.0 * WATER_WAVE_SPEED;
|
||||
|
||||
waterPos.xyz = getParallaxDisplacement(waterPos, playerPos);
|
||||
|
||||
vec3 bump = normalize(getWaveNormal(waterPos, playerPos, false));
|
||||
|
||||
float bumpmult = 10.0 * WATER_WAVE_STRENGTH;
|
||||
float bumpmult = WATER_WAVE_STRENGTH;
|
||||
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
|
||||
|
||||
NormalTex.xyz = bump;
|
||||
@ -656,7 +648,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
const vec3 lpvPos = vec3(0.0);
|
||||
#endif
|
||||
|
||||
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
|
||||
Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, feetPlayerPos, lpvPos);
|
||||
|
||||
vec4 flashLightSpecularData = vec4(0.0);
|
||||
#ifdef FLASHLIGHT
|
||||
@ -666,7 +658,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||
|
||||
#if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3
|
||||
Emission(FinalColor, Albedo, SpecularTex.b, exposure);
|
||||
Emission(FinalColor, Albedo, SpecularTex.b);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -18,7 +18,6 @@ varying vec4 color;
|
||||
|
||||
uniform sampler2D colortex4;
|
||||
uniform sampler2D noisetex;
|
||||
flat varying float exposure;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
@ -200,7 +199,6 @@ void main() {
|
||||
|
||||
|
||||
color = vec4(gl_Color.rgb, 1.0);
|
||||
exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
|
@ -460,12 +460,9 @@ float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, floa
|
||||
void Emission(
|
||||
inout vec3 Lighting,
|
||||
vec3 Albedo,
|
||||
float Emission,
|
||||
float exposure
|
||||
float Emission
|
||||
){
|
||||
// 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 * 5.0 * Emissive_Brightness, pow(Emission, Emissive_Curve)); // old method.... idk why
|
||||
// if( Emission < 254.5/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve);
|
||||
if( Emission < 254.5/255.0) Lighting = mix(Lighting, Albedo * 5.0 * Emissive_Brightness, pow(Emission, Emissive_Curve));
|
||||
}
|
||||
|
||||
#include "/lib/indirect_lighting_effects.glsl"
|
||||
@ -940,6 +937,7 @@ void main() {
|
||||
#else
|
||||
float minimumAbsorbance = (1.0 - lightLeakFix);
|
||||
#endif
|
||||
|
||||
Absorbtion = exp(-totEpsilon * max(Vdiff, minimumAbsorbance));
|
||||
|
||||
|
||||
@ -1186,7 +1184,7 @@ void main() {
|
||||
#else
|
||||
const vec3 lpvPos = vec3(0.0);
|
||||
#endif
|
||||
vec3 blockLightColor = doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos);
|
||||
vec3 blockLightColor = doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, feetPlayerPos, lpvPos);
|
||||
Indirect_lighting += blockLightColor;
|
||||
|
||||
vec4 flashLightSpecularData = vec4(0.0);
|
||||
@ -1305,7 +1303,7 @@ void main() {
|
||||
|
||||
vec3 FINAL_COLOR = (Indirect_lighting + Direct_lighting) * albedo;
|
||||
|
||||
Emission(FINAL_COLOR, albedo, SpecularTex.a, exposure);
|
||||
Emission(FINAL_COLOR, albedo, SpecularTex.a);
|
||||
|
||||
if(lightningBolt) FINAL_COLOR = vec3(77.0, 153.0, 255.0);
|
||||
|
||||
|
@ -33,15 +33,17 @@ uniform float near;
|
||||
uniform float dhFarPlane;
|
||||
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;
|
||||
|
||||
#if defined VIVECRAFT
|
||||
uniform bool vivecraftIsVR;
|
||||
uniform vec3 vivecraftRelativeMainHandPos;
|
||||
uniform vec3 vivecraftRelativeOffHandPos;
|
||||
uniform mat4 vivecraftRelativeMainHandRot;
|
||||
uniform mat4 vivecraftRelativeOffHandRot;
|
||||
#endif
|
||||
|
||||
uniform int frameCounter;
|
||||
uniform float frameTimeCounter;
|
||||
|
||||
@ -276,16 +278,6 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
vec3 absorbance = vec3(1.0);
|
||||
vec3 vL = vec3(0.0);
|
||||
|
||||
// float distanceFromWaterSurface = -(normalize(dVWorld).y + (cameraPosition.y - waterEnteredAltitude)/(waterEnteredAltitude/2)) * 0.5 + 0.5;
|
||||
// distanceFromWaterSurface = clamp(distanceFromWaterSurface, 0.0,1.0);
|
||||
// distanceFromWaterSurface = exp(-7.0*distanceFromWaterSurface*distanceFromWaterSurface);
|
||||
|
||||
// float distanceFromWaterSurface2 = normalize(dVWorld).y + (cameraPosition.y - waterEnteredAltitude)/waterEnteredAltitude;
|
||||
// distanceFromWaterSurface2 = clamp(-distanceFromWaterSurface2,0.0,1.0);
|
||||
|
||||
// distanceFromWaterSurface2 = exp(-7*pow(distanceFromWaterSurface2,1.5));
|
||||
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float lowlightlevel = clamp(eyeBrightnessSmooth.y/240.0,0.1,1.0);
|
||||
float phase = fogPhase(VdotL) * 5.0;
|
||||
@ -294,6 +286,18 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
float phase = 0.0;
|
||||
#endif
|
||||
|
||||
// float thing = -normalize(dVWorld + (cameraPosition - vec3(cameraPosition.x, waterEnteredAltitude-1.0,cameraPosition.z))).y;
|
||||
float thing = -normalize(dVWorld).y;
|
||||
thing = clamp(thing + 0.333,0.0,1.0);
|
||||
thing = pow(1.0-pow(1.0-thing,2.0),2.0);
|
||||
|
||||
// thing = 1.0;
|
||||
|
||||
// thing = max(exp(-3.0*exp(-3.0*thing)),0.0);
|
||||
thing *= 15.0;
|
||||
|
||||
thing = 0.0;
|
||||
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<spCount;i++) {
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
|
||||
@ -344,7 +348,7 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
|
||||
|
||||
vec3 sunAbsorbance = exp(-waterCoefs * (distanceFromWaterSurface/abs(WsunVec.y)));
|
||||
vec3 WaterAbsorbance = exp(-waterCoefs * distanceFromWaterSurface);
|
||||
vec3 WaterAbsorbance = exp(-waterCoefs * (distanceFromWaterSurface + thing));
|
||||
|
||||
vec3 Directlight = lightSource * sh * phase * caustics * sunAbsorbance;
|
||||
vec3 Indirectlight = ambient * WaterAbsorbance;
|
||||
|
@ -549,7 +549,7 @@ void main() {
|
||||
vec3 transmittance = exp(-totEpsilon * linearDistance);
|
||||
color.rgb *= transmittance;
|
||||
|
||||
vec3 transmittance2 = exp(-totEpsilon * 25.0);
|
||||
vec3 transmittance2 = exp(-totEpsilon * 50.0);
|
||||
float fogfade = 1.0 - max((1.0 - linearDistance / min(far, 16.0*7.0) ),0);
|
||||
color.rgb += (transmittance2 * scatterCoef) * fogfade;
|
||||
|
||||
|
@ -99,6 +99,7 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
vec4 dailyWeatherParams1 = vec4(CloudLayer0_density, CloudLayer1_density, CloudLayer2_density, 0.0);
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
#define TIMEOFDAYFOG
|
||||
#include "/lib/lightning_stuff.glsl"
|
||||
@ -128,7 +129,6 @@ uniform sampler2D colortex4;
|
||||
#include "/lib/end_fog.glsl"
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
|
||||
|
||||
|
@ -173,10 +173,10 @@ screen.Fog = Fog Settings
|
||||
option.Noon_Uniform_Fog = Noon Fog Density
|
||||
option.Evening_Uniform_Fog = Evening Fog Density
|
||||
option.Night_Uniform_Fog = Night Fog Density
|
||||
option.Morning_Cloudy_Fog = Cloudy Morning Fog Density
|
||||
option.Noon_Cloudy_Fog = Cloudy Noon Fog Density
|
||||
option.Evening_Cloudy_Fog = Cloudy Evening Fog Density
|
||||
option.Night_Cloudy_Fog = Cloudy Night Fog Density
|
||||
option.Morning_Cloudy_Fog = Morning Cloudy Fog Density
|
||||
option.Noon_Cloudy_Fog = Noon Cloudy Fog Density
|
||||
option.Evening_Cloudy_Fog = Evening Cloudy Fog Density
|
||||
option.Night_Cloudy_Fog = Night Cloudy Fog Density
|
||||
|
||||
option.PER_BIOME_ENVIRONMENT = Per Biome Environments
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// swap out jitter pattern to be a 4 frame pattern instead of an 8 frame halton sequence
|
||||
#if defined RESPONSIVE_TAA || defined DH_TAA_OVERRIDE
|
||||
#if (defined RESPONSIVE_TAA || defined DH_TAA_OVERRIDE) && !defined TAA_UPSCALING
|
||||
const vec2[4] offsets = vec2[4](
|
||||
vec2(-0.125, -0.875),
|
||||
vec2( 0.875, -0.125),
|
||||
|
@ -22,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
vec3 doBlockLightLighting(
|
||||
vec3 lightColor, float lightmap, float exposureValue,
|
||||
vec3 lightColor, float lightmap,
|
||||
vec3 playerPos, vec3 lpvPos
|
||||
){
|
||||
lightmap = clamp(lightmap,0.0,1.0);
|
||||
@ -65,10 +65,6 @@ vec3 doBlockLightLighting(
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// try to make blocklight have consistent visiblity in different light levels.
|
||||
// float autoBrightness = mix(0.5, 1.0, clamp(exp(-10.0*exposureValue),0.0,1.0));
|
||||
// blockLight *= autoBrightness;
|
||||
|
||||
return blockLight * TORCH_AMOUNT;
|
||||
}
|
||||
|
||||
@ -89,12 +85,41 @@ vec3 doIndirectLighting(
|
||||
}
|
||||
|
||||
uniform float centerDepthSmooth;
|
||||
|
||||
#if defined VIVECRAFT
|
||||
uniform bool vivecraftIsVR;
|
||||
uniform vec3 vivecraftRelativeMainHandPos;
|
||||
uniform vec3 vivecraftRelativeOffHandPos;
|
||||
uniform mat4 vivecraftRelativeMainHandRot;
|
||||
uniform mat4 vivecraftRelativeOffHandRot;
|
||||
#endif
|
||||
|
||||
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;
|
||||
// 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;
|
||||
vec3 shiftedViewPos;
|
||||
vec3 shiftedPlayerPos;
|
||||
float forwardOffset;
|
||||
|
||||
#ifdef VIVECRAFT
|
||||
if (vivecraftIsVR) {
|
||||
forwardOffset = 0.0;
|
||||
shiftedPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + vivecraftRelativeMainHandPos;
|
||||
shiftedViewPos = shiftedPlayerPos * mat3(vivecraftRelativeMainHandRot);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
forwardOffset = 0.5;
|
||||
shiftedViewPos = viewPos + vec3(-0.25, 0.2, 0.0);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - forwardOffset, 1e-7);
|
||||
float linearDistance = length(shiftedPlayerPos);
|
||||
float shiftedLinearDistance = length(scaledViewPos);
|
||||
|
||||
|
@ -314,7 +314,7 @@ vec3 ApplySSRT(
|
||||
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){
|
||||
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.y < 1.0){
|
||||
bouncedLight = texture2D(colortex5, previousPosition.xy).rgb * GI_Strength * CURVE;
|
||||
|
||||
radiance += bouncedLight;
|
||||
|
@ -67,6 +67,7 @@ float phaseCloudFog(float x, float g){
|
||||
return (gg * -0.25 + 0.25) * pow(-2.0 * (g * x) + (gg + 1.0), -1.5) / 3.14;
|
||||
}
|
||||
uniform ivec2 eyeBrightness;
|
||||
|
||||
vec4 GetVolumetricFog(
|
||||
in vec3 viewPosition,
|
||||
in vec3 sunVector,
|
||||
@ -227,14 +228,31 @@ vec4 GetVolumetricFog(
|
||||
#endif
|
||||
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz);
|
||||
vec3 lighting = DirectLight + indirectLight;// * (lightLevelZero*0.99 + 0.01) + Lightning;
|
||||
vec3 lighting = DirectLight + indirectLight;
|
||||
|
||||
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);
|
||||
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION && !defined VL_CLOUDS_DEFERRED
|
||||
// vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
|
||||
// vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
vec3 shiftedViewPos;
|
||||
vec3 shiftedPlayerPos;
|
||||
float forwardOffset;
|
||||
|
||||
#ifdef VIVECRAFT
|
||||
if (vivecraftIsVR) {
|
||||
forwardOffset = 0.0;
|
||||
shiftedPlayerPos = (progressW - cameraPosition) + ( vivecraftRelativeMainHandPos);
|
||||
shiftedViewPos = shiftedPlayerPos * mat3(vivecraftRelativeMainHandRot);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
forwardOffset = 0.5;
|
||||
shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
|
||||
shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
}
|
||||
|
||||
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - forwardOffset, 1e-7);
|
||||
float linearDistance = length(shiftedPlayerPos);
|
||||
float shiftedLinearDistance = length(scaledViewPos);
|
||||
|
||||
|
@ -636,7 +636,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
#define FLASHLIGHT_SPECULAR
|
||||
#define FLASHLIGHT_BOUNCED_INDIRECT
|
||||
// #define FLASHLIGHT_FOG_ILLUMINATION
|
||||
#define FLASHLIGHT_RANGE 32 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 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 60.0 70.0 80.0 90.0 100.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 FLASHLIGHT_RANGE 32 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 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 60.0 70.0 80.0 90.0 100.0 120.0 130.0 140.0 150.0 16.0 170.0 180.0 190.0 200.0 250.0 300.0 350.0 400.0 450.0 500.0 600.0 700.0 800.0 900.0 1000.0 ]
|
||||
#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_BRIGHTNESS_MULT 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 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 60.0 70.0 80.0 90.0 100.0 ]
|
||||
#define FLASHLIGHT_BRIGHTNESS_FALLOFF_MULT 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 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 60.0 70.0 80.0 90.0 100.0 ]
|
||||
@ -772,7 +772,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
#define DH_SCREENSPACE_REFLECTIONS
|
||||
#define DH_TAA_JITTER
|
||||
#define DH_NOISE_TEXTURE
|
||||
#define NOISE_RESOLUTION 12 // [1 2 3 4 5 6 7 8 12 14 16 24 32 48 64]
|
||||
#define NOISE_RESOLUTION 16 // [1 2 3 4 5 6 7 8 12 14 16 24 32 48 64]
|
||||
#define NOISE_INTENSITY 12.0 // [1.0 2.0 3.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 18.0 20.0 22.0 24.0 32.0 48.0 64.0]
|
||||
#define NOISE_DROPOFF 1024 // [128 256 512 768 1024 1536 2048 3072 4096 8192]
|
||||
|
||||
@ -827,6 +827,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 RESPONSIVE_TAA
|
||||
#endif
|
||||
#ifdef DH_TAA_JITTER
|
||||
#endif
|
||||
#ifdef DH_SCREENSPACE_REFLECTIONS
|
||||
|
@ -184,7 +184,7 @@ vec4 screenSpaceReflections(
|
||||
// fix UV pos dragging behind due to hand not having a good previous frame position.
|
||||
previousPosition.xy = isHand ? raytracePos.xy : previousPosition.xy;
|
||||
|
||||
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.y < 1.0) {
|
||||
reflection.a = 1.0;
|
||||
|
||||
#ifdef FORWARD_RENDERED_SPECULAR
|
||||
@ -305,7 +305,7 @@ vec3 specularReflections(
|
||||
|
||||
// if(isHand){
|
||||
// f0 = 0.9;
|
||||
// roughness = 0.0;
|
||||
// roughness = 0.25;
|
||||
// }
|
||||
bool isMetal = f0 > 229.5/255.0;
|
||||
|
||||
|
@ -3,9 +3,7 @@ float waterCaustics(vec3 worldPos, vec3 sunVec) {
|
||||
vec3 projectedPos = worldPos - (sunVec/sunVec.y*worldPos.y);
|
||||
vec2 pos = projectedPos.xz;
|
||||
|
||||
float heightSum = 0.0;
|
||||
float movement = frameTimeCounter * 0.035 * WATER_WAVE_SPEED;
|
||||
// movement = 0.0;
|
||||
|
||||
float radiance = 2.39996;
|
||||
mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance)));
|
||||
@ -16,24 +14,23 @@ float waterCaustics(vec3 worldPos, vec3 sunVec) {
|
||||
vec2(32.,32.)
|
||||
);
|
||||
|
||||
float WavesLarge = max(texture2D(noisetex, pos / 600.0 ).b,0.1);
|
||||
float largeWaves = texture2D(noisetex, pos / 600.0 ).b;
|
||||
float largeWavesCurved = pow(1.0-pow(1.0-largeWaves,2.5),4.5);
|
||||
|
||||
float heightSum = 0.0;
|
||||
for (int i = 0; i < 3; i++){
|
||||
pos = rotationMatrix * pos;
|
||||
heightSum += pow(abs(abs(texture2D(noisetex, pos / wave_size[i] + WavesLarge*0.5 + movement).b * 2.0 - 1.0) * 2.0 - 1.0), 2.0) ;
|
||||
heightSum += pow(abs(abs(texture2D(noisetex, pos / wave_size[i] + largeWavesCurved * 0.5 + movement).b * 2.0 - 1.0) * 2.0 - 1.0), 1.0+largeWavesCurved) ;
|
||||
}
|
||||
|
||||
float FinalCaustics = exp((1.0 + 5.0 * pow(WavesLarge,0.5)) * (heightSum / 3.0 - 0.5));
|
||||
return exp((1.0 + 5.0 * sqrt(largeWavesCurved)) * (heightSum / 3.0 - 0.5));
|
||||
|
||||
return FinalCaustics;
|
||||
}
|
||||
|
||||
float getWaterHeightmap(vec2 posxz) {
|
||||
|
||||
float getWaterHeightmap(vec2 posxz, in float largeWaves, in float largeWavesCurved) {
|
||||
vec2 pos = posxz;
|
||||
float heightSum = 0.0;
|
||||
|
||||
float movement = frameTimeCounter * 0.035 * WATER_WAVE_SPEED;
|
||||
// movement = 0.0;
|
||||
|
||||
float radiance = 2.39996;
|
||||
mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance)));
|
||||
@ -44,47 +41,36 @@ float getWaterHeightmap(vec2 posxz) {
|
||||
vec2(32.,32.)
|
||||
);
|
||||
|
||||
float WavesLarge = max(texture2D(noisetex, pos / 600.0 ).b,0.1);
|
||||
|
||||
float heightSum = 0.0;
|
||||
for (int i = 0; i < 3; i++){
|
||||
|
||||
pos = rotationMatrix * pos;
|
||||
heightSum += texture2D(noisetex, pos / wave_size[i] + WavesLarge*0.5 + movement).b;
|
||||
heightSum += texture2D(noisetex, pos / wave_size[i] + largeWavesCurved * 0.5 + movement).b;
|
||||
}
|
||||
|
||||
return (heightSum / 60.0) * WavesLarge;
|
||||
return (heightSum/4.5) * max(largeWavesCurved,0.3);
|
||||
}
|
||||
|
||||
vec3 getWaveNormal(vec3 waterPos, vec3 playerpos, bool isLOD){
|
||||
|
||||
// vary the normal's "smooth" factor as distance changes, to avoid noise from too much details.
|
||||
// float range = pow(clamp(1.0 - length(posxz - cameraPosition)/(32*4),0.0,1.0),2.0);
|
||||
// float deltaPos = mix(0.5, 0.1, range);
|
||||
|
||||
float range = min(length(playerpos) / (16*12.0), 3.0) ;
|
||||
float deltaPos = range + 0.15;
|
||||
|
||||
// float range = 1-max(1.0-length(playerpos) / (16.0*16.0) ,0.0) ;
|
||||
// range = (1.0-pow(1.0-pow(range,2.0),2.0)) * 3.0;
|
||||
// float deltaPos = range + 0.15;
|
||||
|
||||
// float normalMult = 1.0 * WATER_WAVE_STRENGTH;
|
||||
|
||||
// if(isLOD){
|
||||
// deltaPos = mix(0.9, deltaPos, range);
|
||||
// }
|
||||
// added detail for snells window
|
||||
// if(isEyeInWater == 1) deltaPos = 0.025;
|
||||
float largeWaves = texture2D(noisetex, waterPos.xy / 600.0 ).b;
|
||||
float largeWavesCurved = pow(1.0-pow(1.0-largeWaves,2.5),4.5);
|
||||
|
||||
#ifdef HYPER_DETAILED_WAVES
|
||||
deltaPos = 0.025;
|
||||
float deltaPos = mix(1.0, 0.05, largeWavesCurved);
|
||||
#else
|
||||
float deltaPos = mix(1.0, 0.15, largeWavesCurved);
|
||||
// reduce high frequency detail as distance increases. reduces noise on waves. why have more details than pixels?
|
||||
float range = min(length(playerpos) / (16.0*24.0), 3.0);
|
||||
deltaPos += range;
|
||||
#endif
|
||||
|
||||
vec2 coord = waterPos.xy;
|
||||
|
||||
float h0 = getWaterHeightmap(coord);
|
||||
float h1 = getWaterHeightmap(coord + vec2(deltaPos,0.0));
|
||||
float h3 = getWaterHeightmap(coord + vec2(0.0,deltaPos));
|
||||
|
||||
float h0 = getWaterHeightmap(coord, largeWaves, largeWavesCurved);
|
||||
float h1 = getWaterHeightmap(coord + vec2(deltaPos,0.0), largeWaves,largeWavesCurved);
|
||||
float h3 = getWaterHeightmap(coord + vec2(0.0,deltaPos), largeWaves,largeWavesCurved);
|
||||
|
||||
float xDelta = (h1-h0)/deltaPos;
|
||||
float yDelta = (h3-h0)/deltaPos;
|
||||
|
Reference in New Issue
Block a user