Patalarc
Member
|
RE: Heightmap setMaterial issue
Hi
when creating a mesh with Build, different parts are created automatically depending on the materials used, in this way you can create terrain with many different materials
remove the line heightmap.setMaterial(....) and change mesh.draw(...) by:
mesh.parts(0).draw(MatrixIdentity);
there you can see the initial part of the mesh, to see the other parts change it to:
mesh.parts(1).draw(MatrixIdentity);
you're changing the vertex only in parts(0). (To see this you can add again heightmap.setMaterial (....) and see that only modified parts(0), the parts(1) remains unchanged)
the problem is that when creating new parts, the position of the index of the vertex are modified, that is why moving the vertex look messy.
to modify the mesh you would have to move each vertex of each parts to the right position, but i do not know in what way build sorts the vertex to create each part.
about the error that occurs sometimes, not sure but it may be because you try to access index of vertex of the parts(0) that no longer exist, because they went to parts(1) or some problem like that.
|
|
08-11-2013 10:17 PM |
|
SamerK
Member
|
RE: Heightmap setMaterial issue
Thank you Patalarc, I agree with your analysis, actually the main issue revolve around the fact that HM mesh index count changes when applying materials which also cause "out of range issue" crash because my code is not considering this change.
note that the same issue also repeated when trying to update vertex normals only ... it seams EE heightmaps dos not like anyone to touch their vertices .
I don't think its practical to re-sort all vertices for each time I want to apply a material as my objective is to edit the HM vertices dynamically.
Maybe Esenthel can guide for better approach to get around this issue.
Thanks again
(This post was last modified: 08-12-2013 01:57 PM by SamerK.)
|
|
08-11-2013 11:47 PM |
|
Esenthel
Administrator
|
RE: Heightmap setMaterial issue
Hi!
Yes the vtx count can be changed if you modify materials
Different material combinations need to be set as separate MeshParts, please keep that in mind, and don't assume that vtx count will remain the same.
|
|
08-14-2013 09:11 PM |
|
SamerK
Member
|
RE: Heightmap setMaterial issue
Thank you Esenthel.
|
|
08-14-2013 09:29 PM |
|