mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
Fix Emissives in end/nether. fix tiny labSSS curve issue
This commit is contained in:
@ -353,33 +353,49 @@ void main() {
|
||||
float noise = blueNoise();
|
||||
|
||||
vec3 fragpos = toScreenSpace(vec3(texcoord-vec2(tempOffset)*texelSize*0.5,z));
|
||||
vec3 fragpos_RTSHADOW = toScreenSpace(vec3(texcoord,z));
|
||||
vec3 p3 = mat3(gbufferModelViewInverse) * fragpos;
|
||||
vec3 np3 = normVec(p3);
|
||||
|
||||
|
||||
vec4 trpData = texture2D(colortex7,texcoord);
|
||||
bool iswater = trpData.a > 0.99;
|
||||
vec4 SpecularTex = texture2D(colortex8,texcoord);
|
||||
bool isEntities = texture2D(colortex10,texcoord).x > 0.0;
|
||||
vec4 data = texture2D(colortex1,texcoord); // terraom
|
||||
vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y));
|
||||
vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w));
|
||||
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
|
||||
|
||||
float Translucent_Programs = texture2D(colortex2,texcoord).a; // the shader for all translucent progams.
|
||||
// Normal //
|
||||
vec3 normal = decode(dataUnpacked0.yw) ;
|
||||
vec4 data = texture2D(colortex1,texcoord);
|
||||
vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y)); // albedo, masks
|
||||
vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w)); // normals, lightmaps
|
||||
// vec4 dataUnpacked2 = vec4(decodeVec2(data.z),decodeVec2(data.w));
|
||||
|
||||
vec3 albedo = toLinear(vec3(dataUnpacked0.xz,dataUnpacked1.x));
|
||||
vec2 lightmap = dataUnpacked1.yz;
|
||||
vec3 normal = decode(dataUnpacked0.yw);
|
||||
|
||||
////// --------------- UNPACK MISC --------------- //////
|
||||
|
||||
vec4 SpecularTex = texture2D(colortex8,texcoord);
|
||||
float LabSSS = clamp((-65.0 + SpecularTex.z * 255.0) / 190.0 ,0.0,1.0);
|
||||
|
||||
vec4 normalAndAO = texture2D(colortex15,texcoord);
|
||||
vec3 FlatNormals = normalAndAO.rgb * 2.0 - 1.0;
|
||||
float vanilla_AO = 1.0 - exp2(-5 * pow(1-normalAndAO.a,3)) ;
|
||||
vec3 slopednormal = normal;
|
||||
|
||||
#ifdef POM
|
||||
#ifdef Horrible_slope_normals
|
||||
vec3 ApproximatedFlatNormal = normalize(cross(dFdx(p3), dFdy(p3))); // it uses depth that has POM written to it.
|
||||
slopednormal = normalize(clamp(normal, ApproximatedFlatNormal*2.0 - 1.0, ApproximatedFlatNormal*2.0 + 1.0) );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec3 albedo = toLinear(vec3(dataUnpacked0.xz,dataUnpacked1.x));
|
||||
float vanilla_AO = normalAndAO.a;
|
||||
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
|
||||
|
||||
vec2 lightmap = dataUnpacked1.yz;
|
||||
bool translucent = abs(dataUnpacked1.w-0.5) <0.01;
|
||||
bool hand = abs(dataUnpacked1.w-0.75) <0.01;
|
||||
|
||||
|
||||
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;
|
||||
bool entities = abs(dataUnpacked1.w-0.45) < 0.01;
|
||||
|
||||
bool hand = abs(dataUnpacked1.w-0.75) < 0.01;
|
||||
// bool blocklights = abs(dataUnpacked1.w-0.8) <0.01;
|
||||
|
||||
if (z >= 1.0) {
|
||||
|
||||
@ -390,6 +406,8 @@ void main() {
|
||||
p3 += gbufferModelViewInverse[3].xyz;
|
||||
|
||||
// do all ambient lighting stuff
|
||||
|
||||
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
||||
vec3 Indirect_lighting = DoAmbientLighting_End(gl_Fog.color.rgb, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3) ;
|
||||
// Indirect_lighting = vec3(TORCH_R,TORCH_G,TORCH_B) * curveinvert(clamp(lightmap.x,0.0,1.0),2);
|
||||
|
||||
@ -436,24 +454,26 @@ void main() {
|
||||
gl_FragData[0].rgb = (Indirect_lighting + LightSource) * albedo;
|
||||
|
||||
#ifdef Specular_Reflections
|
||||
MaterialReflections_E(gl_FragData[0].rgb, SpecularTex.r, SpecularTex.ggg, albedo, normal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg,noise), hand, LightColor * LightFalloff, normalize(-LightPos), isEntities);
|
||||
MaterialReflections_E(gl_FragData[0].rgb, SpecularTex.r, SpecularTex.ggg, albedo, normal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg,noise), hand, LightColor * LightFalloff, normalize(-LightPos), entities);
|
||||
#endif
|
||||
|
||||
if(!hand) gl_FragData[0].rgb *= ssao(fragpos,noise,FlatNormals) * vanilla_AO;
|
||||
if(!hand) gl_FragData[0].rgb *= ssao(fragpos,noise,FlatNormals) * AO;
|
||||
|
||||
// if(lightningBolt) albedo.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) ;
|
||||
|
||||
LabEmission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
||||
|
||||
|
||||
#ifdef LabPBR_Emissives
|
||||
LabEmission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
////// border Fog
|
||||
if(Translucent_Programs > 0.0){
|
||||
vec3 fragpos = toScreenSpace(vec3(texcoord-vec2(0.0)*texelSize*0.5,z));
|
||||
float fogdistfade = 1.0 - clamp( exp(-pow(length(fragpos / far),2.)*5.0) ,0.0,1.0);
|
||||
// ////// border Fog
|
||||
// if(Translucent_Programs > 0.0){
|
||||
// vec3 fragpos = toScreenSpace(vec3(texcoord-vec2(0.0)*texelSize*0.5,z));
|
||||
// float fogdistfade = 1.0 - clamp( exp(-pow(length(fragpos / far),2.)*5.0) ,0.0,1.0);
|
||||
|
||||
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb*0.5*NetherFog_brightness, fogdistfade) ;
|
||||
}
|
||||
// gl_FragData[0].rgb = mix(gl_FragData[0].rgb, gl_Fog.color.rgb*0.5*NetherFog_brightness, fogdistfade) ;
|
||||
// }
|
||||
|
||||
|
||||
////// Water Fog
|
||||
|
Reference in New Issue
Block a user