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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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