I’ve been staying with a friend (and all round programming Guru) Jethro during my visit to FOTB. He also makes heavy use of Flex in his work and although he was unable to attend yesterday’s presentations he asked if I’d check out the Away 3D talk by Rob Bateman. Jetho has been complaining away over the last few days to me (which isn’t uncommon!) about the instability of the PaperVision3D code-base. He’s using it in a current project and apparently after periodic SVN updates he’s been finding that significant, undocumented changes to the API are not uncommon which of course have knock-on effects on many developer’s projects. Apparently the way the camera focal projection works was changed recently plus a dirty implementation of 3D animation imports led to numerous AS3 errors generated in projects. A few of the examples he’s been complaining about!
Anyway, don’t get me wrong, I think Paper Vision 3D is an amazing engine and that thought is shared by a large percentage of the flash community judging by the high number of presentations by the PV3D team at the Flash conferences over the last year or two.
However, as a developer I need to know that any libraries I’m using in my code are stable and that once the code develops to a certain point the APIs aren’t going to be suddenly changed without warning.
Back to Rob Bateman’s talk. Rob is one of the team behind another Open Source AS3 project called Away3D. Away3D started as a branch off from the earlier versions of the PV3D repository.
Stability and optimization seem to be central to their core development – two very important requirements for many developers who may wish to use the library for commercial development.
One of the first slides from Rob’s presentation I recognized immediately from Alexander Zadorozhny’s old experimental work with PV3D. This was back in April 07 when I was using PV3D in a project. One problem I ran into with that older version of PV3D was the issue of 2 angled intersected triangles. In PV3D the engine used to make a judgement of which triangle was closed to the camera to ensure the correct z order. But if 2 triangles intersect then they need to be split into smaller triangles by the engine and any hidden triangles need to be culled to make the engine as optimized as poss.
I haven’t actually checked but I assume PV3D can now handle this kind of intersection of planes? Hope so. Anyway, back during this period when it couldn’t I ran into this problem in my work and posted a question to the PV3D email list. It was Alexander who explained the problem to me and also pointed me to his experiments site where he had already resolved the issue. However, he’d had to do so by re writing a lot of the PV3D central classes. It wasn’t possible simply by extension. I’m guessing Rob and Alex were thinking about taking PV3D in a different direction around this time.
My original intention with this post was to discuss some of the things I was most impressed by with Away 3D. Well top of the list are the objectives core to the Away 3D team:
I believe Away 3D does a fantastic job in achieving these objectives as well as it’s amazing capabilities for creating complex 3D scenes. They’ve just launched the latest version of the library – 2.2. There’s a very
cool demo of a 3D railway cart journey through various 3D rooms. It’s about 5 minutes long, all in super fast and visually stunning 3D. What’s even more impressive is that it’s just 700KB including all the materials! That’s smaller than our average Flex project at the mo! Hmmm… maybe we should move to Away 3D to keep filesize low… lol.
I also found one of Rob’s earlier examples in his talk very impressive (although I can’t find it on the Away3D site yet but check out some of the examples). They’ve built some very useful functionality into the engine that deals with the distortion caused by a low/medium triangle row/column count on a side wall or floor for example. In the demo we were looking into a basic 3D room and could see the back wall, ceiling, floor and side walls (using a brick tessellating material – tessellation materials are another really well thought through optimized approach). This was first demoed in an earlier version of the engine whereby you see the inaccurate distorted projection on the floor and side walls caused by too few triangles. The problem is that if the all walls are the same size in 3D space and each wall (or plane) has been set by the developer to use say 10 triangles across and 8 down to achieve the 3D distortion then you end up with an optimization and rendering problem. The back wall only really needs 2 triangles (or just a few anyway) in total to achieve a good render as you’re looking straight at it so all of it’s points are on the same z level. The side walls, ceiling and floor all need many more triangles to achieve effective depth rendering. Away 3D’s solution: Do just that! The engine automatically applys more triangles to the side walls and less to the back wall and update this when required to adjust the triangle count per plane when required. Optimized and better rendering results – cool!
There are fewer developers behind Away 3D compared to the programming team on PaperVision 3D but in some ways this is a good thing as although new features may take longer to be released these guys are a small bunch of very high level programmers and I think the quality, stability and optimized code they are producing outweigh some of the additional benefits for choosing PV3D.
If any 3D projects come along Away3D’s going to get my vote.