mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 08:42:50 +08:00
DOUBLE LAYER CLOUDS TEST 5. ALOT OF END SHADER WORK DONE. fix a few tiny issues and some tweaks here and there.
This commit is contained in:
@ -59,15 +59,11 @@ uniform float sunIntensity;
|
||||
uniform vec3 sunColor;
|
||||
uniform vec3 nsunColor;
|
||||
|
||||
|
||||
|
||||
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
#include "/lib/color_transforms.glsl"
|
||||
#include "/lib/projections.glsl"
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
#include "/lib/waterBump.glsl"
|
||||
#include "/lib/clouds.glsl"
|
||||
#include "/lib/stars.glsl"
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
@ -79,6 +75,10 @@ uniform vec3 nsunColor;
|
||||
uniform float nightVision;
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
#include "/lib/end_fog.glsl"
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
float blueNoise(){
|
||||
@ -275,6 +275,7 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
|
||||
|
||||
|
||||
|
||||
|
||||
#define PHYSICSMOD_FRAGMENT
|
||||
#include "/lib/oceans.glsl"
|
||||
|
||||
@ -291,6 +292,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
//////////////////////////////// ALBEDO
|
||||
@ -336,6 +338,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
tangent.z, tangent2.z, normal.z);
|
||||
|
||||
vec4 NormalTex = texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).rgba;
|
||||
|
||||
NormalTex.xy = NormalTex.xy*2.0-1.0;
|
||||
NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0) ;
|
||||
TangentNormal = NormalTex.xy*0.5+0.5;
|
||||
@ -473,7 +476,22 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
vec3 AmbientLightColor = vec3(1.0);
|
||||
float fresnelGlow = pow(clamp(1.5 + dot(WS_normal, normalize(feetPlayerPos))*0.5,0,2),2);
|
||||
vec3 AmbientLightColor = (vec3(0.5,0.75,1.0) *0.9 + 0.1)* fresnelGlow;
|
||||
|
||||
|
||||
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(WS_normal, normalize(-lightPos))*0.5+0.5,0.0,1.0);
|
||||
NdotL *= NdotL;
|
||||
|
||||
Direct_lighting = lightColors * endFogPhase(lightPos) * NdotL;
|
||||
|
||||
#endif
|
||||
|
||||
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
@ -500,7 +518,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
float roughness = max(pow(1.0-SpecularTex.r,2.0),0.05);
|
||||
float f0 = SpecularTex.g;
|
||||
|
||||
roughness = 0.0;
|
||||
// roughness = 0.0;
|
||||
// f0 = 0.9;
|
||||
|
||||
if (iswater > 0.0 && gl_FragData[0].a < 0.9999999){
|
||||
@ -577,7 +595,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
#ifndef HAND
|
||||
gl_FragData[1] = vec4(Albedo, iswater);
|
||||
#endif
|
||||
|
||||
|
||||
gl_FragData[3].a = max(lmtexcoord.w*blueNoise()*0.05 + lmtexcoord.w,0.0);
|
||||
}
|
||||
}
|
@ -421,7 +421,7 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
|
||||
vec3 rayDir = direction * (isSSS ? 1.5 : 3.0) * vec3(RENDER_SCALE,1.0);
|
||||
|
||||
vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise;
|
||||
if(isSSS)screenPos -= rayDir*0.9;
|
||||
if(isSSS) screenPos -= rayDir*0.9;
|
||||
|
||||
for (int i = 0; i < int(steps); i++) {
|
||||
|
||||
@ -444,12 +444,13 @@ void SSRT_Shadows(vec3 viewPos, vec3 lightDir, float noise, bool isSSS, bool ins
|
||||
}
|
||||
|
||||
#ifdef END_SHADER
|
||||
float GetShading( vec3 WorldPos, vec3 LightPos, vec3 Normal){
|
||||
float GetShading(vec3 WorldPos, vec3 LightPos, vec3 Normal){
|
||||
|
||||
float NdotL = clamp(dot(Normal, normalize(-LightPos)),0.0,1.0);
|
||||
float NdotL = clamp(dot(Normal, normalize(-LightPos))*0.5+0.5,0.0,1.0);
|
||||
NdotL *= NdotL;
|
||||
float FogShadow = GetCloudShadow(WorldPos, LightPos);
|
||||
|
||||
return EndLightMie(LightPos) * NdotL * FogShadow;
|
||||
return endFogPhase(LightPos) * NdotL * FogShadow;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -503,7 +504,36 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
||||
|
||||
#include "/lib/indirect_lighting_effects.glsl"
|
||||
#include "/lib/PhotonGTAO.glsl"
|
||||
vec4 renderInfiniteWaterPlane(
|
||||
vec3 FragPosition, inout vec3 oceanNormals
|
||||
){
|
||||
|
||||
float planeHeight = 20 + 0.50;
|
||||
float total_extinction = 1.0;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
//project pixel position into projected shadowmap space
|
||||
vec4 viewPos = normalize(gbufferModelViewInverse * vec4(FragPosition,1.0) );
|
||||
vec3 dV_view = normalize(viewPos.xyz); dV_view *= 1.0/abs(dV_view.y);
|
||||
|
||||
float mult = length(dV_view);
|
||||
|
||||
float startFlip = mix(max(cameraPosition.y - planeHeight,0.0), max(planeHeight - cameraPosition.y,0), clamp(dV_view.y,0,1));
|
||||
float signFlip = mix(-1.0, 1.0, clamp(cameraPosition.y - planeHeight,0.0,1.0));
|
||||
if(max(signFlip * normalize(dV_view).y,0.0) > 0.0) return vec4(0,0,0,1);
|
||||
|
||||
vec3 progress_view = vec3(0,cameraPosition.y,0) + dV_view/abs(dV_view.y) * startFlip;
|
||||
|
||||
oceanNormals = normalize(getWaveHeight((progress_view+cameraPosition).xz,1));
|
||||
|
||||
vec3 Lighting = vec3(1);
|
||||
float object = 1;
|
||||
|
||||
color += max(Lighting - Lighting*exp(-mult*object),0.0) * total_extinction;
|
||||
total_extinction *= max(exp(-mult*object),0.0);
|
||||
|
||||
return vec4(color, total_extinction);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
@ -543,6 +573,7 @@ void main() {
|
||||
lightmap.y = 1.0;
|
||||
#endif
|
||||
|
||||
|
||||
////// --------------- UNPACK MISC --------------- //////
|
||||
|
||||
vec4 SpecularTex = texture2D(colortex8,texcoord);
|
||||
@ -617,9 +648,11 @@ void main() {
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec3 Background = vec3(0.0);
|
||||
|
||||
vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2;
|
||||
Background += stars(orbitstar) * 10.0;
|
||||
|
||||
|
||||
#if RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0
|
||||
vec3 orbitstar = vec3(feetPlayerPos_normalized.x,abs(feetPlayerPos_normalized.y),feetPlayerPos_normalized.z); orbitstar.x -= WsunVec.x*0.2;
|
||||
Background += stars(orbitstar) * 10.0;
|
||||
#endif
|
||||
|
||||
#if RESOURCEPACK_SKY == 2
|
||||
Background += toLinear(texture2D(colortex10, texcoord).rgb * (255.0 * 2.0));
|
||||
@ -633,7 +666,7 @@ void main() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Background *= exp(-25.0 * pow(clamp(-feetPlayerPos_normalized.y*5.0 + 0.5 ,0.0,1.0),2.0)); // darken the ground in the sky.
|
||||
// Background *= 1.0 - exp2(-50.0 * pow(clamp(feetPlayerPos_normalized.y+0.025,0.0,1.0),2.0) ); // darken the ground in the sky.
|
||||
|
||||
vec3 Sky = skyFromTex(feetPlayerPos_normalized, colortex4)/30.0;
|
||||
Background += Sky;
|
||||
@ -802,22 +835,17 @@ void main() {
|
||||
|
||||
|
||||
#ifdef END_SHADER
|
||||
vec3 LightPos1 = vec3(0); vec3 LightPos2 = vec3(0);
|
||||
LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition, LightPos1, LightPos2);
|
||||
|
||||
vec3 LightCol1 = vec3(0); vec3 LightCol2 = vec3(0);
|
||||
LightSourceColors(LightCol1, LightCol2);
|
||||
// LightCol1 *= Flashing;
|
||||
LightCol2 *= Flashing;
|
||||
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);
|
||||
|
||||
Direct_lighting += lightColors * GetShading(feetPlayerPos+cameraPosition, lightPos, slopednormal) ;
|
||||
|
||||
Direct_lighting += LightCol1 * GetShading(feetPlayerPos+cameraPosition, LightPos1, slopednormal) ;
|
||||
|
||||
#if lightsourceCount == 2
|
||||
Direct_lighting += LightCol2 * GetShading(feetPlayerPos+cameraPosition, LightPos2, slopednormal);
|
||||
#endif
|
||||
|
||||
// float RT_Shadows = rayTraceShadow(worldToView(normalize(-LightPos)), viewPos, noise);
|
||||
// if(!hand) Direct_lighting *= RT_Shadows*RT_Shadows;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -849,7 +877,8 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef END_SHADER
|
||||
vec3 AmbientLightColor = vec3(1.0);
|
||||
float fresnelGlow = pow(clamp(1.5 + dot(normal, feetPlayerPos_normalized)*0.5,0,2),2);
|
||||
vec3 AmbientLightColor = (vec3(0.5,0.75,1.0) *0.9 + 0.1)* fresnelGlow;
|
||||
#endif
|
||||
|
||||
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
@ -889,11 +918,12 @@ void main() {
|
||||
if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0);
|
||||
DirectLightColor *= cloudShadow;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////// EFFECTS FOR INDIRECT /////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
float SkySSS = 0.0;
|
||||
|
||||
|
@ -253,10 +253,12 @@ void main() {
|
||||
vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, lightCol.rgb/80.0, averageSkyCol/30.0);
|
||||
#endif
|
||||
|
||||
#if defined NETHER_SHADER || defined END_SHADER || defined FALLBACK_SHADER
|
||||
#if defined NETHER_SHADER || defined END_SHADER
|
||||
vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, noise_2);
|
||||
#endif
|
||||
|
||||
// VolumetricFog = vec4(0,0,0,1);
|
||||
|
||||
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);
|
||||
}
|
||||
|
||||
|
@ -190,6 +190,7 @@ void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths){
|
||||
if(DistortedAlpha <= 0.001) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents
|
||||
}
|
||||
|
||||
uniform float eyeAltitude;
|
||||
void main() {
|
||||
/* DRAWBUFFERS:73 */
|
||||
|
||||
@ -294,9 +295,8 @@ void main() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
#ifdef Cave_fog
|
||||
if (isEyeInWater == 0){
|
||||
#if defined OVERWORLD_SHADER && defined Cave_fog
|
||||
if (isEyeInWater == 0 && eyeAltitude < 1500){
|
||||
|
||||
float fogdistfade = clamp( pow(length(fragpos) / far, CaveFogFallOff) ,0.0,1.0);
|
||||
|
||||
@ -310,12 +310,17 @@ void main() {
|
||||
#endif
|
||||
|
||||
color.rgb = mix(color.rgb, cavefogCol*fogfade, fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ;
|
||||
// color.rgb = mix(color.rgb, vec3(0.), fogdistfade * (1.0-lightleakfix) * (1.0-darknessFactor) * clamp( 1.5 - np3.y,0.,1)) ;
|
||||
// color.rgb = vec3(CaveFogColor_R,CaveFogColor_G,CaveFogColor_B)*fogfade ;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef END_SHADER
|
||||
|
||||
if (isEyeInWater == 0){
|
||||
vec3 hazeColor = vec3(0.3,0.75,1.0) * 0.3;
|
||||
|
||||
float hazeDensity = clamp(1.0 - length(fragpos) / max(far, 32.0 * 24.0),0.0,1.0);
|
||||
color.rgb = mix(hazeColor, color.rgb, hazeDensity) ;
|
||||
}
|
||||
#endif
|
||||
// underwater fog
|
||||
if (isEyeInWater == 1){
|
||||
float dirtAmount = Dirt_Amount;
|
||||
|
@ -3,12 +3,12 @@
|
||||
|
||||
/*
|
||||
const int colortex0Format = RGBA16F; // low res clouds (deferred->composite2) + low res VL (composite5->composite15)
|
||||
const int colortex1Format = RGBA16; //terrain gbuffer (gbuffer->composite2)
|
||||
const int colortex2Format = RGBA16F; //forward + transparencies (gbuffer->composite4)
|
||||
const int colortex3Format = R11F_G11F_B10F; //frame buffer + bloom (deferred6->final)
|
||||
const int colortex4Format = RGBA16F; //light values and skyboxes (everything)
|
||||
const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final)
|
||||
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
const int colortex1Format = RGBA16; // terrain gbuffer (gbuffer->composite2)
|
||||
const int colortex2Format = RGBA16F; // forward + transparencies (gbuffer->composite4)
|
||||
const int colortex3Format = R11F_G11F_B10F; // frame buffer + bloom (deferred6->final)
|
||||
const int colortex4Format = RGBA16F; // light values and skyboxes (everything)
|
||||
const int colortex6Format = R11F_G11F_B10F; // additionnal buffer for bloom (composite3->final)
|
||||
const int colortex7Format = RGBA8; // Final output, transparencies id (gbuffer->composite4)
|
||||
const int colortex8Format = RGBA8; // Specular Texture
|
||||
const int colortex9Format = RGBA8; // rain in alpha
|
||||
const int colortex10Format = RGBA16; // resourcepack Skies
|
||||
|
@ -37,6 +37,7 @@ uniform mat4 gbufferModelView;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 shadowProjection;
|
||||
uniform float sunElevation;
|
||||
uniform vec3 sunPosition;
|
||||
uniform vec3 cameraPosition;
|
||||
// uniform float far;
|
||||
uniform ivec2 eyeBrightnessSmooth;
|
||||
@ -95,6 +96,19 @@ void main() {
|
||||
gl_FragData[0] = vec4(0.0);
|
||||
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);
|
||||
}
|
||||
|
||||
if(accumuteSpeed < 1.0) mixhistory = 1.0;
|
||||
|
||||
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
///////////////////////////////
|
||||
/// --- STORE COLOR LUT --- ///
|
||||
@ -139,6 +153,8 @@ float mixhistory = 0.06;
|
||||
|
||||
/// --- Sky only
|
||||
if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
|
||||
|
||||
|
||||
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.,1.))/256.+tempOffsets/256.,0.0,1.0);
|
||||
vec3 viewVector = cartToSphere(p);
|
||||
|
||||
@ -147,7 +163,7 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
|
||||
vec3 skyAbsorb = vec3(0.0);
|
||||
|
||||
// float GroundDarkening = (exp2(-15 * clamp(-viewVector.y,0.0,1.0)) * 0.7+0.3); // darken the ground in the sky.
|
||||
sky = calculateAtmosphere((averageSkyCol*4000./2.0), viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
|
||||
sky = calculateAtmosphere((averageSkyCol*4000./2.0) , viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise());
|
||||
|
||||
// sky = mix(sky, (averageSkyCol + skyAbsorb)*4000./2.0, (1.0 - exp(pow(clamp(-viewVector.y+0.5,0.0,1.0),2) * -25)));
|
||||
|
||||
@ -167,14 +183,16 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
|
||||
vec3 viewVector = cartToSphere(p);
|
||||
|
||||
WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
|
||||
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
|
||||
|
||||
vec3 suncol = sunColor;
|
||||
vec3 suncol = lightSourceColor;
|
||||
#ifdef ambientLight_only
|
||||
suncol = vec3(0.0);
|
||||
#endif
|
||||
|
||||
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol, moonColor, skyGroundCol/30.0);
|
||||
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0);
|
||||
sky = sky*clouds.a + clouds.rgb / 5.0;
|
||||
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), lightSourceColor*1.75, skyGroundCol/30.0);
|
||||
@ -184,7 +202,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined NETHER_SHADER || defined END_SHADER || defined FALLBACK_SHADER
|
||||
#if defined NETHER_SHADER || defined END_SHADER
|
||||
vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0);
|
||||
|
||||
//Sky gradient with clouds
|
||||
@ -203,30 +221,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// /* ---------------------- FOG SHADER ---------------------- */
|
||||
// vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0);
|
||||
|
||||
// //Sky gradient with clouds
|
||||
// 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);
|
||||
// vec3 viewVector = cartToSphere(p);
|
||||
|
||||
// vec3 BackgroundColor = vec3(0.0);
|
||||
|
||||
// vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., fract(frameCounter/1.6180339887), fract(frameCounter/2.6180339887));
|
||||
|
||||
// BackgroundColor += VL_Fog.rgb/5.0;
|
||||
|
||||
// gl_FragData[0] = vec4(BackgroundColor, 1.0);
|
||||
|
||||
// }
|
||||
|
||||
#ifdef END_SHADER
|
||||
/* ---------------------- TIMER ---------------------- */
|
||||
|
||||
float flash = 0.0;
|
||||
float maxWaitTime = 10;
|
||||
float maxWaitTime = 5;
|
||||
|
||||
float Timer = texelFetch2D(colortex4, ivec2(3,1), 0).x/150.0;
|
||||
Timer -= frameTime;
|
||||
@ -247,7 +246,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
|
||||
vec2 pixelPos1 = vec2(1,1);
|
||||
if (gl_FragCoord.x > pixelPos1.x && gl_FragCoord.x < pixelPos1.x + 1 && gl_FragCoord.y > pixelPos1.y && gl_FragCoord.y < pixelPos1.y + 1){
|
||||
mixhistory = clamp(5.0 * frameTime,0.0,1.0);
|
||||
mixhistory = clamp(4.0 * frameTime,0.0,1.0);
|
||||
gl_FragData[0] = vec4(flash, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@ -259,7 +258,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
|
||||
vec3 LastPos = (texelFetch2D(colortex4,ivec2(2,1),0).xyz/150.0) * 2.0 - 1.0;
|
||||
|
||||
LastPos += (hash31(frameCounter / 75) * 2.0 - 1.0);
|
||||
LastPos += (hash31(frameCounter / 50) * 2.0 - 1.0);
|
||||
LastPos = LastPos * 0.5 + 0.5;
|
||||
|
||||
if(Timer > maxWaitTime * 0.7 ){
|
||||
@ -277,8 +276,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
//Temporally accumulate sky and light values
|
||||
vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb;
|
||||
vec3 curr = gl_FragData[0].rgb*150.;
|
||||
|
||||
|
||||
gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.);
|
||||
|
||||
|
||||
//Exposure values
|
||||
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||
gl_FragData[0] = vec4(exposure, avgBrightness, avgL2,1.0);
|
||||
|
@ -41,6 +41,7 @@ uniform float rainStrength;
|
||||
|
||||
// uniform int worldTime;
|
||||
vec3 sunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
|
||||
// vec3 sunVec = normalize(LightDir);
|
||||
|
||||
#include "/lib/sky_gradient.glsl"
|
||||
@ -104,16 +105,11 @@ void main() {
|
||||
pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90);
|
||||
|
||||
averageSkyCol_Clouds += 2.0*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
|
||||
// pos = normalize(vec3(0,1,0));
|
||||
// pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90);
|
||||
averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.; // please dont do an infinite feedback loop....
|
||||
|
||||
|
||||
averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
}
|
||||
|
||||
/// TOOO DAMN BLUE
|
||||
// // only need to sample one spot for this
|
||||
// averageSkyCol += 2.0*skyFromTex(normalize(vec3(0.0,1.0,0.0)),colortex4).rgb/150.;
|
||||
|
||||
// only need to sample one spot for this
|
||||
vec3 minimumlight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.003 + nightVision);
|
||||
averageSkyCol_Clouds = max(averageSkyCol_Clouds, minimumlight);
|
||||
averageSkyCol = max(averageSkyCol, minimumlight);
|
||||
@ -141,6 +137,8 @@ void main() {
|
||||
|
||||
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
|
||||
|
||||
|
||||
// WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
|
@ -93,7 +93,7 @@ void main() {
|
||||
|
||||
vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1));
|
||||
|
||||
vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80., moonColor/150., averageSkyCol/30.0);
|
||||
vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80.0, averageSkyCol/30.0);
|
||||
|
||||
gl_FragData[0] = VolumetricClouds;
|
||||
|
||||
|
@ -29,7 +29,7 @@ void main() {
|
||||
sunColor = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
|
||||
|
||||
WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) *sunPosition);
|
||||
WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
// WsunVec = normalize(LightDir);
|
||||
|
||||
tempOffsets = HaltonSeq2(frameCounter%10000);
|
||||
|
Reference in New Issue
Block a user