Changeset 12091 for data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationWithNormalsVp.glsl
- Timestamp:
- Nov 9, 2018, 1:06:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
data/branches/Shader_HS18/programs/Example/GLSL150/HardwarePoseAnimationWithNormalsVp.glsl
r12083 r12091 9 9 in vec4 uv4; // pose2norm 10 10 11 out vec2 oUv;11 // out vec2 oUv; 12 12 out vec4 colour; 13 13 … … 20 20 void main() 21 21 { 22 23 vec4 posinterp = vec4(pos + anim_t.x*uv1.xyz + anim_t.y*uv3.xyz, 1.0);22 // interpolate position 23 vec4 posinterp = vec4(vertex.xyz + anim_t.x * uv1.xyz + anim_t.y * uv3.xyz, 1.0); 24 24 25 25 // nlerp normal 26 // nlerp normal 27 // First apply the pose normals (these are actual normals, not offsets) 28 vec3 ninterp = anim_t.x*uv2.xyz + anim_t.y*uv4.xyz; 26 // First apply the pose normals (these are actual normals, not offsets) 27 vec3 ninterp = anim_t.x * uv2.xyz + anim_t.y * uv4.xyz; 29 28 30 31 32 33 34 ninterp = ninterp + (normal * remainder);35 29 // Now add back any influence of the original normal 30 // This depends on what the cumulative weighting left the normal at, if it's lacking or cancelled out 31 //float remainder = 1.0 - min(anim_t.x + anim_t.y, 1.0); 32 float remainder = 1.0 - min(length(ninterp), 1.0); 33 ninterp = ninterp + (remainder * normal.xyz); 34 ninterp = normalize(ninterp); 36 35 37 gl_Position = worldViewProj * posinterp; 38 oUv = uv0.xy; 39 40 vec3 lightDir = normalize( 41 objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w)); 36 gl_Position = worldViewProj * posinterp; 37 // oUv = uv0.xy; 42 38 43 // Colour it red to make it easy to identify 44 float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0); 45 colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0); 39 vec3 lightDir = normalize( 40 objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w)); 41 42 // Colour it red to make it easy to identify 43 float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0); 44 colour = vec4((ambient.rgb + vec3(lit, lit, lit)) * vec3(1.0, 0.0, 0.0), 1.0); 46 45 }
Note: See TracChangeset
for help on using the changeset viewer.