by Michele » Wed Jul 28, 2010 3:56 am
To me it looks like the file format of the given .obj file is not correct, as no normal index is specified in the face data, I think the face data should look like:
f 1//1 4//2 3//3 2//4
f 17//5 15//6 16//7 18//8
f 7//9 1//10 2//11 8//12
...
instead of
f 1 4 3 2
f 17 15 16 18
f 7 1 2 8
...
in this case VL assumes there are no normals so they get recomputed by VL at loading time, producing the hard normals visible in the picture.
You should modify your exporter (or post-process the .obj file) to produce a correct output or write a custom OBJ loader for VL based on the existing one (should not be too difficult, just put some extra logic in the existing one).
VL seems to be stricter than ASSIMP. VL does not make any assumption on the data layout and just sticks to what the face info says even if in this case (for a human) is quite obvious that the normal count equals the face-vertex count.
You might want to preprocess the OBJ file before feeding it to VL, for example by loading the OBJ file, adding the face data, writing the resulting OBJ data into a MemoryFile and then feeding this new MemoryFile to the VL loader. The beauty of this approach is that it allows you to do everything in memory (if memory consumption is not an issue) and use the existing vlOBJ loader. Of course you would need to do a basic parsing of the OBJ file on your own but this shouldn't be too difficult either given the tools present in VL (vl::String, file handling, vl::TextStream etc.). If this option is not viable for some reason you'll have to make your customized OBJ loader as said before.
Cheers,
Michele