mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 08:42:50 +08:00
re-implement "render fog with clouds" option.
This commit is contained in:
@ -250,7 +250,7 @@ void main() {
|
||||
if (isEyeInWater == 0){
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, lightCol.rgb/80.0, averageSkyCol/30.0);
|
||||
vec4 VolumetricFog = GetVolumetricFog(viewPos, vec2(noise_1,noise_2), lightCol.rgb/80.0, averageSkyCol/30.0);
|
||||
#endif
|
||||
|
||||
#if defined NETHER_SHADER || defined END_SHADER
|
||||
|
@ -195,7 +195,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
|
||||
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0);
|
||||
sky = sky*clouds.a + clouds.rgb / 5.0;
|
||||
|
||||
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., 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)), lightSourceColor*1.75, skyGroundCol/30.0);
|
||||
sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0;
|
||||
|
||||
gl_FragData[0] = vec4(sky,1.0);
|
||||
|
@ -104,7 +104,7 @@ void main() {
|
||||
pos = normalize(vec3(0,1,0));
|
||||
pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.90);
|
||||
|
||||
averageSkyCol_Clouds += 2.0*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
averageSkyCol_Clouds += 1.5*skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
|
||||
averageSkyCol += 1.5*skyFromTex(pos,colortex4).rgb/maxIT/150.;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ screen.Fog = Fog Settings
|
||||
option.BLOOMY_FOG = Bloomy Fog Multiplier
|
||||
option.Haze_amount = Atmospheric Haze Density
|
||||
option.RainFog_amount = Rain Fog Multiplier
|
||||
option.Cloud_Fog = Fog Inside Clouds
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG = Render Clouds As Fog
|
||||
option.BorderFog = Chunk Border Fog
|
||||
|
||||
screen.TOD_fog = Time Of Day Fog
|
||||
@ -420,7 +420,7 @@ screen.Fog.comment = Configure settings related to the raymarched volumetric fog
|
||||
option.BLOOMY_FOG.comment = Configure the strength of bloom that is applied to fog. §bWhat is this?§r This effect makes the fog look soft, it helps hide a little noise too. can cause some visible flickering on detailed edges. §aPERFORMANCE COST:§r very low
|
||||
option.Haze_amount.comment = Configure how dense the atmosphere around you is. §bWhat is this?§r This is the blue haze you see in the distance.
|
||||
option.RainFog_amount.comment = Configure how dense the fog gets when it rains.
|
||||
option.Cloud_Fog.comment = Toggle detailed fog when you go within or around a cloud. §aPERFORMANCE COST:§r low to medium
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG.comment = Toggle detailed fog when you go within or around a cloud. §aPERFORMANCE COST:§r medium to high
|
||||
option.BorderFog.comment = Toggle a fog that hides the unloaded chunks.
|
||||
|
||||
screen.TOD_fog.comment = Configure the density of fog that appears at specific times of the day.
|
||||
|
@ -124,7 +124,7 @@ screen.Fog = Ajustes da Névoa
|
||||
option.BLOOMY_FOG = Quantidade de Névoa Difusa
|
||||
option.Haze_amount = Densidade da Névoa Atmosférica
|
||||
option.RainFog_amount = Quantidade de Névoa na Chuva
|
||||
option.Cloud_Fog = Névoa Dentro das Nuvens
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG = Névoa Dentro das Nuvens
|
||||
option.BorderFog = Névoa na Borda dos Chunks
|
||||
|
||||
screen.TOD_fog = Névoa por Horário
|
||||
@ -416,7 +416,7 @@ screen.Fog.comment = Ajustes relacionados à névoa volumétrica ou névoa dista
|
||||
option.BLOOMY_FOG.comment = Ajuste à força do bloom que é aplicada a névoa. §bO Que é Isso?§r Esse efeito faz a névoa ter um aspecto suave, isso ajuda a diminuir o ruído. Pode causar flick em bordas detalhadas. §aCUSTO DE PERFORMANCE:§r Muito Baixo
|
||||
option.Haze_amount.comment = Ajuste a densidade da atmosféra ao seu redor. §bO Que é Isso?§r É aquela névoa azul que você vê na distância.
|
||||
option.RainFog_amount.comment = Ajuste a densidade da névoa quando chove.
|
||||
option.Cloud_Fog.comment = Habilita uma névoa detalhada quando você vai dentro ou do lado de uma nuvem. §aCUSTO DE PERFORMANCE:§r Baixo para Médio
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG.comment = Habilita uma névoa detalhada quando você vai dentro ou do lado de uma nuvem. §aCUSTO DE PERFORMANCE:§r Baixo para Médio
|
||||
option.BorderFog.comment = Habilita uma névoa que esconde chunks não carregados.
|
||||
|
||||
screen.TOD_fog.comment = Ajusta a densidade da névoa que aparece em horários especifícos do dia.
|
||||
|
@ -105,7 +105,7 @@ screen.Fog = 雾气设置
|
||||
option.BLOOMY_FOG = 雾气泛化值
|
||||
option.Haze_amount = 大气雾霾密度
|
||||
option.RainFog_amount = 雨雾密度
|
||||
option.Cloud_Fog = 云中雾
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG = 云中雾
|
||||
option.BorderFog = 边界雾
|
||||
|
||||
screen.TOD_fog = 全天雾气
|
||||
@ -371,7 +371,7 @@ screen.Fog.comment = 配置和光线行进体积雾, 基于距离的雾气相关
|
||||
option.BLOOMY_FOG.comment = 配置作用于雾气的泛化强度. §b这啥?§r 本选项的效果使雾气看起来更柔和, 同时有助于隐藏部分噪点. 但可能会导致在细节边缘出现一些明显的闪烁. §a性能消耗水平:§r 非常低.
|
||||
option.Haze_amount.comment = 配置周遭的大气密度. §b这啥?§r 在远处看到的蓝色雾霾.
|
||||
option.RainFog_amount.comment = 配置雨天时的雾气密度.
|
||||
option.Cloud_Fog.comment = 进入云层内或靠近云层周围时, 更细致的雾气的开关. §a性能消耗水平:§r 低偏中.
|
||||
option.RAYMARCH_CLOUDS_WITH_FOG.comment = 进入云层内或靠近云层周围时, 更细致的雾气的开关. §a性能消耗水平:§r 低偏中.
|
||||
option.BorderFog.comment = 隐藏未加载区块的雾气开关.
|
||||
|
||||
screen.TOD_fog.comment = 配置一天中特定时间出现的雾气的密度.
|
||||
|
@ -62,7 +62,193 @@ float fogPhase(float lightPoint){
|
||||
return exponential;
|
||||
}
|
||||
|
||||
vec4 GetVolumetricFog(
|
||||
vec3 viewPosition,
|
||||
vec2 dither,
|
||||
vec3 LightColor,
|
||||
vec3 AmbientColor
|
||||
){
|
||||
|
||||
/// ------------- RAYMARCHING STUFF ------------- \\\
|
||||
|
||||
//project pixel position into projected shadowmap space
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
||||
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
|
||||
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
|
||||
|
||||
//project view origin into projected shadowmap space
|
||||
vec3 start = toShadowSpaceProjected(vec3(0.0));
|
||||
|
||||
//rayvector into projected shadow map space
|
||||
//we can use a projected vector because its orthographic projection
|
||||
//however we still have to send it to curved shadow map space every step
|
||||
vec3 dV = fragposition - start;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
|
||||
float maxLength = min(length(dVWorld), far)/length(dVWorld);
|
||||
dV *= maxLength;
|
||||
dVWorld *= maxLength;
|
||||
float dL = length(dVWorld);
|
||||
float mult = length(dVWorld)/25;
|
||||
|
||||
vec3 progress = start.xyz;
|
||||
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||
|
||||
vec3 WsunVec = mat3(gbufferModelViewInverse) * sunVec * lightCol.a;
|
||||
float SdotV = dot(sunVec,normalize(viewPosition))*lightCol.a;
|
||||
|
||||
|
||||
/// ------------- COLOR/LIGHTING STUFF ------------- \\\
|
||||
|
||||
vec3 color = vec3(0.0);
|
||||
vec3 absorbance = vec3(1.0);
|
||||
|
||||
///// ----- fog lighting
|
||||
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
|
||||
float mie = fogPhase(SdotV) * 5.0;
|
||||
float rayL = phaseRayleigh(SdotV);
|
||||
|
||||
vec3 rC = vec3(fog_coefficientRayleighR*1e-6, fog_coefficientRayleighG*1e-5, fog_coefficientRayleighB*1e-5);
|
||||
vec3 mC = vec3(fog_coefficientMieR*1e-6, fog_coefficientMieG*1e-6, fog_coefficientMieB*1e-6);
|
||||
|
||||
vec3 LightSourceColor = LightColor;
|
||||
#ifdef ambientLight_only
|
||||
LightSourceColor = vec3(0.0);
|
||||
#endif
|
||||
|
||||
vec3 skyCol0 = AmbientColor;
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
BiomeFogColor(LightSourceColor);
|
||||
BiomeFogColor(skyCol0);
|
||||
#endif
|
||||
|
||||
skyCol0 = max(skyCol0 + skyCol0*(normalize(wpos).y*0.9+0.1),0.0);
|
||||
|
||||
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
|
||||
|
||||
#ifdef RAYMARCH_CLOUDS_WITH_FOG
|
||||
///// ----- cloud stuff
|
||||
|
||||
// first cloud layer
|
||||
float MinHeight_0 = Cumulus_height;
|
||||
float MaxHeight_0 = 100 + MinHeight_0;
|
||||
|
||||
// second cloud layer
|
||||
float MinHeight_1 = MaxHeight_0 + 50;
|
||||
float MaxHeight_1 = 100 + MinHeight_1;
|
||||
|
||||
vec3 SkyColor = AmbientColor;
|
||||
|
||||
float shadowStep = 200.0;
|
||||
|
||||
vec3 dV_Sun = WsunVec*shadowStep;
|
||||
|
||||
float mieDay = phaseg(SdotV, 0.75);
|
||||
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
|
||||
|
||||
vec3 directScattering = LightColor * mieDay * 3.14;
|
||||
vec3 directMultiScattering = LightColor * mieDayMulti * 4.0;
|
||||
|
||||
vec3 sunIndirectScattering = LightColor * phaseg(dot(mat3(gbufferModelView)*vec3(0,1,0),normalize(viewPosition)), 0.5) * 3.14;
|
||||
#endif
|
||||
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<VL_SAMPLES;i++) {
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(VL_SAMPLES))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither.x)/float(VL_SAMPLES)) * log(expFactor) / float(VL_SAMPLES)/(expFactor-1.0);
|
||||
progress = start.xyz + d*dV;
|
||||
progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
|
||||
//project into biased shadowmap space
|
||||
float distortFactor = calcDistort(progress.xy);
|
||||
vec3 pos = vec3(progress.xy*distortFactor, progress.z);
|
||||
|
||||
float sh = 1.0;
|
||||
|
||||
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
||||
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
||||
sh = shadow2D(shadow, pos).x;
|
||||
}
|
||||
float sh2 = sh;
|
||||
|
||||
#ifdef VL_CLOUDS_SHADOWS
|
||||
sh *= GetCloudShadow_VLFOG(progressW, WsunVec);
|
||||
#endif
|
||||
|
||||
float densityVol = cloudVol(progressW) * lightleakfix;
|
||||
//Water droplets(fog)
|
||||
float density = densityVol*300.0;
|
||||
|
||||
///// ----- main fog lighting
|
||||
|
||||
//Just air
|
||||
vec2 airCoef = exp(-max(progressW.y - SEA_LEVEL, 0.0) / vec2(8.0e3, 1.2e3) * vec2(6.,7.0)) * 24 * Haze_amount;
|
||||
|
||||
//Pbr for air, yolo mix between mie and rayleigh for water droplets
|
||||
vec3 rL = rC*airCoef.x;
|
||||
vec3 m = (airCoef.y+density) * mC;
|
||||
|
||||
vec3 AtmosphericFog = skyCol0 * (rL*3.0 + m);
|
||||
vec3 DirectLight = (LightSourceColor*sh) * (rayL*rL*3.0 + m*mie);
|
||||
vec3 AmbientLight = skyCol0 * m;
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition, lightningBoltPosition.xyz) * m;
|
||||
|
||||
vec3 lighting = (AtmosphericFog + AmbientLight + DirectLight + Lightning) * lightleakfix;
|
||||
|
||||
|
||||
color += max(lighting - lighting * exp(-(rL+m)*dd*dL),0.0) / max(rL+m, 0.00000001)*absorbance;
|
||||
absorbance *= max(exp(-(rL+m)*dd*dL),0.0);
|
||||
|
||||
#ifdef RAYMARCH_CLOUDS_WITH_FOG
|
||||
//////////////////////////////////////////
|
||||
///// ----- cloud part
|
||||
//////////////////////////////////////////
|
||||
|
||||
// determine the base of each cloud layer
|
||||
bool isUpperLayer = max(progressW.y - MinHeight_1,0.0) > 0.0;
|
||||
float CloudBaseHeights = isUpperLayer ? 200.0 + MaxHeight_0 : MaxHeight_0;
|
||||
|
||||
float curvature = pow(clamp(1.0 - length(progressW)/far,0,1),2) * 50;
|
||||
|
||||
float cumulus = GetCumulusDensity(progressW, 1, MinHeight_0, MaxHeight_0);
|
||||
|
||||
float fadedDensity = Cumulus_density * clamp(exp( (progressW.y - (CloudBaseHeights - 70)) / 9.0 ),0.0,1.0);
|
||||
|
||||
if(cumulus > 1e-5){
|
||||
float muE = cumulus*fadedDensity;
|
||||
|
||||
float directLight = 0.0;
|
||||
for (int j=0; j < 3; j++){
|
||||
|
||||
vec3 shadowSamplePos = progressW + dV_Sun * (0.1 + j * (0.1 + dither.y*0.05));
|
||||
float shadow = GetCumulusDensity(shadowSamplePos, 0, MinHeight_0, MaxHeight_0) * Cumulus_density;
|
||||
|
||||
directLight += shadow;
|
||||
}
|
||||
|
||||
if(max(progressW.y - MaxHeight_1 + 50,0.0) < 1.0) directLight += Cumulus_density * 2.0 * GetCumulusDensity(progressW + dV_Sun/abs(dV_Sun.y) * max((MaxHeight_1 - 30.0) - progressW.y,0.0), 0, MinHeight_0, MaxHeight_0);
|
||||
|
||||
float upperLayerOcclusion = !isUpperLayer ? Cumulus_density * 2.0 * GetCumulusDensity(progressW + vec3(0.0,1.0,0.0) * max((MaxHeight_1 - 30.0) - progressW.y,0.0), 0, MinHeight_0, MaxHeight_0) : 0.0;
|
||||
float skylightOcclusion = max(exp2((upperLayerOcclusion*upperLayerOcclusion) * -5), 0.75);
|
||||
|
||||
float skyScatter = clamp((CloudBaseHeights - 20 - progressW.y) / 275.0,0.0,1.0);
|
||||
vec3 Lighting = DoCloudLighting(muE, cumulus, SkyColor*skylightOcclusion, skyScatter, directLight, directScattering*sh2, directMultiScattering*sh2, 1);
|
||||
|
||||
// a horrible approximation of direct light indirectly hitting the lower layer of clouds after scattering through/bouncing off the upper layer.
|
||||
Lighting += sunIndirectScattering * exp((skyScatter*skyScatter) * cumulus * -35.0) * upperLayerOcclusion * exp(-20.0 * pow(abs(upperLayerOcclusion - 0.3),2));
|
||||
|
||||
|
||||
color += max(Lighting - Lighting*exp(-muE*dd*dL),0.0) * absorbance;
|
||||
absorbance *= max(exp(-muE*dd*dL),0.0);
|
||||
}
|
||||
#endif /// VL CLOUDS
|
||||
|
||||
}
|
||||
return vec4(color, min(dot(absorbance,vec3(0.335)),1.0));
|
||||
}
|
||||
|
||||
/*
|
||||
// uniform bool inSpecialBiome;
|
||||
vec4 GetVolumetricFog(
|
||||
vec3 viewPosition,
|
||||
@ -173,159 +359,4 @@ vec4 GetVolumetricFog(
|
||||
}
|
||||
return vec4(color, dot(absorbance,vec3(0.333333)));
|
||||
}
|
||||
|
||||
/*
|
||||
/// experimental functions to render clouds and fog in 2 passes
|
||||
|
||||
float cloudCoverage(in vec3 pos, float minHeight, float maxHeight){
|
||||
float FinalCloudCoverage = 0.0;
|
||||
vec3 playerPos = pos - cameraPosition;
|
||||
vec3 samplePos = pos*vec3(1.0,1./48.,1.0)/4;
|
||||
|
||||
// minHeight -= curvature; maxHeight -= curvature;
|
||||
|
||||
float thingy = pow(1.0-clamp(1.0-length(playerPos)/2000,0,1),2) * 2.0;
|
||||
|
||||
float CloudLarge = texture2D(noisetex, (samplePos.xz+ cloud_movement)/5000.0).b;
|
||||
float CloudSmall = texture2D(noisetex, (samplePos.xz- cloud_movement)/500.0).r;
|
||||
|
||||
float coverage = abs(CloudLarge*2.0 - 1.2)*0.5 - (1.0-CloudSmall);
|
||||
|
||||
|
||||
/////// FIRST LAYER
|
||||
float layer0 = min(min(coverage + max(Cumulus_coverage,thingy), clamp(maxHeight - pos.y,0,1)), 1.0 - clamp(minHeight - pos.y,0,1));
|
||||
|
||||
float Topshape = max(pos.y - (maxHeight - 75),0.0) / 200.0;
|
||||
Topshape += max(pos.y - (maxHeight - 10),0.0) / 50.0;
|
||||
|
||||
float Baseshape = max(minHeight + 12.5 - pos.y, 0.0) / 50.0;
|
||||
|
||||
FinalCloudCoverage += max(layer0 - Topshape - Baseshape,0.0);
|
||||
|
||||
float erosion = 1.0 - densityAtPos(samplePos * 200);
|
||||
float noise = erosion * (1.0-FinalCloudCoverage) ;
|
||||
FinalCloudCoverage = max(FinalCloudCoverage - noise*noise*0.5, 0.0);
|
||||
|
||||
return FinalCloudCoverage;
|
||||
}
|
||||
|
||||
vec4 renderVolumetrics(
|
||||
vec3 viewPosition,
|
||||
vec2 dither,
|
||||
vec3 directLightColor,
|
||||
vec3 skyLightColor
|
||||
){
|
||||
int SAMPLES = 30;
|
||||
vec3 color = vec3(0.0);
|
||||
float absorbance = 1.0;
|
||||
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
||||
vec3 fragposition = mat3(shadowModelView) * wpos + shadowModelView[3].xyz;
|
||||
fragposition = diagonal3(shadowProjection) * fragposition + shadowProjection[3].xyz;
|
||||
|
||||
//////////////////////////////////////////
|
||||
////// lighting stuff
|
||||
//////////////////////////////////////////
|
||||
|
||||
float shadowStep = 200.0;
|
||||
vec3 dV_Sun = WsunVec*shadowStep;
|
||||
float SdotV = dot(mat3(gbufferModelView)*WsunVec,normalize(viewPosition));
|
||||
// if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun;
|
||||
|
||||
float mieDay = phaseg(SdotV, 0.75);
|
||||
float mieDayMulti = (phaseg(SdotV, 0.35) + phaseg(-SdotV, 0.35) * 0.5) ;
|
||||
|
||||
vec3 sunScattering = directLightColor * mieDay * 3.14;
|
||||
vec3 sunMultiScattering = directLightColor * mieDayMulti * 4.0;
|
||||
|
||||
//////////////////////////////////////////
|
||||
////// raymarching stuff
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
||||
//project view origin into projected shadowmap space
|
||||
vec3 start = toShadowSpaceProjected(vec3(0.0));
|
||||
|
||||
vec3 dV = fragposition - start;
|
||||
// vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
|
||||
vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
|
||||
|
||||
// float maxLength = min(length(dVWorld), far)/length(dVWorld);
|
||||
float maxLength = 1.0;
|
||||
dV *= maxLength;
|
||||
dVWorld *= maxLength;
|
||||
|
||||
float dL = length(dVWorld);
|
||||
|
||||
float minCloudHeight = Cumulus_height;
|
||||
float maxCloudHeight = minCloudHeight + 100;
|
||||
|
||||
|
||||
float expFactor = 11.0;
|
||||
vec3 progress = start.xyz;
|
||||
|
||||
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||
|
||||
|
||||
float heightRelativeToClouds = clamp(1.0 - max(eyeAltitude - (Cumulus_height),0.0) / 100.0 ,0.0,1.0);
|
||||
|
||||
for (int i=0; i < SAMPLES; i++) {
|
||||
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLES))/expFactor - 1.0/expFactor)/(1.0-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither.x)/float(SAMPLES)) * log(expFactor) / float(SAMPLES)/(expFactor-1.0);
|
||||
|
||||
progress = start.xyz + d*dV;
|
||||
|
||||
// progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||
|
||||
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||
|
||||
|
||||
float curvature = pow(length(progressW-cameraPosition)/200.0,2.0) * heightRelativeToClouds ;
|
||||
minCloudHeight -= curvature; maxCloudHeight -= curvature;
|
||||
|
||||
//project into biased shadowmap space
|
||||
float distortFactor = calcDistort(progress.xy);
|
||||
vec3 pos = vec3(progress.xy*distortFactor, progress.z);
|
||||
|
||||
float sh = 1.0;
|
||||
if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){
|
||||
pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5;
|
||||
sh = shadow2D(shadow, pos).x;
|
||||
}
|
||||
|
||||
float cloud = cloudCoverage(progressW, minCloudHeight, maxCloudHeight);
|
||||
|
||||
float UniformFog = clamp(1.0 - (progressW.y-minCloudHeight-100) / 200,0.0,1.0);
|
||||
|
||||
float density = max(cloud, (UniformFog*UniformFog) * 0.00);
|
||||
|
||||
float horizonfalloff = exp(-(1.0-clamp(normalize(progressW-vec3(cameraPosition.x,0.0,cameraPosition.x)).y+1.0,0,1)));
|
||||
sunScattering *= horizonfalloff;
|
||||
sunMultiScattering *= horizonfalloff;
|
||||
|
||||
|
||||
// if(density > 1e-5){
|
||||
float muE = density * 0.5;
|
||||
|
||||
float sunLight = 0.0;
|
||||
|
||||
|
||||
for (int j=0; j < 3; j++){
|
||||
vec3 shadowSamplePos = progressW + dV_Sun * (0.1 + j * (0.1 + dither.y*0.05));
|
||||
float shadow = cloudCoverage(shadowSamplePos, minCloudHeight, maxCloudHeight) * 0.5;
|
||||
|
||||
sunLight += shadow;
|
||||
}
|
||||
|
||||
sunLight += 2*cloudCoverage(progressW + dV_Sun/abs(dV_Sun.y) * max(minCloudHeight+20 - progressW.y,0.0), minCloudHeight, maxCloudHeight) * exp(-10*cloud);
|
||||
vec3 lighting = skyLightColor + (sunScattering*exp(-5 * sunLight) + sunMultiScattering*exp(-3 * sunLight)) * sh;
|
||||
|
||||
color += max(lighting - lighting*exp(-muE*dd*dL),0.0) * absorbance;
|
||||
absorbance *= max(exp(-muE*dd*dL),0.0);
|
||||
|
||||
if (absorbance < 1e-5) break;
|
||||
}
|
||||
return vec4(color, absorbance);
|
||||
}
|
||||
*/
|
@ -323,7 +323,7 @@ uniform int moonPhase;
|
||||
#define CLOUDS_QUALITY 0.5 // [0.1 0.125 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.9 1.0]
|
||||
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
#define Cloud_Fog
|
||||
#define RAYMARCH_CLOUDS_WITH_FOG
|
||||
|
||||
#ifndef ambientLight_only
|
||||
#define CLOUDS_SHADOWS
|
||||
|
@ -103,6 +103,8 @@ vec4 texture2D_bicubic_offset(sampler2D tex, vec2 uv, float noise)
|
||||
{
|
||||
float offsets = noise * (2.0 * 3.141592653589793238462643383279502884197169);
|
||||
vec2 circleOffsets = vec2(sin(offsets), cos(offsets));
|
||||
|
||||
// circleOffsets = vec2(0.0);
|
||||
|
||||
vec4 texelSize = vec4(texelSize,1.0/texelSize);
|
||||
uv = uv*texelSize.zw;
|
||||
|
@ -40,10 +40,10 @@ blend.gbuffers_textured = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_textured_lit = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_spidereyes = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_basic = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_armor_glint = ONE ONE ONE ONE
|
||||
blend.gbuffers_weather = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
|
||||
blend.gbuffers_skytextured = ONE ONE ONE ONE
|
||||
blend.gbuffers_damagedblock = ONE ONE ONE ONE
|
||||
blend.gbuffers_armor_glint = ONE ONE ONE ZERO
|
||||
blend.gbuffers_skytextured = ONE ONE ONE ZERO
|
||||
blend.gbuffers_damagedblock = ONE ONE ONE ZERO
|
||||
|
||||
# Disable blending
|
||||
blend.gbuffers_hand = off
|
||||
@ -190,7 +190,7 @@ PhysicsMod_support [LabPBR]
|
||||
BLOOMY_FOG [TOD_fog] \
|
||||
BorderFog [Cave_Fog] \
|
||||
FOG_START_HEIGHT [END_AND_NETHER_FOG] \
|
||||
PER_BIOME_ENVIRONMENT
|
||||
RAYMARCH_CLOUDS_WITH_FOG PER_BIOME_ENVIRONMENT
|
||||
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ PhysicsMod_support [LabPBR]
|
||||
######## PROFILES
|
||||
# profile.ULTRA_PERFORMANCE=SHARPENING:1.0 Rough_reflections Specular_Reflections SKY_CONTRIBUTION_IN_SSRT VL_RENDER_RESOLUTION:1.0 Sun_specular_Strength:10 Roughness_Threshold:3.0 VL_SAMPLES:50 indirect_effect:4 BLEND_FACTOR:0.01 HQ_SSGI !Adaptive_Step_length POM CLOUDS_QUALITY:1.0 DOF_QUALITY:4 aperture:0.05 Screen_Space_Reflections MAX_DIST:400.0 SCALE_FACTOR:0.95 Sky_reflection Porosity WAVY_STRENGTH:2.0 MISC_BLOCK_SSS MAX_ITERATIONS:400 SSR_STEPS:400 shadowDistanceRenderMul:-1.0 shadowDistance:384.0 shadowMapResolution:8192
|
||||
# profile.BASELINE=SHARPENING:0.35 !Rough_reflections !Specular_Reflections !SKY_CONTRIBUTION_IN_SSRT VL_RENDER_RESOLUTION:0.5 Sun_specular_Strength:3 Roughness_Threshold:1.5 VL_SAMPLES:8 indirect_effect:1 BLEND_FACTOR:0.05 !HQ_SSGI Adaptive_Step_length !POM CLOUDS_QUALITY:0.5 DOF_QUALITY:-1 aperture:0.8 !Screen_Space_Reflections MAX_DIST:25.0 SCALE_FACTOR:0.75 !Sky_reflection !Porosity WAVY_STRENGTH:1.0 !MISC_BLOCK_SSS MAX_ITERATIONS:35 SSR_STEPS:30
|
||||
# profile.ULTRA_QUALITY=shadowDistance:64.0 SHARPENING:1.0 EMISSIVE_TYPE:0 !WATER_SUN_SPECULAR !MOB_SSS !Ambient_SSS TAA_UPSCALING VL_RENDER_RESOLUTION:0.25 !Puddles VL_SAMPLES:4 indirect_effect:0 BLEND_FACTOR:0.16 !Cloud_Fog !Refraction !SCREENSPACE_CONTACT_SHADOWS !WATER_BACKGROUND_SPECULAR SSS_TYPE:0 !WATER_REFLECTIONS !RENDER_ENTITY_SHADOWS !Hand_Held_lights shadowMapResolution:512 SCALE_FACTOR:0.35 !CLOUDS_SHADOWS !SCREENSPACE_REFLECTIONS shadowDistanceRenderMul:1.0 shadowDistance:128.0 shadowMapResolution:2048
|
||||
# profile.ULTRA_QUALITY=shadowDistance:64.0 SHARPENING:1.0 EMISSIVE_TYPE:0 !WATER_SUN_SPECULAR !MOB_SSS !Ambient_SSS TAA_UPSCALING VL_RENDER_RESOLUTION:0.25 !Puddles VL_SAMPLES:4 indirect_effect:0 BLEND_FACTOR:0.16 !RAYMARCH_CLOUDS_WITH_FOG !Refraction !SCREENSPACE_CONTACT_SHADOWS !WATER_BACKGROUND_SPECULAR SSS_TYPE:0 !WATER_REFLECTIONS !RENDER_ENTITY_SHADOWS !Hand_Held_lights shadowMapResolution:512 SCALE_FACTOR:0.35 !CLOUDS_SHADOWS !SCREENSPACE_REFLECTIONS shadowDistanceRenderMul:1.0 shadowDistance:128.0 shadowMapResolution:2048
|
||||
|
||||
profile.QUALITY=GI_Strength:1.0 shadowDistance:128.0 SHARPENING:0.35 EMISSIVE_TYPE:2 ambientOcclusionLevel:1.0 MOB_SSS VOLUMETRIC_CLOUDS Max_Filter_Depth:99.0 !Specular_Reflections Ambient_SSS AO_Strength:1.0 SHADOW_FILTER_SAMPLE_COUNT:13 VL_RENDER_RESOLUTION:0.5 Roughness_Threshold:1.5 VL_SAMPLES:8 indirect_effect:1 shadowDistanceRenderMul:1.0 !HQ_SSGI !BorderFog Min_Shadow_Filter_Radius:5.0 Refraction Dynamic_SSR_quality SCREENSPACE_CONTACT_SHADOWS reflection_quality:30 WATER_BACKGROUND_SPECULAR VPS_Search_Samples:4 SSS_TYPE:2 CLOUDS_QUALITY:0.5 RENDER_ENTITY_SHADOWS Hand_Held_lights shadowMapResolution:2048 CLOUDS_SHADOWS SCREENSPACE_REFLECTIONS Max_Shadow_Filter_Radius:30.0 !Vanilla_like_water BLOOM_STRENGTH:4.0 WAVY_PLANTS SSR_STEPS:30
|
||||
profile.PERFORMANCE=GI_Strength:0.0 shadowDistance:512.0 SHARPENING:1.0 EMISSIVE_TYPE:0 ambientOcclusionLevel:0.0 !MOB_SSS !VOLUMETRIC_CLOUDS Max_Filter_Depth:0.1 Specular_Reflections !Ambient_SSS AO_Strength:0.0 SHADOW_FILTER_SAMPLE_COUNT:128 VL_RENDER_RESOLUTION:0.25 Roughness_Threshold:10.0 VL_SAMPLES:50 indirect_effect:2 shadowDistanceRenderMul:-1.0 HQ_SSGI BorderFog Min_Shadow_Filter_Radius:0.0 !Refraction !Dynamic_SSR_quality !SCREENSPACE_CONTACT_SHADOWS reflection_quality:100.0 !WATER_BACKGROUND_SPECULAR VPS_Search_Samples:64 SSS_TYPE:0 CLOUDS_QUALITY:1.0 !RENDER_ENTITY_SHADOWS !Hand_Held_lights shadowMapResolution:512 !CLOUDS_SHADOWS !SCREENSPACE_REFLECTIONS Max_Shadow_Filter_Radius:0.0 Vanilla_like_water BLOOM_STRENGTH:0.0 !WAVY_PLANTS SSR_STEPS:400
|
||||
|
Reference in New Issue
Block a user