Import with Melange 5 / Get Normals (from 11.5)



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

    On 14/10/2011 at 05:09, xxxxxxxx wrote:

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

    ---------
    Hey!

    I'm writing an importer  for an external tool that should support C4D. while i'm getting all kind of data smoothly, i have some troubles with the normal tag. It doesn't seem that 11.5 attaches normal tags. So do i have to create them on my own based on neighbours, edges and phong break angles? Is there any other way?

    i unfortunately never touched C4D before, and it's my first day with the SDK.... but i can't find the info i'm needing :(

    Thanks!!!



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

    On 14/10/2011 at 05:43, xxxxxxxx wrote:

    Nevermind, i found that it works fine with:

    SVector* normals = op->CreatePhongNormals();

    The question is, is it safe to rely on that?

    Otherwise i'd fallback and generate it with the method mentioned above.

    Thanks....



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

    On 14/10/2011 at 06:33, xxxxxxxx wrote:

    CreatePhongNormals will give you the exeact same vertex normals that Cinema uses. Just make sure the object contain a Phong tag, otherwise the function will crash.

    cheers,
    Matthias



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

    On 20/10/2011 at 00:43, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    CreatePhongNormals will give you the exeact same vertex normals that Cinema uses. Just make sure the object contain a Phong tag, otherwise the function will crash.cheers,Matthias

    I think it won't actually crash, but it returns a Null pointer (which would crash if you didn't check the return before using it) - at least that was my experience in the past.



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

    On 20/10/2011 at 06:30, xxxxxxxx wrote:

    Hmm, sorry to open this again. But the normals i'm getting from CreatePhongNormals seem to be false, or i'm adressing them wrong, probably. when rendering/displaying the normals, they look totally different and i can't find a reasonable pattern what i'm adressing wrong here.

    Here's what i do:

      
      const Vector *vertices            = op->GetPointR();  
      const CPolygon *polygonIndices    = op->GetPolygonR();  
      LONG polygonCount                = op->GetPolygonCount();  
      
    if(btag->GetType() == Tphong)  
    {  
      normals = op->CreatePhongNormals();  
    }  
      
    for(long i = 0; i < polygonCount; i++)  
    {  
      // add data, e.g.:  
      vertices[polygonIndices[i].c], normals[i * 4 + 2], uvw.c  
      vertices[polygonIndices[i].b], normals[i * 4 + 1], uvw.b  
    }  
      
    

    any idea?

    thanks for your help! awesome :)


Log in to reply