Radium-Engine icon indicating copy to clipboard operation
Radium-Engine copied to clipboard

Handling quad mesh

Open hoshiryu opened this issue 5 years ago • 13 comments

I have encountered issues with the handling of quad meshes (which I need to apply nice-looking Catmull-Clark subdivision):

  • There is no QuadMesh or MixedMesh in Core/Geometry. This can be easily resolved by introducing some class like:
class MixedMesh : public Ra::Core::Geometry::IndexedGeometry<Ra::Core::VectorNui>
{
public:
    /// Initialize the MixedMesh from the TriangleMesh
    MixedMesh( const Ra::Core::Geometry::TriangleMesh& triMesh );
    /// Converts the MixedMesh to a full-triangle mesh.
    Ra::Core::Geometry::TriangleMesh toTriangleMesh();
};
  • When loading quad meshes (or mixed triangle/quad meshes) there is only the TriangleMeshComponent. Here again, it would be nice to have some class like MixedMeshComponent that would hold the MixedMesh and just converts it to a TriangleMesh when needed, e.g. for rendering.

  • The TopologicalMesh class only takes as input TriangleMeshes. Though it can internally handle polygonal faces, converting back into a TriangleMesh assumes the internal mesh is already triangulated. Hence, operations dealing with topology, e.g. Catmull-Clark subdivision, must ensure the output mesh is triangulated. It would be nice TopologicalMesh deal with MixedMeshes.

  • Assimp loading parameteris must then be changed to avoid triangulation: aiProcess_Triangulatemust be removed, and I don't remember the effect of aiProcess_SortByPType on the loaded data.

hoshiryu avatar Jul 09 '20 15:07 hoshiryu

Thanks for the issue.

Do you need to handle meshes with both triangles and quad, or only quad meshes ?

nmellado avatar Jul 09 '20 17:07 nmellado

I think the easiest way to handle that is to have triangle mesh on one side (with one to one mapping with engine gpu mesh represetnation) and polymesh on the other side, with on the fly triangulation to map to a engine gpu mesh). We can assume that polyhedrons are flat and convex for fast triangulation. General case, if needed, is left as futur work.

dlyr avatar Jul 09 '20 19:07 dlyr

ok, and what do you suggest about the TopologicalMesh ? Does it takes both Triangle and Poly meshes ?

nmellado avatar Jul 09 '20 19:07 nmellado

Quad meshes have nice properties but mix meshes migh be very hard to manage. if we only need this for subdivision, why not using Loop subdivision on triangle mesh?

MathiasPaulin avatar Jul 09 '20 20:07 MathiasPaulin

I guess because Loop doesn’t have the desired property (e.g., continuity).

nmellado avatar Jul 09 '20 20:07 nmellado

Loop is C2 except at extraordinary vertices where it is C1. Si Catmull-Clark is better at quad-triangle jonction?

MathiasPaulin avatar Jul 09 '20 20:07 MathiasPaulin

Well I guess quad mesh is de facto standard in modelling community, along with catmull clack subdivision (better behavior along parameterization ?) Current implementation of topological mesh is already base on OpenMesh's poly mesh, there is surely some function in our implementation that suppose triangle, but we may adapt.

dlyr avatar Jul 09 '20 21:07 dlyr

Also to be noted (I will add it to the description), Assimp loading parameteris must then be changed to avoid triangulation: aiProcess_Triangulatemust be removed, and I don't remember the effect of aiProcess_SortByPType on the loaded data.

hoshiryu avatar Jul 10 '20 07:07 hoshiryu

Is it time to remove deprecated props management from topo mesh ?

dlyr avatar Jul 16 '20 06:07 dlyr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 14 '20 12:10 stale[bot]

Yes it is. Maybe Chems can help here ?

nmellado avatar Oct 23 '20 05:10 nmellado

Okay I will give it a shot

chemseddinehimeur avatar Oct 23 '20 07:10 chemseddinehimeur

From what I understood from the doc and code, the structure already exists, we have polymesh that supports quad and also have triangle conversion for gpu. also topological mesh supports poly meshes by default, but it only takes in triangle meshes, the issue is there are some classes like wedge class for example that depend on topomesh to be 100% triangular. I think we need to adapt topomesh to support polymesh, since all the processes are applied on topomesh including catmull clack subdivision.

chemseddinehimeur avatar Oct 23 '20 09:10 chemseddinehimeur