Multiple Textures On a Model

Software: Away3D 4.x

FeffersHat, Newbie
Posted: 05 June 2012 10:57 AM   Total Posts: 21

So I exported a model in blender, sketchup and Prefab and they all do the same thing. They only add the first material on the whole mesh rather than different materials on the same mesh. My code is as follows:

[Embed(source="../lib/Models/GoalArena.obj"mimeType="application/octet-stream")]
  
public static var model:Class;
  
  public static var 
arenaModel:Mesh;

public static function 
create():void {
   Parsers
.enableAllBundled();
   
   
createMaterial();
   
   
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEcompleteModel);
   
AssetLibrary.loadData(new model());
  
}
  
  
public static function completeModel(event:AssetEvent):void {
   
if (event.asset.assetType == AssetType.MESH{
    arenaModel 
event.asset as Mesh;
    
arenaModel.geometry.scale(25);
    
arenaModel.= -1000;
    
    
Scene.view.scene.addChild(arenaModel);
   
}else {
    
   } 

Should it be placing multiple materials on the mesh or just only the first single material? I’ve also tried different types such as as3 class (which is really cool) by exporting one in Prefab but it does the same thing.
When I do import my model in Prefab though, it imports it perfectly with all the textures and unjoined meshes.

So I’d really love some help. I’ve seen a few other people with my problem too but I still can’t find a fix. Thanks <3

Edit: Also, if Prefab can import it perfectly why can’t the object parser? That’s why I presume I’m doing something wrong.

   

FeffersHat, Newbie
Posted: 06 June 2012 01:18 AM   Total Posts: 21   [ # 1 ]

I think I found the problem. The textures all looked similar because it only grabs a few pixels from the texture, weirdly enough.

http://i.imgur.com/JGKTS.png Here’s a picture of my model. Look at the floor and how it’s stretched.

http://i.imgur.com/baZOl.png Now here’s my full texture. (The real one is 64x64). Why is it being stretched out like that?

   

empend, Member
Posted: 06 June 2012 02:03 AM   Total Posts: 77   [ # 2 ]

You want it to tile the texture across the model?
If so you need to make sure you make repeat = true when creating the bitmapMaterial.

var material:BitmapMaterial = new BitmapMaterial(bitmapDatasmoothrepeat truetrue); 

Or do you want it stretched?

   

FeffersHat, Newbie
Posted: 06 June 2012 02:43 AM   Total Posts: 21   [ # 3 ]

Oh my god, that’s perfect. Looks wonderful. Thank you so much, I can’t believe it was so simple. <3

By the way, I did: model.material.repeat = true, rather than params for texture material.

Edit: Also I just wanted to say I finally realised why this whole problem occured. I make my models in Sketchup and export them as an obj, then export as an obj in Blender (because sketchup screws it up). What you have to do is export it as a .dae in sketchup then export as an obj in Blender otherwise your materials don’t work.
Anyway, just saying if anyone found this thread and had the same problem.

   

empend, Member
Posted: 06 June 2012 04:02 AM   Total Posts: 77   [ # 4 ]

Whatever works. raspberry

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X