Multi material reflections dont match on same surface if created parametricly

Hi there…

I’m building some parametric mesh building code for my project and while playing with multimaterials i couldn’t match the reflections. Its two reflective materials in one face just different colors and they seem to have different reflection indexes.

im creating a bezier shape array and lathe. its all maths so they join at same coordinates. If i use mesh.forceSharedVertices(); the abnormality of reflection goes away but submeshes are lost too and multimaterial is disabled…
https://www.babylonjs-playground.com/#PJL2EH#1

i tought the normals are rotated at start and end of meshes but thats not the case…
i tried dividing mesh with CSG and it divides meshes perfectly, no reflection problem but its slow…
is there a way fixing these reflection to be in synch ?
thanks…

Definitely looks like a discontinuity in the normal.

You could potentially reapply the normal of the top part to the one of the bottom to ensure they exactly match.

In the mean time I ll summon @jerome and @JohnK our amazing maths ppl :slight_smile:

1 Like

Thanks for your reply.
As i mentioned i added add normal function and made lengths of normals like 20 still there was no seperation in normals in the middle. Maybe its made on purpose in the webGl renderer so two different meshes side by side can be seperated by some light distortion.
I use 3dsmax and when i see this kind of seperation i make smoothing groups the same. But i cant find any smoothing groups here. They are calculated from normals…

Still if there is a way to find the normals and apply their normals to the other mesh faces i can try that approach. But i couldnt find a way to catch those polygons. And how do i modify one faces normal ?