Hello Guest

Blender winding order

  • 6 Replies
  • 10394 Views
Blender winding order
« on: October 14, 2015, 14:20:45 »
Not sure if this is the right forum for this but can anyone point me in the right direction on how to import .obj triangles in a winding order? or is it something i gotta do manually, how, and is it worth it efficient wise? I rendered an imported model i have, used glPolygonMode to see how it was with/without cull facing and it just loses triangles so it isnt winding ordered :( what do i do?

Using an element buffer object, but not doing anything with the normals, if that could be relevant.
« Last Edit: October 14, 2015, 14:46:30 by DeadRabbit »

Re: Blender winding order
« Reply #1 on: October 14, 2015, 14:27:52 »
update: inserting the face indexes in the opposite order and using CCW seems to have some effect, but I'm not entirely sure if that was the solution,was it? Nevermind it's still removing triangles that are in front :(
« Last Edit: October 14, 2015, 14:37:24 by DeadRabbit »

*

Kai

Re: Blender winding order
« Reply #2 on: October 14, 2015, 14:46:28 »
When I export something from Blender as Wavefront OBJ, it consistently has counter-clockwise winding order (OpenGL default).
The problem is maybe that your model itself has inconsistent face orientations.
What do you see in Blender when you enable "Backface Culling" there?
(In 2.76 enabling backface culling can be done on the Properties view (hotkey 'N' in the 3D view) under section "Shading.")
« Last Edit: October 14, 2015, 14:48:24 by Kai »

Re: Blender winding order
« Reply #3 on: October 14, 2015, 14:55:19 »
it was unchecked, hmm was i supposed to check that? gonna try with a new export with that checked.

*

Kai

Re: Blender winding order
« Reply #4 on: October 14, 2015, 15:00:39 »
No, what I mean is: Does your model also look inconsistent in the view in Blender itself (with some faces being hidden when they are not supposed to) when enabling that option.
Enabling this option has nothing to do with how the faces will be exported.
It is only an option for viewing the model, like when you import it and then render the model in your own OpenGL application yourself with backface culling enabled.
Also what is interesting is that Blender seems to generate the winding order depending on the direction of the normal of a face. So maybe check your normals.
« Last Edit: October 14, 2015, 15:04:25 by Kai »

Re: Blender winding order
« Reply #5 on: October 14, 2015, 15:06:56 »
Oh wait i thought it was eating triangles but i think it wasn't i think its working +/- CW

CW and no cull facing:

http://imgur.com/a/nAOJL

when i go inside with CW the triangles seem the same size as without cull facing, nvm i can't see them if i go inside but they seem the same size idk

hah sorry i was paranoid for a second it was working CW+back and CCW+front ^.^ I'm a newbie at this, thanks for the help though.
« Last Edit: October 14, 2015, 15:21:49 by DeadRabbit »

Re: Blender winding order
« Reply #6 on: January 04, 2022, 12:38:40 »
First make sure you are enabling Zbuffer :
   
Code: [Select]
glEnable(GL_DEPTH_TEST); // put this outside the rendering loop
And make sure you are updating it :
Code: [Select]
glClear(GL_DEPTH_BUFFER_BIT); // put this inside the rendering loop
If that does not fix your issue try :
Code: [Select]
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glFrontFace(GL_CW); // or GL_CCW