I’m using head.ac model from examples sources folder. The meat is in onResourceComplete (taken from cellshader example). So this would work just fine with .obj files but with .ac, yeah i get hardedges on polygons, no normals applied.
the code is:
_light3 = new DirectionalLight(-1, -1, 1);
_light3.specular = .25;
_light3.diffuse = .25;
_light3.color = 0xffffff;
_view.scene.addChild(_light3);
_loader = new Loader3D();
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.load(new URLRequest(‘assets/head.ac’));
private function onResourceComplete(e:LoaderEvent):void
{
var mesh : Mesh;
var len : uint = _container.numChildren;
var material : ColorMaterial = new ColorMaterial(0xe24062 /*0xfbcbc1*/);
material.ambientColor = 0xaaaaaa; //0xdd5525;
material.specular = .25;
material.diffuseMethod = new CelDiffuseMethod(2);
material.specularMethod = new CelSpecularMethod();
CelSpecularMethod(material.specularMethod).smoothness = .2;
CelDiffuseMethod(material.diffuseMethod).smoothness = .1;
material.lights = [ _light3 ];
for (var i : uint = 0; i < len; ++i) {
mesh = Mesh(_loader.getChildAt(i));
mesh.material = material;
}
}