mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 08:42:50 +08:00
Lightleak Fix for water fog and SSS
also, wind on clouds.
This commit is contained in:
@ -38,7 +38,7 @@ uniform sampler2D colortex11; // specular
|
||||
uniform sampler2D colortex10; // specular
|
||||
uniform sampler2D colortex12; // specular
|
||||
uniform sampler2D colortex13; // specular
|
||||
// uniform sampler2D colortex14; // specular
|
||||
uniform sampler2D colortex14;
|
||||
uniform sampler2D colortex15; // specular
|
||||
uniform sampler2D colortex16; // specular
|
||||
uniform sampler2D depthtex1;//depth
|
||||
@ -262,7 +262,6 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
||||
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
// vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition;
|
||||
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<spCount;i++) {
|
||||
@ -775,9 +774,6 @@ void main() {
|
||||
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
|
||||
|
||||
|
||||
|
||||
float z0 = texture2D(depthtex0,texcoord).x;
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
float TranslucentDepth = clamp( ld(z0)-ld(z0) ,0.0,1.0);
|
||||
@ -1135,7 +1131,7 @@ void main() {
|
||||
vec3 FINAL_COLOR = Indirect_lighting + Direct_lighting;
|
||||
|
||||
#ifdef Variable_Penumbra_Shadows
|
||||
FINAL_COLOR += SSS*DirectLightColor;
|
||||
FINAL_COLOR += SSS*DirectLightColor * lightleakfix;
|
||||
#endif
|
||||
|
||||
FINAL_COLOR *= albedo;
|
||||
@ -1163,9 +1159,9 @@ void main() {
|
||||
float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane
|
||||
float estimatedSunDepth = estimatedDepth/abs(WsunVec.y); //assuming water plane
|
||||
|
||||
// float custom_lightmap_T = texture2D(colortex14, texcoord).x; * max(custom_lightmap_T,0.005)// y = torch
|
||||
float custom_lightmap_T = pow(texture2D(colortex14, texcoord).a,1.5);
|
||||
|
||||
vec3 ambientColVol = (avgAmbient * 8./150./1.5);
|
||||
vec3 ambientColVol = (avgAmbient * 8./150./1.5) * max(custom_lightmap_T,MIN_LIGHT_AMOUNT*0.001);
|
||||
vec3 lightColVol = (lightCol.rgb / 80.) ;
|
||||
|
||||
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));
|
||||
|
@ -20,9 +20,6 @@ const int colortex3Format = R11F_G11F_B10F; //frame buffer + bloom (deferred6-
|
||||
const int colortex4Format = RGBA16F; //light values and skyboxes (everything)
|
||||
|
||||
|
||||
const int colortex11Format = RGBA16; //Final output, transparencies id (gbuffer->composite4)
|
||||
|
||||
const int colortex13Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
|
||||
const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final)
|
||||
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
@ -30,6 +27,9 @@ const int colortex8Format = RGBA16F; //Final output, transparencies id (gbuffe
|
||||
const int colortex9Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
const int colortex10Format = RGBA16F; //Final output, transparencies id (gbuffer->composite4)
|
||||
|
||||
const int colortex11Format = RGBA16; //Final output, transparencies id (gbuffer->composite4)
|
||||
const int colortex13Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
const int colortex14Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||
// const int colortex15Format = RGBA16F; // flat normals and vanilla
|
||||
*/
|
||||
|
||||
|
@ -261,7 +261,7 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
/* RENDERTARGETS:2,7,11 */
|
||||
/* RENDERTARGETS:2,7,11,14 */
|
||||
void main() {
|
||||
if (gl_FragCoord.x * texelSize.x < RENDER_SCALE.x && gl_FragCoord.y * texelSize.y < RENDER_SCALE.y ) {
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
@ -479,5 +479,7 @@ if (gl_FragCoord.x * texelSize.x < RENDER_SCALE.x && gl_FragCoord.y * texelSize
|
||||
#ifndef HAND
|
||||
gl_FragData[1] = vec4(Albedo,iswater);
|
||||
#endif
|
||||
|
||||
gl_FragData[3].a = lmtexcoord.w;
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ float MaxCumulusHeight = CumulusHeight + 100;
|
||||
float AltostratusHeight = 2000;
|
||||
|
||||
float rainCloudwetness = rainStrength;
|
||||
float cloud_movement = 0;
|
||||
float cloud_movement = frameTimeCounter;
|
||||
|
||||
//3D noise from 2d texture
|
||||
float densityAtPos(in vec3 pos){
|
||||
@ -46,8 +46,15 @@ float densityAtPos(in vec3 pos){
|
||||
|
||||
float cloudCov(in vec3 pos,vec3 samplePos){
|
||||
|
||||
float CloudLarge = texture2D(noisetex, (samplePos.xz + cloud_movement) / 5000 ).b;
|
||||
float CloudSmall = texture2D(noisetex, (samplePos.xz - cloud_movement) / 500 ).r;
|
||||
// vec2 windshift2 = pow( max(MaxCumulusHeight - pos.y, 0.0) / 20,2) * vec2(1);
|
||||
// windshift.x *= sin(frameTimeCounter);
|
||||
// windshift.y *= -cos(frameTimeCounter);
|
||||
|
||||
float CloudLarge = texture2D(noisetex, (samplePos.xz + cloud_movement) / 5000 ).b;
|
||||
|
||||
|
||||
vec2 windshift = pow( max(pos.y-CumulusHeight, 0.0) / 5,1.5) * vec2(1) * (CloudLarge*2-1.15);
|
||||
float CloudSmall = texture2D(noisetex, (samplePos.xz - cloud_movement) / 500 ).r;
|
||||
|
||||
float coverage = abs(pow(CloudLarge,1)*2.0 - 1.2)*0.5 - (1.0-CloudSmall) + 0.3;
|
||||
|
||||
@ -74,6 +81,8 @@ float cloudVol(in vec3 pos,in vec3 samplePos,in float cov, in int LoD){
|
||||
float pw2 = log(fbmPower2);
|
||||
|
||||
samplePos.xz -= cloud_movement/4;
|
||||
samplePos.xz += pow( max(pos.y - (CumulusHeight+20), 0.0) / 20.0,1.50);
|
||||
|
||||
noise += 1.0-densityAtPos(samplePos * 200.) ;
|
||||
|
||||
float smallnoise = densityAtPos(samplePos * 600.);
|
||||
@ -101,8 +110,8 @@ float GetCumulusDensity(in vec3 pos, in int LoD){
|
||||
|
||||
float GetAltostratusDensity(vec3 pos){
|
||||
|
||||
float large = texture2D(noisetex, pos.xz/100000. ).b;
|
||||
float small = texture2D(noisetex, pos.xz/10000. - vec2(-large,1-large)/5).b;
|
||||
float large = texture2D(noisetex, (pos.xz + cloud_movement)/100000. ).b;
|
||||
float small = texture2D(noisetex, (pos.xz - cloud_movement)/10000. - vec2(-large,1-large)/5).b;
|
||||
|
||||
float shape = (small + pow((1.0-large),2.0))/2.0;
|
||||
|
||||
|
Reference in New Issue
Block a user