Need Help with the Basics in Away3d 4.x(Loading Mesh, Mesh w/textures, understanding a few things)

Software: Away3D 4.x

dubletar, Member
Posted: 12 January 2012 11:59 PM   Total Posts: 73

Hi Away Community!

First, I want to say that I have fallen in love with Away3D. I have been checking out 3d Engines for flash for about 2 weeks and finally settled upon Away 3d for a few reasons:
*Open Source
*Ability to contribute to it
*Simple installation and source code access

Two friends and myself are working on a project I began a year ago and we want to go 3d.

After diving into Away3d 4.x, using Flash CS5, coding in Flash Builder…

We dont know where to begin.

I’ve been unable to understand the away3d for 2 weeks, and this week I took off 4 days from work to sit down, read resources and figure it out. :( fail… I feel like a newb all over again…

So here’s my Q’s (which I know has been asked a million times):

1. View3D: How does that work!? When added to the stage, does it act like a movie clip would? or does it act like a window? It is automatically sized as the entire stage? or does the size need to be defined?

2. Loading Mesh: We’re new to 3d and flash. Whats the best format to load static objects (like a house)? and the best format for animated objects ? and best for non-bone animated 3d objects?

3. How do we load a simple mesh into Away3D? Ive searched and downloaded plenty of resources, but they are for Away3D 3.x, not 4.x.

4. How do we load the skins/texture to these 3d objects?

Please, please help!

Once I understand these things and create our application online, I want to begin contributing to Away3D, financially, and via online support. I want to create a library of info with all newbish questions explaining everything in detail, so people like my self can hit the ground running.

I truly appreciate it!

   

dubletar, Member
Posted: 13 January 2012 12:13 AM   Total Posts: 73   [ # 1 ]

Sorry for double post! Was an accident!

Update:
Ive found something thats awesome, and useful.
http://videometry.blogspot.com/2011/05/mocap-to-molehill-via-3d-studio-max-and.html (thanks guy!)

I will update thread and ask as I go.

 

   

Avatar
Baush, Sr. Member
Posted: 13 January 2012 01:23 PM   Total Posts: 135   [ # 2 ]

for the dev tool, i suggest FlashDevelop, instead of CS5 and flash builder, its free.

Also in the git repository of away3d, check out the examples bundle to get working examples and play around with them to get s better grasp of how things work

 

   

Avatar
Matse, Sr. Member
Posted: 13 January 2012 06:12 PM   Total Posts: 149   [ # 3 ]

Dang, I replied to your other post :(
copy/paste of my post there :

Hi dubletar,

you probably didn’t get answers because the forum is swarmed with those questions, use the search feature wink

First of all make sure you get the “right” version of away3D, you should get it from here :
https://github.com/away3d/away3d-core-fp11 (notice the “zip” button, clicking on it will prompt you to download the whole away3d lib as a zip file)

This is the “master” branch, I didn’t check those last days but personaly I’d go with the “dev” branch which is meant to become away3D4 Beta (Away3D is still “Alpha” currently, although it’s very stable and all)

depending on the branch you start with, you will probably want to get the associated example files. Beware those might work or not as the code base is still evolving and examples are not always up to date. Typically some will work, some won’t (it’s usually pretty easy to fix them if you really want to)

Examples for the master branch should be those ones :
https://github.com/away3d/away3d-examples-fp11

for the dev branch I’m not sure, I’d try those :
https://github.com/away3d/away3d-examples-fp11/tree/texturerefactor

Don’t get scared with those master/dev branch though : it’s not a whole different world, but there are changes that you need to account for in your code.
See this blog post by DerSchmale about “dev branch” :
http://www.derschmale.com/2011/12/27/the-away3d-dev-branch/
I recommend you read his other blog posts too wink

Ok now to your questions

1. View3D is a Sprite, it just displays the 3D scene. You have to resize it if you need ( myView.width = 300; )

2. It really depends on what 3D software you’re using. .OBJ works pretty good, it’s a bit “fat” on the filesize. .3DS works good too, has smaller filesize but won’t import multi-materials.
For bones-animated meshes MD5 or AWD2
For vertex-animated meshes MD2

3. This is something you will easily find in the example files I pointed you to. AssetLibrary class is good for that although there are other ways too. Look at the examples, do a search on the forum with “AssetLibrary” and if you don’t manage to load a mesh post again in this thread I’ll try to take some time to clean up the class I use for my game and post it.

4. Nothing special here, the same way you would load any bitmap image (jpeg/png/whatever), then it depends on the branch you use. Master branch will let you assign a BitmapData to a Material directly while with Dev branch you’ll create a texture from the BitmapData then assign that texture to a Material.

Yeah some wiki or something would be really nice, for newcomers of course but also experienced ones to share knowledge and all. The forum is meant for this too but it requires quite some digging/searching.

 

   

Federaik, Newbie
Posted: 17 January 2012 07:23 PM   Total Posts: 4   [ # 4 ]

OK, I have to import a good number of animated characters built in 3dsmax, I understand from Matse’s words that a sound pipeline would probably be:
3DSMax -> obj to MilkShape -> MD5/MD2 to runtime loading in Away?
Am I right? or there is some shortcut/ wiser alternative?
thanks in advance!
F

 

   

Avatar
Matse, Sr. Member
Posted: 17 January 2012 07:42 PM   Total Posts: 149   [ # 5 ]

Yeah, for characters you will want either MD5 or AWD2 : those two formats work with bones. MD2 handles animation but if I understand correctly those are vertex-based, pretty much keyframe animation : no skeleton etc

The path you take to get to one of those 2 formats is up to you, I think AWD2 only has exporters for Maya and Blender currently.
I you work with 3DSmax you should be able to export to MD5 directly with the right plugin/script. My 3D artist buddy exports directly from Max, I think he’s using this script (see attachment) it comes from a doom 3 related forum.
My buddy tells me it only works in max8 though, but won’t you loose your skeleton by going through OBJ ?

 

File Attachments
md5export.ms  (File Size: 26KB - Downloads: 0)
   

Federaik, Newbie
Posted: 17 January 2012 10:16 PM   Total Posts: 4   [ # 6 ]

Yep sorry I got mixed up, not OBJ: as far as I understand Collada (DAE) is the only format that retains both types of animation data: bones and vertexanimation. Our 3D artist is working with 3DSMax 2011 so I’ll test the script you attached just in case it works the same or I’m able to make it work (thanks man!). Otherwise I’ll hunt for another script/plugin to do the job!

 

   

Avatar
Matse, Sr. Member
Posted: 18 January 2012 10:25 AM   Total Posts: 149   [ # 7 ]

You’re welcome wink

Beware the script is very picky, I think most MD5 export scripts are : search the forum for md5 export or something like that and you should find some guidelines to make the export work.
I know that with this script any “special” character in bones names will make the export fail, even spaces I think. There are other constraints but I can’t remember them right now.

I also have a script that should work in max2011, coming from Quake Wars ET, but my buddy had a hard time with it as it generated errors… that said he had quite a hard time with the one that is working for us now so it might just be about learning the constraints to make it work, I attach it in case you wanna try it.

 

File Attachments
MD5-Exporter-ETQW.zip  (File Size: 57KB - Downloads: 184)
   

dubletar, Member
Posted: 22 January 2012 02:49 PM   Total Posts: 73   [ # 8 ]

Thanks a lot guys!

I’m spending the next week making a 3d prototype of our current 2d application.

I appreciate the comments very much, I’ve been doing a lot of reading on away3d and some experiments. I’ll use you guys’ suggestions and see what I can do.

If you’re curious, our project is SimNations.com. 3d would totally revamp it!

If I get things going, I’ll be compiling a tutorial for away3d and working with 3d from a subdirectory on our website, and making it available to the public. All the questions I had, I want new people to be able to pick up immediately!

Great job Away3D group!

*hoping to contribute soon*

 

   

dubletar, Member
Posted: 21 March 2012 10:15 PM   Total Posts: 73   [ # 9 ]

Hi All,

I’m having trouble loading a texture on a primitive Sphere.

Can anyone help?

I’m using Away3D.4.Beta and FlashDevelop.

This is a class that creates a sphere and adds it to Scene3D (lescene) and adds an EventListener to View3D (cam). Both View3D(cam) and Scene(lescene) are passed to it.



The code works fine (great actually) without the texture, just the color red, but when I attempt to load the texture, I just get a black screen.

The code is below. What am I doing wrong?

package  
{
 import away3d
.cameras.Camera3D;
 
import away3d.containers.Scene3D;
 
import away3d.containers.View3D;
 
import away3d.entities.Mesh;
 
import away3d.materials.ColorMaterial;
 
import away3d.primitives.SphereGeometry;
 
import flash.display.Sprite;
 
import flash.events.Event;
 
import away3d.events.MouseEvent3D;
 
import flash.automation.MouseAutomationAction;
 
import flash.display.Loader;
 
import flash.display.MovieClip;
 
import flash.geom.Vector3D;
 
import flash.net.URLRequest;
 
import flash.system.Capabilities;
 
import flash.utils.Timer;
 
import mx.controls.videoClasses.INCManager;
 
import away3d.cameras.*;
 
import away3d.containers.*;
 
import away3d.controllers.*;
 
import away3d.debug.*;
 
import away3d.entities.Mesh;
 
import away3d.extrusions.*;
 
import away3d.filters.*;
 
import away3d.lights.*;
 
import away3d.materials.*;
 
import away3d.materials.lightpickers.*;
 
import away3d.materials.methods.*;
 
import away3d.primitives.*;
 
import away3d.textures.*;
 
 
import flash.display.*;
 
import flash.events.*;
 
import flash.filters.*;
 
import flash.text.*;
 
import flash.ui.*;
 
/**
  * ...
  * @author SimNations
  */
 
 
public class spherey extends Sprite
 {
  
//Objects
  
private var mesh:Mesh;
  private var 
sphereGeometry:SphereGeometry;
  private var 
sphereMaterial:TextureMaterial;
  
  
//Embeds
  
[Embed(source "../../3d_objects/Textures/globeprototype.jpg")]
  
private var map:Class;
  
  
  public function 
spherey(cam,lescene
  
{
   init
(cam,lescene);
  
}
  
  
private function init(cam,lescene):void
  {
   startEngine
(cam,lescene );
  
}
  
  
private function startEngine(cam,lescene):void
  {
   sphereGeometry 
= new SphereGeometry(500,100,100);
   
sphereMaterial = new TextureMaterial(new BitmapTexture((new map()).bitmapData));
   
mesh = new Mesh(new SphereGeometry(500,100,100), sphereMaterial);
   
lescene.addChild(mesh);
   
cam.addEventListener(Event.ENTER_FRAMEonEnterFrame);
   
}
   
private function onEnterFrame(event:Event):void
   {
   mesh
.rotationY++;
   
event.target.render();
   
}
  
 }

Also, the location of the embed is correct, the code works when the sphere is a color instead of a texture.

private function startEngine(cam,lescene):void
{
   sphereGeometry 
= new SphereGeometry(500,100,100);
   
sphereMaterial = new ColorMaterial0xff0000 );
   
mesh = new Mesh(sphereGeometrysphereMaterial);
   
lescene.addChild(mesh);
   
cam.addEventListener(Event.ENTER_FRAMEonEnterFrame);
 

Link to code: http://www.simnations.com (Planet in the background is what the class creates).

 

   

dubletar, Member
Posted: 22 March 2012 11:56 AM   Total Posts: 73   [ # 10 ]

Please, anyone? ^^above code.

How do I wrap a texture around a primitive sphere?

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X