Workflow from 3dmax to away3d, how to change texture dynamic?

Software: Away3D 4.x

manisa, Newbie
Posted: 19 June 2012 07:28 AM   Total Posts: 2

Hi, I’m a newbie, I just want to load 3ds model and replace it’s texture by picture which from http://....jpg or png.

I think the workflow maybe like this:

1. Export 3ds from 3d max
2. Load 3ds and load picture and then set texture.
3. Load other picture and reset texture.

Could anybody tell me some detail about the workflow? Some sample code is better.

Thanks for your time, nice guys!!

   

Avatar
Austen, Newbie
Posted: 19 June 2012 06:26 PM   Total Posts: 21   [ # 1 ]

hi, using obj:

[Embed(source=”/../assets/mat/char.jpg”)] private var CharMat:Class;

AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onObjLoaded);
AssetLibrary.load(new URLRequest(”../assets/awd/file.obj”));

public function onObjLoaded(e:AssetEvent):void
{
mesh = e.asset as Mesh;
var tempMat:TextureMaterial;
tempMat = new TextureMaterial(new BitmapTexture(new CharMat().bitmapData));
mesh.material = tempMat;
scene.addChild(mesh);
}

to modify the texture, you just run another method setting your mesh.material with a different material

   

manisa, Newbie
Posted: 20 June 2012 01:35 AM   Total Posts: 2   [ # 2 ]
Austen - 19 June 2012 06:26 PM

hi, using obj:

[Embed(source=”/../assets/mat/char.jpg”)] private var CharMat:Class;

AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onObjLoaded);
AssetLibrary.load(new URLRequest(”../assets/awd/file.obj”));

public function onObjLoaded(e:AssetEvent):void
{
mesh = e.asset as Mesh;
var tempMat:TextureMaterial;
tempMat = new TextureMaterial(new BitmapTexture(new CharMat().bitmapData));
mesh.material = tempMat;
scene.addChild(mesh);
}

to modify the texture, you just run another method setting your mesh.material with a different material

Thanks for your reply.
But if my model has multi textures( or meshes?), how can I know which texture belongs to which mesh? I just want to load the model, and then load it’s textures automatically.

   

Richard Olsson, Administrator
Posted: 20 June 2012 06:23 PM   Total Posts: 1192   [ # 3 ]

The names that you use for your meshes in 3ds Max should follow along into Away3D, so listen for MESH_COMPLETE on your loader and for each mesh that comes in, check it’s name to determine which texture you should assign to it (using a TextureMaterial.)

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X