My favorites | Sign in
Project Home Downloads Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 18: Keep default normal when smooth computation leads to null normal
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


 
Reported by epuyba...@gmail.com, Sep 16, 2014
What steps will reproduce the problem?
1. Download the 3DS file http://www.baument.com/restore/Models/Faucet1.zip
available at http://www.baument.com/restore/archives.html
2. Read it with lib3ds
3. In smooth normals computation part of lib3ds_mesh_calculate_vertex_normals function of lib3ds_mesh.c, this should lead to a few incorrect normals (I say "should" because I got this result using a pseudo-translation of lib3ds in Java 3D).

What is the expected output? What do you see instead?
Getting default normals from lib3ds_vector_normalize when length is 0 isn't a major issue, but it would be better to keep the default normal in that case (i.e. the normal computed before smoothing operation). After line 222 of lib3ds_mesh.c, I would suggest to add this test:

	if (lib3ds_vector_length(n) == 0) {
		lib3ds_vector_copy(n, fa[3*i+j].normal);
	}

(with an additional lib3ds_vector_length_squared function, you could spare a call to sqrt here)


What version of the product are you using? 
I looked to source code of version 20080909


Powered by Google Project Hosting