need some refactor step but if that is ok i can do that steps
*** don’t notice the mesh builder step that is alpha version yet
also if you wanna find the better way to detect lines on camera side you most calculate vertex normal and you can use simple math formula for find the same direction with camera or not
but a lot situation you see after you have that same face behind the other face but right direction
in final you most detect all point of all face for have successful result i dont recommend that so less fps keep GPU solution always
You can switch between white materials / normal materials by changing the const whiteMaterials.
You can change the number of dashes and the spacing between them by modifying this line in the fragment shader:
if (mod(sum, .33) < 0.12) discard;
Change the .33 and 0.12 values to increase/decrease the number of dashes/the space between dashes.
Note that I create the markers after all the other meshes so that they are displayed after the dashed lines: if dashed lines are displayed after, they overwrite the markers because z-test is disabled when drawing the dashes.
[EDIT]
To explain quickly how I do it:
I clone the lines and set a specific vertex/fragment shader that do a crude dash rendering
I disable the z-testing for those line meshes (engine.setDepthFunction(BABYLON.Engine.ALWAYS))
Those lines are rendered as usual. As they are displayed in the exact same position of the original lines, the dotted pattern where the lines are not hidden is not visible (you would see it if the cloned lines did not have the same colour than the original lines). And because z-testing is disabled, you do see the line “inside” meshes.
Note that you can change the alpha value from the last line of the fragment shader to dim the dashed lines.
[/EDIT]
WOW! I can’t believe it. This is awesome! This is the best answer I could imagine. Robust, clear and complete. I really do appreciate your help my friend.