Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Build normals of a obj file

gaita
2010-06-30
2013-03-15
  • gaita
    gaita
    2010-06-30

    Hi

    I'm trying to rebuild the normals of an obj file loaded in a freeform, but the problem is that everytime I use it the normals of the object are created at random directions giving me black effects over the object form, I use this code:

    var
      Triangles: TAffineVectorList;
      Indices:   TIntegerList;
      Indices2:  TIntegerList;
    begin
      with ObjectA.MeshObjects.Items do
      begin
        Triangles := ExtractTriangles;
        Indices  := BuildVectorCountOptimizedIndices(Triangles);
        RemapAndCleanupReferences(Triangles, Indices);
        BuildNormals(Indices, momTriangles); <- I've used triangles and triangleStrip
        Triangles.Free;
        Indices.Free;
      end;

      ObjectA.StructureChanged;

    but it always gives me the wrong normals, I think it might be with the order of the vertices indices, but I don't know what to do
    can someone help me?

    thks

     
  • YarUnderoaker
    YarUnderoaker
    2010-07-01

    I do not really know much about this subject, but can you help someone else.
    I recommend to create a new forum topic https://sourceforge.net/apps/phpbb/glscene/

     
  • gaita
    gaita
    2010-07-01

    thanks, but do you know anyone that can help me on this?
    I've tried to send a request to start a new Glscene forum in the forums.embarcadero.com, but they dind't like it too much

    and thanks for the link, but what is that? is it better than this forum?

    thks