mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-01-04 00:23:41 +08:00
f82426c609
it has begun
88 lines
2.8 KiB
GLSL
88 lines
2.8 KiB
GLSL
#version 120
|
|
#extension GL_EXT_gpu_shader4 : enable
|
|
|
|
//Computes volumetric clouds at variable resolution (default 1/4 res)
|
|
#define HQ_CLOUDS //Renders detailled clouds for viewport
|
|
#define CLOUDS_QUALITY 0.5 //[0.1 0.125 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.9 1.0]
|
|
#define TAA
|
|
|
|
flat varying vec3 sunColor;
|
|
flat varying vec3 moonColor;
|
|
flat varying vec3 avgAmbient;
|
|
flat varying float tempOffsets;
|
|
|
|
uniform sampler2D depthtex0;
|
|
uniform sampler2D noisetex;
|
|
|
|
// uniform vec3 sunVec;
|
|
// uniform vec3 sunPosition;
|
|
uniform vec2 texelSize;
|
|
uniform float frameTimeCounter;
|
|
uniform float rainStrength;
|
|
uniform int frameCounter;
|
|
uniform mat4 gbufferProjectionInverse;
|
|
uniform mat4 gbufferModelViewInverse;
|
|
uniform mat4 gbufferModelView;
|
|
uniform vec3 cameraPosition;
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
#include "lib/volumetricClouds.glsl"
|
|
|
|
|
|
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 interleaved_gradientNoise2(){
|
|
vec2 coord = gl_FragCoord.xy;
|
|
float noise = 1-fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)+frameCounter/1.6180339887);
|
|
return noise;
|
|
}
|
|
float blueNoise(){
|
|
return fract(texelFetch2D(noisetex, ivec2(1.0-gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
|
}
|
|
float blueNoise2(){
|
|
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
|
}
|
|
float R2_dither(){
|
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
|
return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter);
|
|
}
|
|
float R2_dither2(){
|
|
vec2 alpha = vec2(0.75487765, 0.56984026);
|
|
return fract(alpha.x * (1.0-gl_FragCoord.x) + alpha.y * (1.0-gl_FragCoord.y) + 1.0/1.6180339887 * frameCounter);
|
|
}
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
void main() {
|
|
/* DRAWBUFFERS:0 */
|
|
|
|
|
|
|
|
#ifdef VOLUMETRIC_CLOUDS
|
|
vec2 halfResTC = vec2(floor(gl_FragCoord.xy)/CLOUDS_QUALITY+0.5);
|
|
|
|
vec3 fragpos = toScreenSpace(vec3(halfResTC*texelSize,1.0));
|
|
// vec4 currentClouds = renderClouds(fragpos,vec3(0.),R2_dither(),sunColor/150.,moonColor/150.,avgAmbient/150., blueNoise());
|
|
|
|
// gl_FragData[0] = currentClouds;
|
|
|
|
|
|
#else
|
|
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
|
|
#endif
|
|
|
|
}
|