Optimizing Papervision Rendering Performance Part I

1 Comment

One of the big problems with Papervision as a 3D engine is that because it’s cross platform, not hardware accelerated, it really uses up a lot of the hardware CPU.
Many Papervision projects can really bog down the CPU and can be a major turnoff for a user or a site visitor.

One of the easiest most common sense things to do is to render only when necessary. This only works for certain types of Papervision projects. If you have a 3D 1st person shooter, this probably won’t apply as much since you are always in motion. However if you have a project with clearly defined animation states that end up into mostly static states, this trick is a good one.

What I do is have a global variable, singleton or what have you called NEEDS_RENDER, which is set to true only when you need to render of course. By that I mean, only when there’s animation. If the scene does not change, there’s no need for us to call the Papervision render loop to update the scene.

// our render loop should look something like this now:
private function enterFrameHandler(event:Event):void {
if (NEEDS_RENDER)
view.singleRender();
}

If we are doing tween based animation (I am a big fan of TweenMax), then right before we do the animation, we set ourvariable to true so that the render loop knows to update the scene.
We use the onComplete event to set the NEEDS_RENDER variable back to false so that when the animation is done, we are no longer updating the scene.

NEEDS_RENDER = true;
TweenMax.to(cube, 1, {
rotationY:180,
onComplete:function():void {NEEDS_RENDER = false;}
})

This works for really simple cases where we only have at most ONE animation going on at any one time. In a more complicated scene where there maybe animations starting in the middle of other animations ending, using this method will produce rendering artifacts where animations suddenly stop or freeze or disappear. This is because the previous animation has not had a chance to finish its animation when a new animation starts. When the first animation finishes, the global variable is set and the render loop gets the message to not have to update the scene. This results in the new animation not being able to finish.

The simple workaround for this is to use the onUpdate event of TweenMax. We just keep setting the variable to true on this event which will keep firing until the animation is complete.

TweenMax.to(cube, 1, {
rotationY:180,
onComplete:function():void {NEEDS_RENDER = false;},
onUpdate:function():void {NEEDS_RENDER = true;}
})

Using these simple techniques, I was able to get a Papervision project that was constantly eating up 70-80% CPU to something that hovered around 20%, only spiking up during the animation.

Popularity: 7% [?]

Slides from “Tools for Creating WOW Experiences in FLEX” Talk

No Comments

Yesterday I gave a talk at the monthly Chicago Flex Users Group organized by Mike Epstein. In this presentation I give away all my tools and secrets on how I create great experiences for Rich Internet Applications. Here are the slides I promised.

Popularity: 1% [?]

RIApalooza 2: RIAs Beyond the Mouse and Keyboard Recap

1 Comment

On May 8th I as at RIApalooza Two, an unconference event for Rich Internet Application enthusiasts. Adam Flater and I gave a talk titled ‘RIA Beyond the Mouse and Keyboard’. Adam and I talked about how computing user interfaces are evolving and moving away from the current status quo of mouse and keyboard.

Adam talked about and demoed examples including his use of the mac accelerometer as an input device, his Lego Mindstorm robot controlled via Flash, and his mobile device, the Tesla Roadster.

I showed a couple videos of innovative uses of technologies such as augmented reality, touch computing, and the Wii balance board. Here’s a link to some of those videos. I demoed controlling a virtual 3D car with the Wii balance board, controlling a 3D earth using head tracking, combining Augmented Reality with Twitter, and my PostIt board with handwriting recognition. These are all part of a holistic vision of what constitutes a more natural user interface, moving away from the more artificial interaction that are the current state of input devices.

Here are some photos taken from Anthony Hand’s camera. My favorite picture has to be where I’m caught picking my nose – great.

Popularity: 2% [?]

AutoDesk Project Dragonfly Lead Developer Interviewed

No Comments

My friend Shelly Mujtaba, lead developer of Project Dragonfly, was interviewed over the web. Dragofly is a free online 2D/3D home layout design Rich Internet Application created by AutoDesk. Check out the video series here: http://www.youtube.com/view_play_list?p=D2617D775224DEBF

Read a review of it I posted earlier this year here.

Popularity: 2% [?]

Concept Virtual Corkboard With Handwriting Recognition for Large Interactive Walls

7 Comments

I’ve been playing with the idea of an inexpensive large collaborative wall. Part of the requirements for my large interactive touch screen is that it has to be multitouch and provide a more natural way of interfacing with it other than mouse and keyboard. Johnny Lee has shown that you can build one pretty cheaply. You can set one up using just a couple Wii remotes, a projection screen, and a homemade IR pen. You can then create a virtual whiteboard application pretty easily.

The problem with virtual whiteboards is that all the drawings and text are just graphics. They don’t mean anything to the system. The text isn’t really text. It would be better if you could write the letters and have them be interpreted as real text.

Using an open source Flash based mouse gesture library, I put together a concept virtual corkboard that lets you write letters with your mouse (or IR pen) and put that text on virtual PostIt notes that you can place anywhere on the board.

Check out the video:

Of course, this isn’t the only way to tackle this problem. One could just do OCR on the drawings and figure out the text that way like the mobile app EverNote, but this is just one solution.

Open demo in lightbox

Open demo in new browser

Popularity: 12% [?]

Older Entries