Open GinoDerycke opened 1 year ago
Hi Gino,
I'm here to address your query regarding mesh handling in Evergine.
In Evergine, it is indeed possible to import meshes from various asset formats such as FBX, GLTF, and GLB. Additionally, you can create custom meshes dynamically at runtime for rendering.
To provide you with a practical example, I've attached a sample project CreateRuntimeMesh.zip
When you press the 'U' key, a custom quad will be dynamically added to the scene. Conversely, if you press the 'J' key, the quad will be removed.
I trust this clarifies your doubts. If you have any further questions or need additional assistance, please don't hesitate to reach out.
Best regards, Jorge
@Jorgemagic Are there any plans the extend primitives to more complex meshes? I too would like to generate meshes at runtime and it would be great if there were some helpers for creating meshes (i.e. extrusions). I have used Helix3d in the past which provides a nice mesh builder that simplifies the creation of meshes that can be done at runtime.
@Jorgemagic Thanks for this sample it helped a lot. I'm trying to make an importer for simple meshes. I have tried to use this approach in other scenes but I ended up with invisible mesh but it was casting shadows. So I tried to inherit from PrimitiveBaseMesh and it kind of worked until the geometry was created in the Build method. When I started to pass it through the constructor I got some flipped normals and part of the geometry was invisible. How should I bind/pass geometry to make it work?
--Update-- I have double-checked mesh generation and there was a bug in building on my side. Using PrimitiveBaseMesh seems to work. The approach in the sample seems to work when a mesh is created with the method in behaviour attached. It doesn't work on the CreateScene method (mesh is still not visible). I have tried MeshRefresh when constructing but it did not appear. Is there any other way to trigger mesh refresh?
Additionally, meshes were invisible because I used the default material from the scene with VertexColor turned off and the mesh was not visible. Moreover, when I used Vertex with gradient and IBL Light options on, the mesh also didn't appear. It seems to work only with one solid colour on all vertexes.
Is it possible to create your own 3d model at runtime? For example a freeform that exists of meshes?