This is something I created to kill time whilst on a long train journey to see my folks this weekend – yeah yeah OK, coding for fun on the train isn’t so cool, but I had intended to watch the second series of Flight Of The Conchords and I had the wrong codex so the videos wouldn’t play. I was left with nothing much to do and started playing around with Flash (as you do). I had the idea to create a digital clock in Papervision using cubes quite a while ago so it was a good time to finally build it.

You can view the clock here – I have set it up to use completely random colours, so it might look nice, or it might be pink and yellow (if it looks ugly just refresh your browser for different colours!)

Every project I do in Papervision I learn something new and this experiment was no exception. You may have read my recent post How to make DisplayObject3D alpha work in Papervision. Basically you have to set the useOwnContainer variable to true, which renders out the object onto it’s own ViewportLayer. I originally did this for the clock, so I could do some nice fading transitions between digits. However, this was inadvertently causing some strange Z-ordering issues as shown in the image below.

So I’m guessing that’s why Papervision doesn’t automatically set useOwnContainer when you alter the alpha (or add filters and change blendModes), as you need to consider the effects of using separate ViewportLayers when creating your applications, as it may mess up your Z-ordering.

Since I’m back in London now and it’s late I’m yet to figure out a suitable way around this, I’m thinking that perhaps altering the alpha of the material rather than the cube should do the trick, but I will experiment when I get more time, and post my fix here.