I've been working with as3exporter with a collada model because I was
not able to apply a texture to a model loaded from parsed collada
model; and I thought the only way to apply a shader to a collada model
was by using as3exporter then use the object.meshes[0].material to
apply the shader.  ( these were the only method I discovered from
examples).

I have several versions  that I published using different shaders  but
none of these shaders seem to correctly display ..  I must be doing
something wrong but I've been struggling with these..

1.  teapot with baked texture --> correctly displays
http://www.antoniolea.com/temp/Bullet.swf

2.  teapot with phong shade --> (looks like flat shader, I can see the
polygons)
http://www.antoniolea.com/temp/BulletPhongShade.swf

3.  teapot with environmental shade --> does not look right.. (earth,
the reflection map is not even identifiable..)
http://www.antoniolea.com/temp/BulletEnvironmentalShade.swf





//////////////////////// code below
// 1.
//regular bitmap texture
_bulletModel = new BulletModel(); // as3 exported
var material : BitmapMaterial = new
BitmapMaterial(Cast.bitmap(BulletUVW), { smooth: true });
var mesh : Mesh = _bulletModel.meshes[0];
mesh.material = material;
_scene.addChild(_bulletModel);



// 2.
// phong shade texture
_bulletModel = new BulletModel(); // as3 exported
var phongColorMat : PhongColorMaterial = new
PhongColorMaterial(0xffdf33);
var mesh : Mesh = _bulletModel.meshes[0];
mesh.material = phongColorMat;
_scene.addChild(_bulletModel);

// 3.
// environmental texture
_bulletModel = new BulletModel(); // as3 exported
var envMat : EnviroBitmapMaterial = new
EnviroBitmapMaterial(Cast.bitmap(BulletUVW), Cast.bitmap(EarthImage));
envMat.reflectiveness = 0.2;

var mesh : Mesh = _bulletModel.meshes[0];
mesh.material = envMat;
_scene.addChild(_bulletModel);


//

        private function updateHandler(event : Event) : void
{
                _bulletModel.rotationY += 1;
                _light1.x = Math.cos(_angle) * 300;
                _angle += .2;
                _view.render();
}

Reply via email to