siebeneicher / webgl-loader

Automatically exported from code.google.com/p/webgl-loader
0 stars 0 forks source link

OBJ File Fails to Convert with "mesh.h:940 CHECK failed: Uint16ToUtf8(za, utf8)" #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When the attached OBJ file is run with:

objcompress 'Brain.obj' 'Brain.utf8'

it fails with the following message:

mesh.h:940 CHECK failed: Uint16ToUtf8(za, utf8)

Since I have modified my source code, the line number is incorrect, however it 
is the CHECK() in CompressQuantizedAttribsToUtf8(). I have only modified MTL 
parser and JSON writing. The OBJ parser, UTF8 stuff, or binary writing 
functions have been modified at all.

Original issue reported on code.google.com by j...@coderforlife.com on 4 Apr 2012 at 4:38

Attachments:

GoogleCodeExporter commented 9 years ago
Interesting...it appears you've hit a difficult to encode value, which I 
thought should be impossible based on the existing bounds params, but I'm 
definitely able to reproduce this. Taking a look now.

Original comment by wonchun on 9 Apr 2012 at 9:48

GoogleCodeExporter commented 9 years ago
Ah, there are some normals with very large values, like:

vn -65.964500 26.871040 -325.114197

And the quantization code assumes that normal components are in [-1, 1]. On one 
hand, it is probably a good idea to be able to preserve the actual inputs. On 
the other hand, the easy thing is to just automatically normalize vn inputs. 
I'm leaning to the latter. Any thoughts?

Original comment by wonchun on 9 Apr 2012 at 10:20

GoogleCodeExporter commented 9 years ago
Normalization is probably the way to go. Is the magnitude of the normal vector 
ever actually used in ANY 3D render? I will ask about this from my source as 
well.

Original comment by j...@coderforlife.com on 9 Apr 2012 at 10:39

GoogleCodeExporter commented 9 years ago
It might matter if you want to interpolate normals before normalizations. You 
can use the magnitude of the normal to act as a weight. I agree it is not 
obvious. I'm about to land the feature, and when I go through and hook up 
flags, then I'll have it default to normalize, but have it be switchable.

Original comment by wonchun on 9 Apr 2012 at 11:29

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r83.

Original comment by wonchun on 9 Apr 2012 at 11:34