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

How it works

ow they get displayed:

  • The Scenegraph - much like the display list
  • ObjectContainer3D - has an almost identical transformation matrix to DisplayObject
  • Massive calculation overheads for nesting
  • similar for interactivity

Video Transcript

00:00So scene graph, the scene graph is just like the display list. We've been through that.
00:06There's a few differences. You can nest object container 3Ds much in the same way that you can nest display object containers.
00:17But if you're used to working with flash, you're probably used to nesting lots of display objects down quite deeply and having loads of them there.
00:28Because you're moving in a third dimension and you've got an awful lot of points in your meshes,
00:33the overheads on nesting loads and loads of object container 3Ds are much higher than you might expect.
00:41Away 3D does contain some rather nice tools to get around that. I might go into that a little bit later.
00:51So you've got to watch out for that. Also, because you're working on stage 3D and not on the flash display list,
00:58you're going to have problems with mouse interactivity. It's not as easy as I was hoping at all.
01:05So quite a lot of the time, for instance, if I want something to react to a mouse over,
01:15I'll just wrap it in an invisible sphere and add the mouse detection to the sphere,
01:20because otherwise it has performance overheads and it's slightly glitchy.
01:29So here's the display classes you get with Away 3D. Everything pretty much derives from object container 3D.
01:41Entity is an abstract class which everything else inherits from.
01:47You can instantiate your own object container 3D and you can instantiate all your main display classes.
01:53You can't instantiate entity at all.
01:57Sprite 3D is what they call a billboard in the 3D world. It always points towards the camera.
02:03It's just like a 2D sprite only. It moves around the 3D universe with perspective and everything else,
02:10just like any other 3D object would. Because they're not vectors, they again don't behave quite like you might expect.
02:22Mesh is the fundamental object. It's a bunch of vector points.
02:27Meshes contain submeshes. This is where it gets slightly more complicated.
02:32The geometry is just the raw geometric data.
02:38And geometries inherit from, sorry, meshes contain geometries.
02:43The mesh contains the transformation matrix, position of 3D space.
02:49It also contains the material. The reason you've got a mesh contains submeshes
02:55is you might think it would be much, much more simple if a mesh just contained a geometry.
03:01But the problem is natively a mesh can only contain one material.
03:07So if you want your little hero guy to be wearing a red coat and green trousers, you can't do it.
03:13The easiest way is you have him as a mesh. The coat is a sub mesh.
03:17The trousers are a sub mesh, and then you can apply different materials to both of them.
03:21That's kind of the way it thinks. Camera 3D, again, it is a display object.
03:26It sits within the scene graph. Think display list.
03:31It moves around in the 3D world. You can do everything you want to it that you can do to any other object,
03:37container 3D. You can even, because it inherits from object container 3D,
03:41you can also, of course, add children to it. That's another little away 3D thing.
03:49You can add child to an object container 3D. They didn't give it add child 3D or anything.
03:54You've got to remember that it's a 3D thing. You're not working on the display list,
03:58but you just call add child on it because they've just tried to duplicate as much as they can
04:03the functionality of flash. Light base, there's actually a couple of extra classes in here.
04:10There are only two lights in away 3D. There's point light and directional light.
04:16Point light is a very attractive way of lighting. It's like having a bulb on the scene.
04:22It's got distance, and it produces nice, smooth, specular shading on surfaces.
04:28Directional light is much cheaper in terms of processing, and it's like having the sun.
04:35It's just that all the lines are parallel. It doesn't do nice hot spots and specular shading
04:42or anything like that. So normally you'd light a scene with a combination of directional light
04:47and point light. I know away 3D 3.6 had a plethora of types of lights you could use,
04:53as far as I remember, and it's just been knocked down to two that work very well.

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!