First, thank you so much for this great work and community.
I am trying to write a simple low poly style water material.
I know there are different ways of writing this kind of thing, and I would like as much as possible to do it in a js script (I come from C# dev', and I am not super comfy with frontend yet).
The one way I can understand after hours of compiling infos on the Net is this one:
var waterVertexShader =
"attribute float vertexDisplacement;" +
"uniform float time;" +
"varying vec3 vUv;" +
"void main() {" +
" vUv = position;" +
" vUv.y += sin(time) * 0.01;" +
" gl_Position = projectionMatrix * modelViewMatrix * vec4(vUv, 1.0);"+
"}"
;
var waterFragmentShader =
"void main() {" +
"gl_FragColor = vec4(0.65, 0.88, 1, 1);" +
"}";
},
flatShading : true,
vertexShader: waterVertexShader,
That gives me the beginning of the wanted behavior, but this is not my issue.
Now, if I want to inherit let's say the Lambert or Phong material properties, what is the right way to proceed?
It sounds very basic, but this is the only relevant link I found: ThreeJS - Extend Lambert Shader with Custom VertexShader and there is no answer.
Thank you for your attention.