scale route markers correctly on custom meshes
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_vertex_blend.h
index 672d154f5d1b2233a7ad2006f56f03876101f378..c5206d125dc08e4667b78b26644aaeb4878a45a7 100644 (file)
@@ -204,14 +204,18 @@ static struct vg_shader _shader_scene_vertex_blend = {
 "   vec3 sun_colour  = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n"
 "        sun_colour *= sun_shape;\n"
 "\n"
-"\n"
+"   \n"
 "   float star = 0.0;\n"
-"   for( float j = 1.0; j <= 4.1; j += 1.0 ){\n"
-"      float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n"
-"      star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n"
+"   float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n"
+"\n"
+"   if( star_blend > 0.001 ){\n"
+"      for( float j = 1.0; j <= 4.1; j += 1.0 ){\n"
+"         float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n"
+"         star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n"
+"      }\n"
 "   }\n"
 "   \n"
-"   vec3 composite   = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n"
+"   vec3 composite   = sky_colour + sun_colour + star*star_blend;\n"
 "   return composite;\n"
 "}\n"
 "\n"
@@ -473,7 +477,7 @@ static struct vg_shader _shader_scene_vertex_blend = {
 "   vec4 rgarbage = texture( uTexGarbage, uvdiffuse );\n"
 "\n"
 "   // Colour blending\n"
-"   float fblendclip = step(0.380,aNorm.w + (rgarbage.r-0.5)*-1.740)*0.320;\n"
+"   float fblendclip = step(0.380,aNorm.w + (rgarbage.r-0.5)*-1.740)*0.380;\n"
 "   vec2 uvgradients = aUv + vec2( fblendclip, 0.0 );\n"
 "\n"
 "   vfrag = texture( uTexGradients, uvgradients ).rgb;\n"
@@ -485,7 +489,7 @@ static struct vg_shader _shader_scene_vertex_blend = {
 "   }\n"
 "\n"
 "   vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );\n"
-"   oColour = vec4(vfrag, 1.0);\n"
+"   oColour = vec4(vec3(aNorm.w), 1.0);\n"
 "}\n"
 ""},
 };