Drawing faces even if their normal is backwards

Problems building or running the engine, queries about how to use features etc.
Post Reply
samapico
Kobold
Posts: 30
Joined: Wed Jul 11, 2012 6:42 pm

Drawing faces even if their normal is backwards

Post by samapico »

I'm dealing with 3D models exported from software such as Solidworks, and it happens quite often that the faces are not oriented properly. Some faces will be facing towards the inside of a part, for example. This makes several faces invisible when the camera is looking at it. It's hard to explain to the CAD guys how to fix it, because a surface in Solidworks doesn't seem to have an orientation (or if it has one, it's pretty meaningless). Also the source models often come from our clients, so we don't want to waste time for every new part we need to import.

Is there an easy way to tell Ogre to draw those faces anyway? Or some kind of shader that reverses the normal when needed?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Drawing faces even if their normal is backwards

Post by dark_sylinc »

If this is Ogre 1.x; then you need "cull_hardware none"
If this is Ogre 2.1; then you can either use "cull_mode : none" (in the macroblock) or "two_sided : true" (in the PBS material)
samapico
Kobold
Posts: 30
Joined: Wed Jul 11, 2012 6:42 pm

Re: Drawing faces even if their normal is backwards

Post by samapico »

Thanks you for this. "cull_hardware none" makes all faces visible, but the lighting of these faces is wrong.

According to this and this, it seems I also need a vertex shader to flip the normals when they are pointing away from the camera. I guess this should be a simple enough task for a noob like me :P
Post Reply