ngon performace



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/08/2007 at 13:11, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.1 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi there!

    I am creating a tree mesh here, that has to contain some five sided polygons in a generator object. I used to use the modeling library to create the polys, but found that this doesn't get me the performance needed to generate big meshes interactively.

    For that reason I turned over to using the ngonBase directly, but that doesn't make me happy right now.

    If I generate the mesh with just triangles and quads (including the five sided ones as a triangle and a quad) the generation of an example model takes me 320ms. As soon as I use the BuildNgon() function, mesh generation times jump up to 1570ms. This is my code:

      
    m_pobj->GetAndBuildNgon(); // necessary?  
    m_pngons = m_pobj->GetNgonBase();  
    if (!m_pngons) return FALSE;  
      
    for ( ... loop over polygons ... )  
    {  
    // add polygon  
    CPolygon *polys = m_pobj->GetPolygonW();  
    polys[m_polygons].a = poly[0];  
    polys[m_polygons].b = poly[1];  
    polys[m_polygons].c = poly[2];  
    polys[m_polygons++].d = poly[4];  
      
    polys[m_polygons].a = poly[4];  
    polys[m_polygons].b = poly[2];  
    polys[m_polygons].c = poly[3];  
    polys[m_polygons++].d = poly[3];  
      
    LONG *edges = (LONG* )GeAlloc(sizeof(LONG)*2);  
    edges[0] = (m_polygons - 2) * 4 + 2;  
    edges[1] = (m_polygons - 1) * 4 + 0;  
    m_pngons->BuildNgon(edges, NULL, 2, 0, m_pobj->GetPolygonR(), m_pobj->GetPointR());  
    GeFree(edges);  
    }  
      
    m_pngons->InitMap();  
    m_pngons->SetFlags(NGON_FLAG_NOVALIDATION);  
    m_pobj->Message(MSG_UPDATE);  
    

    Any ideas?
    Timm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 31/08/2007 at 03:39, xxxxxxxx wrote:

    You have not passed the outer array so build is having to work this out itself from the passed internal edges. If you pass the outline edges this will be faster. If you want max performance you would be better with either using Create or directly modifying the edge data from GetNgons. Look in the lib_ngon.cpp for code showing how to deal with this edge data.


Log in to reply