mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-20 16:07:22 +08:00
make mask for leaves so ambient SSS can look good everywhere else
This commit is contained in:
parent
4345e0560e
commit
c46ac275df
@ -1,13 +1,15 @@
|
|||||||
|
|
||||||
#if MC_VERSION >= 11300
|
#if MC_VERSION >= 11300
|
||||||
|
|
||||||
|
block.2100 = minecraft:end_portal
|
||||||
|
|
||||||
####### ----- SSS and waving ----- #######
|
####### ----- SSS and waving ----- #######
|
||||||
|
|
||||||
##ground waving
|
##ground waving
|
||||||
block.10001 = minecraft:beetroots minecraft:potatoes minecraft:carrots minecraft:wheat minecraft:nether_wart minecraft:kelp minecraft:large_fern:half=upper minecraft:peony:half=upper minecraft:rose_bush:half=upper minecraft:lilac:half=upper minecraft:crimson_roots minecraft:nether_sprouts minecraft:warped_roots minecraft:seagrass minecraft:tall_seagrass:half=upper minecraft:sunflower:half=upper minecraft:tall_grass:half=upper minecraft:wither_rose minecraft:lily_of_the_valley minecraft:cornflower minecraft:sweet_berry_bush minecraft:oxeye_daisy minecraft:pink_tulip minecraft:white_tulip minecraft:orange_tulip minecraft:red_tulip minecraft:azure_bluet minecraft:allium minecraft:blue_orchid minecraft:poppy minecraft:dandelion minecraft:grass minecraft:dead_bush minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling minecraft:fern
|
block.10001 = minecraft:beetroots minecraft:potatoes minecraft:carrots minecraft:wheat minecraft:nether_wart minecraft:kelp minecraft:large_fern:half=upper minecraft:peony:half=upper minecraft:rose_bush:half=upper minecraft:lilac:half=upper minecraft:crimson_roots minecraft:nether_sprouts minecraft:warped_roots minecraft:seagrass minecraft:tall_seagrass:half=upper minecraft:sunflower:half=upper minecraft:tall_grass:half=upper minecraft:wither_rose minecraft:lily_of_the_valley minecraft:cornflower minecraft:sweet_berry_bush minecraft:oxeye_daisy minecraft:pink_tulip minecraft:white_tulip minecraft:orange_tulip minecraft:red_tulip minecraft:azure_bluet minecraft:allium minecraft:blue_orchid minecraft:poppy minecraft:dandelion minecraft:grass minecraft:dead_bush minecraft:oak_sapling minecraft:spruce_sapling minecraft:birch_sapling minecraft:jungle_sapling minecraft:acacia_sapling minecraft:dark_oak_sapling minecraft:fern
|
||||||
|
|
||||||
##air waving
|
##air waving
|
||||||
block.10003 =minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:cherry_leaves minecraft:mangrove_leaves minecraft:vine minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves
|
block.10003 =minecraft:azalea_leaves minecraft:flowering_azalea_leaves minecraft:cherry_leaves minecraft:mangrove_leaves minecraft:vine minecraft:oak_leaves minecraft:spruce_leaves minecraft:birch_leaves minecraft:jungle_leaves minecraft:acacia_leaves minecraft:dark_oak_leaves
|
||||||
|
|
||||||
####### ----- SSS ----- #######
|
####### ----- SSS ----- #######
|
||||||
|
|
||||||
@ -38,7 +40,6 @@
|
|||||||
|
|
||||||
####### ----- misc ----- #######
|
####### ----- misc ----- #######
|
||||||
|
|
||||||
block.222 = end_portal end_gateway end_portal_frame
|
|
||||||
|
|
||||||
block.8 = minecraft:water minecraft:flowing_water
|
block.8 = minecraft:water minecraft:flowing_water
|
||||||
|
|
||||||
|
@ -622,15 +622,17 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
|||||||
return scatter;
|
return scatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
|
void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal, bool isleaves){
|
||||||
ivec2 pos = ivec2(gl_FragCoord.xy);
|
ivec2 pos = ivec2(gl_FragCoord.xy);
|
||||||
const float tan70 = tan(70.*3.14/180.);
|
const float tan70 = tan(70.*3.14/180.);
|
||||||
|
|
||||||
float dist = 1.0 + (clamp(fragpos.z*fragpos.z/50.0,0,2)); // shrink sample size as distance increases
|
float dist = 1.0 + (clamp(fragpos.z*fragpos.z/50.0,0,2)); // shrink sample size as distance increases
|
||||||
float mulfov2 = gbufferProjection[1][1]/(tan70 * dist);
|
float mulfov2 = gbufferProjection[1][1]/(tan70 * dist);
|
||||||
|
|
||||||
|
float maxR2_2 = fragpos.z*fragpos.z*mulfov2*2./50.0;
|
||||||
|
|
||||||
float dist3 = clamp(1-exp( fragpos.z*fragpos.z / -50),0,1);
|
float dist3 = clamp(1-exp( fragpos.z*fragpos.z / -50),0,1);
|
||||||
float maxR2_2 = mix(10, fragpos.z*fragpos.z*mulfov2*2./50.0, dist3);
|
if(isleaves) maxR2_2 = mix(10, maxR2_2, dist3);
|
||||||
|
|
||||||
float rd = mulfov2 * 0.1;
|
float rd = mulfov2 * 0.1;
|
||||||
|
|
||||||
@ -738,7 +740,7 @@ vec3 Moon(vec3 PlayerPos, vec3 WorldSunVec, vec3 Color, inout vec3 occludeStars)
|
|||||||
|
|
||||||
#include "lib/PhotonGTAO.glsl"
|
#include "lib/PhotonGTAO.glsl"
|
||||||
|
|
||||||
|
uniform float detectThunderStorm;
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
@ -822,9 +824,8 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
|
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
|
||||||
bool boatMask = abs(dataUnpacked1.w-0.6) <0.01;
|
bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01;
|
||||||
// bool translucent2 = abs(dataUnpacked1.w-0.6) <0.01; // Weak translucency
|
// bool translucent2 = abs(dataUnpacked1.w-0.6) <0.01; // Weak translucency
|
||||||
// bool translucent3 = abs(dataUnpacked1.w-0.55) <0.01; // all blocks
|
|
||||||
// bool translucent4 = abs(dataUnpacked1.w-0.65) <0.01; // Weak translucency
|
// bool translucent4 = abs(dataUnpacked1.w-0.65) <0.01; // Weak translucency
|
||||||
bool entities = abs(dataUnpacked1.w-0.45) < 0.01;
|
bool entities = abs(dataUnpacked1.w-0.45) < 0.01;
|
||||||
|
|
||||||
@ -1043,7 +1044,7 @@ void main() {
|
|||||||
|
|
||||||
#ifdef Ambient_SSS
|
#ifdef Ambient_SSS
|
||||||
#if indirect_effect != 1
|
#if indirect_effect != 1
|
||||||
if (!hand) ScreenSpace_SSS(SkySSS, fragpos, blueNoise(gl_FragCoord.xy).rg, FlatNormals);
|
if (!hand) ScreenSpace_SSS(SkySSS, fragpos, blueNoise(gl_FragCoord.xy).rg, FlatNormals, isLeaf);
|
||||||
#endif
|
#endif
|
||||||
Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3) * pow(1.0-clamp(abs(ambientCoefs.y+0.5),0.0,1.0),0.1) ;
|
Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3) * pow(1.0-clamp(abs(ambientCoefs.y+0.5),0.0,1.0),0.1) ;
|
||||||
// Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3);
|
// Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3);
|
||||||
@ -1143,9 +1144,11 @@ void main() {
|
|||||||
LabEmission(FINAL_COLOR, albedo, SpecularTex.a);
|
LabEmission(FINAL_COLOR, albedo, SpecularTex.a);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
if(lightningBolt) FINAL_COLOR.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) * 150.0;
|
// if(lightningBolt) FINAL_COLOR.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0;
|
||||||
|
|
||||||
gl_FragData[0].rgb = FINAL_COLOR;
|
gl_FragData[0].rgb = FINAL_COLOR;
|
||||||
|
// if(LabSSS > 0.0) gl_FragData[0].rgb = vec3(0,25,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// ----- Apply Clouds ----- //////
|
////// ----- Apply Clouds ----- //////
|
||||||
@ -1168,8 +1171,5 @@ void main() {
|
|||||||
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));
|
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// gl_FragData[0].rgb *= GetCloudSkyOcclusion(p3 + cameraPosition);
|
|
||||||
|
|
||||||
/* DRAWBUFFERS:3 */
|
/* DRAWBUFFERS:3 */
|
||||||
}
|
}
|
@ -197,6 +197,63 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
|
|||||||
inColor += vL;
|
inColor += vL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec4 RainRays(vec3 rayStart, vec3 rayEnd, float rayLength, float dither, vec3 ambient, vec3 lightSource, float VdotL){
|
||||||
|
int spCount = 8;
|
||||||
|
|
||||||
|
vec3 start = toShadowSpaceProjected(rayStart);
|
||||||
|
vec3 end = toShadowSpaceProjected(rayEnd);
|
||||||
|
vec3 dV = (end-start);
|
||||||
|
|
||||||
|
|
||||||
|
//limit ray length at 32 blocks for performance and reducing integration error
|
||||||
|
//you can't see above this anyway
|
||||||
|
float maxZ = min(rayLength,1000)/(1e-8+rayLength);
|
||||||
|
|
||||||
|
// min(length(dVWorld),far)/length(dVWorld);
|
||||||
|
dV *= maxZ;
|
||||||
|
vec3 dVWorld = mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ;
|
||||||
|
rayLength *= maxZ;
|
||||||
|
float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength;
|
||||||
|
vec3 progressW = (gbufferModelViewInverse[3].xyz+cameraPosition);
|
||||||
|
vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float absorbance = 1.0;
|
||||||
|
vec3 vL = vec3(0.0);
|
||||||
|
|
||||||
|
vec3 mC = vec3(fog_coefficientMieR*1e-6, fog_coefficientMieG*1e-6, fog_coefficientMieB*1e-6);
|
||||||
|
|
||||||
|
|
||||||
|
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
||||||
|
float mie = phaseg(VdotL,0.7);
|
||||||
|
float rayL = phaseRayleigh(VdotL);
|
||||||
|
|
||||||
|
float cloudShadow = 1;
|
||||||
|
float expFactor = 11.0;
|
||||||
|
for (int i=0;i<spCount;i++) {
|
||||||
|
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
|
||||||
|
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0); //step length (derivative)
|
||||||
|
|
||||||
|
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||||
|
|
||||||
|
float sh = 1.0;
|
||||||
|
#ifdef VL_CLOUDS_SHADOWS
|
||||||
|
sh *= GetCloudShadow_VLFOG(progressW,WsunVec);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float density = clamp(CumulusHeight - progressW.y,0,1) ;
|
||||||
|
vec3 m = density*mC;
|
||||||
|
vec3 DirectLight = (lightSource*sh) * (m*mie);
|
||||||
|
|
||||||
|
vec3 vL0 = DirectLight*25 ;
|
||||||
|
|
||||||
|
|
||||||
|
vL += (vL0 - vL0 * exp(-m*dd*rayLength)) / (m+0.00000001)*absorbance;
|
||||||
|
absorbance *= dot(clamp(exp(-m*dd*rayLength),0.0,1.0), vec3(0.333333));
|
||||||
|
}
|
||||||
|
return vec4(vL,0);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
@ -218,7 +275,15 @@ void main() {
|
|||||||
|
|
||||||
#ifdef Cloud_Fog
|
#ifdef Cloud_Fog
|
||||||
vec4 VL_CLOUDFOG = InsideACloudFog(fragpos, vec2(R2_dither(),blueNoise()), lightCol.rgb/80., moonColor/150., (avgAmbient*2.0) * 8./150./3.);
|
vec4 VL_CLOUDFOG = InsideACloudFog(fragpos, vec2(R2_dither(),blueNoise()), lightCol.rgb/80., moonColor/150., (avgAmbient*2.0) * 8./150./3.);
|
||||||
gl_FragData[0] = clamp(VL_CLOUDFOG,0.0,65000.);
|
|
||||||
|
// vec4 rays = vec4(0.0);
|
||||||
|
|
||||||
|
// if(rainStrength > 0.0){
|
||||||
|
// rays = RainRays(vec3(0.0), fragpos, length(fragpos), R2_dither(), (avgAmbient*2.0) * 8./150./3., lightCol.rgb, dot(normalize(fragpos), normalize(sunVec) ));
|
||||||
|
// VL_CLOUDFOG += rays * rainStrength;
|
||||||
|
// }
|
||||||
|
|
||||||
|
gl_FragData[0] = clamp(VL_CLOUDFOG ,0.0,65000.);
|
||||||
#else
|
#else
|
||||||
vec4 VL_Fog = getVolumetricRays(fragpos,blueNoise(),avgAmbient);
|
vec4 VL_Fog = getVolumetricRays(fragpos,blueNoise(),avgAmbient);
|
||||||
gl_FragData[0] = clamp(VL_Fog,0.0,65000.);
|
gl_FragData[0] = clamp(VL_Fog,0.0,65000.);
|
||||||
|
@ -282,8 +282,6 @@ void main() {
|
|||||||
float rainDrops = clamp(texture2D(colortex9,texcoord).a, 0.0,1.0);
|
float rainDrops = clamp(texture2D(colortex9,texcoord).a, 0.0,1.0);
|
||||||
if(rainDrops > 0.0) vl.a *= clamp(1.0 - pow(rainDrops*5.0,2),0.0,1.0);
|
if(rainDrops > 0.0) vl.a *= clamp(1.0 - pow(rainDrops*5.0,2),0.0,1.0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// lava.
|
/// lava.
|
||||||
if (isEyeInWater == 2){
|
if (isEyeInWater == 2){
|
||||||
color.rgb = vec3(4.0,0.5,0.1);
|
color.rgb = vec3(4.0,0.5,0.1);
|
||||||
|
@ -8,6 +8,4 @@ entity.1100 = slime giant ender_dragon ghast sheep
|
|||||||
#weak sss (same as weak sss for blocks)
|
#weak sss (same as weak sss for blocks)
|
||||||
entity.1200 = player frog chicken snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned elder_gaurdian endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager wither trader_llama
|
entity.1200 = player frog chicken snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned elder_gaurdian endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager wither trader_llama
|
||||||
|
|
||||||
entity.12345 = minecraft:lightning_bolt
|
entity.12345 = minecraft:lightning_bolt weather2:lightning_bolt
|
||||||
|
|
||||||
entity.2468 = minecraft:boat
|
|
@ -32,8 +32,9 @@ uniform int framemod8;
|
|||||||
#ifdef POM
|
#ifdef POM
|
||||||
varying vec4 vtexcoordam; // .st for add, .pq for mul
|
varying vec4 vtexcoordam; // .st for add, .pq for mul
|
||||||
varying vec4 vtexcoord;
|
varying vec4 vtexcoord;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "/lib/res_params.glsl"
|
#include "/lib/res_params.glsl"
|
||||||
varying vec4 lmtexcoord;
|
varying vec4 lmtexcoord;
|
||||||
|
|
||||||
@ -81,6 +82,8 @@ in vec3 velocity;
|
|||||||
flat varying float blockID;
|
flat varying float blockID;
|
||||||
flat varying float EMISSIVE;
|
flat varying float EMISSIVE;
|
||||||
flat varying int LIGHTNING;
|
flat varying int LIGHTNING;
|
||||||
|
flat varying int PORTAL;
|
||||||
|
|
||||||
flat varying float HELD_ITEM_BRIGHTNESS;
|
flat varying float HELD_ITEM_BRIGHTNESS;
|
||||||
|
|
||||||
flat varying int PHYSICSMOD_SNOW;
|
flat varying int PHYSICSMOD_SNOW;
|
||||||
@ -186,8 +189,13 @@ vec3 toClipSpace3(vec3 viewSpacePosition) {
|
|||||||
{
|
{
|
||||||
return texture2DGradARB(texture,fract(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy);
|
return texture2DGradARB(texture,fract(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy);
|
||||||
}
|
}
|
||||||
|
vec4 readNoise(in vec2 coord)
|
||||||
|
{
|
||||||
|
return texture2DGradARB(noisetex,(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
float luma(vec3 color) {
|
float luma(vec3 color) {
|
||||||
return dot(color,vec3(0.21, 0.72, 0.07));
|
return dot(color,vec3(0.21, 0.72, 0.07));
|
||||||
}
|
}
|
||||||
@ -229,6 +237,12 @@ vec3 blackbody2(float Temp)
|
|||||||
return srgbToLinear2(col);
|
return srgbToLinear2(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uniform float near;
|
||||||
|
|
||||||
|
|
||||||
|
float ld(float dist) {
|
||||||
|
return (2.0 * near) / (far + near - dist * (far - near));
|
||||||
|
}
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
//////////////////////////////VOID MAIN//////////////////////////////
|
//////////////////////////////VOID MAIN//////////////////////////////
|
||||||
@ -275,7 +289,7 @@ void main() {
|
|||||||
#ifndef HAND
|
#ifndef HAND
|
||||||
#ifdef WORLD
|
#ifdef WORLD
|
||||||
#ifdef Puddles
|
#ifdef Puddles
|
||||||
Puddle_shape = (1.0 - clamp(exp(-15 * pow(texture2D(noisetex, worldpos.xz * (0.015 * Puddle_Size) ).b ,5)),0,1)) * lightmap ;
|
Puddle_shape = (1.0 - clamp(exp(-15 * pow(texture2D(noisetex, worldpos.xz * (0.020 * Puddle_Size) ).b ,5)),0,1)) * lightmap ;
|
||||||
Puddle_shape *= clamp( viewToWorld(normal).y*0.5+0.5 ,0.0,1.0);
|
Puddle_shape *= clamp( viewToWorld(normal).y*0.5+0.5 ,0.0,1.0);
|
||||||
Puddle_shape *= rainfall;
|
Puddle_shape *= rainfall;
|
||||||
#endif
|
#endif
|
||||||
@ -294,7 +308,7 @@ void main() {
|
|||||||
gl_FragDepth = gl_FragCoord.z;
|
gl_FragDepth = gl_FragCoord.z;
|
||||||
|
|
||||||
#ifdef WORLD
|
#ifdef WORLD
|
||||||
if (dist < MAX_OCCLUSION_DISTANCE) {
|
if (dist < MAX_OCCLUSION_DISTANCE && PORTAL > 0) {
|
||||||
|
|
||||||
float depthmap = readNormal(vtexcoord.st).a;
|
float depthmap = readNormal(vtexcoord.st).a;
|
||||||
float used_POM_DEPTH = 1.0;
|
float used_POM_DEPTH = 1.0;
|
||||||
@ -331,6 +345,8 @@ void main() {
|
|||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -340,6 +356,41 @@ void main() {
|
|||||||
|
|
||||||
vec4 Albedo = texture2DGradARB(texture, adjustedTexCoord.xy, dcdx,dcdy) * color;
|
vec4 Albedo = texture2DGradARB(texture, adjustedTexCoord.xy, dcdx,dcdy) * color;
|
||||||
|
|
||||||
|
float endportalGLow = 0;
|
||||||
|
// if (dist < MAX_OCCLUSION_DISTANCE && PORTAL > 0) {
|
||||||
|
|
||||||
|
// Albedo = vec4(0,0,0,1);
|
||||||
|
// float used_POM_DEPTH = 1.0;
|
||||||
|
// float depth = 0.2;
|
||||||
|
|
||||||
|
// if ( viewVector.z < 0.0) {
|
||||||
|
// float noise = interleaved_gradientNoise_temp();
|
||||||
|
|
||||||
|
// vec3 interval = (viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS * POM_DEPTH) * 0.6 ;
|
||||||
|
// used_POM_DEPTH = 1.0;
|
||||||
|
|
||||||
|
// vec3 coord = vec3(-abs(worldpos.zx)/4, 1.0);
|
||||||
|
|
||||||
|
// coord += interval * noise;
|
||||||
|
|
||||||
|
// float sumVec = noise;
|
||||||
|
|
||||||
|
// for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - depth + depth * (1-readNoise(coord.st).r - readNoise((-coord.st*3 )).b*0.2) ) < coord.p && coord.p >= 0.0; ++loopCount) {
|
||||||
|
// coord = coord+interval ;
|
||||||
|
// sumVec += 1.0 ;
|
||||||
|
|
||||||
|
// endportalGLow += 0.01*0.6;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// vec3 truePos = fragpos + sumVec*inverse(tbnMatrix)*interval;
|
||||||
|
|
||||||
|
|
||||||
|
// Albedo.rgb += vec3(0.5,0.75,1.0) * sqrt(endportalGLow);
|
||||||
|
// endportalGLow = clamp(pow(endportalGLow*3.5,5),0,1);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENTITIES
|
#ifdef ENTITIES
|
||||||
if(NameTags == 1) Albedo = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color;
|
if(NameTags == 1) Albedo = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color;
|
||||||
@ -425,6 +476,8 @@ void main() {
|
|||||||
#else
|
#else
|
||||||
gl_FragData[2].a = EMISSIVE;
|
gl_FragData[2].a = EMISSIVE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(PORTAL > 0) gl_FragData[2].a = clamp(endportalGLow * 0.9 ,0,0.9);
|
||||||
|
|
||||||
#if SSS_TYPE == 0
|
#if SSS_TYPE == 0
|
||||||
gl_FragData[2].b = 0.0;
|
gl_FragData[2].b = 0.0;
|
||||||
@ -542,7 +595,12 @@ void main() {
|
|||||||
#ifdef WORLD
|
#ifdef WORLD
|
||||||
vec4 Albedo = texture2D(texture, lmtexcoord.xy, bias) * color;
|
vec4 Albedo = texture2D(texture, lmtexcoord.xy, bias) * color;
|
||||||
|
|
||||||
if(LIGHTNING > 0) Albedo = vec4(1);
|
#ifdef WhiteWorld
|
||||||
|
Albedo.rgb = vec3(1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(LIGHTNING > 0) Albedo = vec4(1);
|
||||||
|
|
||||||
|
|
||||||
#ifdef AEROCHROME_MODE
|
#ifdef AEROCHROME_MODE
|
||||||
vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631), AEROCHROME_PINKNESS);
|
vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631), AEROCHROME_PINKNESS);
|
||||||
@ -569,9 +627,6 @@ void main() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WhiteWorld
|
|
||||||
Albedo.rgb = vec3(1.0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DISABLE_ALPHA_MIPMAPS
|
#ifdef DISABLE_ALPHA_MIPMAPS
|
||||||
Albedo.a = texture2DLod(texture,lmtexcoord.xy,0).a;
|
Albedo.a = texture2DLod(texture,lmtexcoord.xy,0).a;
|
||||||
|
@ -57,6 +57,7 @@ flat varying int LIGHTNING;
|
|||||||
flat varying float SSSAMOUNT;
|
flat varying float SSSAMOUNT;
|
||||||
flat varying float EMISSIVE;
|
flat varying float EMISSIVE;
|
||||||
flat varying int NameTags;
|
flat varying int NameTags;
|
||||||
|
flat varying int PORTAL;
|
||||||
|
|
||||||
in vec3 at_velocity;
|
in vec3 at_velocity;
|
||||||
out vec3 velocity;
|
out vec3 velocity;
|
||||||
@ -206,14 +207,22 @@ void main() {
|
|||||||
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal), 1.0);
|
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal), 1.0);
|
||||||
FlatNormals = normalMat.xyz;
|
FlatNormals = normalMat.xyz;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
blockID = mc_Entity.x;
|
blockID = mc_Entity.x;
|
||||||
velocity = at_velocity;
|
velocity = at_velocity;
|
||||||
|
|
||||||
NameTags = 0;
|
|
||||||
|
|
||||||
PHYSICSMOD_SNOW = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
PORTAL = 0;
|
||||||
|
|
||||||
|
#ifdef WORLD
|
||||||
|
if(blockEntityId == 2100) PORTAL = 255;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NameTags = 0;
|
||||||
|
PHYSICSMOD_SNOW = 0;
|
||||||
|
|
||||||
#ifdef ENTITIES
|
#ifdef ENTITIES
|
||||||
|
|
||||||
#ifdef ENTITY_PHYSICSMOD_SNOW
|
#ifdef ENTITY_PHYSICSMOD_SNOW
|
||||||
@ -227,9 +236,11 @@ PHYSICSMOD_SNOW = 0;
|
|||||||
// if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1);
|
// if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1);
|
||||||
|
|
||||||
if(entityId == 1100 || entityId == 1200 || entityId == 2468) normalMat.a = 0.45;
|
if(entityId == 1100 || entityId == 1200 || entityId == 2468) normalMat.a = 0.45;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(mc_Entity.x == 10003) normalMat.a = 0.55;
|
||||||
|
|
||||||
/////// ----- EMISSIVE STUFF ----- ///////
|
/////// ----- EMISSIVE STUFF ----- ///////
|
||||||
EMISSIVE = 0.0;
|
EMISSIVE = 0.0;
|
||||||
|
@ -69,7 +69,6 @@ flat varying vec3 avgAmbient;
|
|||||||
#include "lib/clouds.glsl"
|
#include "lib/clouds.glsl"
|
||||||
#include "lib/stars.glsl"
|
#include "lib/stars.glsl"
|
||||||
#include "lib/volumetricClouds.glsl"
|
#include "lib/volumetricClouds.glsl"
|
||||||
|
|
||||||
#define OVERWORLD
|
#define OVERWORLD
|
||||||
#include "lib/diffuse_lighting.glsl"
|
#include "lib/diffuse_lighting.glsl"
|
||||||
|
|
||||||
|
@ -299,6 +299,7 @@ const float shadowDistanceRenderMul = -1.0; //[-1.0 1.0] THIS WILL BREAK SUBSURF
|
|||||||
#define SSR_STEPS 30 //[10 15 20 25 30 35 40 50 100 200 400]
|
#define SSR_STEPS 30 //[10 15 20 25 30 35 40 50 100 200 400]
|
||||||
#define SUN_MICROFACET_SPECULAR // If enabled will use realistic rough microfacet model, else will just reflect the sun. No performance impact.
|
#define SUN_MICROFACET_SPECULAR // If enabled will use realistic rough microfacet model, else will just reflect the sun. No performance impact.
|
||||||
#define USE_QUARTER_RES_DEPTH // Uses a quarter resolution depth buffer to raymarch screen space reflections, improves performance but may introduce artifacts
|
#define USE_QUARTER_RES_DEPTH // Uses a quarter resolution depth buffer to raymarch screen space reflections, improves performance but may introduce artifacts
|
||||||
|
#define Dynamic_SSR_quality // rougher reflections have lower quality. this improves performance a bit in alot of scenes
|
||||||
|
|
||||||
#ifdef Specular_Reflections
|
#ifdef Specular_Reflections
|
||||||
#define Puddles // yes
|
#define Puddles // yes
|
||||||
|
@ -134,7 +134,7 @@ vec3 rayTraceSpeculars(vec3 dir,vec3 position,float dither, float quality, bool
|
|||||||
spos += stepv;
|
spos += stepv;
|
||||||
|
|
||||||
//small bias
|
//small bias
|
||||||
float biasamount = (0.0002 + 0.0015*depthcancleoffset ) / dist;
|
float biasamount = (0.0002 + 0.0015*pow(depthcancleoffset,5) ) / dist;
|
||||||
// float biasamount = 0.0002 / dist;
|
// float biasamount = 0.0002 / dist;
|
||||||
if(hand) biasamount = 0.01;
|
if(hand) biasamount = 0.01;
|
||||||
minZ = maxZ-biasamount / ld(spos.z);
|
minZ = maxZ-biasamount / ld(spos.z);
|
||||||
@ -147,10 +147,29 @@ vec3 rayTraceSpeculars(vec3 dir,vec3 position,float dither, float quality, bool
|
|||||||
return vec3(1.1);
|
return vec3(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// vec3 sampleGGXVNDF(vec3 V_, float roughness, float U1, float U2){
|
||||||
|
// // stretch view
|
||||||
|
// vec3 V = normalize(vec3(roughness * V_.x, roughness * V_.y, V_.z));
|
||||||
|
// // orthonormal basis
|
||||||
|
// vec3 T1 = (V.z < 0.9999) ? normalize(cross(V, vec3(0,0,1))) : vec3(1,0,0);
|
||||||
|
// vec3 T2 = cross(T1, V);
|
||||||
|
// // sample point with polar coordinates (r, phi)
|
||||||
|
// float a = 1.0 / (1.0 + V.z);
|
||||||
|
// float r = sqrt(U1*0.25);
|
||||||
|
// float phi = (U2<a) ? U2/a * 3.141592653589793 : 3.141592653589793 + (U2-a)/(1.0-a) * 3.141592653589793;
|
||||||
|
// float P1 = r*cos(phi);
|
||||||
|
// float P2 = r*sin(phi)*((U2<a) ? 1.0 : V.z);
|
||||||
|
// // compute normal
|
||||||
|
// vec3 N = P1*T1 + P2*T2 + sqrt(max(0.0, 1.0 - P1*P1 - P2*P2))*V;
|
||||||
|
// // unstretch
|
||||||
|
// N = normalize(vec3(roughness*N.x, roughness*N.y, N.z));
|
||||||
|
// return N;
|
||||||
|
// }
|
||||||
|
|
||||||
float xonk_fma(float a,float b,float c){
|
float xonk_fma(float a,float b,float c){
|
||||||
return a * b + c;
|
return a * b + c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// thank you Zombye | the paper: https://ggx-research.github.io/publication/2023/06/09/publication-ggx.html
|
//// thank you Zombye | the paper: https://ggx-research.github.io/publication/2023/06/09/publication-ggx.html
|
||||||
vec3 SampleVNDFGGX(
|
vec3 SampleVNDFGGX(
|
||||||
vec3 viewerDirection, // Direction pointing towards the viewer, oriented such that +Z corresponds to the surface normal
|
vec3 viewerDirection, // Direction pointing towards the viewer, oriented such that +Z corresponds to the surface normal
|
||||||
@ -178,28 +197,9 @@ vec3 SampleVNDFGGX(
|
|||||||
return normalize(vec3(alpha * halfway.xy, halfway.z));
|
return normalize(vec3(alpha * halfway.xy, halfway.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 sampleGGXVNDF(vec3 V_, float roughness, float U1, float U2){
|
|
||||||
// stretch view
|
|
||||||
vec3 V = normalize(vec3(roughness * V_.x, roughness * V_.y, V_.z));
|
|
||||||
// orthonormal basis
|
|
||||||
vec3 T1 = (V.z < 0.9999) ? normalize(cross(V, vec3(0,0,1))) : vec3(1,0,0);
|
|
||||||
vec3 T2 = cross(T1, V);
|
|
||||||
// sample point with polar coordinates (r, phi)
|
|
||||||
float a = 1.0 / (1.0 + V.z);
|
|
||||||
float r = sqrt(U1*0.25);
|
|
||||||
float phi = (U2<a) ? U2/a * 3.141592653589793 : 3.141592653589793 + (U2-a)/(1.0-a) * 3.141592653589793;
|
|
||||||
float P1 = r*cos(phi);
|
|
||||||
float P2 = r*sin(phi)*((U2<a) ? 1.0 : V.z);
|
|
||||||
// compute normal
|
|
||||||
vec3 N = P1*T1 + P2*T2 + sqrt(max(0.0, 1.0 - P1*P1 - P2*P2))*V;
|
|
||||||
// unstretch
|
|
||||||
N = normalize(vec3(roughness*N.x, roughness*N.y, N.z));
|
|
||||||
return N;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
|
vec3 GGX(vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
|
||||||
r = pow(r,2.5);
|
r = max(pow(r,2.5), 0.0001);
|
||||||
// r*=r;
|
|
||||||
|
|
||||||
vec3 h = l + v;
|
vec3 h = l + v;
|
||||||
float hn = inversesqrt(dot(h, h));
|
float hn = inversesqrt(dot(h, h));
|
||||||
@ -255,7 +255,6 @@ void MaterialReflections(
|
|||||||
#ifdef Rough_reflections
|
#ifdef Rough_reflections
|
||||||
int seed = frameCounter%40000;
|
int seed = frameCounter%40000;
|
||||||
vec2 ij = fract(R2_samples_spec(seed) + noise.rg) ;
|
vec2 ij = fract(R2_samples_spec(seed) + noise.rg) ;
|
||||||
// vec3 H = sampleGGXVNDF(normSpaceView, roughness, ij.x, ij.y);
|
|
||||||
vec3 H = SampleVNDFGGX(normSpaceView, vec2(roughness), ij.xy);
|
vec3 H = SampleVNDFGGX(normSpaceView, vec2(roughness), ij.xy);
|
||||||
|
|
||||||
if(hand) H = normalize(vec3(0.0,0.0,1.0));
|
if(hand) H = normalize(vec3(0.0,0.0,1.0));
|
||||||
@ -286,8 +285,15 @@ void MaterialReflections(
|
|||||||
|
|
||||||
#ifdef Screen_Space_Reflections
|
#ifdef Screen_Space_Reflections
|
||||||
float rayQuality = mix_float(reflection_quality,6.0,rayContribLuma); // Scale quality with ray contribution
|
float rayQuality = mix_float(reflection_quality,6.0,rayContribLuma); // Scale quality with ray contribution
|
||||||
if(hand) {rayQuality = max(rayQuality,30.0); noise.b = 0.5 + (noise.b-0.5);}
|
|
||||||
|
#ifndef Dynamic_SSR_quality
|
||||||
|
rayQuality = reflection_quality;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
noise.b = mix_float(noise.b, 0.5 + (noise.b-0.5),rayContribLuma);
|
||||||
|
if(hand) {rayQuality = max(rayQuality,30.0); noise.b = 0.5 + (noise.b-0.5);}
|
||||||
|
|
||||||
vec3 rtPos = rayTraceSpeculars(mat3(gbufferModelView) * L, fragpos.xyz, noise.b, rayQuality, hand, reflectLength);
|
vec3 rtPos = rayTraceSpeculars(mat3(gbufferModelView) * L, fragpos.xyz, noise.b, rayQuality, hand, reflectLength);
|
||||||
|
|
||||||
float LOD = clamp(reflectLength * 6.0, 0.0,6.0);
|
float LOD = clamp(reflectLength * 6.0, 0.0,6.0);
|
||||||
@ -306,6 +312,8 @@ void MaterialReflections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if the f0 is within the metal ranges, then tint by albedo if it's true.
|
// check if the f0 is within the metal ranges, then tint by albedo if it's true.
|
||||||
|
// // the brightening is disgusting
|
||||||
|
// vec3 Metals = f0.y > 229.5/255.0 ? clamp((albedo / max(pow(luma(albedo),0.1),0.4)) + fresnel,0.0,1.0) : vec3(1.0);
|
||||||
vec3 Metals = f0.y > 229.5/255.0 ? clamp(albedo + fresnel,0.0,1.0) : vec3(1.0);
|
vec3 Metals = f0.y > 229.5/255.0 ? clamp(albedo + fresnel,0.0,1.0) : vec3(1.0);
|
||||||
|
|
||||||
SunReflection *= Metals;
|
SunReflection *= Metals;
|
||||||
|
@ -386,7 +386,7 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){
|
|||||||
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
// assume a flat layer of cloud, and stretch the sampled density along the sunvector, starting from some vertical layer in the cloud.
|
||||||
#ifdef Cumulus
|
#ifdef Cumulus
|
||||||
vec3 lowShadowStart = WorldPos + WorldSpace_sunVec/abs(WorldSpace_sunVec.y) * max((MaxCumulusHeight - 60) - WorldPos.y,0.0) ;
|
vec3 lowShadowStart = WorldPos + WorldSpace_sunVec/abs(WorldSpace_sunVec.y) * max((MaxCumulusHeight - 60) - WorldPos.y,0.0) ;
|
||||||
shadow += GetCumulusDensity(lowShadowStart,0)*Cumulus_density;
|
shadow += max(GetCumulusDensity(lowShadowStart,0) - 0.2,0.0)*Cumulus_density;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Altostratus
|
#ifdef Altostratus
|
||||||
|
@ -82,7 +82,7 @@ screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds]
|
|||||||
screen.World = [LabPBR] [Waving_Stuff] [Water] <empty> AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED
|
screen.World = [LabPBR] [Waving_Stuff] [Water] <empty> AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED
|
||||||
### SPECULARS
|
### SPECULARS
|
||||||
screen.Reflections.columns=2
|
screen.Reflections.columns=2
|
||||||
screen.Reflections = Specular_Reflections Sun_specular_Strength Screen_Space_Reflections reflection_quality Rough_reflections Roughness_Threshold Sky_reflection
|
screen.Reflections = Specular_Reflections Sun_specular_Strength Screen_Space_Reflections reflection_quality Rough_reflections Roughness_Threshold Sky_reflection Dynamic_SSR_quality
|
||||||
### WAVING STUFF
|
### WAVING STUFF
|
||||||
screen.Waving_Stuff.columns=1
|
screen.Waving_Stuff.columns=1
|
||||||
screen.Waving_Stuff = WAVY_STRENGTH WAVY_SPEED WAVY_PLANTS
|
screen.Waving_Stuff = WAVY_STRENGTH WAVY_SPEED WAVY_PLANTS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user