1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexGradients;
4 uniform vec3 uSandColour;
5 uniform vec2 uBlendOffset;
7 #include "common_scene.glsl"
8 #include "motion_vectors_fs.glsl"
12 compute_motion_vectors();
16 vec3 vfrag = vec3(0.5,0.5,0.5);
19 vec4 wgarbage = texture( uTexGarbage, aCo.xz * 0.015 );
21 // Creating normal patches
22 vec3 modnorm = (wgarbage.rgb-0.4) * 1.4;
23 vec3 qnorm = normalize(floor(aNorm.xyz*4.0+modnorm)*0.25);
24 qnorm += vec3(0.001,0.0,0.0);
26 vec2 dir = normalize(qnorm.xz);
27 vec2 uvdiffuse = aCo.xz * 0.02;
28 uvdiffuse = mat2(dir.y, dir.x, -dir.x, dir.y) * uvdiffuse;
31 vec4 rgarbage = texture( uTexGarbage, uvdiffuse );
34 float amtgrass = step(qnorm.y,0.6);
35 float amtsand = min(max((aCo.y - 10.0) * -0.1,0.0)*qnorm.y,1.0);
36 vec2 uvgradients = aUv + vec2( amtgrass + rgarbage.a*0.8 )*uBlendOffset;
37 vfrag = texture( uTexGradients, uvgradients ).rgb;
38 vfrag = mix( vfrag, uSandColour, amtsand );
40 qnorm = mix( qnorm, aNorm.xyz, amtsand );
42 if( g_light_preview == 1 )
47 vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );
48 oColour = vec4(vfrag, 1.0);