Hi Rich
That's probably because you set the material this way...
it gets overwrited by the mtl information, or nulled if no valid .mtl
is found
best way is to set it after its loaded to set manually
or let the system works, and have the expected mtl file next to the
obj file.
The Obj parser has more processes, the loading and parsing of the obj
file holding the geometry.
A second one triggered if an mtl tag is found in the obj file, the
loading & parsing of the mtl
and finally: the loading(s) of the source(s) to be applied as
material(s).
Search on this group or look at the example in Obj class in doc or the
many examples in the svn
to see how this is done.
Fabrice
On Aug 21, 2009, at 1:03 PM, Richard Davey wrote:
I've successfully exported a low-poly model from 3DS Max into the
Obj format, and got it displayed in Away3D (3.4 FP10 branch) after
wrestling with scale values for a while :)
It looks great. But when I apply a BitmapMaterial to it I get an
ever-so brief moment where I see the model textured, and then the
material vanishes and I get a random flat colour with black
wireframe (as if it's done a material: "random#" on it).
I'm setting the material on the loader:
loader = Obj.load("../models/fighter.obj", { material: mat2, x: 0,
y: 0, z: 0, scaling: 0.1 } );
As I couldn't see a way to set the material on the target itself:
private function onLoaderSuccess(event:Loader3DEvent):void {
target = ObjectContainer3D(event.loader.handle);
}
All I can think is that an "ObjectContainer3D" isn't a single
object, but rather a container to hold many objects?? If this is the
case how can I get a single object from the loader so I can add my
material to it?
Even after this I'm still not sure why I see the textured object
briefly before it vanishes.
It's the only object in the scene. There are no light sources added.
Cheers,
Rich
--
PHP: http://www.corephp.co.uk / Zend Certified Engineer
AS3: http://www.photonstorm.com / Full Gamer Alchemist