Alternativa3D two sided texture


It is so simple… you just basically have to set the culling property of the draw unit of your material to Context3DTriangleFace.NONE

that will draw both sides of each polygon. In  my case, to do this, i got a copy of the TextureMaterial class into my proyect source directory and changed the visibiity of the method getDrawUnit to protected. Then, you just override it in your own material’s class and set the culling protperty of the return value of the super.getDrawUnit then return the same value:

override protected function getDrawUnit(program:TextureMaterialProgram, camera:Camera3D, surface:Surface, geometry:Geometry, opacityMap:TextureResource):DrawUnit {

var du:DrawUnit = super.getDrawUnit(program,camera,surface,geometry,opacityMap);
du.culling = Context3DTriangleFace.NONE; // <-- THIS MAKES THE MATERIAL TWO SIDED!
return du;
}

Source: http://forum.alternativaplatform.com/index.php?showtopic=3986&p=22123

Advertisements