02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Away3D Basics

The basics of Away3D

The View or viewport is a window into the 3D space. The scene- think of it as your Stage only in 3D. The Camera - is your viewpoint in space, dictates how the 3D objects are rendered into 2D. Object3D- a bunch of points in 3D space(vector3D's) and a material. Lights - optional but only just...

What can we display?

Primitives - 15 of them. Suprisingly useful. 3d models - ASE, AWD,3Ds,MD2,Collada, MQO, KMZ an dOBJ

  • Prefab 3D for prebaking textures
  • New asset manager detects, parses and stores models Programmaticlly generated meshes -extrusions, paths, ect

Video Transcript

00:00How does Away3D work?
00:05How does it think?
00:06Well, the basic is you've got a viewport.
00:10Your viewport's a rectangular window
00:12allowing you to look into the 3D space, which is called a scene.
00:18The scene is very much like a 3D version of the display list.
00:25And Away3D have gone really out of their way
00:29to try and make using 3D in Flash
00:32as much like using the display list as possible.
00:36So for instance, instead of a display object container,
00:44you've got an object container 3D.
00:47And they all have transformation matrices attached to them,
00:51which just have 3D coordinates.
00:56So you're going to find yourself at home very,
00:58very quickly using Away3D.
01:01The camera is just a bunch of maps, really,
01:04that determines how the objects in the scene or the scene graph
01:12is what they call the equivalent of the display list is rendered.
01:16The camera actually lives, as far as Away3D is concerned,
01:20the camera lives within the scene itself.
01:22You give it a point just like any other 3D object.
01:26You can swing it around, point it.
01:28You can point it at objects.
01:31You can also put different lenses onto it.
01:35And this is part of what I love about working with Away3D.
01:41You can have orthogonal lenses.
01:43If you're going for that farm, they'll look of no perspective.
01:47So you've got a 3D world that there's
01:51no kind of normal perspective.
01:52It's just a grid system.
01:54You just pop an orthogonal lens onto your camera.
01:56It's just a class.
01:57You instantiate it.
01:59And you go camera.lens equals new orthogonal lens.
02:05There you go, bang.
02:07But you normally don't have to think about these details.
02:10They're all there available for you.
02:11But most classes in Away3D come with a whole bunch
02:17of defaults already there.
02:18So they just work.
02:19And if they don't do what you want,
02:21then you can start messing around.
02:23That makes it really, really quick
02:24to get up and running with it.
02:27So Object 3D, I suppose, is probably the closest
02:34equivalent to a sprite.
02:35It contains a mesh, which is a bunch of points in 3D space.
02:42And a material, which wraps around it.
02:47We'll go into that in a little bit more detail later on.
02:50Also, lights.
02:52Lights aren't actually necessary,
02:56but you don't really get very far with them if you don't use them.
03:00So they're kind of important.
03:04Without lights, what you're doing is
03:06going to look pretty awful, really.
03:10So what can we display?
03:11Well, there's 15 primitives.
03:14So you can just create objects, toruses, cubes, spheres.
03:20It sounds really basic.
03:21But as soon as you start adding materials,
03:23you can really get somewhere very, very fast.
03:26I've found quite a lot of primitives,
03:30which I dismissed early on.
03:32I find myself using them quite a lot.
03:34It can also import 3D models.
03:37It'll support most of them.
03:40Actually, I believe that's not true.
03:43I'm just going to delete that.
03:45I don't think it does support Colada.
03:47There was a lot of discussion about this.
03:49Colada is the kind of open source format for 3D models.
03:55But it's extremely large, so it's
03:58not really suitable for being downloaded over the web.
04:01And the team don't like it.
04:03They're actually developing their own format called
04:06AWD2, and they're trying to push that
04:08to become an industry standard.
04:10It's much better suited to being delivered over the web.
04:15It can contain an awful lot of information, animations,
04:19and everything.
04:203D models are actually extremely complex files.
04:26They contain meshes.
04:29They contain objects, sub-meshes, all sorts of geometries.
04:32You can contain multiple materials.
04:34They can contain lights.
04:35They can contain a vast amount of things and animations as well.
04:40Object files are static.
04:42They're really simple.
04:43They're just like meshes, whereas 3DS files contain.
04:48And they're not just files.
04:49They're entire folders full of stuff,
04:51which tells you where everything is.
04:55The way 3D is a very nice job of importing all of these things.
04:59It's called an asset library, which is a singleton.
05:06You can instantiate it, pass it around, use it that way,
05:09or you can just use static methods, which is what I do,
05:12because it's just easier.
05:15So you can just say, right, load this file, pass it, prepare it,
05:19and then give it to me, tell me when it's ready.
05:22You can pull out various parts of it.
05:27So you could, for instance, tell it to load a 3DS file
05:30and an object file.
05:31And then you can then just ask the asset library
05:34to return all meshes that have been loaded
05:37from within the 3DS file, or materials.
05:41Object files can contain materials.
05:42And it will just give you a list of all the available materials.
05:45So that's had a lot of work put into it.
05:48It does make working with pre-built models
05:51much, much more easy.
05:53You've got prefab 3D as well, which is great for importing.
05:58And you can export from prefab 3D into AWD,
06:02which is probably what you should be working with.
06:06I tend to stick with 3DS files exported from Blender.
06:09You can also generate meshes programmatically.
06:15Extrusions is the classic one, where
06:19you can extrude a vector as a kind of cylinder in a lathe style,
06:26or you can extrude vertically.
06:29There's an awful lot of ways you can actually
06:31generate your own meshes programmatically,
06:33if you're that much of a masochist.
06:35And there's an awful lot of scope
06:39for doing very creative stuff in there.
06:40But you're going to need a bit of time to do that.
06:42I haven't really looked into that yet.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!