Skip to content

+Add vertex duplication during face normal generation - #5805

Merged
kimkulling merged 3 commits into
assimp:masterfrom
diiigle:GenNormals/duplicate_vertices
Nov 2, 2024
Merged

kimkulling merged 3 commits into
assimp:masterfrom
diiigle:GenNormals/duplicate_vertices

Conversation

@diiigle

@diiigle diiigle commented Oct 8, 2024

Copy link
Copy Markdown
Contributor

aiProcess_GenNormals PostProcess now duplicates vertices if they are referenced by more than one polygon which results in the correct faceted appearance. I tried to keep an eye on performance, but haven't done any profiling.

/** Generates normals for all faces of all meshes.
*
* This is ignored if normals are already there at the time this flag
* is evaluated. Model importers try to load them from the source file, so
* they're usually already there. Face normals are shared between all points
* of a single face, so a single point can have multiple normals, which
* forces the library to duplicate vertices in some cases.
* #aiProcess_JoinIdenticalVertices is senseless then.
*
* This flag may not be specified together with #aiProcess_GenSmoothNormals.
*/

According to the documentation, this should have already been the case. Maybe it got removed over the years, or was never implemented in the first place.

Alternatively, I have considered:

  1. Guard it by an optional aiProcess_GenNormals_DuplicateVertices flag
  2. Implement it as a separate PostProcess such that it can be used in other contexts

Let me know if you prefer either one of the alternative implementations.

`aiProcess_GenNormals` PostProcess now duplicates vertices if they are referenced by more than one polygon which results in the correct faceted appearance.
@diiigle
diiigle force-pushed the GenNormals/duplicate_vertices branch from e7d043e to 1e3c5f4 Compare October 9, 2024 08:18
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2024

Copy link
Copy Markdown

@kimkulling
kimkulling merged commit e06b80f into assimp:master Nov 2, 2024
@kimkulling

Copy link
Copy Markdown
Member

Merged, thanks a lot for your contribution.

@stillhated

Copy link
Copy Markdown

there is a leak here. have been unsuccessful finding it.

kimkulling added a commit that referenced this pull request Jul 1, 2026
* +Add vertex duplication during face normal generation
`aiProcess_GenNormals` PostProcess now duplicates vertices if they are referenced by more than one polygon which results in the correct faceted appearance.

* Update GenFaceNormalsProcess.cpp

- Fix old spellings
- Use static_cast instead of c-style casts

---------

Co-authored-by: Kim Kulling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants