Closed melfnt closed 6 years ago
Update: I opened my .obj in Blender, and it shows up correctly. Then I exported it in .obj and I got this:
bb8_exported.obj.zip
Now, I can see the robot but it's too big, I'll resize it in some way.
So why can't webgl-obj-loader load the first .obj I attached?
I'm not sure why the Blender exported OBJ model appears to be doing better than the 3DS Max exported file. The order in which the "v", "vt", and "vn" lines appear doesn't matter as long as they are grouped with their appropriate "f" section. The only thing that appears different between the two files is the the 3DS Max OBJ file contains a lot more material information; this may somehow be affecting the parser.
I will try to take a look at this as soon as I can, but for now at least you have a workaround of loading the OBJ file into Blender and re-exporting.
Ok, thank you.
Here is how the scaled robot .obj is shown in blender
And here is how is shown if loaded by webgl-obj-loader
The sphere it is sort of roughly approximated by disjoint triangles, is it normal?
And what about the "non well-formed" errors?
Hmm, I know for sure that I saw faces (f) with more than 3 vertices (usually there were 4). The loader currently only supports a maximum of 4, so maybe there are some faces with more than 4?
There is an issue (#25) to support N-gons, but it hasn't been worked yet.
Try exporting the model in Blender again, but this time select the check box for triangulating the faces. This will force the output to have exactly 3 vertices per face.
I will also have to check out the "non well-formed" errors.
Thanks for reporting this and for all of the detailed information!
Ok, thank you: with triangulated faces it show up perfectly. Now I can use it. The only remaining problem is load the downloaded .obj, but the blender re-exporting workaround works just fine for now.
Hi everyone, I'm a noob in 3D graphics. I tried to load the model I attach bb8.obj.zip but it doesn't show up. I downloaded the model from http://tf3dm.com, and it seems to work in http://www.meshlabjs.net/
I cloned webgl-obj-loader and checked out in the gh-pages branch. Then I added my model in the models/ directory and makes the window.onload function in webgl.js load "bb8.obj" instead of "suzanne,obj" and the result is... that nothing appear on the pedestal![screen](https://cloud.githubusercontent.com/assets/6087390/16177138/04355646-3625-11e6-871b-9bd9b8e3e7a5.png)
I looked at the javascript console, and this is what I got:
A "non well formed" for each .obj files I tried to load (also for those that I didn't changed such as "boulder.obj"). I get the same errors on http://frenchtoast747.github.io/webgl-obj-loader/, but of course I can see suzanne on the pedestal.
I watched into the .obj files, and I saw that there were some missing lines in bb8.obj, that I added:
but nothing changed.
I also noticed that the lines are in different order from the other files: in "suzanne.obj", there are a lot of lines that starts with "v", then a lot of lines that starts with "vn", then a lot of lines that starts with "f" in "bb8.obj", there are a lot of lines that starts with "v", then a lot of lines that starts with "vn", then a lot of lines that starts with "vt", then a line that begins with "s" and finally lot of lines that begins with "f" and "s", mixed. As I said before, I know nothing about the obj format, I can just guess that each line defines a vertex, and in the two files the lines order is different. I wonder why webgl-obj-loader cannot load my .obj file, or as an alternative, can you please tell me how to reorder the lines in my file to get it loaded?
Thank you in advance, Lucio