-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
GLTFExporter: Ensure normalized normal attribute #13767
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
Conversation
|
Normals in three.js are assumed to have unit length. The library does not validate inputs, however. We already have |
|
We already concluded in another thread that |
|
Looking good so far, just two requests:
|
I wanna think that option if we see the actual use case/model where the checking (quite) slows the performance. I still a bit doubt the checking does... So evaluating first.
If we do that, perhaps it might be better to check/ensure in |
You are right, I just did a quick test with a big enough buffer and it was quick to normalize: var geometry = new THREE.BufferGeometry();
var numElements = 10000000;
var positions = new THREE.BufferAttribute( new Float32Array( numElements * 3 ), 3 );
positions.dynamic = true;
geometry.addAttribute( 'position', positions );
var normals = new THREE.BufferAttribute( new Float32Array( numElements * 3 ), 3 );
normals.dynamic = true;
geometry.addAttribute( 'normal', normals );
geometry.normalizeNormals(); |
|
I've just tried with a-painter and works as expected 👍 |
|
Cool. Let's think those two options if/when we see this checking actually affects the performance. |
|
Thanks! |
This PR lets
GLTFExporterensure normalized normal attribute. See #11951 (comment)I still need to evaluate to know if this change (quite) slows the performance because this's our first computation with each vertex but let me first share the PR with you. You can test by yourselves, too, if you want.
@fernandojsg Can you share the model file on which this change can affect the performance if you have? I tested some standard models but I didn't see performance degradation (from same to just a few percents worse).