Wavefront files with Blender [SOLVED]
Moderator: Coders of Rage
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Wavefront files with Blender [SOLVED]
When I export a wavefront obj file with blender, I get the vertices, but it doesn't seem to be in triangles. When I use "GL_TRIANGLES" the cube looks all out of order. I check the box for "triangulate" also. What else should I do?
Last edited by Benjamin100 on Mon Mar 03, 2014 4:51 pm, edited 1 time in total.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Wavefront files with Blender
Are you sure you have the clockwise / counter-clockwise orientation correct?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender
Well, I'm not really sure how to control the orientation. Is there something other than the z and "y is up" options that I should be paying attention too? I don't see very many options in Blender. Or do you mean that I need to program it a certain way?
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Wavefront files with Blender
Well that depends what "looks all out of order" means exactly. Perhaps an image would be useful.Benjamin100 wrote:Well, I'm not really sure how to control the orientation. Is there something other than the z and "y is up" options that I should be paying attention too? I don't see very many options in Blender. Or do you mean that I need to program it a certain way?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender
Well, when I do "GL_POINTS" I see the 8 vertices as I would expect, but when I use triangles or triangle strip, it is as if it connects in the wrong order, it looks all twisted and missing sides and a face going diagonally across the middle.
- bbguimaraes
- Chaos Rift Junior
- Posts: 294
- Joined: Wed Apr 11, 2012 4:34 pm
- Programming Language of Choice: c++
- Location: Brazil
- Contact:
Re: Wavefront files with Blender
If the points are correct, my guess is the edges are being loaded incorrectly. Create a simple model and take a look at the data produced by the code that loads this information from the file.
-
- Respected Programmer
- Posts: 387
- Joined: Fri Dec 19, 2008 3:33 pm
- Location: Dallas
- Contact:
Re: Wavefront files with Blender
Are you backface culling?
Not familiar with wavefront's format but if you have a poly list you should have a good solid object model. If your poly winding order is off, then if you have backface culling for either CW/CCW then you'll get exactly the anomalies you're seeing.
Either way, this should not happen with a good design because you should be able to cull back faces for solid object models.
Not familiar with wavefront's format but if you have a poly list you should have a good solid object model. If your poly winding order is off, then if you have backface culling for either CW/CCW then you'll get exactly the anomalies you're seeing.
Either way, this should not happen with a good design because you should be able to cull back faces for solid object models.
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender
Thanks for the advice.
I don't understand why I would need to load edges if I have the vertices.
I don't understand why I would need to load edges if I have the vertices.
-
- Respected Programmer
- Posts: 387
- Joined: Fri Dec 19, 2008 3:33 pm
- Location: Dallas
- Contact:
Re: Wavefront files with Blender
You wouldn't need to at all unless that information was useful to you.
If there is no poly list, however, then you will require the edge list. You may have to build it yourself with correct winding order.
If there is no poly list, however, then you will require the edge list. You may have to build it yourself with correct winding order.
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender
Well, I took a break from this for a while, and now I'm back to trying to understand my old code.
I'm mostly confused about the Obj file format.
What are the numbers associated with the faces for? What do they tell me?
I see three pairs of numbers for each face, each pair separated by two slashes.
What does this tell me and how does it help me draw the object?
I'm mostly confused about the Obj file format.
What are the numbers associated with the faces for? What do they tell me?
I see three pairs of numbers for each face, each pair separated by two slashes.
What does this tell me and how does it help me draw the object?
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Wavefront files with Blender
Have you read the Wiki article? http://en.wikipedia.org/wiki/Wavefront_.obj_file
If you want more details about a particular section, just click the citation link and browse to the site where the information was sourced from.
If you want more details about a particular section, just click the citation link and browse to the site where the information was sourced from.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender
Ok. I transitioned to using 3ds because the lib3ds library looked helpful, and I didn't want to deal with parsing the files myself anymore.
But I still have problems drawing. I don't understand why I need any more information than the vertices to draw the triangles. What is the purpose of the list of faces? What other information do I need? Are the vertices simply written out of order?
But I still have problems drawing. I don't understand why I need any more information than the vertices to draw the triangles. What is the purpose of the list of faces? What other information do I need? Are the vertices simply written out of order?
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender
So I leave this for months out of frustration over this one problem.
No matter what I do I cannot load the file information correctly to draw to the screen.
I have it all, and yet many of the vertices look out of place, and almost random.
Then, it occurs to me, that such a thing would happen if it was taking the color array as the vertex array. So I change a number in the color array, and one of the polygons drastically changes size.
Well, that much should be easy to fix.
No matter what I do I cannot load the file information correctly to draw to the screen.
I have it all, and yet many of the vertices look out of place, and almost random.
Then, it occurs to me, that such a thing would happen if it was taking the color array as the vertex array. So I change a number in the color array, and one of the polygons drastically changes size.
Well, that much should be easy to fix.
-
- ES Beta Backer
- Posts: 250
- Joined: Tue Jul 19, 2011 9:37 pm
Re: Wavefront files with Blender [SOLVED]
Finally got an OBJ file model on the screen. No lighting yet, but I finally got the info. Found a tutorial that gave a good explanation of how to get the face information and use it to order the vertices. What a relief!