Closed Mouldi closed 3 years ago
This:
var mesh = new MeshBuilder<VertexPositionNormal,VertexColor1,VertexEmpty>();
and how do I add different vertices to the mesh? i will be forced to use : PrimitiveBuilder<MaterialBuilder, VERTEX, VertexColor1, VertexEmpty> prim = mesh.UsePrimitive(mat); and if the material changes, I have to call mesh.UsePrimitive(mat); again. but this will create another primitive in the underline structure. the way primitives are stored as keys and the key is <mat, primtivetype> ===> if I change the material, I create another key, hence multiple primitives by mesh! Is there a way to keep the same primitive but change the material?
glTF Primitives exist precisely to change the materials of a mesh.
If you have a mesh that uses 5 materials, you will end with a mesh with 5 primitives. This is how glTF and graphics engines work and there's no way around this.
the UsePrimitive method reuses a primitive when the material already exists, so if you call it multiple times to switch between 2 materials, you will end with a mesh with 2 primitive-materials.
ok, thank you. last question: how can I account for the alpha when I use VERTEXCOLOR vc1 = new VERTEXCOLOR(vpos, vcolor); to create my primitives? the primitive loses the transparency when I render the model.
You have to enable alpha transparency in the material: AlphaMode = Blend
Perfect thank you
Hi, Love the library, Great work!
Is there a way to create one primitive with multiple vertices but not the same material (vertex color)?
In other words, is it possible to change the material on different vertices while creating a primitive? If so, can you please explain how it's done?
Cheers