Skip to content

Remove handling of normals in fbximporter #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

stigrus
Copy link
Contributor

@stigrus stigrus commented Mar 21, 2025

What have I made? πŸ‘©β€πŸ’»

Removed handling of normals in the FBX importer, since they are not used by the CadRevealFbxProvider anyways.

Benchmark

Benchmark of fbximporter reading normals vs not handling normals.
Benchmarks performed using BenchmarkDotNet.

BenchmarkDotNet v0.14.0, macOS Sequoia 15.3.2 (24D81) [Darwin 24.3.0]
Apple M4 Max, 1 CPU, 14 logical and 14 physical cores
.NET SDK 8.0.407
  [Host]     : .NET 8.0.14 (8.0.1425.11118), Arm64 RyuJIT AdvSIMD
  DefaultJob : .NET 8.0.14 (8.0.1425.11118), Arm64 RyuJIT AdvSIMD
Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
LoadFbxFile (Reading Normals) 2.246 s 0.0284 s 0.0252 s 6000.0000 2000.0000 1000.0000 55.2 MB
LoadFbxFile (Without Normals) 1.898 s 0.0145 s 0.0113 s 5000.0000 2000.0000 1000.0000 44.77 MB
Mean      : Arithmetic mean of all measurements
Error     : Half of 99.9% confidence interval
StdDev    : Standard deviation of all measurements
Gen0      : GC Generation 0 collects per 1000 operations
Gen1      : GC Generation 1 collects per 1000 operations
Gen2      : GC Generation 2 collects per 1000 operations
Allocated : Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)

How can you best review this? 🧐

Make sure fbx files are imported properly.

Did I remember everything checklist?

  • I made some awesome changes! 😎
  • I left the code in a better state than when I started working on it ✨
  • I wrote unit and/or integration tests πŸ‘Ύ
  • I have considered any security implications, and requested review of them explicitly πŸ”
  • I verified that it checks the acceptance criteria. πŸ“œ
  • I have tested this change in the Echo DEV environment, or requested someone to test it for me πŸš€
  • I updated the documentation/readme πŸ“š
  • I made the PR title descriptive and human-readable πŸ‘¨β€πŸ‘©β€πŸ‘¦β€πŸ‘¦
  • Existing unreported issues I found but could not fix was added as a new Issues 🚧

Comment on lines -18 to -22
//this should never be called in the first place if the SDK is invalid
if (!_sdk.IsValid())
{
throw new NullReferenceException("Cannot load files with invalid SDK.");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this check removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another call to this function in FbxWorkload (ReadFbxData), where it checks this before calling the LoadFile function of the FbxImporter

@@ -78,7 +78,7 @@ public static (IReadOnlyList<CadRevealNode>, ModelMetadata?) ReadFbxData(
var progress = 0;

// FBX Importer is intentionally not disposed as the dispose operation takes too long. If this becomes a problem with memory leaks we need to investigate why the dispose is so slow.
var fbxImporter = new FbxImporter();
using var fbxImporter = new FbxImporter();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either remove the using or update the comment.

Copy link
Collaborator

@Strepto Strepto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dod we have any profiling on the difference in memory use? Not that important but might be nice to have as some documentation if we ever consider re-adding normals.

@stigrus stigrus force-pushed the ssob/fbximporter-remove-normals branch from 1205d83 to 0496cb4 Compare March 25, 2025 09:18
@stigrus stigrus merged commit 9e368e1 into master Mar 26, 2025
9 checks passed
@stigrus stigrus deleted the ssob/fbximporter-remove-normals branch March 26, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants