X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=shaders%2Fpoint_map.h;h=931d512595edad6ddadd5c1a0e7e32db449fd6c1;hb=38e07d851915d4ea3d25eeb28a3ace78fb0d1c12;hp=533b0ddf1ea1d6ad5bd83452d50b0f2637d25677;hpb=0310bab3c018e23f5516c3e3c3653b844a8106ed;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/point_map.h b/shaders/point_map.h index 533b0dd..931d512 100644 --- a/shaders/point_map.h +++ b/shaders/point_map.h @@ -10,8 +10,7 @@ static struct vg_shader _shader_point_map = { .orig_file = "shaders/cloud.vs", .static_src = "layout (location=0) in vec4 a_co;\n" -"layout (location=1) in vec4 a_norm;\n" -"layout (location=2) in vec4 a_colour;\n" +"layout (location=1) in vec4 a_colour;\n" "\n" "#line 1 1 \n" "const float k_motion_lerp_amount = 0.01;\n" @@ -31,7 +30,7 @@ static struct vg_shader _shader_point_map = { " aMotionVec1 = vec3( vproj1.xy, vproj1.w );\n" "}\n" "\n" -"#line 6 0 \n" +"#line 5 0 \n" "\n" "uniform mat4x3 uMdl;\n" "uniform mat3 uNormMtx;\n" @@ -41,7 +40,6 @@ static struct vg_shader _shader_point_map = { "uniform vec4 uTransform;\n" "\n" "out vec4 aColour;\n" -"out vec3 aNorm;\n" "out vec3 aWorldCo;\n" "out vec3 aCo;\n" "\n" @@ -69,24 +67,22 @@ static struct vg_shader _shader_point_map = { "\n" "\n" " vec3 center = vec3(0.5);\n" -" vec3 lco = mapP(mco-center);\n" -" mco = lco + center;\n" +" vec3 lco = mapP(mco);\n" "\n" " vec3 world_pos0 = uMdl * vec4( mco, 1.0 );\n" " vec4 vproj0 = uPv * vec4( world_pos0, 1.0 );\n" " vec4 vproj1 = uPvmPrev * vec4( mco, 1.0 );\n" "\n" " float t = max(0.0,uTime.y);\n" -" float scaler = smoothstep(0.6,0.58,length(lco.xz*vec2(0.7,1.0)));\n" +" float scaler = smoothstep(0.6,0.58,length(lco.xz));\n" "\n" " vs_motion_out( vproj0, vproj1 );\n" "\n" " gl_Position = vproj0;\n" -" gl_PointSize = (8.0*uTransform.w*scaler) / (gl_Position.z + 0.01);\n" +" gl_PointSize = (9.0*uTransform.w*scaler) / (gl_Position.z + 0.01);\n" " aWorldCo = world_pos0;\n" -" aColour = a_colour*scaler*(0.3+a_co.y);\n" +" aColour = a_colour*scaler;\n" " aCo = mco;\n" -" aNorm = uNormMtx * a_norm.xyz;\n" "}\n" ""}, .fs = @@ -119,7 +115,6 @@ static struct vg_shader _shader_point_map = { "uniform vec3 uCamera;\n" "\n" "in vec4 aColour;\n" -"in vec3 aNorm;\n" "in vec3 aCo;\n" "in vec3 aWorldCo;\n" "\n" @@ -130,8 +125,7 @@ static struct vg_shader _shader_point_map = { " float dither = fract( vDither.g / 71.0 ) - 0.5;\n" "\n" " float diff = length(gl_PointCoord.xy-vec2(0.5));\n" -" if( diff>0.5 )\n" -" discard;\n" +" if( diff+dither>0.5 )discard;\n" "\n" " compute_motion_vectors();\n" " FragColor = aColour;\n"