Same texture/color on both sides of face

Sep 12, 2011 at 7:13 AM

Hi! Is there any way I can get Babylon (Xna) to use the defined face texture on both sides of all faces in a model, instead of painting the back side of the faces black?

The reason I'm asking is that I'm importing a WPF 3D model where half of the faces seem to face the wrong direction according to the vertex ordering of each face.

Sep 26, 2011 at 12:31 PM

Found a solution myself, though it feels a bit awkward having to double the face count: For every face that is located in the WPF 3D model I create 2 faces facing opposite directions (with individual vertex normals), and then I set the StatesManager.CullMode to CullClockWiseFace. Is this the best way to solve it, or is it possible to persuade Xna to use the same texture for both sides of a face?

Regards,

Daniel Persson

Coordinator
Sep 26, 2011 at 12:51 PM

It seems to be the better solution as Xna cannot render dual faces (with differents texture coordinates I mean)

Developer
Sep 26, 2011 at 1:01 PM

If the texture coordinates are the same on both sides (the backface is mirrored), you can also set the CullMode to CullNone. This way both sides of the triangles will be rendered.

From: bolddp [email removed]
Sent: lundi 26 septembre 2011 13:31
To: simon.ferquel@hotmail.fr
Subject: Re: Same texture/color on both sides of face [babylontoolkit:272248]

From: bolddp

Found a solution myself, though it feels a bit awkward having to double the face count: For every face that is located in the WPF 3D model I create 2 faces facing opposite directions (with individual vertex normals), and then I set the StatesManager.CullMode to CullClockWiseFace. Is this the best way to solve it, or is it possible to persuade Xna to use the same texture for both sides of a face?

Regards,

Daniel Persson