mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-20 16:07:22 +08:00
111 lines
3.2 KiB
Plaintext
111 lines
3.2 KiB
Plaintext
![]() |
#include "/lib/settings.glsl"
|
||
|
|
||
|
|
||
|
// flat varying vec3 ambientUp;
|
||
|
// flat varying vec3 ambientLeft;
|
||
|
// flat varying vec3 ambientRight;
|
||
|
// flat varying vec3 ambientB;
|
||
|
// flat varying vec3 ambientF;
|
||
|
// flat varying vec3 ambientDown;
|
||
|
|
||
|
flat varying vec3 lightSourceColor;
|
||
|
flat varying vec3 sunColor;
|
||
|
flat varying vec3 sunColorCloud;
|
||
|
flat varying vec3 moonColor;
|
||
|
flat varying vec3 moonColorCloud;
|
||
|
flat varying vec3 zenithColor;
|
||
|
flat varying vec3 avgSky;
|
||
|
flat varying vec2 tempOffsets;
|
||
|
flat varying float exposure;
|
||
|
flat varying float rodExposure;
|
||
|
flat varying float avgBrightness;
|
||
|
flat varying float exposureF;
|
||
|
flat varying float fogAmount;
|
||
|
flat varying float VFAmount;
|
||
|
|
||
|
uniform sampler2D colortex4;
|
||
|
uniform sampler2D noisetex;
|
||
|
|
||
|
uniform int frameCounter;
|
||
|
uniform float rainStrength;
|
||
|
uniform float eyeAltitude;
|
||
|
uniform vec3 sunVec;
|
||
|
uniform vec2 texelSize;
|
||
|
uniform float frameTimeCounter;
|
||
|
uniform mat4 gbufferProjection;
|
||
|
uniform mat4 gbufferProjectionInverse;
|
||
|
uniform mat4 gbufferPreviousProjection;
|
||
|
uniform mat4 gbufferModelViewInverse;
|
||
|
uniform mat4 gbufferModelView;
|
||
|
uniform mat4 shadowModelView;
|
||
|
uniform mat4 shadowProjection;
|
||
|
uniform float sunElevation;
|
||
|
uniform vec3 cameraPosition;
|
||
|
uniform float far;
|
||
|
uniform ivec2 eyeBrightnessSmooth;
|
||
|
|
||
|
#include "/lib/util.glsl"
|
||
|
#include "/lib/ROBOBO_sky.glsl"
|
||
|
|
||
|
vec3 toShadowSpaceProjected(vec3 p3){
|
||
|
p3 = mat3(gbufferModelViewInverse) * p3 + gbufferModelViewInverse[3].xyz;
|
||
|
p3 = mat3(shadowModelView) * p3 + shadowModelView[3].xyz;
|
||
|
p3 = diagonal3(shadowProjection) * p3 + shadowProjection[3].xyz;
|
||
|
|
||
|
return p3;
|
||
|
}
|
||
|
float interleaved_gradientNoise(){
|
||
|
vec2 coord = gl_FragCoord.xy;
|
||
|
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)+frameCounter/1.6180339887);
|
||
|
return noise;
|
||
|
}
|
||
|
float blueNoise(){
|
||
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
#ifdef END_SHADER
|
||
|
#include "/lib/end_fog.glsl"
|
||
|
#endif
|
||
|
|
||
|
#ifdef NETHER_SHADER
|
||
|
#include "/lib/nether_fog.glsl"
|
||
|
#endif
|
||
|
|
||
|
void main() {
|
||
|
/* DRAWBUFFERS:4 */
|
||
|
|
||
|
gl_FragData[0] = vec4(0.0);
|
||
|
|
||
|
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-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
|
||
|
//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,0.07),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,exposureF,1.0);
|
||
|
if (gl_FragCoord.x > 14. && gl_FragCoord.x < 15. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||
|
gl_FragData[0] = vec4(rodExposure,0.0,0.0,1.0);
|
||
|
|
||
|
}
|