mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 08:42:50 +08:00
FIX cloud flicker issue. FIX red hurt effect missing for translucent entities. FIX line on water edges. FIX RTAO/SSGI being super dark. IMPROVE cloud lighting and shapes. ADD toggle to use quarter res depth with rtao/ssgi.UPDATE zh_ch.lang file
This commit is contained in:
@ -100,7 +100,6 @@ uniform vec3 cameraPosition;
|
||||
void main() {
|
||||
|
||||
#ifdef DH_OVERDRAW_PREVENTION
|
||||
// overdraw prevention
|
||||
if(clamp(1.0-length(pos.xyz)/max(far - 32.0 * sqrt(interleaved_gradientNoise_temporal()),0.0),0.0,1.0) > 0.0 ){
|
||||
discard;
|
||||
return;
|
||||
|
@ -19,10 +19,38 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-7.,-1.)/8.,
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform float far;
|
||||
uniform mat4 dhProjection;
|
||||
uniform vec3 cameraPosition;
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
return vec4(projMAD(dhProjection, viewSpacePosition),-viewSpacePosition.z);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void main() {
|
||||
gl_Position = ftransform();
|
||||
|
||||
|
||||
/*
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
float cellSize = 32*2;
|
||||
vec3 modulusWorldPos = vec3(worldpos.x,worldpos.y,worldpos.z) + fract(cameraPosition/cellSize)*cellSize - cellSize*0.5;
|
||||
|
||||
worldpos.y -= (clamp(1.0-length(modulusWorldPos)/max(far-32,0.0),0.0,1.0)) * 50.0;
|
||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||
gl_Position = toClipSpace3(position);
|
||||
*/
|
||||
|
||||
#ifdef TAA_UPSCALING
|
||||
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
|
||||
#endif
|
||||
|
@ -261,12 +261,13 @@ vec4 texture2D_POMSwitch(
|
||||
sampler2D sampler,
|
||||
vec2 lightmapCoord,
|
||||
vec4 dcdxdcdy,
|
||||
bool ifPOM
|
||||
bool ifPOM,
|
||||
float LOD
|
||||
){
|
||||
if(ifPOM){
|
||||
return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw);
|
||||
}else{
|
||||
return texture2D(sampler, lightmapCoord, bias());
|
||||
return texture2D(sampler, lightmapCoord, LOD);
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,8 +405,8 @@ void main() {
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
//////////////////////////////// ALBEDO ////////////////////////////////
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
||||
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM) * color;
|
||||
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;
|
||||
@ -467,7 +468,7 @@ void main() {
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
||||
#if defined WORLD && defined MC_NORMAL_MAP
|
||||
vec4 NormalTex = texture2D_POMSwitch(normals, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM).xyzw;
|
||||
vec4 NormalTex = texture2D_POMSwitch(normals, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD).xyzw;
|
||||
|
||||
#ifdef MATERIAL_AO
|
||||
Albedo.rgb *= NormalTex.b*0.5+0.5;
|
||||
@ -495,7 +496,7 @@ void main() {
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
||||
#ifdef WORLD
|
||||
vec4 SpecularTex = texture2D_POMSwitch(specular, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM);
|
||||
vec4 SpecularTex = texture2D_POMSwitch(specular, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD);
|
||||
|
||||
SpecularTex.r = max(SpecularTex.r, Puddle_shape);
|
||||
SpecularTex.g = max(SpecularTex.g, Puddle_shape*0.02);
|
||||
@ -546,8 +547,7 @@ void main() {
|
||||
|
||||
// hit glow effect...
|
||||
#ifdef ENTITIES
|
||||
Albedo.rgb = mix(Albedo.rgb, entityColor.rgb, entityColor.a);
|
||||
gl_FragData[2].a = mix(gl_FragData[2].a, 0.25, clamp(entityColor.a*5,0,1));
|
||||
Albedo.rgb = mix(Albedo.rgb, entityColor.rgb, clamp(entityColor.a*1.5,0,1));
|
||||
#endif
|
||||
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
|
@ -305,6 +305,7 @@ uniform float dhFarPlane;
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
uniform vec4 entityColor;
|
||||
/* RENDERTARGETS:2,7,11,14 */
|
||||
void main() {
|
||||
if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) {
|
||||
@ -521,6 +522,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
#endif
|
||||
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
|
||||
|
||||
#ifdef ENTITIES
|
||||
Albedo.rgb = mix(Albedo.rgb, entityColor.rgb, clamp(entityColor.a*1.5,0,1));
|
||||
#endif
|
||||
|
||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||
|
||||
|
@ -108,6 +108,7 @@ uniform ivec2 eyeBrightnessSmooth;
|
||||
|
||||
uniform vec3 sunVec;
|
||||
flat varying vec3 WsunVec;
|
||||
// flat varying vec3 unsigned_WsunVec;
|
||||
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
@ -157,6 +158,7 @@ float DH_inv_ld (float lindepth){
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
// return (2.0 * near) / (far + near - depth * (far - near));
|
||||
}
|
||||
float invertlinearDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return ((2.0*near/depth)-far-near)/(far-near);
|
||||
@ -805,7 +807,8 @@ void main() {
|
||||
|
||||
////// --------------- MASKS/BOOLEANS --------------- //////
|
||||
|
||||
bool iswater = texture2D(colortex7,texcoord).a > 0.99;
|
||||
float translucent_alpha = texture2D(colortex7,texcoord).a;
|
||||
bool iswater = translucent_alpha > 0.99;
|
||||
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
|
||||
bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01;
|
||||
bool entities = abs(dataUnpacked1.w-0.45) < 0.01;
|
||||
@ -1126,7 +1129,7 @@ void main() {
|
||||
float SkylightDir = ambientcoefs.y*1.5;
|
||||
if(isGrass) SkylightDir = 1.25;
|
||||
|
||||
float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.25 + (1.0-lightmap.y) * 0.75) ;
|
||||
float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1.0-lightmap.y)*0.8) ;
|
||||
|
||||
#if indirect_effect == 1
|
||||
skylight = min(skylight, (SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x) * 2.5);
|
||||
@ -1177,14 +1180,13 @@ void main() {
|
||||
#if indirect_effect == 0
|
||||
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
||||
Indirect_lighting *= AO;
|
||||
// Direct_lighting *= AO;
|
||||
#endif
|
||||
|
||||
#if indirect_effect == 1
|
||||
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
|
||||
|
||||
AO *= SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x;//*SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x;
|
||||
// AO *= exp((1-SSAO_SSS.x) * -10);
|
||||
AO *= SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x;
|
||||
// AO *= exp((1-SSAO_SSS.x) * -5);
|
||||
|
||||
SkySSS = SSAO_SSS.y;
|
||||
|
||||
@ -1193,7 +1195,7 @@ void main() {
|
||||
|
||||
// GTAO
|
||||
#if indirect_effect == 2
|
||||
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) );
|
||||
Indirect_lighting = AmbientLightColor/2.5;
|
||||
|
||||
vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + bnoise);
|
||||
if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0);
|
||||
@ -1203,8 +1205,8 @@ void main() {
|
||||
|
||||
// RTAO and/or SSGI
|
||||
#if indirect_effect == 3 || indirect_effect == 4
|
||||
// Indirect_lighting = AmbientLightColor;
|
||||
if (!hand) ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), lightmap.xy, AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass);
|
||||
Indirect_lighting = AmbientLightColor;
|
||||
if (!hand) ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), lightmap.xy, AmbientLightColor*2.5, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass);
|
||||
#endif
|
||||
|
||||
#if defined END_SHADER
|
||||
@ -1259,14 +1261,15 @@ void main() {
|
||||
|
||||
}
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec4 vlBehingTranslucents = BilateralUpscale_DH(colortex13, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0));
|
||||
#else
|
||||
vec4 vlBehingTranslucents = BilateralUpscale(colortex13, depthtex1, gl_FragCoord.xy, ld(z));
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb;
|
||||
if(translucent_alpha > 0.0 ){
|
||||
#ifdef DISTANT_HORIZONS
|
||||
vec4 vlBehingTranslucents = BilateralUpscale_DH(colortex13, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0));
|
||||
#else
|
||||
vec4 vlBehingTranslucents = BilateralUpscale(colortex13, depthtex1, gl_FragCoord.xy, ld(z));
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb;
|
||||
}
|
||||
|
||||
|
||||
//////// DEBUG VIEW STUFF
|
||||
|
@ -6,6 +6,7 @@
|
||||
#endif
|
||||
|
||||
flat varying vec3 WsunVec;
|
||||
// flat varying vec3 unsigned_WsunVec;
|
||||
flat varying vec3 averageSkyCol_Clouds;
|
||||
flat varying vec4 lightCol;
|
||||
|
||||
@ -52,6 +53,7 @@ void main() {
|
||||
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
|
||||
WsunVec = lightCol.a*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
// unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
|
||||
|
||||
#ifdef TAA
|
||||
|
@ -16,6 +16,7 @@ flat varying vec3 lightSourceColor;
|
||||
flat varying vec3 sunColor;
|
||||
flat varying vec3 moonColor;
|
||||
// flat varying vec3 zenithColor;
|
||||
// flat varying vec3 rayleighAborbance;
|
||||
|
||||
// flat varying vec3 WsunVec;
|
||||
|
||||
@ -231,9 +232,10 @@ if (gl_FragCoord.x > pixelPos6.x && gl_FragCoord.x < pixelPos6.x + 1 && gl_FragC
|
||||
|
||||
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||
gl_FragData[0] = vec4(sunColor,1.0);
|
||||
|
||||
if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||
if (gl_FragCoord.x > 9. && gl_FragCoord.x < 10. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||
gl_FragData[0] = vec4(moonColor,1.0);
|
||||
// if (gl_FragCoord.x > 16. && gl_FragCoord.x < 17. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
|
||||
// gl_FragData[0] = vec4(rayleighAborbance,1.0);
|
||||
#endif
|
||||
|
||||
|
||||
@ -273,7 +275,7 @@ 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);
|
||||
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition) * ( float(sunElevation > 1e-5)*2.0-1.0 );
|
||||
|
||||
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
|
||||
|
||||
@ -287,7 +289,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
sky = sky*clouds.a + clouds.rgb / 5.0;
|
||||
|
||||
sky = mix(dot(sky,vec3(0.333)) * vec3(0.5), sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5));
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), lightSourceColor*1.75, skyGroundCol/30.0);
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0);
|
||||
|
||||
sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0;
|
||||
|
||||
|
@ -156,11 +156,10 @@ void main() {
|
||||
|
||||
vec3 skyAbsorb = vec3(0.0);
|
||||
sunColor = calculateAtmosphere(vec3(0.0), sunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.0);
|
||||
sunColor = sunColorBase/4000. * skyAbsorb;
|
||||
|
||||
sunColor = sunColorBase/4000.0 * skyAbsorb;
|
||||
moonColor = moonColorBase/4000.0;
|
||||
|
||||
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
|
||||
lightSourceColor = (sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis) ;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#endif
|
||||
|
||||
flat varying vec3 sunColor;
|
||||
flat varying vec3 moonColor;
|
||||
// flat varying vec3 moonColor;
|
||||
flat varying vec3 averageSkyCol;
|
||||
|
||||
flat varying float tempOffsets;
|
||||
@ -73,9 +73,9 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(7.,-7.)/8.);
|
||||
float blueNoise(){
|
||||
#ifdef TAA
|
||||
return fract(texelFetch2D(noisetex, ivec2(1.0-gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||
#else
|
||||
return fract(texelFetch2D(noisetex, ivec2(1.0-gl_FragCoord.xy)%512, 0).a);
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ flat varying vec3 dailyWeatherParams0;
|
||||
flat varying vec3 dailyWeatherParams1;
|
||||
flat varying vec3 averageSkyCol;
|
||||
flat varying vec3 sunColor;
|
||||
flat varying vec3 moonColor;
|
||||
// flat varying vec3 moonColor;
|
||||
|
||||
|
||||
flat varying float tempOffsets;
|
||||
@ -32,9 +32,13 @@ void main() {
|
||||
|
||||
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
||||
sunColor = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
|
||||
// moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
|
||||
|
||||
// sunColor = texelFetch2D(colortex4,ivec2(8,37),0).rgb;
|
||||
// moonColor = texelFetch2D(colortex4,ivec2(9,37),0).rgb;
|
||||
|
||||
|
||||
WsunVec = ( float(sunElevation > 1e-5)*2-1. )*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition) * (float(sunElevation > 1e-5)*2.0-1.0);
|
||||
// WsunVec = normalize(LightDir);
|
||||
|
||||
tempOffsets = HaltonSeq2(frameCounter%10000);
|
||||
|
Reference in New Issue
Block a user