X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fscene_vertex_blend.h;fp=shaders%2Fscene_vertex_blend.h;h=aba9d8b40d97ee1fa4101dd408c29a9549ed82c9;hb=2c91a71533b4ce86b9e7fd708420ae05c74d8f52;hp=2302cc7e8ff0e03c607c1cb427271f306df12c1b;hpb=d27f8a570e5cfad1974b4be303888e17ff846406;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/scene_vertex_blend.h b/shaders/scene_vertex_blend.h index 2302cc7..aba9d8b 100644 --- a/shaders/scene_vertex_blend.h +++ b/shaders/scene_vertex_blend.h @@ -209,19 +209,15 @@ static struct vg_shader _shader_scene_vertex_blend = { " return world_depth_sample( pos ) - ref_depth;\n" "}\n" "\n" -"float shadow_sample( vec3 vdir )\n" -"{\n" -" vec3 sample_pos = aWorldCo + vdir;\n" -" float height_sample = world_depth_sample( sample_pos );\n" +"float shadow_sample( vec3 co ){\n" +" float height_sample = world_depth_sample( co );\n" "\n" -" float fdelta = height_sample - sample_pos.y;\n" +" float fdelta = height_sample - co.y;\n" " return clamp( fdelta, 0.2, 0.4 )-0.2;\n" "}\n" "\n" -"float newlight_compute_sun_shadow( vec3 dir )\n" -"{\n" -" if( g_shadow_samples == 0 )\n" -" {\n" +"float newlight_compute_sun_shadow( vec3 co, vec3 dir ){\n" +" if( g_shadow_samples == 0 ){\n" " return 1.0;\n" " }\n" "\n" @@ -229,15 +225,15 @@ static struct vg_shader _shader_scene_vertex_blend = { " float flength = g_shadow_length;\n" "\n" " float famt = 0.0;\n" -" famt += shadow_sample((dir+vec3(-0.56,0.55, 0.30)*fspread)*flength*0.1);\n" -" famt += shadow_sample((dir+vec3( 0.80,0.68, 0.34)*fspread)*flength*0.2);\n" -" famt += shadow_sample((dir+vec3( 0.78,0.07,-0.06)*fspread)*flength*0.3);\n" -" famt += shadow_sample((dir+vec3(-0.59,0.07,-0.42)*fspread)*flength*0.4);\n" +" famt += shadow_sample(co+(dir+vec3(-0.56,0.55, 0.30)*fspread)*flength*0.1);\n" +" famt += shadow_sample(co+(dir+vec3( 0.80,0.68, 0.34)*fspread)*flength*0.2);\n" +" famt += shadow_sample(co+(dir+vec3( 0.78,0.07,-0.06)*fspread)*flength*0.3);\n" +" famt += shadow_sample(co+(dir+vec3(-0.59,0.07,-0.42)*fspread)*flength*0.4);\n" "\n" -" //famt+=shadow_sample((dir+vec3(-0.790,-0.933,-0.875)*fspread)*flength*0.5);\n" -" //famt+=shadow_sample((dir+vec3( 0.807,-0.690, 0.472)*fspread)*flength*0.6);\n" -" //famt+=shadow_sample((dir+vec3( 0.522,-0.379, 0.350)*fspread)*flength*0.7);\n" -" //famt+=shadow_sample((dir+vec3( 0.483, 0.201, 0.306)*fspread)*flength*0.8);\n" +" //famt+=shadow_sample(co+(dir+vec3(-0.790,-0.933,-0.875)*fspread)*flength*0.5);\n" +" //famt+=shadow_sample(co+(dir+vec3( 0.807,-0.690, 0.472)*fspread)*flength*0.6);\n" +" //famt+=shadow_sample(co+(dir+vec3( 0.522,-0.379, 0.350)*fspread)*flength*0.7);\n" +" //famt+=shadow_sample(co+(dir+vec3( 0.483, 0.201, 0.306)*fspread)*flength*0.8);\n" "\n" " return 1.0 - famt;\n" "}\n" @@ -325,8 +321,8 @@ static struct vg_shader _shader_scene_vertex_blend = { " float fdist = length(halfview);\n" " halfview /= fdist;\n" "\n" -" float world_shadow = newlight_compute_sun_shadow( g_sun_dir.xyz \n" -" * (1.0/(max(g_sun_dir.y,0.0)+0.2)) );\n" +" float world_shadow = newlight_compute_sun_shadow( \n" +" co, g_sun_dir.xyz * (1.0/(max(g_sun_dir.y,0.0)+0.2)) );\n" "\n" " vec3 total_light = clearskies_lighting( \n" " normal, min( light_mask, world_shadow ), halfview );\n"