Der Schmale – David Lenaerts’s blog

Flash Platform Experiments

The Away3D “dev” Branch

Tags: , , , ,

If you’ve been following the updates on the Away3D blog, you’ll have noticed the updated roadmap mentioning the dev branch on Github. This branch is basically where we’re working to get things towards Beta, so take a look if you’re curious to see where we’re headed. I personally advise anyone to use this branch if you’re starting out with a new project but make a snapshot of the revision you’re working with. Some things will still change and might very well break your code ;)

We’ll put up some proper blog posts introducing new features as we get to Beta, but for now I’ll quickly explain what I’ve personally been working on, and how I broke your existing code ;) I’ve also went ahead and updated the source code for the demos in previous blog posts to match the dev branch, so you can see how it differs concretely.

 

Death to BitmapMaterial! All hail TextureMaterial!

One of the biggest changes, I think. Favouring composition over inheritance, we deprecated BitmapMaterial, VideoMaterial, MovieMaterial etc. They have been replaced by a single TextureMaterial, which accepts a Texture2DBase object. In practice, this will for instance be a BitmapTexture (VideoTexture etc are still in development). This way, when supporting new texture types you don’t need to extend every type of material that needs to extend this material type, which is especially a mess when you start creating custom materials (and need to extend/duplicate those to support all possible texture types). The same applies for cube maps (fe: BitmapCubeTexture), the normal and specular maps that are set on the default materials, and the view’s backgroundImage (now simply View3D::background). It’s a big change that might annoy many of you, but it’s necessary. With things like ATF support coming up (and who knows what else), things would simply become unmanageable and error-prone otherwise.

Furthermore, there are some “special” convenience textures that can be used for the default materials. For instance, these materials expect a specular map to have the specular strength on the red channel, and the specular power (gloss) on the green. SpecularBitmapTexture allows you to pass two greyscale BitmapData objects (gloss is optional) and composites the data correctly. When using texture splatting, you can use SplatBlendBitmapTexture, which takes 3 BitmapData objects containing the blending value for each splatting layer and places each on the red, blue and green channels as expected by TerrainDiffuseMethod. However, in both cases, it’s usually better to do these things in your offline asset preparation stage and use simpler texture objects instead.

 

Light Picking

Another rather big change for those working with lights, but one that offers great benefits. Instead of assigning the lights as a static array as before, materials now expect a LightPickerBase object. Right now, that means StaticLightPicker, which in turn accepts the array of lights. Why this extra object? This way, you can create a DynamicLightPicker object that selects the most important lights from the EntityCollector, allowing different lights to be used without reassigning the light array (and as a result potentially invalidating the material). As light collection is often game-engine dependent, providing our own dynamic light picker is not the highest priority. At least it’s good to know the possibility is there, right? ;)

 

Disposal

Before, most dispose(…) methods accepted a “deep” parameter, which caused “sub-assets” (Geometry of a Mesh, BitmapData of a BitmapTexture, etc) to be disposed as well. While in some cases this saves you from writing a trivial few lines of disposal code, in many cases it just is an open door to invalid state (accidentally disposing a BitmapData used by another BitmapTexture) and ambiguity (what will be cleared, and what will remain uncleaned?). Allowing an object to destroy objects it did not create is poor resource management and generally bad practice in my opinion. Hence the new credo: you clean up what you create!

 

Ambient lighting

There have been some changes in how ambient lighting works. Before, the ambient and ambientColor of the materials dictated how much ambient light is coming from the lights, rather than how much ambient light is actually reflected by the material. That has been changed, and lights now have ambient and ambientColor properties as well. As a result, ambient light now functions similar to diffuse and specular light. The lights emit it, the material reflects it. It’s usually best to only set ambient light properties on DirectionalLight objects, since ambient light is global. PointLight objects can get culled if they’re not affecting anything in the frustum and their ambient contribution would be dropped as a result.

 

Other changes and new features

  • Big refactor on how the materials and animations are compiled to facilitate building custom materials
  • Slight restructuring of the render flow to allow more intricate custom renderers
  • Light probes (default materials only support convoluted cube maps at this point)
  • Reduced shadow swimming with shadow mapping
  • RefractionEnvMapMethod for environment-map based refraction mapping
  • AnisotropicSpecularMethod for anisotropic specular highlights
  • Shadow mapping for point lights (HardShadowMapMethod only)
  • AlphaMaskMethod to influence the material’s alpha, optionally based on a secondary UV set
  • Light map methods: DiffuseLightMapMethod to apply light maps as diffuse light, and LightMapMethod to apply it on the final shaded result
  • WrapDiffuseMethod to perform a very cheap fake way for subsurface scattering, as outlined in GPU Gems #1
I hope to scrape together some time to write some things about these new features as soon as possible. A recurring promise, I know, but bear with me here ;)
Update: Forgot to mention that there are also updated official Away3D demos in the examples’ texture-refactor branch (the name is due to a previous branch).
Leave a comment (6 comments)

A George divided against itself cannot stand!

Tags: , , ,

georgeFor over 3 years now, I’ve been employed as an “interaction developer” at Nascom, focused on – what else – developing for the Flash platform. Since some time, however, I’ve been growing increasingly restless. Introspection was unavoidable, leading to one resounding conclusion: it’s time for a change.

Fact is, what I found myself doing on a daily basis at work is not something I fully enjoy any more, and it was definitely not why I started programming a long time ago. This opposed to what I do in my free time, the result of which can be seen on this blog. Trying to do both has caused me doing little else than sit behind my computer screen, coding away for entire days. So, I’ve decided to leave Nascom to pursue a carreer as an independent developer starting mid-June. Focused on graphics programming, I can shift what I love to do to a healthier part of the day. Or at least, that’s the plan ;-)

It was great to be a part of Nascom and work alongside so many talented people. Both from a human and a technical perspective, I still believe it’s the best digital agency in Belgium. Thanks for having me, guys!

Leave a comment (10 comments)

A heartbeat, some books, and an IDE

Tags: , , , , , , , ,

Ouch! My last post has almost been 5 months ago! Realizing this, I had two options: to feign my own death until the next update, or to give some sign of (what for me passes as) life. Let’s go with the second option and see if there’s anything useful I can pass on anyway.

Not having posted in such a long time doesn’t mean I’ve been slacking off, though. Quite the contrary; the past months have seen some of the most intense coding sessions I’ve went through in a long time. First a 3-month non-stop coding spree for Away3D, followed by continued development on Farbe. Hopefully, the result of both will be available in the (very?) near future, along with some other updates!

Now, instead of giving you demos or code, here’s some other things to help you develop.

(and no, I won’t be sharing any thoughts on the future of Flash)

Books!

Books form such an important part of my development process and knowledge, I’m a bit surprised myself that I haven’t really shared any titles here. Trying to ammend the situation, here’s some of the more influential ones I’ve read since I’ve started this blog (leaving out more general ones concerning design patterns etc):

  • The Pragmatic Programmer, by Andrew Hunt and David Thomas: it’s a classic, and you should already have read it. So why am I still listing it? Because it often seems many Flash platform programmers stick to ActionScript/Flex-related books. Here’s a book that changes the way you think about your code, be it in form of design principles, tools or workflow. It’s a rather short read, so no excuses!
  • Elements of Programming,  by Alexander Stepanov and Paul McJones: I found this one on a random trip to the bookstore. Approaching algorithms and data structures in a very formal and mathematical way, it forces you to – again - think differently about your code, but on a lower level (mainly concerning algorithms using data structures). What I love about this type of books is that you suddenly realize how differently you start tackling certain algorithmic problems. Perhaps not a book for everyone, but an interesting read nonetheless.
  • 3D Game Engine Design, by David H. Eberly: (Thanks to Ralph for suggesting it way back :) ). “The Morgan Kaufmann Series in Interactive 3D Technology” has quite a few good books, but to me, this is the most valuable. Of all books I had at the time, this one taught me most about many 3D engine concepts. During the development of Wick3d, I couldn’t do without it.

IDE – IntelliJ

I’ve recently started using IntelliJ IDEA 9 for ActionScript and Flex development, after hearing Joa and the Flash Bum raving about it. Coming from Eclipse (Flex Builder and FDT), it took a while to get used to, but now I have I can’t imagine returning to Eclipse at all. I have been raving about it in real life, much to the annoyance of my co-workers, so it would be wrong of me not to mention it here.  The refactoring, template and code generation support is simply unmatched, there’s a very useful and clean UML diagram view, properly integrated Maven support, … AND I get to annoy the Java/back-end team directly inside the IDE ;-)

To think I was once had to code C in MS-Dos Edit, how times have changed… :)

Edit: The Flashbum just wrote an article on InsideRIA about how to get started. Read all about it!

That’s about it. I hope this sign of life is useful to anyone after all! If not, I promise there will be more real updates soon!

Leave a comment (5 comments)

One year later: a short retrospective

Tags: , , ,

birthdaypieThe first post on this blog dates from May 4th, 2008, so I thought it fitting to look back at the year that has passed since then.

Over the time I’ve done some experiments/projects that, when I look back at them, make me think “What was I thinking?!”. On the other hand, there are luckily a few of which I’m actually proud, or at least content with how they turned out – whether they were practically useful or not (which is not exactly always my goal). A lot of the things I did, I did as a way to learn. As such there was Wick3d, a (now defunct) basic 3d engine to rehash my algebra (actually, I worked on it some more after the last update without comitting anything to svn). And of course Pixel Bender came along, giving me a whole new area to explore, as did Alchemy.

I do feel I learned quite a bit, but at the same time it seems with everything I learn, there’s twice as much I still need to study. Feels like a constant battle against ineptitude, especially when talking to those who actually seem to know what they’re talking about ;)

Lastly, I’d like to pass some more updates on Farbe. I recently made some updates implementing oil paint and airbrush. There’s still so much work to do before it can go public, but soon it will be time to look for a Flex UI-designer/skin artist. If you know or are anyone with experience, send me a hoot with some examples! AS3/MXML/CSS experience is a must of course :) Just keep in mind, the project is free and will likely be open-sourced eventually (which is also a cheap way of saying: no money involved ;) ). If you follow me on Twitter, you might have seen some demo pictures being tweeted. Those that haven’t: here’s some previews of Farbe simulating pencils (1, 2), oil paint and airbrush.

Off towards another year! Thanks to all you readers!

Leave a comment (4 comments)

I’m like, well hip.

Tags: ,

After a long time of scepticism and critique, my colleagues have finally persuaded me to join Twitter. This phase of scepticism is pretty normal for me when it concerns the embarassingly public social side of the web [2.0 if you will]. As such, I still don’t have a Facebook account, that at least is still one of the few waning values to which I desperately cling.

Anyway, in this particular case, I’ve always considered Twitter a pointless and exhibitionistic medium. I still think it’s pretty pointless at times, but so far I must admit I’m having fun, and I guess that’s the point after all.

I’m out there. I’m prostituting myself. [ and annoying the hell out of people in the process. ]

In other news, battling a sleeping disorder can be pretty exhausting, and as a result I haven’t been able to be very productive in my spare time. Things are shaping up, however, and I’ve found some new inspiration for some experiments. I’ve pushed Wick3d to the back shelf for a bit, as it’s not the area I feel like exploring right now. Some more 2D dynamics/sims perhaps? … :)

Leave a comment (6 comments)

© 2009 Der Schmale – David Lenaerts’s blog. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.