mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
Better ambient light for the nether. slightly better specular reflection of fog for the end
This commit is contained in:
parent
234b55070a
commit
6d73d842cf
@ -8,7 +8,7 @@ const bool colortex5MipmapEnabled = true;
|
||||
const bool colortex12MipmapEnabled = true;
|
||||
|
||||
// #ifndef Rough_reflections
|
||||
// const bool colortex4MipmapEnabled = true;
|
||||
// const bool colortex4MipmapEnabled = true;
|
||||
// #endif
|
||||
|
||||
const bool shadowHardwareFiltering = true;
|
||||
@ -1208,6 +1208,8 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef Specular_Reflections
|
||||
// MaterialReflections(FINAL_COLOR, SpecularTex.r, SpecularTex.ggg, albedo, WsunVec, (Shadows*NdotL)*DirectLightColor, lightmap.y, slopednormal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg, interleaved_gradientNoise()), hand, entities);
|
||||
|
||||
vec3 specNoise = vec3(blueNoise(gl_FragCoord.xy).rg, interleaved_gradientNoise());
|
||||
|
||||
DoSpecularReflections(FINAL_COLOR, fragpos, np3, WsunVec, specNoise, slopednormal, SpecularTex.r, SpecularTex.g, albedo, DirectLightColor*NdotL*Shadows, lightmap.y, hand);
|
||||
|
@ -157,12 +157,14 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
|
||||
if(viewVector.y < -0.025) sky = sky * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
|
||||
|
||||
|
||||
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), sunColor, moonColor, averageSkyCol*5.0);
|
||||
sky = sky*clouds.a + clouds.rgb/5.0;
|
||||
|
||||
vec4 VL_Fog = getVolumetricRays(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), averageSkyCol);
|
||||
sky = sky*VL_Fog.a + VL_Fog.rgb*20;
|
||||
|
||||
// if(viewVector.y < -0.025) sky *= clamp( viewVector.y,0.0,1.0) ;
|
||||
gl_FragData[0] = vec4(sky,1.0);
|
||||
}
|
||||
|
||||
|
@ -44,11 +44,9 @@ vec3 DoAmbientLighting_Nether(vec3 FogColor, vec3 TorchColor, float Lightmap, ve
|
||||
LavaGlow *= clamp(exp2(-max((WorldPos.y - 50.0) / 5,0.0)),0.0,1.0);
|
||||
LavaGlow *= pow(Lightmap,0.2);
|
||||
|
||||
vec3 FogTint = FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0) * 0.05;
|
||||
FogColor = max(FogColor, vec3(0.05) * (MIN_LIGHT_AMOUNT*0.01 + nightVision*0.5) );
|
||||
|
||||
vec3 AmbientLight = max(vec3(0.05), (MIN_LIGHT_AMOUNT*0.01 + nightVision*0.5) );
|
||||
|
||||
return AmbientLight + FogTint + TorchLight + LavaGlow;
|
||||
return FogColor + TorchLight ;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,7 @@ vec4 GetVolumetricFog(
|
||||
vec3 dV = fragposition-start;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
|
||||
float maxLength = min(length(dVWorld),far)/length(dVWorld);
|
||||
float maxLength = min(length(dVWorld),far*25)/length(dVWorld);
|
||||
|
||||
dV *= maxLength;
|
||||
dVWorld *= maxLength;
|
||||
@ -80,6 +80,7 @@ vec4 GetVolumetricFog(
|
||||
vec3 vL0 = vec3(1.0,0.4,0.2) * exp(fireLight * -25) * exp(max(progressW.y-30,0.0) / -10) * 25;
|
||||
vL0 += vec3(0.8,0.8,1.0) * (1.0 - exp(Density * -1)) / 10 ;
|
||||
|
||||
|
||||
// do background fog lighting
|
||||
float Air = 0.01;
|
||||
vec3 vL1 = fogcolor / 20.0;
|
||||
|
@ -9,6 +9,7 @@ vec2 sphereToCarte(vec3 dir) {
|
||||
float lonlat = atan(-dir.x, -dir.z);
|
||||
return vec2(lonlat * (0.5/pi) +0.5,0.5*dir.y+0.5);
|
||||
}
|
||||
|
||||
vec3 skyFromTex(vec3 pos,sampler2D sampler){
|
||||
vec2 p = sphereToCarte(pos);
|
||||
return texture2D(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb;
|
||||
@ -17,6 +18,8 @@ vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
|
||||
vec2 p = sphereToCarte(pos);
|
||||
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb;
|
||||
}
|
||||
|
||||
|
||||
float w0(float a)
|
||||
{
|
||||
return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0);
|
||||
@ -87,5 +90,14 @@ vec4 skyCloudsFromTex(vec3 pos,sampler2D sampler){
|
||||
}
|
||||
vec4 skyCloudsFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
|
||||
vec2 p = sphereToCarte(pos);
|
||||
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5+257.,1.5)*texelSize,LOD);
|
||||
return texture2DLod(sampler,p*texelSize*256. + vec2(18.5 + 257., 1.5)*texelSize,LOD);
|
||||
}
|
||||
// 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-vec2(256*0.75,256*0.25))/150.+tempOffsets/150.,0.0,1.0);
|
||||
|
||||
// vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.33,1.0);
|
||||
|
||||
vec4 skyCloudsFromTexLOD2(vec3 pos,sampler2D sampler, float LOD){
|
||||
vec2 p = sphereToCarte(pos);
|
||||
return texture2DLod(sampler,p*texelSize*256. + vec2(256.0 - 256.0*0.12,1.5)*texelSize,LOD);
|
||||
}
|
@ -230,7 +230,12 @@ void DoSpecularReflections(
|
||||
// --------------- BACKGROUND REFLECTIONS
|
||||
// apply background reflections to the final color. make sure it does not exist based on the lightmap
|
||||
#ifdef Sky_reflection
|
||||
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD(L, colortex4, sqrt(Roughness) * 9.0).rgb / 30.0) * Metals;
|
||||
|
||||
#ifndef OVERWORLD
|
||||
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD2(L, colortex4, sqrt(Roughness) * 6.0).rgb / 30.0) * Metals;
|
||||
#else
|
||||
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD(L, colortex4, sqrt(Roughness) * 9.0).rgb / 30.0) * Metals;
|
||||
#endif
|
||||
|
||||
// take fresnel and lightmap levels into account and write to the final color
|
||||
Final_Reflection = mix_vec3(Output, Background_Reflection, Lightmap * RayContribution);
|
||||
|
@ -6,11 +6,8 @@
|
||||
#define NETHER
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
||||
flat varying vec3 avgAmbient;
|
||||
|
||||
flat varying vec2 TAA_Offset;
|
||||
flat varying float tempOffsets;
|
||||
|
||||
@ -85,7 +82,6 @@ vec2 RENDER_SCALE = vec2(1.0);
|
||||
|
||||
|
||||
#undef LIGHTSOURCE_REFLECTION
|
||||
#define NETHERSPECULAR
|
||||
#include "/lib/specular.glsl"
|
||||
|
||||
|
||||
@ -380,9 +376,22 @@ void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
|
||||
|
||||
|
||||
|
||||
vec3 cosineHemisphereSample(vec2 Xi, float roughness){
|
||||
float r = sqrt(Xi.x);
|
||||
float theta = 2.0 * 3.14159265359 * Xi.y;
|
||||
|
||||
float x = r * cos(theta);
|
||||
float y = r * sin(theta);
|
||||
|
||||
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
|
||||
}
|
||||
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
|
||||
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
||||
vec3 T = normalize(cross(UpVector, N));
|
||||
vec3 B = cross(N, T);
|
||||
|
||||
return vec3((T * H.x) + (B * H.y) + (N * H.z));
|
||||
}
|
||||
|
||||
void main() {
|
||||
float dirtAmount = Dirt_Amount;
|
||||
@ -432,8 +441,6 @@ void main() {
|
||||
float vanilla_AO = normalAndAO.a;
|
||||
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
|
||||
|
||||
|
||||
|
||||
bool iswater = texture2D(colortex7,texcoord).a > 0.99;
|
||||
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
|
||||
bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01;
|
||||
@ -453,10 +460,12 @@ void main() {
|
||||
|
||||
// vec3 FogColor = (gl_Fog.color.rgb / pow(0.00001 + dot(gl_Fog.color.rgb,vec3(0.3333)),1.0) ) * 0.2;
|
||||
// vec3 fogColor = (gl_Fog.color.rgb / max(pow(dot(gl_Fog.color.rgb,vec3(0.3333)),1.1),0.01) ) ;
|
||||
vec3 FogColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01) );
|
||||
// vec3 FogColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01) );
|
||||
|
||||
vec3 AmbientLightColor = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb / 30.0;
|
||||
|
||||
// do all ambient lighting stuff
|
||||
vec3 Indirect_lighting = DoAmbientLighting_Nether(FogColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
|
||||
vec3 Indirect_lighting = DoAmbientLighting_Nether(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
|
||||
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
||||
|
||||
@ -476,8 +485,13 @@ void main() {
|
||||
|
||||
if(lightningBolt) gl_FragData[0].rgb += vec3(77.0, 153.0, 255.0);
|
||||
|
||||
// gl_FragData[0].rgb = skyCloudsFromTexLOD2(np3, colortex4, 6).rgb / 30.0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ////// border Fog
|
||||
// if(Translucent_Programs > 0.0){
|
||||
// vec3 fragpos = toScreenSpace(vec3(texcoord-vec2(0.0)*texelSize*0.5,z));
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
||||
flat varying vec3 avgAmbient;
|
||||
// flat varying vec3 avgAmbient;
|
||||
|
||||
flat varying float tempOffsets;
|
||||
flat varying vec2 TAA_Offset;
|
||||
@ -46,6 +46,6 @@ void main() {
|
||||
#endif
|
||||
|
||||
|
||||
avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
// avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
zMults = vec3((far * near)*2.0,far+near,far-near);
|
||||
}
|
||||
|
@ -5,12 +5,13 @@
|
||||
#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 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;
|
||||
@ -74,20 +75,22 @@ const float[17] Slightmap = float[17](14.0,17.,19.0,22.0,24.0,28.0,31.0,40.0,60.
|
||||
void main() {
|
||||
/* DRAWBUFFERS:4 */
|
||||
|
||||
gl_FragData[0] = vec4(0.0);
|
||||
gl_FragData[0] = vec4(0.0,0.0,0.0,0.0);
|
||||
|
||||
vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0);
|
||||
//Sky gradient with clouds
|
||||
if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+257.){
|
||||
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-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 = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01)) / 30.0;
|
||||
// BackgroundColor *= abs(viewVector.y+0.5);
|
||||
vec3 BackgroundColor = vec3(0.0);
|
||||
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887));
|
||||
BackgroundColor += VL_Fog.rgb/5;
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., fract(frameCounter/1.6180339887));
|
||||
BackgroundColor += VL_Fog.rgb/3.0;
|
||||
|
||||
gl_FragData[0] = vec4(BackgroundColor,1.0);
|
||||
}
|
||||
@ -95,7 +98,7 @@ 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,0.07),0.0,65000.);
|
||||
gl_FragData[0].rgb = clamp(mix(temp,curr,0.05),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 )
|
||||
|
@ -79,11 +79,16 @@ void main() {
|
||||
gl_FragData[0] = vec4(0.0);
|
||||
|
||||
//Fog for reflections
|
||||
if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+257.){
|
||||
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
|
||||
// if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+257.){
|
||||
|
||||
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);
|
||||
|
||||
mat2x3 vl = getVolumetricRays(fract(frameCounter/1.6180339887),mat3(gbufferModelView)*viewVector*1024.,fract(frameCounter/2.6180339887));
|
||||
mat2x3 vl = getVolumetricRays(fract(frameCounter/1.6180339887),mat3(gbufferModelView)*viewVector*1024.,fract(frameCounter/2.6180339887));
|
||||
|
||||
float absorbance = dot(vl[1],vec3(0.22,0.71,0.07));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user