I am learning webgl_custom_attributes example. Here is the vertex-shader below:
uniform float amplitude;
attribute float displacement;
varying vec3 vNormal;
varying vec2 vUv;
void main() {
vNormal = normal;
vUv = ( 0.5 + amplitude ) * uv + vec2( amplitude );
vec3 newPosition = position + amplitude * normal * vec3( displacement );
gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );
}
I am wondering why the code comes liks this:
vec3 newPosition = position + amplitude * normal * vec3( displacement );
instead of below:
vec3 newPosition = position + displacement * amplitude * normal ;
I believe they are assigning the same value to newPosition.