loading 3ds models with textures

Software: Away3D 4.x

Argas, Newbie
Posted: 23 September 2012 12:20 PM   Total Posts: 2

I read any topics about loading *.3DS models in Away3D. For exaple :

public function loadModel(product:String):void
  {
   Loader3D
.enableParser(Max3DSParser);
   
_loader = new Loader3D();
   
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETEonModelLoaded);
   
_loader.scale (10);
   
_loader.load(new URLRequest(product));
  
}
  
  
private function onModelLoaded(e:LoaderEvent):void
  {
   
   conteiner
.addChild(_loader);
   
   var 
mat:ColorMaterial;
   
mat = new ColorMaterial(0xCCCCCC1);
   
//mat.lights = [_light];
   
   
var i:int;
   var 
mesh:Mesh;
   var 
numChil:uint _loader.numChildren;
   for (
0numChil; ++i)
   
{
    mesh 
Mesh(_loader.getChildAt(i));
    
//INSERT YOUR OWN CODE FOR MATERIAL, CHOOSE AFTER NAME, ETC.
    
mesh.material mat;
   
}
  } 

But in this case I’ve got to resize sides of texure images to 2^n px. and move they into “bin” folder of project. But in FlashPlayer window my model without textures…
Is there more simply approach to load model from 3Ds MAX 2011 to Away3D 4.0.9 ?
P.S.: sorry for my english.

 

File Attachments
Load3DSTest.rar  (File Size: 1110KB - Downloads: 0)
   

Avatar
80prozent, Sr. Member
Posted: 23 September 2012 02:37 PM   Total Posts: 430   [ # 1 ]

hi

the example you gave would overwrite the loadet material with a gray colormaterial.
if you change it to this, you should see if your texture was loadet proper.

public function loadModel(product:String):void
  {
   Loader3D
.enableParser(Max3DSParser);
   
_loader = new Loader3D();
   
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETEonModelLoaded);
   
_loader.scale (10);
   
_loader.load(new URLRequest(product));
  
}
  
  
private function onModelLoaded(e:LoaderEvent):void
  {
   
   conteiner
.addChild(_loader);
   
   
//var mat:ColorMaterial;
   //mat = new ColorMaterial(0xCCCCCC, 1);
   //mat.lights = [_light];
   
   
var i:int;
   var 
mesh:Mesh;
   var 
numChil:uint _loader.numChildren;
   for (
0numChil; ++i)
   
{
    mesh 
Mesh(_loader.getChildAt(i));
    
//INSERT YOUR OWN CODE FOR MATERIAL, CHOOSE AFTER NAME, ETC.
    //mesh.material = mat;
   
}
  } 
 Signature 

sorry…i hope my actionscript is better than my english…

   

Argas, Newbie
Posted: 24 September 2012 02:52 PM   Total Posts: 2   [ # 2 ]

thx smile

really, I looked through those lines .

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X