Hello everyone!
I want to create some custom object in my scene.My plan is to build a RibbonMesh first,then select some vertices of the RibbonMesh and use BABYLON.Vector3.TransformCoordinates to transform them.
But when I apply material to the transformed RibbonMesh I found a question:the Meshbuilder always automatically use the whole texture,so when the mesh is not absolutely flat there must be some triangles whose texture is distorted,such as:
(the uvScale of texture is 101)
I try to eliminate the warping by adjusting the uv of each vertex,but I find that for the triangles in the mesh share vertices,the uv must be cumulative!So if I change the mesh,I must change the texture image synchronously!Is there a mature way to solve it?
I try another way to solve this question:I create a “myCreateRibbon” function,in this function I create six vertices for each position,so I can set the uv coordinates separately:
The grid become regular,but I add 5 times redundant vertices!
Now I want to know which is the correct way to make the triangles?Can you give me some advice?
The “myCreateRibbon” function can be found at here,and this a sketch Map of the triangles:
I tried the mesh.convertToFlatShadedMesh,the vertex really become six times,but the uvs are still cumulative.So the operation sequences should be
1.create a mesh by Meshbuilder
2.convert the mesh to flat
3.adjust the uvs by myself
4.transform vertices by some condition
5.call MeshBuilder.CreateRibbon again?(use instance param?)
After the fifth step,is the mesh flat still or should be convert to flat and adjust the uv again?
On the other hand,I wonder how much the redundant vertices will affect rendering speed.How should I choose between clear texture and rendering speed?
In addition,I want to create some “Terrain attachment” mesh which appress to the surface of the ground mesh(eg a road rises and falls with the mountain).Could I find a function in Babylon ready to use?
I seem to have heard in a tutorial(maybe the old http://pixelcodr.com/?) that the convertToFlatShadedMesh function may change the time to process light calculations in shader progrem.Will it be?