downgrade to v1.53
-> fix dark nights, but removes DH compat too
This commit is contained in:
@@ -2,15 +2,6 @@
|
||||
#extension GL_ARB_shader_texture_lod : enable
|
||||
const bool gaux1MipmapEnabled = true;
|
||||
/* DRAWBUFFERS:3 */
|
||||
/*
|
||||
Sildur's Vibrant Shaders:
|
||||
https://www.patreon.com/Sildur
|
||||
https://sildurs-shaders.github.io/
|
||||
https://twitter.com/SildurFX
|
||||
|
||||
Permissions:
|
||||
You are not allowed to edit, copy code or share my shaderpack under a different name or claim it as yours.
|
||||
*/
|
||||
|
||||
#define composite2
|
||||
#define composite1
|
||||
@@ -81,6 +72,7 @@ uniform float darknessFactor;
|
||||
uniform float darknessLightFactor;
|
||||
#endif
|
||||
|
||||
/*------------------------------------------*/
|
||||
float comp = 1.0-near/far/far;
|
||||
float tmult = mix(min(abs(worldTime-6000.0)/6000.0,1.0),1.0,rainStrength);
|
||||
float night = clamp((worldTime-13000.0)/300.0,0.0,1.0)-clamp((worldTime-22800.0)/200.0,0.0,1.0);
|
||||
@@ -105,7 +97,7 @@ vec3 drawMoon(vec3 fposition, vec3 color, float vis) {
|
||||
vec3 moonlightC = mix(pow(moonlight*40.0,vec3(1.0))*44.0,vec3(0.25,0.3,0.4),rainStrength*0.8);
|
||||
|
||||
return mix(color,moonlightC,moon*vis);
|
||||
}
|
||||
}/**--------------------------------------*/
|
||||
|
||||
#ifdef Fog
|
||||
float getAirDensity (float h) {
|
||||
@@ -168,16 +160,6 @@ gradN = mix(gradN,moonlightRain,rainStrength);
|
||||
return pow(L*(c*exp(d*Y)+A),invRain07)*sunVisibility *length(rawAvg) * (0.85+rainStrength*0.425)*grad3+ 0.2*pow(L2*1.2+1.2,invRain07)*moonVisibility*gradN;
|
||||
}/*---------------------------------*/
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
uniform sampler2D dhDepthTex0;
|
||||
uniform sampler2D dhDepthTex1;
|
||||
uniform int dhRenderDistance;
|
||||
uniform float dhFarPlane;
|
||||
uniform float dhNearPlane;
|
||||
uniform mat4 dhProjection;
|
||||
uniform mat4 dhProjectionInverse;
|
||||
#endif
|
||||
|
||||
#if defined waterRefl || defined iceRefl ||defined metallicRefl || defined polishedRefl || defined RainReflections
|
||||
const int maxf = 3; //number of refinements
|
||||
const float ref = 0.11; //refinement multiplier
|
||||
@@ -193,7 +175,7 @@ float cdist(vec2 coord) {
|
||||
return max(abs(coord.s-0.5),abs(coord.t-0.5))*2.0;
|
||||
}
|
||||
|
||||
vec4 raytrace(vec3 fragpos, vec3 skycolor, vec3 rvector, sampler2D depth, mat4 projection, mat4 projectionInverse) {
|
||||
vec4 raytrace(vec3 fragpos, vec3 skycolor, vec3 rvector) {
|
||||
vec4 color = vec4(0.0);
|
||||
vec3 start = fragpos;
|
||||
rvector *= 1.2;
|
||||
@@ -202,15 +184,15 @@ vec4 raytrace(vec3 fragpos, vec3 skycolor, vec3 rvector, sampler2D depth, mat4 p
|
||||
int sr = 0;
|
||||
|
||||
for(int i=0;i<25;i++){
|
||||
vec3 pos = nvec3(projection * nvec4(fragpos)) * 0.5 + 0.5;
|
||||
vec3 pos = nvec3(gbufferProjection * nvec4(fragpos)) * 0.5 + 0.5;
|
||||
if(pos.x < 0 || pos.x > 1 || pos.y < 0 || pos.y > 1 || pos.z < 0 || pos.z > 1.0) break;
|
||||
vec3 fragpos0 = vec3(pos.st, texture2D(depth, pos.st).r);
|
||||
fragpos0 = nvec3(projectionInverse * nvec4(fragpos0 * 2.0 - 1.0));
|
||||
vec3 fragpos0 = vec3(pos.st, texture2D(depthtex1, pos.st).r);
|
||||
fragpos0 = nvec3(gbufferProjectionInverse * nvec4(fragpos0 * 2.0 - 1.0));
|
||||
float err = distance(fragpos,fragpos0);
|
||||
if(err < pow(length(rvector),1.175)){
|
||||
if(err < pow(length(rvector),1.175)){ //if(err < pow(length(rvector)*1.85,1.15)){ <- old, adjusted error check to reduce banding issues/glitches
|
||||
sr++;
|
||||
if(sr >= maxf){
|
||||
bool land = texture2D(depth, pos.st).r < comp;
|
||||
bool land = texture2D(depthtex1, pos.st).r < comp;
|
||||
color = pow(texture2DLod(gaux1, pos.st, 1),vec4(2.2))*257.0;
|
||||
if (isEyeInWater == 0) color.rgb = land ? mix(color.rgb,skycolor*(0.7+0.3*tmult)*(1.33-rainStrength*0.8),calcFog(fragpos0.xyz)) : drawSun(rvector,skycolor,1.0);
|
||||
color.a = clamp(1.0 - pow(cdist(pos.st), 20.0), 0.0, 1.0);
|
||||
@@ -219,12 +201,8 @@ vec4 raytrace(vec3 fragpos, vec3 skycolor, vec3 rvector, sampler2D depth, mat4 p
|
||||
tvector -= rvector;
|
||||
rvector *= ref;
|
||||
|
||||
}
|
||||
#ifndef DISTANT_HORIZONS
|
||||
rvector *= inc - 0.0000275 / (2.0 * near / (far + near - rvector.z * far - near)); //offset to reduce reflection errors
|
||||
#else
|
||||
rvector *= texture2D(dhDepthTex1, texcoord).x > texture2D(dhDepthTex0, texcoord).x ? inc : inc - 0.0000275 / (2.0 * near / (far + near - rvector.z * far - near)); //offset to reduce reflection errors
|
||||
#endif
|
||||
}
|
||||
rvector *= inc;
|
||||
tvector += rvector;
|
||||
fragpos = start + tvector;
|
||||
}
|
||||
@@ -250,7 +228,7 @@ vec4 raytraceLand(vec3 fragpos, vec3 skycolor, vec3 rvector) {
|
||||
vec3 fragpos0 = vec3(pos.st, texture2D(depthtex1, pos.st).r);
|
||||
fragpos0 = nvec3(gbufferProjectionInverse * nvec4(fragpos0 * 2.0 - 1.0));
|
||||
float err = distance(fragpos,fragpos0);
|
||||
if(err < pow(length(rvector),errorstep)){
|
||||
if(err < pow(length(rvector),errorstep)){ //if(err < pow(length(rvector)*1.85,1.15)){ <- old, adjusted error check to reduce banding issues/glitches
|
||||
sr++;
|
||||
if(sr >= maxf){
|
||||
bool land = texture2D(depthtex1, pos.st).r < comp;
|
||||
@@ -460,7 +438,8 @@ float calcWaves(vec2 coord){
|
||||
coord1 *= waveSize;
|
||||
|
||||
float wave = texture2D(noisetex,coord0 * 0.005).x * 10.0; //big waves
|
||||
wave -= texture2D(noisetex,coord1 * 0.010416).x * 7.0; //small waves
|
||||
wave -= texture2D(noisetex,coord1 * 0.010416).x * 7.0; //small waves
|
||||
wave += 1.0-sqrt(texture2D(noisetex,coord2 * 0.0416).x * 6.5) * 1.33; //noise texture
|
||||
wave *= 0.0157;
|
||||
|
||||
return wave;
|
||||
@@ -523,17 +502,23 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(3,7.)/8.,
|
||||
vec2(7.,-7.)/8.);
|
||||
|
||||
vec3 ScreenSpace() {
|
||||
vec3 toScreenSpace(vec3 p) {
|
||||
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
|
||||
vec3 p3 = vec3(gl_FragCoord.xy*texelSize-offsets[framemod8]*texelSize*0.5, texture2D(depthtex0, gl_FragCoord.xy*texelSize).x) * 2.0 - 1.0;
|
||||
vec3 p3 = p * 2.0 - 1.0;
|
||||
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
|
||||
return normalize(fragposition.xyz / fragposition.w);
|
||||
return fragposition.xyz / fragposition.w;
|
||||
}
|
||||
|
||||
vec2 newTC = gl_FragCoord.xy*texelSize;
|
||||
vec3 TAAfragpos = toScreenSpace(vec3(newTC-offsets[framemod8]*texelSize*0.5, texture2D(depthtex0, newTC).x));
|
||||
|
||||
#if defined waterRefl || defined iceRefl
|
||||
vec3 toClipSpace(vec3 viewSpacePosition) {
|
||||
return (vec3(gbufferProjection[0].x, gbufferProjection[1].y, gbufferProjection[2].z) * viewSpacePosition + gbufferProjection[3].xyz) / -viewSpacePosition.z * 0.5 + 0.5;
|
||||
}
|
||||
float ld(float dist) {
|
||||
return (2.0 * near) / (far + near - dist * (far - near));
|
||||
}
|
||||
|
||||
vec3 newTrace(vec3 dir, vec3 position, float dither, float fresnel){
|
||||
#define SSR_STEPS 40 //[10 15 20 25 30 35 40 50 100 200 400]
|
||||
@@ -541,22 +526,28 @@ vec3 newTrace(vec3 dir, vec3 position, float dither, float fresnel){
|
||||
|
||||
vec3 clipPosition = toClipSpace(position);
|
||||
float rayLength = ((position.z + dir.z * far*1.732) > -near) ? (-near -position.z) / dir.z : far*1.732;
|
||||
vec3 direction = normalize(toClipSpace(position+dir*rayLength) - clipPosition);
|
||||
vec3 direction = normalize(toClipSpace(position+dir*rayLength)-clipPosition); //convert to clip space
|
||||
|
||||
vec3 maxLengths = (step(0.0, direction) - clipPosition) / direction;
|
||||
vec3 stepv = direction * min(min(maxLengths.x, maxLengths.y), maxLengths.z) / quality;
|
||||
//get at which length the ray intersects with the edge of the screen
|
||||
vec3 maxLengths = (step(0.0,direction)-clipPosition) / direction;
|
||||
float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
|
||||
|
||||
vec3 stepv = direction * mult / quality;
|
||||
|
||||
vec3 spos = clipPosition + stepv*dither;
|
||||
float minZ = clipPosition.z;
|
||||
float maxZ = spos.z+stepv.z*0.5;
|
||||
spos.xy+=offsets[framemod8]*texelSize*0.5;
|
||||
|
||||
//raymarch on a quarter res depth buffer for improved cache coherency
|
||||
|
||||
for (int i = 0; i < int(quality+1); i++) {
|
||||
float sp = texture2D(depthtex1, spos.xy).x;
|
||||
//float sp = texelFetch2D(depthtex1, ivec2(spos.xy/texelSize), 0).x;
|
||||
float sp = texture2D(depthtex1, spos.xy).x; //might be slower then texelfetch but doesn't require shader4 extension
|
||||
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy,sp);
|
||||
|
||||
spos += stepv;
|
||||
minZ = maxZ - 0.00004 / (2.0 * near / (far + near - spos.z * (far - near))); //small offset
|
||||
//small bias
|
||||
minZ = maxZ-0.00004/ld(spos.z);
|
||||
maxZ += stepv.z;
|
||||
}
|
||||
|
||||
@@ -564,6 +555,15 @@ vec3 newTrace(vec3 dir, vec3 position, float dither, float fresnel){
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
vec2 decodeVec2(float a){
|
||||
const vec2 constant1 = 65535. / vec2( 256., 65536.);
|
||||
const float constant2 = 256. / 255.;
|
||||
return fract( a * constant1 ) * constant2 ;
|
||||
}
|
||||
|
||||
float ld(float depth) {
|
||||
return 1.0 / (far+near - depth * far-near);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -581,35 +581,14 @@ float depth1 = texture2D(depthtex1, texcoord).x;
|
||||
vec4 fragpos1 = gbufferProjectionInverse * (vec4(texcoord, depth1, 1.0) * 2.0 - 1.0);
|
||||
fragpos1 /= fragpos1.w;
|
||||
vec3 normalfragpos1 = normalize(fragpos1.xyz);
|
||||
|
||||
#ifndef DISTANT_HORIZONS
|
||||
bool island = !(dot(texture2D(colortex0,texcoord).rgb,vec3(1.0))<0.00000000001 || (depth1 > comp)); //must be depth1 > comp for transparency
|
||||
#else
|
||||
float DHdepth0 = texture2D(dhDepthTex0, texcoord).x;
|
||||
vec4 DHfragpos0 = dhProjectionInverse * (vec4(texcoord, DHdepth0, 1.0) * 2.0 - 1.0);
|
||||
DHfragpos0 /= DHfragpos0.w;
|
||||
vec3 DHnormalfragpos0 = normalize(DHfragpos0.xyz);
|
||||
|
||||
float DHdepth1 = texture2D(dhDepthTex1, texcoord).x;
|
||||
vec4 DHfragpos1 = dhProjectionInverse * (vec4(texcoord, DHdepth1, 1.0) * 2.0 - 1.0);
|
||||
DHfragpos1 /= DHfragpos1.w;
|
||||
vec3 DHnormalfragpos1 = normalize(DHfragpos1.xyz);
|
||||
|
||||
bool DH_reflective = DHdepth1 > DHdepth0;
|
||||
bool island = !(dot(texture2D(colortex0,texcoord).rgb,vec3(1.0))<0.00000000001 || (depth1 > comp)) || (DHdepth1 < depth1); //Fix DH terrain rendering against sky
|
||||
#ifdef Fog
|
||||
float dither = fract(0.75487765 * gl_FragCoord.x + 0.56984026 * gl_FragCoord.y);
|
||||
dither = fract(frameTimeCounter * 16.0 + dither);
|
||||
if(length(fragpos1.xyz) > dither * 32.0 - 16.0 + far) c = mix(c.rgb, hr.rgb*(1.0-rainStrength*0.25), clamp((length(DHfragpos1.xyz) - dhRenderDistance * 0.05) / dhRenderDistance, 0.0, 1.0));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------------------------------------------*/
|
||||
float mats = texture2D(colortex0,texcoord).b;
|
||||
|
||||
vec4 trp = texture2D(gaux3,texcoord.xy);
|
||||
|
||||
bool transparency = dot(trp.xyz,trp.xyz) > 0.000001;
|
||||
bool isMetallic = mats > 0.39 && mats < 0.41;
|
||||
bool isPolished = mats > 0.49 && mats < 0.51;
|
||||
|
||||
#ifndef polishedRefl
|
||||
isPolished = false;
|
||||
#endif
|
||||
@@ -620,20 +599,18 @@ bool isPolished = mats > 0.49 && mats < 0.51;
|
||||
#ifdef Refraction
|
||||
if (texture2D(colortex2, texcoord).z < 0.2499 && dot(texture2D(colortex2,texcoord).xyz,texture2D(colortex2,texcoord).xyz) > 0.0 || isEyeInWater == 1.0) { //reflective water
|
||||
vec2 wpos = (gbufferModelViewInverse*fragpos0).xz+cameraPosition.xz;
|
||||
|
||||
vec2 refraction = texcoord.xy + calcBump(wpos);
|
||||
float caustics = 0.0;
|
||||
|
||||
#ifdef Caustics
|
||||
float skylight = pow(max(lightmap.y-1.0/16.0,0.0)*1.14285714286, 0.5);
|
||||
//vec2 wposC = (gbufferModelViewInverse*fragpos1).xz+cameraPosition.xz;
|
||||
caustics = calcWaves(wpos*3.0);
|
||||
caustics = mix(caustics*4.25, 1.0, 1.0-skylight);
|
||||
caustics = clamp(caustics*causticsStrength, -0.8, 0.2); //adjust color and filter out dark parts
|
||||
caustics = mix(caustics*4.0, 1.0, 1.0-skylight);
|
||||
caustics = clamp(caustics*causticsStrength, -1.0, 0.1); //adjust color and filter out dark parts
|
||||
caustics *= (1.0-rainStrength);
|
||||
#endif
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if(DH_reflective) wpos = (gbufferModelViewInverse*DHfragpos0).xz+cameraPosition.xz; //should be before caustics but we disable them on DH water anyways
|
||||
if(length(fragpos1.xyz) > 16.0 + far) caustics *= 0.0; //blend caustics with DH water
|
||||
#endif
|
||||
vec2 refraction = texcoord.xy + calcBump(wpos);
|
||||
|
||||
c = pow(texture2D(gaux1, refraction).xyz, vec3(2.2) + caustics)*257.0;
|
||||
#ifdef uwatertint
|
||||
if(isEyeInWater == 1.0){
|
||||
@@ -645,6 +622,8 @@ if (texture2D(colortex2, texcoord).z < 0.2499 && dot(texture2D(colortex2,texcoor
|
||||
}
|
||||
#endif
|
||||
|
||||
bool island = !(dot(texture2D(colortex0,texcoord).rgb,vec3(1.0))<0.00000000001 || (depth1 > comp)); //must be depth1 > comp for transparency
|
||||
|
||||
if (!island){ //breaks transparency rendering against the sky
|
||||
vec3 cpos = normalize(gbufferModelViewInverse*fragpos1).xyz;
|
||||
#ifdef defskybox
|
||||
@@ -686,14 +665,17 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
fresnel = mix(0.09,1.0,fresnel); //F0
|
||||
|
||||
vec3 sky_c = getSkyc(reflectedVector)*metallicSky;
|
||||
vec4 reflection = raytrace(fragpos0.xyz, sky_c, reflectedVector, depthtex1, gbufferProjection, gbufferProjectionInverse);
|
||||
vec4 reflection = raytrace(fragpos0.xyz, sky_c, reflectedVector);
|
||||
|
||||
reflection.rgb = mix(sky_c, reflection.rgb, reflection.a)*0.5;
|
||||
c = mix(c,reflection.rgb,fresnel*metalStrength);
|
||||
}
|
||||
#endif
|
||||
|
||||
//if (transparency) { //this broke in iris 1.21.5+
|
||||
//Draw entities etc
|
||||
//c = c*(1.0-texture2D(colortex2, texcoord).a)+texture2D(colortex2, texcoord).rgb;
|
||||
|
||||
if (transparency) {
|
||||
vec3 normal = texture2D(colortex2,texcoord).xyz;
|
||||
float sky = normal.z;
|
||||
|
||||
@@ -712,15 +694,13 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
|
||||
normal = max(normalize(decode(normal.xy)),vec3(-1.0)); //Using max to fix issues on widescreens.
|
||||
|
||||
#ifndef DISTANT_HORIZONS
|
||||
//draw fog for transparency
|
||||
float iswater2 = float(iswater);
|
||||
float skylight = pow(max(lightmap.y-2.0/16.0,0.0)*1.14285714286, 1.0);
|
||||
c = mix(c, fogC, fogF-fogF) / (1.0 + 5.0*night*iswater2*skylight);
|
||||
if(depth1 < comp)c = mix(hr.rgb*(1.0-rainStrength*0.25), c, exp(-exp2(length(fragpos1.xyz) / far * 16.0 - 14.0))); //chunk border fog through transparency, land only
|
||||
#endif
|
||||
|
||||
//Draw transparency and entities
|
||||
//Draw transparency
|
||||
vec3 finalAc = texture2D(gaux2, texcoord.xy).rgb;
|
||||
float alphaT = clamp(length(trp.rgb)*1.02,0.0,1.0);
|
||||
|
||||
@@ -729,7 +709,7 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
/*
|
||||
#if defined waterRefl || defined iceRefl
|
||||
if (reflectiveWater || reflectiveIce) {
|
||||
vec3 wFragpos1 = ScreenSpace();
|
||||
vec3 wFragpos1 = normalize(TAAfragpos);
|
||||
vec3 reflectedVector = reflect(wFragpos1, normal);
|
||||
|
||||
float normalDotEye = dot(normal, wFragpos1);
|
||||
@@ -772,13 +752,8 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
if (reflectiveWater || reflectiveIce) {
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if(DH_reflective){
|
||||
normalfragpos0 = DHnormalfragpos0;
|
||||
fragpos0.xyz = DHfragpos0.xyz;
|
||||
}
|
||||
#endif
|
||||
vec3 reflectedVector = reflect(normalfragpos0, normal);
|
||||
|
||||
float normalDotEye = dot(normal, normalfragpos0);
|
||||
@@ -797,10 +772,7 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
#endif
|
||||
#endif
|
||||
#if defined waterRefl || defined iceRefl
|
||||
vec4 reflection = raytrace(fragpos0.xyz, sky_c, reflectedVector, depthtex1, gbufferProjection, gbufferProjectionInverse);
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if(DH_reflective) reflection = raytrace(DHfragpos0.xyz, sky_c, reflectedVector, dhDepthTex1, dhProjection, dhProjectionInverse);
|
||||
#endif
|
||||
vec4 reflection = raytrace(fragpos0.xyz, sky_c, reflectedVector);
|
||||
#else
|
||||
vec4 reflection = vec4(0.0);
|
||||
#endif
|
||||
@@ -815,14 +787,10 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
reflection.rgb = mix(sky_c, reflection.rgb, reflection.a)*0.85;
|
||||
|
||||
c = mix(c,reflection.rgb,fresnel);
|
||||
#ifdef DISTANT_HORIZONS
|
||||
#ifdef Fog
|
||||
if(length(fragpos0.xyz) > dither * 32.0 - 16.0 + far) c = mix(c.rgb, hr.rgb*(1.0-rainStrength*0.25), clamp((length(DHfragpos0.xyz) - dhRenderDistance * 0.05) / dhRenderDistance, 0.0, 1.0));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
bool land = depth0 < comp;
|
||||
|
||||
#ifdef RainReflections
|
||||
@@ -852,19 +820,31 @@ if (dot(fragpos1.xyz, upVec) > 0.0 || cameraPosition.y > cheight)c = renderCloud
|
||||
reflection.rgb = mix(sky_c, reflection.rgb, reflection.a)*0.5;
|
||||
|
||||
c = mix(c.rgb, reflection.rgb, fresnel*iswet); //smooth out wetness start and end
|
||||
//c.rgb = wnormal;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if Clouds == 3
|
||||
if(!island && rainStrength > 0.01)c = mix(c,fogC,fogF*0.75); //tint vl clouds with fog while raining, changed from land to island check for DH, might cause issues
|
||||
if(!land && rainStrength > 0.01)c = mix(c,fogC,fogF*0.75); //tint vl clouds with fog while raining
|
||||
#endif
|
||||
/*
|
||||
//Draw rain
|
||||
vec4 rain = texture2D(gaux4, texcoord);
|
||||
if (rain.r > 0.0001 && rainStrength > 0.01 && !(depth1 < texture2D(depthtex2, texcoord).x)){
|
||||
float rainRGB = 0.25;
|
||||
float rainA = rain.r;
|
||||
|
||||
float torch_lightmap = 12.0 - min(rain.g/rain.r * 12.0,11.0);
|
||||
torch_lightmap = 0.05 / torch_lightmap / torch_lightmap - 0.002595;
|
||||
|
||||
vec3 rainC = rainRGB*(pow(max(dot(normalfragpos0, sunVec)*0.1+0.9,0.0),6.0)*(0.1+tr*0.9)*pow(sunlight,vec3(0.25))*sunVisibility+pow(max(dot(normalfragpos0, -sunVec)*0.05+0.95,0.0),6.0)*48.0*moonlight*moonVisibility)*0.04 + 0.05*rainRGB*length(avgAmbient2);
|
||||
rainC += max(torch_lightmap,0.0)*vec3(emissive_R,emissive_G,emissive_B);
|
||||
c = c*(1.0-rainA*0.3)+rainC*1.5*rainA;
|
||||
}
|
||||
*/
|
||||
#ifndef Volumetric_Lighting
|
||||
#ifdef Godrays
|
||||
float sunpos = abs(dot(normalfragpos0,normalize(sunPosition.xyz)));
|
||||
#ifdef DISTANT_HORIZONS
|
||||
if(DHdepth1 < depth1) sunpos = abs(dot(DHnormalfragpos0,normalize(sunPosition.xyz)));
|
||||
#endif
|
||||
float illuminationDecay = pow(sunpos,30.0)+pow(sunpos,16.0)*0.8+pow(sunpos,2.0)*0.125;
|
||||
|
||||
vec2 deltaTextCoord = (lightPos-texcoord)*0.01;
|
||||
@@ -915,7 +895,6 @@ vec3 vgrC = lightcol*exposure*phase*0.08*(0.25+0.75*tmult*tmult)*tr*(1.0+pow(1.0
|
||||
c += texture2D(composite,texcoord.xy*0.5+0.5+1.0/vec2(viewWidth,viewHeight)).rgb*fading*30*30/100*pow(dot(texture2D(gaux1, vec2(1.0)/vec2(viewWidth,viewHeight)).w, 1.0), 2.0);
|
||||
#endif
|
||||
|
||||
#ifndef DISTANT_HORIZONS
|
||||
#ifdef Fog
|
||||
//Render fog at the end.
|
||||
//land fog
|
||||
@@ -923,8 +902,7 @@ c += texture2D(composite,texcoord.xy*0.5+0.5+1.0/vec2(viewWidth,viewHeight)).rgb
|
||||
//Chunk border fog
|
||||
if(land)c = mix(hr.rgb*(1.0-rainStrength*0.25), c, exp(-exp2(length(fragpos0.xyz) / far * 16.0 - 14.0)));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
vec3 ufogC = sky1.rgb*0.1;
|
||||
// ufogC.g *= 1.0+2.0*inSwamp; //make fog greenish in swamp biomes
|
||||
ufogC.r *= 0.0;
|
||||
|
||||
Reference in New Issue
Block a user