… is a strong understatement.
The solution looks clear to me and is obviously perfect. I especially like the way of determining p0,p1,p2.
I myself have only managed to apply the rather complicated codepen ( https://codepen.io/marco_fugaro/pen/xxZWPWJ from Calculating vertex normals after displacement in the vertex shader ) for my geometry in the meantime.
But I could not get the essential out of the mixture of controls-state
const controls = initControls({ ...
and
vertexShader: monkeyPatch(THREE.ShaderChunk.meshphysical_vert, {...
pull out.
In the solution I see that <defaultnormal_vertex> is the key. But how to do it, I certainly would not have thought of that. The extensive shader parts in three.module.js I do not see through.
Although I had tried to do something with
var defaultnormal_vertex = "vec3 transformedNormal = objectNormal; ...
but without success.
Can this way of determining vertex normals be directly integrated into three.js? Or are there reasons why this is not useful?