0% found this document useful (0 votes)
80 views15 pages

Render Fragment

The document discusses the results of a study on the impact of COVID-19 lockdowns on air pollution. Researchers found that lockdowns led to significant short-term reductions in nitrogen dioxide and fine particulate matter pollution globally as transportation and industrial activities declined substantially. However, the document notes that the improvements in air quality were temporary and pollution levels rose back to pre-pandemic levels as restrictions eased and activity increased again.

Uploaded by

Juan ito
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views15 pages

Render Fragment

The document discusses the results of a study on the impact of COVID-19 lockdowns on air pollution. Researchers found that lockdowns led to significant short-term reductions in nitrogen dioxide and fine particulate matter pollution globally as transportation and industrial activities declined substantially. However, the document notes that the improvements in air quality were temporary and pollution levels rose back to pre-pandemic levels as restrictions eased and activity increased again.

Uploaded by

Juan ito
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 15

// __multiversion__

// This signals the loading code to prepend either #version 100 or #version 300 es
as apropriate.

#include "fragmentVersionCentroid.h"

#if __VERSION__ >= 300


#ifndef BYPASS_PIXEL_SHADER
#if defined(TEXEL_AA) && defined(TEXEL_AA_FEATURE)
_centroid in highp vec2 uv0;
_centroid in highp vec2 uv1;
#else
_centroid in vec2 uv0;
_centroid in vec2 uv1;
#endif
#endif
#else
#ifndef BYPASS_PIXEL_SHADER
varying vec2 uv0;
varying vec2 uv1;
#endif
#endif

varying vec4 color;


varying vec3 screen;

varying highp vec3 position;


varying highp vec3 look;

varying vec3 screen_pos;


varying highp vec3 world_pos;

varying POS3 t_pos;


varying POS3 h_pos;
varying float far_f;

varying POS3 wPos;


varying float wf;

varying highp float f;

varying highp vec3 wpos;

#include "uniformWorldConstants.h"
UNIFORM vec3 VIEW_POS;
UNIFORM highp float TIME;
UNIFORM vec4 FOG_COLOR;
UNIFORM vec2 FOG_CONTROL;
UNIFORM float RENDER_DISTANCE;
UNIFORM float FAR_CHUNKS_DISTANCE;
#include "uniformShaderConstants.h"
#include "uniformRenderChunkConstants.h"
#include "util.h"

LAYOUT_BINDING(0) uniform sampler2D TEXTURE_0;


LAYOUT_BINDING(1) uniform sampler2D TEXTURE_1;
LAYOUT_BINDING(2) uniform sampler2D TEXTURE_2;

float inrect(vec2 pos, float x1, float y1, float x2, float y2, float focus){
return min(1.0, max(min(min(pos.x - x1, x2 - pos.x), min(pos.y - y1, y2 - pos.y)),
0.0) / focus);
}

float playershadow(){
vec3 lookvector=position;
lookvector.x*=1.8;
vec3 pos = lookvector + vec3(0.4, 0.4, 0.4);
vec3 dir = vec3(-1.0, (1.25) * 0.31, 0.0);
float factor = 1.0;
if (pos.x < 0.2){
factor = max(0.0, pos.x / 0.4 + 0.5);
}
pos += dir * pos.x;
float focus = .04;
float footwalk = sin((position.x - lookvector.x) * 2.0 + (position.z -
lookvector.z) * 2.0);
float handswalk = sin((position.x - lookvector.x) * 2.0 + (position.z -
lookvector.z)) * .5;
pos.yz -= vec2(.2, .4);
float body = max(inrect(pos.yz, -1.5 + footwalk*.4, -0.25, 0.75, .1, focus),
inrect(pos.yz, -1.5 - footwalk*.4, -.1, 0.75, 0.25, focus));
float hands = max(inrect(pos.yz, -0.5 + footwalk * .1, -0.5, 0.25, .1, focus),
inrect(pos.yz, -0.5 - footwalk * 0.1, -.1, 0.25, 0.5, focus));
return min(1.0, max(body, hands)) * factor;
}

#ifdef FOG
varying vec4 fogColor;
#endif

highp vec3 light_pos(){


highp vec3 norm_block = normalize(cross(dFdx(position), dFdy(position)));
return norm_block;
}

highp vec3 LowtoneSaturate( vec3 color)


{
color *= 1.1f;
color-= 0.1f;
color= clamp(color, vec3(0.0f), vec3(1.0f));
return color;
}

highp vec3 RainSaturation( vec3 color)


{
color *= 0.6f;
color-= 0.1f;
color= clamp(color, vec3(0.0f), vec3(1.0f));
return color;
}
highp vec3 ToneMap(vec3 x) {
float A = 3.0;
float B = 0.05;
float C = 1.60;
float D = 0.40;
float E = 0.40;
float F = 1.0;

x=x*(A*x+B)/(x*(C*x+D)+E/F);

return (x-dot(x,vec3(0.1)))*1.5+0.05;}

float filmic_curve(float x) {
float A = 0.22;
float B = 0.5;
float C = 3.0;
float D = 0.5;
float E = 0.02;
float F = 0.5;
return ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F;
}

highp vec3 toneMap(vec3 clr) {


float W = 1.3 / 1.0;

float Luma = dot(clr, vec3(1.0));


vec3 Chroma = clr - Luma;
clr = (Chroma * vec3(1.1)) + Luma;
clr = vec3(filmic_curve(clr.r), filmic_curve(clr.g), filmic_curve(clr.b)) /
filmic_curve(W);

return clr;
}

float getColorDifference(highp vec3 c1, highp vec3 c2){


highp vec3 d = abs(c1 - c2); //think about using length function
return (d.r + d.g*0.0+ d.b);//1.0;
}

highp float ray_sun(highp vec3 wp,vec3 d){


highp vec3 np = normalize(wp);
highp float sun = abs(1.-length(np.yz));
d.r = clamp(d.r*1.2-0.3,0.,0.4);
return sun*d.r; }

highp float rand(highp vec2 A){


return fract(sin(A.x+A.y*5.)*7.);
}

highp float noise(highp vec2 A){


highp vec2 B=floor(A);
highp vec2 C=fract(A);
highp vec2 D=C*(2.-C);
return
2.*mix(mix(rand(B+vec2(.0)),rand(B+vec2(1.,.0)),D.x),mix(rand(B+vec2(.0,1.)),rand(B
+vec2(1.)),D.x),D.y)-1.;}
highp float cos_between_vecs(highp vec3 v1, highp vec3 v2){
return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z) / length(v1) / length(v2);
}

highp float randz(highp float n){


return fract(cos(n) * 3782.288);
}

highp float noisez(highp float pos){


highp float start = floor(pos);
highp float smoothy = smoothstep(0.0, 1.0, fract(pos));
return mix(randz(start), randz(start + 1.0), smoothy);}

highp float noise2d(highp float horizont, highp float forward){


highp float start = floor(forward);
highp float smoothy = smoothstep(0.0, 1.0, fract(forward));
return mix(noisez(horizont + randz(start) * 700.0), noisez(horizont + randz(start
+ 1.0) * 700.0), smoothy);
}

highp float chuyen_dong(highp vec3 pos){


pos.z += TIME * 0.35;
highp float chuyen_dong1 = noise2d(pos.z+pos.z+pos.z, pos.z+pos.z+pos.x+pos.x);
highp float chuyen_dong2 = sin(chuyen_dong1) * 2.5 + 0.5;
float interp = sin(TIME * 2.5 + pos.z+pos.x+pos.z+pos.x) * sin(pos.z) * 0.35;
return mix(chuyen_dong1, chuyen_dong2, interp);
}

highp vec3 ban_do_nuoc(highp vec3 pos){


highp float value = (chuyen_dong(pos + vec3(6.0, 0.0, 10.0)) - chuyen_dong(pos));
return vec3(value, 1.0, -value);
}

vec4 mat_troi_mau(highp vec3 pos, float day_flag){


highp vec3 sun_pos = vec3(0.0, 0.0, 0.0);
float white = clamp(abs(day_flag - 0.7) / 0.3 + 0.2, 0.0, 1.0);
vec4 sun_color = vec4(5.0, white, white, 5.0);
sun_color.a = pow(max(0.0, 0.0 - length(sun_pos.xz - pos.xz) / 0.0), 0.6);
return sun_color;
}

void main()
{
#ifdef BYPASS_PIXEL_SHADER
gl_FragColor = vec4(0, 0, 0, 0);
return;
#else

highp float fact = 0.00065;

#if USE_TEXEL_AA
highp vec4 diffuse = texture2D_AA(TEXTURE_0, uv0);
highp vec4 dxm = texture2D_AA( TEXTURE_0, vec2(uv0.x-0.1 * fact, uv0.y) );
highp vec4 dym = texture2D_AA( TEXTURE_0, vec2(uv0.x, uv0.y-0.1 * fact) );
#else
highp vec4 diffuse = texture2D(TEXTURE_0, uv0);
highp vec4 dxm = texture2D( TEXTURE_0, vec2(uv0.x-0.1 * fact, uv0.y) );
highp vec4 dym = texture2D( TEXTURE_0, vec2(uv0.x, uv0.y-0.2 * fact) );
#endif

highp vec4 d5 = mix(dxm, dym, 0.5);

#ifdef SEASONS_FAR
diffuse.a = 1.0;
#endif

#if USE_ALPHA_TEST
#ifdef ALPHA_TO_COVERAGE
#define ALPHA_THRESHOLD 0.05
#else
#define ALPHA_THRESHOLD 0.5
#endif
if(diffuse.a < ALPHA_THRESHOLD)
discard;
#endif

vec4 inColor = color;


highp vec3 lp = light_pos();
highp float far = length(look)/RENDER_DISTANCE*0.8;

highp float time_ = texture2D(TEXTURE_1, vec2(0.0, 1.0)).r;


time_ = max(0.0, min(1.0, (time_ - 0.5) / 0.5));

if(FOG_CONTROL.x > 0.55){

if(time_ <= 0.2){

#ifdef BLEND
#else
#ifdef ALPHA_TEST

if((lp.x < 0.5 && -lp.x < 0.5 && lp.y < 0.5)){
diffuse.b = mix(diffuse.b * 1.0, diffuse.b / 1.4, pow(uv1.x, 5.5));
diffuse.rgb *= vec3(0.30);
}
#else
if((lp.x < 0.5 && -lp.x < 0.5 && lp.y < 0.5)){
diffuse.b = mix(diffuse.b * 1.0, diffuse.b / 1.4, pow(uv1.x, 5.5));
diffuse.rgb *= vec3(0.25);
}
#endif
#endif

if(time_ >= 0.05 && time_ <= 0.8){

#ifdef BLEND
#else
#ifdef ALPHA_TEST

if((lp.y > 0.5 && -lp.y > 0.5)){


diffuse.b = mix(diffuse.b * 1.0, diffuse.b / 1.4, pow(uv1.x, 5.5));
diffuse.rgb *= vec3(0.30);
}
#else
if((lp.y > 0.5 && -lp.y > 0.5)){
diffuse.b = mix(diffuse.b * 1.0, diffuse.b / 1.4, pow(uv1.x, 5.5));
diffuse.rgb *= vec3(0.25);
}
#endif
#endif

if(time_ >= 0.8){

#ifdef BLEND
#else
#ifdef ALPHA_TEST

if((lp.y > 0.5 && -lp.y > 0.5)){


diffuse.b = mix(diffuse.b * 1.0, diffuse.b / 1.4, pow(uv1.x, 5.5));
diffuse.rgb *= vec3(0.10);
}
#else
if((lp.y > 0.5 && -lp.y > 0.5)){
diffuse.b = mix(diffuse.b * 1.0, diffuse.b / 1.4, pow(uv1.x, 5.5));
diffuse.rgb *= vec3(0.05);
}
#endif
#endif

}
}

#if defined(BLEND)
diffuse.a *= inColor.a;
#endif

#if !defined(ALWAYS_LIT)
diffuse *= texture2D( TEXTURE_1, uv1 );
#endif

#ifndef SEASONS
#if !USE_ALPHA_TEST && !defined(BLEND)
diffuse.a = inColor.a;
#endif

diffuse.rgb *= inColor.rgb;
#else
vec2 uv = inColor.xy;
diffuse.rgb *= mix(vec3(1.0,1.0,1.0), texture2D( TEXTURE_2, uv).rgb*2.0,
inColor.b);
diffuse.rgb *= inColor.aaa;
diffuse.a = 1.0;
#endif

//PHAN_CHIEU_MAT_TROI

const vec3 origin_water_normal = vec3(0.0, 1.0, 0.0);


vec4 uvs = texture2D( TEXTURE_1, vec2(uv1.x*0.65,uv1.y));

highp vec3 frag_water_normal = ban_do_nuoc(look);

highp vec3 water_normal = mix(frag_water_normal, origin_water_normal, min(1.0,


length(look.xz) / max(50.0, abs(look.y) * 4.0)));

highp vec3 reflected_dir = normalize(reflect(look, water_normal));

highp vec3 reflected_pos = reflected_dir * 100.0 / reflected_dir.y + look;

vec4 phan_chieu = mat_troi_mau(reflected_pos * 2.3, uvs.r);

//NUOC_CHUYEN_DONG

float rT = (1.0 - uv1.x);

vec4 ch = texture2D( TEXTURE_1, vec2(0.0,1.0) ) ;

float buy = (1.0-pow(FOG_CONTROL.y,2.0));

float threatened = pow(min(max(1.1-pow(ch.r,10.0),0.0),1.0),3.0);

float you = min(pow(1.0-ch.r,2.0)*2.0,1.0);

vec4 lunch_water = vec4(1.75,1.73,1.55,1.0);


vec4 afternoon_water = vec4(1.8,1.5,0.5,1.0);
vec4 my_country = vec4(0.2,0.5,0.85,1.0);
vec4 rain_water = vec4(0.5,0.55,0.6,1.0)*pow(ch.r,0.35);

vec4 water_color = mix(lunch_water,afternoon_water,threatened*rT) ;


water_color = mix(water_color,my_country,you*rT);
water_color = mix(water_color,rain_water,buy*rT);

highp vec3 nuoc = ban_do_nuoc(look);

highp float nuoc_chuyen_dong = acos(abs(cos_between_vecs(look, nuoc)));

#ifdef BLEND
if(color.b > color.r){
diffuse = mix(diffuse,water_color,pow(nuoc_chuyen_dong/5.0, 1.5));

diffuse += phan_chieu * phan_chieu.a;


}
#endif

#ifdef BLEND
if(inColor.b > inColor.r){
diffuse.a *= 1.5;
}
#endif

#ifdef ALPHA_TEST

float normalpower = 0.25f;

if(diffuse.r > 0.5){


diffuse.rgb += ray_sun(look + position.x +
position.y,diffuse.rgb+0.5)*normalpower;}
if(diffuse.r > 0.5){
diffuse.rgb += ray_sun(look + position.z +
position.x,diffuse.rgb+0.5)*normalpower;}
if(diffuse.r > 0.5){
diffuse.rgb += ray_sun(look - position.x -
position.y,diffuse.rgb+0.5)*normalpower;}
if(diffuse.r > 0.5){
diffuse.rgb += ray_sun(look - position.z -
position.x,diffuse.rgb+0.5)*normalpower;}

if(diffuse.b > 0.3){


diffuse.rgb += ray_sun(look + position.x +
position.y,diffuse.rgb+0.5)*normalpower;}
if(diffuse.b > 0.3){
diffuse.rgb += ray_sun(look + position.z +
position.x,diffuse.rgb+0.5)*normalpower;}
if(diffuse.b > 0.3){
diffuse.rgb += ray_sun(look - position.x -
position.y,diffuse.rgb+0.5)*normalpower;}
if(diffuse.b > 0.3){
diffuse.rgb += ray_sun(look - position.z -
position.x,diffuse.rgb+0.5)*normalpower;}

if(diffuse.g > 0.4){


diffuse.rgb += ray_sun(look + position.x +
position.y,diffuse.rgb+0.5)*normalpower;}
if(diffuse.g > 0.4){
diffuse.rgb += ray_sun(look + position.z +
position.x,diffuse.rgb+0.5)*normalpower;}
if(diffuse.g > 0.4){
diffuse.rgb += ray_sun(look - position.x -
position.y,diffuse.rgb+0.5)*normalpower;}
if(diffuse.g > 0.4){
diffuse.rgb += ray_sun(look - position.z -
position.x,diffuse.rgb+0.5)*normalpower;}

#endif

//making rain puddles

//ALPHA TEST

//day
if(time_ >= 0.3){
if(FOG_CONTROL.x < 0.55){
#ifdef FOG
#ifdef ALPHA_TEST

highp vec3 raintorch = vec3(2.1, 1.2, -0.6) * 3.0;


diffuse.rgb += diffuse.rgb*vec3(raintorch)*pow(uv1.x*1.10,5.1);

diffuse.rgb = RainSaturation(diffuse.rgb);

diffuse.rgb*= 4.0;

if(uv1.y > 0.8210 && diffuse.r < 0.2){


diffuse.rgb += ray_sun(look + position.x + position.y,diffuse.rgb+0.5)*0.6;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.5)*0.6;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.y,diffuse.rgb+0.5)*0.6;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.5)*0.6;}

if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.y,diffuse.rgb+0.1)*0.6;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.1)*0.6;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.y,diffuse.rgb+0.1)*0.6;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.1)*0.6;}

#endif
#endif
}
}

//night

if(time_ <= 0.3){


if(FOG_CONTROL.x < 0.55){
#ifdef FOG
#ifdef ALPHA_TEST

highp vec3 raintorch = vec3(2.1, 1.2, -0.6) * 3.0;


diffuse.rgb += diffuse.rgb*vec3(raintorch)*pow(uv1.x*1.10,5.1);

diffuse.rgb*= 0.6;

if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.y,diffuse.rgb+0.2)*1.5;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.2)*1.5;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.y,diffuse.rgb+0.2)*1.5;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.2)*1.5;}

if(uv1.y > 0.8210 && diffuse.r > 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.y,diffuse.rgb+0.5)*1.0;}
if(uv1.y > 0.8210 && diffuse.r > 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.5)*1.0;}
if(uv1.y > 0.8210 && diffuse.r > 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.y,diffuse.rgb+0.5)*1.0;}
if(uv1.y > 0.8210 && diffuse.r > 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.5)*1.0;}

#endif
#endif
}
}

//BLEND

//day
if(time_ >= 0.4){
if(FOG_CONTROL.x < 0.55){
#ifdef FOG
#ifdef BLEND
diffuse.rgb += ray_sun(look + position.x,diffuse.rgb+0.8)*0.5;
#else
#ifdef ALPHA_TEST
#else

highp vec3 raintorch = vec3(2.1, 1.2, -0.6) * 1.0;


diffuse.rgb += diffuse.rgb*vec3(raintorch)*pow(uv1.x*1.10,5.1);

diffuse.rgb = RainSaturation(diffuse.rgb);

diffuse.rgb*= 2.0;

if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.z,diffuse.rgb+0.35)*0.6;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.35)*0.6;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.z,diffuse.rgb+0.35)*0.6;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.35)*0.6;}

if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.z,diffuse.rgb+0.03)*1.4;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.03)*1.4;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.z,diffuse.rgb+0.03)*1.4;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.03)*1.4;}

#endif
#endif
#endif
}
}

//night
if(time_ <= 0.4){
if(FOG_CONTROL.x < 0.55){
#ifdef FOG
#ifdef BLEND
diffuse.rgb += ray_sun(look + position.x,diffuse.rgb+0.8)*0.5;
#else
#ifdef ALPHA_TEST
#else

highp vec3 raintorch = vec3(2.1, 1.2, -0.6) * 3.0;


diffuse.rgb += diffuse.rgb*vec3(raintorch)*pow(uv1.x*1.10,5.1);

diffuse.rgb*= 1.0;

if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.z,diffuse.rgb+0.35)*0.4;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.35)*0.4;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.z,diffuse.rgb+0.35)*0.4;}
if(uv1.y > 0.8210 && diffuse.r < 0.2 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.35)*0.4;}

if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.x + position.z,diffuse.rgb+0.03)*1.2;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look + position.z + position.x,diffuse.rgb+0.03)*1.2;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.x - position.z,diffuse.rgb+0.03)*1.2;}
if(uv1.y > 0.8210 && diffuse.r > 0.3 && lp.y > 0.5){
diffuse.rgb += ray_sun(look - position.z - position.x,diffuse.rgb+0.03)*1.2;}

#endif
#endif
#endif
}
}

#ifdef BLEND
diffuse.rgb += ray_sun(look + position.x,diffuse.rgb+0.8)*0.5;
#else
#ifdef ALPHA_TEST
#else

if(lp.y > 0.5 && color.b > color.r){


diffuse.rgb += ray_sun(look + position.x,diffuse.rgb+0.5)*0.6;}
if(lp.y > 0.5 && color.b > color.r){
diffuse.rgb += ray_sun(look + position.z,diffuse.rgb+0.5)*0.6;}
if(lp.y > 0.5 && color.b > color.r){
diffuse.rgb += ray_sun(look - position.x,diffuse.rgb+0.5)*0.6;}
if(lp.y > 0.5 && color.b > color.r){
diffuse.rgb += ray_sun(look - position.z,diffuse.rgb+0.5)*0.6;}

#endif
#endif

#ifdef BLEND
highp float sp1 = 0.5;
highp float sp2 = 1.5;
highp vec3 N = normalize(cross(dFdx(look),dFdy(look)));
highp vec3 viewDir = normalize(vec3(-4,1,0) - look);
highp vec3 reflectDir = reflect(-viewDir, N);
highp float spec = pow(max(dot(reflectDir, N), 0.0),5.0);
diffuse.rgb += sp1 *spec *sp2;
#endif

//nether 0.1

if((FOG_CONTROL.x == 0.1)){
diffuse.rgb = mix(diffuse.rgb, vec3(1.5)*FOG_COLOR.rgb*1.5, far*6.0);
diffuse.rgb *= 3.0;
}

//underwater 0.02

vec3 underwatercolor = vec3(1.4, 3.0, 4.2) * 3.0;

if(time_ >= 0.01){


if((FOG_CONTROL.x == 0.02)){
diffuse.rgb = mix(diffuse.rgb, vec3(1.0, 1.6, 2.0)*FOG_COLOR.rgb*1.0, far*3.0);
diffuse.rgb*= underwatercolor;}
}

if((FOG_CONTROL.x == 0.02)){
highp vec3 torchinwater = vec3(2.1, 0.6, -0.6) * 0.8;
diffuse.rgb += diffuse.rgb*vec3(torchinwater)*pow(uv1.x*1.10,5.1);
}

if(time_ <= 0.3){


if((FOG_CONTROL.x == 0.02)){
highp vec3 torchinwater = vec3(2.1, 1.6, -0.6) * 5.0;
diffuse.rgb += diffuse.rgb*vec3(torchinwater)*pow(uv1.x*1.10,5.1);
}
}

//reflection underground

if((FOG_CONTROL.x == 0.02)){
#ifdef BLEND
diffuse.rgb += ray_sun(look + position.x,diffuse.rgb+0.8)*0.5;
#else
#ifdef ALPHA_TEST
#else

if(uv1.y < 2.0){


diffuse.rgb += ray_sun(look + position.x,diffuse.rgb+0.5)*1.5;}
if(uv1.y < 2.0){
diffuse.rgb += ray_sun(look + position.z,diffuse.rgb+0.5)*1.5;}
if(uv1.y < 2.0){
diffuse.rgb += ray_sun(look - position.x,diffuse.rgb+0.5)*1.5;}
if(uv1.y < 2.0){
diffuse.rgb += ray_sun(look - position.z,diffuse.rgb+0.5)*1.5;}

#endif
#endif
}

highp vec4 normalcolor = mix(dxm, dym, 2.0);


//NEW SPECULAR MAPPING

if(FOG_CONTROL.x > 0.55){

vec3 specularcolorday = vec3(0.35,0.5,0.5) * 1.0;

if(time_ >= 0.8){


if(normalcolor.r > 0.45 && uv1.y >= 0.8751){
diffuse.rgb += ray_sun(look, diffuse.rgb+0.5)*specularcolorday;}
}

vec3 specularcolorsunset = vec3(0.7,0.6,0.4) * 1.0;

if(time_ > 0.005 && time_ <= 0.8){


if(normalcolor.r > 0.45 && uv1.y >= 0.8751){
diffuse.rgb += ray_sun(look, diffuse.rgb+0.5)*specularcolorsunset;}
}

vec3 specularcolornight = vec3(0.1, 0.1, 0.2) * 1.0;

if(time_ < 0.005){


if(normalcolor.r > 0.45 && uv1.y >= 0.8751){
diffuse.rgb += ray_sun(look, diffuse.rgb+0.5)*specularcolornight;}
}

vec3 watercolorday = vec3(0.2,0.4,0.7) * 0.5;


vec3 watercolorsunrise = vec3(0.2,0.4,0.7)*0.3;
vec3 watercolornight = vec3(0.1);

// making color water

if(FOG_CONTROL.x > 0.55){

//day
#ifdef BLEND
if((color.b > color.r && time_ >= 0.6)){
diffuse.rgb*= watercolorday;}
#endif

//sunrise
#ifdef BLEND
if((color.b > color.r && time_ > 0.005 && time_ <= 0.6)){
diffuse.rgb*= watercolorsunrise;}
#endif

//night
#ifdef BLEND
if((color.b > color.r && time_ < 0.005)){
diffuse.rgb*= watercolornight;}
#endif

//shadows
float uY = uv1.y;

vec2 uvl=uv1;
uvl.y-=playershadow()*.6;
diffuse *= texture2D(TEXTURE_1, uvl);

vec3 shadowColor = vec3(0.55);

if((uY<= 0.8751)){
diffuse.rgb*= shadowColor;}

highp vec3 torch = vec3(2.1, 0.6, -0.6) * 1.5;


diffuse.rgb += diffuse.rgb*vec3(torch)*pow(uv1.x*1.10,5.1);

//sunray direction sun for lowersunset


if(FOG_CONTROL.x > 0.55){
if(time_ > 0.005 && time_ <= 0.7){
if((lp.z < 0.5 && -lp.z < 0.5 && -lp.y < 0.5 && lp.y < 0.5 && uY>= 0.6890)){
vec3 sunsetcolor = vec3(1.1, 1.0, 0.6) * 3.0;
diffuse.rgb *= sunsetcolor;
}
}
}

//sunray direction sun for uppersunset


if(FOG_CONTROL.x > 0.55){
if(time_ > 0.7 && time_ <= 0.8){
if((lp.x < 0.5 && -lp.x < 0.5 && -lp.y < 0.5 && uY>= 0.6890)){
diffuse.rgb *= 0.4;}
vec3 sunsetcolorB = vec3(1.1, 1.0, 0.6)*3.0;
if((-lp.y < 0.5 && -lp.z < 0.5 && lp.z < 0.5 && uY>= 0.6890)){
diffuse.rgb *= sunsetcolorB;}
}
}

//sunlight direction for day

if(FOG_CONTROL.x > 0.55){


if(time_ >= 0.8){
if((lp.y < 0.5 && lp.x < 0.5 && -lp.x < 0.5 && uY>= 0.8751)){
diffuse.rgb *= 0.3;}
vec3 middledaycolor = vec3(1.1, 1.1, 1.0)*1.0;
if((lp.y > 0.5 && uY>= 0.6890)){
diffuse.rgb *= middledaycolor;}
}
}

if(FOG_CONTROL.x < 0.55){


diffuse.rgb *= vec3(0.43);
}

if(FOG_CONTROL.x > 0.55){

//colorcycle

vec3 daycolor = vec3(1.7, 1.5, 1.3);

if(time_ >= 0.8){


if((uY>= 0.8751)){
diffuse.rgb*= daycolor;}
}

vec3 sunrisecolor = vec3(1.5, 1.3, 1.1) * 0.5;

if(time_ > 0.005 && time_ <= 0.8){


if((uY>= 0.8751)){
diffuse.rgb*= sunrisecolor;}
}

vec3 nightcolor = vec3(0.6) * 1.3;

if(time_ <= 0.005){


if((uY>= 0.8751)){
diffuse.rgb*= nightcolor;}
}

//fog cycle

// day

if(time_ >= 0.8){


diffuse.rgb = mix(diffuse.rgb, vec3(1.0, 1.1, 1.3)*1.0, far*0.3);
}

// sunrise

if(time_ > 0.02 && time_ <= 0.8){


diffuse.rgb = mix(diffuse.rgb, vec3(1.2,0.5,0.0)*0.5, far*0.3);
}

// night

if(time_ < 0.02){


diffuse.rgb = mix(diffuse.rgb, vec3(0.8)*0.5, far*0.05);
}

//tonemapping
if((FOG_CONTROL.x > 0.15)){
diffuse.rgb = toneMap(diffuse.rgb)*1.0;
}

#ifdef FOG
diffuse.rgb = mix( diffuse.rgb, fogColor.rgb, fogColor.a );
#endif

gl_FragColor = diffuse;

#endif // BYPASS_PIXEL_SHADER
}

You might also like