Papervision3D + Xray Introspection = FINALLY

Man, after nearly 2 years of working with Papervision3D I FINALLY sat down and made it work with Papervision3D (and alot of other things).  Turns out it wasn’t that hard, I just needed to flip a switch to let other objects besides pure Objects and Array’s pass through to the interface.  It’s been digging through all of Papervision’s stuff all this time now, and I just needed to turn the key ;)   Well, there was a bit more with fixing a bug to support Dictionary’s now in Xray, but that’s all fixed now.

video: http://www.rockonflash.com/video/XrayPapervision3D.mov

You can see in this picture that I’m looking at a DisplayObject3D which is actually a child object of the loaded DAE.  You can change any of the properties you see there at runtime.  This makes it an extremely useful tool for debugging, but also for learning someone else’s application as well as optimization.  You can go through and change nearly any property at runtime to see who’s causin’ the problems.

The image below shows you the fix for Dictionarys.  DisplayObject3D’s children object is a Dictionary, and so now you can see all of it’s children and continue to click your way through to the end.  This is the group of panels in the QuadTree demo and you can see each one in the list of children.

I’ve committed the code and you can check out Xray here with your favorite svn client:
http://osflash-xray.googlecode.com/svn/trunk/

You can get the Xray interface here:
http://www.rockonflash.com/xray/flex/Xray.zip

The version you see in the video is the new AIR version which runs really well and as soon as I have time to package it up properly, I’ll release that version.

To get it working, put this in your code:

// create public var:
public var xray:Xray = new Xray();

// then, after you’re sure the stage is there in the main application:
addChild(xray);

Then just fire up the Xray Interface and hit the “go” button to take a snapshot and get started

It is time. To rock that is.

I’ve been researching guitars and tones from some of my favorite players and bands and one theme kept coming up: a Les Paul was involved.

So, meet the new member of the RockOn family:

The difference in sound between 2 guitars can be staggering.  I sat and played this guitar and others at guitar center tonight for 2 hours.  Hands down, the Les Paul had the best tone at any range.  I was really taken back by it.  I couldn’t imagine it could sound that good.  So I bought it.

Good things to come.  Rock on.

Posted in Guitar. 2 Comments »

HEAD Conference 2008 – it was alot of fun!

The Les Paul has NOTHING to do with the conference, but it DEFINITELY ROCKED \m/

It was the first time I’d spoken in a while (since Feb08 in Amsterdam if I remember right) and I had a blast!  It’s incredible how lively an online chat room can be like that – the people in there were awesome and we definitely covered alot of Papervision3D goodness in the hour I was on.  I went over by 15 minutes ;)

I talked at length about materials and animations and how they affect CPU/performance.  The coolest part about preparing for this conference was the benchmark application we got out of it.  We’d been meaning to write a good benchmark app to test new revisions with and so forth, and so this is a good start.

One part I was excited to talk about is how the new Benchmark showed the latest trunk to be 5% faster than the GreatWhite branch before we merged!  Andy’s changes to accommodate QuadTree resulted in a very nice increase in speed.  Even with GreatWhite before the merge, we’d been seeing 13k poly scenes rendering at 12pfs – that’s pretty freakin good if you’re keepin’ score.

check it out:
http://www.rockonflash.com/papervision3d/benchmarks/Papervision3D_Benchmarks.html

Drum solo for the week

I re-organized my office so I could get my kit closer to my computer :)   So far so good – the samson mic’s sound VERY good consider the cost/grade.  I’ve been extremely happy with them and the Alesis MultiMix 16 USB console.

Well, after a completely frustrating day and not so hot week at work, I finally had had enough of the 3D animation I’ve been working on and just beat the tar out of my drums.

be warned, this has nothing to do with flash, and it’s a completely self-indulgent “drummers” type of solo playing.  I don’t wanna hear comments like:

“MORE COWBELL” – bad

“that cowbell sounds off…” – yes, that’s because I meant to play it as a rhythm on top of the main rhythm and “attempt” to keep it going through out ( 4 on top of tripplet feel I guess you could call it ).

“it sounds the same all the way through…”- it’s not, but its definitely more for the drummers in the audience ;)

it’s not the cleanest of solo’s, but I washed my hands beforehand – Enjoy ;)

Read on only if you like being bored by drum stuff…

For those enthusiasts who might wonder about the kit – its a 2006 Hawaiian Thunder Tama kit.  9 Ply shells – 8 are Bubinga wood from South Africa, the outer ply is Koa from Hawaii.  8, 10, 12, 14, 16, 18×22, 14×6.5 Snare, 13″ hats (k top, z bottom zillgian), 20″ Sabian Ride, 8″ Sabian splash, 14″ K crash, 16″ Sabian Vault crash, Sabian china, DW 5000 pedals

it’s the best sounding kit I’ve heard or played on – unbelievable.

Posted in Drums. 11 Comments »

Happy Birthday Keith!

I don’t know how old Keith really is, but I’m sure it’s in the late 40’s somewhere ;)

LOL JUST KIDDING KEITH!!!

Anyway, Andy (3D), Seb (particles) and I (music) put together a little something for ya for your birthday man -

Happy Birthday Keith!

Posted in Flash. 9 Comments »

On Demand Papervision Course: Optimization Techniques

For a few months now, I’ve been doing live workshops online through RMI and those have been going very well.  So finally, after this last run, we archived the class (recorded it) and are offering it up as an on demand course you can take any time you like!

We’d received alot of feed back to provide an on demand version since not everyone can make it on the days we hold them.  Given that a fair amount of you are coming from over seas, it’s even more difficult to make the time slots.  One person was taking the class at 1am in the morning ;)   So I think this will help!

This course covers the Winter Wonder Land animation and engine.  You get all the source files for the application along with alot of other demo files that I typically hand out when I teach.  It covers:

  • Materials preparation and best usage with animation
  • BitmapData concepts to replace traditional MovieClip animations at runtime
  • SWF settings that can cause better performance (or worse)
  • Using multiple viewports and BitmapViewport3D
  • Simple tricks for getting decent effects (cheaply on the cpu)
  • Shaders ( bonus material )

Title: Papervision3D 2.0 Optimization

Duration:~200 minutes

Description: We’re going to take the Winter Wonderland demo from Zero fps to the 20’s by practicing a few some less known and some well known tips and tricks concerning both the Flash Player and Papervision3D. We’ll cover image preparation and rules, the Flash Player’s idiosyncrasies and what makes Papervision3D really sing. The Winter Wonderland animation started out as slow as 2fps and ended up in the mid 20’s after all of these techniques were applied. That leaves plenty of room for additional animations and bells and whistles later on! We’ll take the source for Winter Wonderland and crawl through it together to squeeze every last FPS out possible.

Who this course is for: Flash designers / developers with Papervision3D experience.

Check it out here

Papervision3D: QuadTree Released

If you haven’t seen it yet, Andy Zupko just released QuadTree for Papervision3D! He also released a more indepth look at using the new features on his blog. A big huge thanks to the Away3D team for their code and brilliance!  Andy was able to port it over to work with Papervision3D rather well and we’ve added some features that I think everyone will want to take advantage of.

So, what is QuadTree?  Well, in simple terms, its corrective z sorting for a 3D scene.  Say wha?  In other words, when you have 2 triangles who’s size is bigger than the distance between them, you will sometimes see sorting issues depending on the angle the camera is to the triangles.

It makes this:

Look like this:

How do I use it?

Now, this is very easy to use with Papervision3D.  Instead of creating a BasicRenderEngine, you’d now use the new QuadrantRenderEngine object instead:

var renderer:QuadrantRenderEngine = new QuadrantRenderEngine(QuadrantRenderEngine.CORRECT_Z_FILTER);

You’ll notice that there’s one argument about which type of filter to use.  On the sample I’ve created, I used the CORRECT_Z_FILTER which is the faster filter of the 3 options.  It simply takes care of z sorting of triangles.

Two new features added for speed

There’s also 2 other options worth mentioning.  One is the ability to tell QuadTree that any particular DO3D is not to be tested on each render (DisplayObject3D.testQuad:Boolean=true).  The default setting is true, but you can set it to false.  The second option is the maxLevel setting.  This controls the regions of the QuadTree.  Having less does NOT mean better performance.   You have to find a nice balance between the # of tri’s you have and how many regions gives you the best bang for the buck.

You might be asking yourself “why would I only want certain objects to be tested for z sorting fixes?”.  Well, the example I’ve created shows you just a instance that you *would* choose to be very picky about what QuadTree does and doesn’t test on.  This example is using the 3D object I’d made for my Mom’s site.  When you first load the sample, it is *not* including the big white mass in the middle (under the panels) in the QuadTree testing.  To activate it, hit the “s” key on the keyboard, and you’ll notice a decrease in performance.  In this particular type of demo, not testing the biggest object in the scene pays off as the panels above it are still corrected.  That’s a substantial savings.

Also, if you want to see how maxLevel affects performance, use the Q and A buttons to increase and decrease the maxLevel.  As I said earlier, a lower number does not equal better performance.  You just have to find a nice middle ground.  The default value, btw, is 4 and my demo seemed to run better set to 3.

Try it out here

My point, all along, is proven true ;)

Now, this all leads me to a point that I’ve been making since this topic and request for corrective z sorting came up a long time ago.  My point has been:  If you have the 3D model, fix the sorting yourself – its FAR faster performance-wize than QuadTree could ever be.  And my example here proves my point.

In the pictures below, I have the original version of my 3D object, and then a new version with the Panels much closer to the surface of the main structure.  The only difference between the 2 visually, is JUST that:  the panels are simply closer to the main structure.

Original:

The new QuadTree enhanced version:

When you run my sample, just hit “T” to switch between the QuadTree enhanced version and my original model.  You’ll see a huge difference in performance.  Yes, there are still some sorting issues in my model, but I could very easily go in and split the triangles by hand to fix those minor issues.  And I’d still have a very fast presentation.  While I would agree that having the panels closer to the main object looks a bit nicer, it’s not “nice enough” to justify the CPU/performance.

Now don’t go and take this as “John thinks QuadTree is useless” – I don’t think that, but I do think it’s uses are very confined given the speed we all live with in Flash 3D.  It’s awesome to see it working, and I would love to see good samples of it in production for sure, but if speed is what you need, you’ll likely end up fixing your sorting issues by hand in a good editor.  Of course, I haven’t talked about triangles colliding, which is something QuadTree deals with as well.  But for more information on that, head over to Andy’s blog for a full explanation ;)

Conclusion

Corrective Z sorting is a very cool feature to have indeed and, btw, the most requested.  But so was shaders before they came out.  Now ask yourself, “how much do I use shaders these days?”  I’d venture a guess that your answer is hardly ever – if ever.  I think we’ll see more need for QuadTree than shaders, but I don’t think that QuadTree is the miracle pill we’ll all be able to leverage very often to fix our sorting issues.  That will most likely STILL fall on the hands of the 3D modeler 95% of the time I would bet.

Posted in Flash. 7 Comments »

Xray short walk-through video

After seeing some of the replies on my last post, I thought doing a little video on what the AS3 version is capable would be a good idea.  So here’s a little walk through:

http://dl-client.getdropbox.com/u/36547/videos/xray/XrayWalkthrough_7Min.mov

Posted in AIR, AS3, Flash, Flex, Xray. 1 Comment »

Xray – Yes it does AS3 :)

Well, for a while now, people have been asking me about using Xray with ActionScript3, so I thought I’d clear up the confusion with one post about it.

Yes – there is a version for AS3.  That’s the good news.  The bad news is, it doesn’t have all the bells and whistles that AS2 version had.  It DOES do introspection of your objects at runtime with a snapshot, and the logger is as strong as ever.  There’s also a Flex specific Xray class that works rather well.

The nice thing is, the logger and Xray work the same in either the Flash IDE, pure ActionScript project, Flex application or Air application.  It doesn’t have an AS3 component yet, but it works very easily with a couple lines of code just the same way.

Let’s take a look at doing 2 things: 1)  setting up an Xray instance for introspection and 2) just using the logger.

Xray Instance

To create an instance of Xray, you simply add the import to your class, then create an instance:

import com.blitzagency.xray.inspector.Xray;

// later in your property declarations:

public var xray:Xray = new Xray();

addChild(Xray);  // you have to add it to the stage in a pure ActionScript application or Flash IDE app – thanks Dave!

// for you Flex users – it works for Flex2 or Flex3 or Air

import com.blitzagency.xray.inspector.flex.Flex2Xray;

public var xray:Flex2Xray = new Flex2Xray();

Yay me!  we’re done and you can use the Flex Xray interface to take a look at your application.

Xray’s Logger

Xray’s logger has the same log levels that most do these days: debug, info, warn, error and fatal.  To create an instance of the Xray logger, you simply add the import, then create an instance like so:

import com.blitzagency.xray.logger.XrayLog;

// later in your property declarations:

public var log:XrayLog = new XrayLog();

// later, when you want to log something:

log.debug(“StringMessage”, object [, object, object...]);

log.info(“StringMessage”, object [, object, object...]);

log.warn(“StringMessage”, object [, object, object...]);

log.error(“StringMessage”, object [, object, object...]);

log.fatal(“StringMessage”, object [, object, object...]);

You pass a string message as the first argument, then send as many objects as you like after that.  The output is nice in that it includes a time stamp as well as the class and line number that made the log call:

(2793) com.electricsheepcompany.aspen.spaces::SpaceCreator/handleGroupLoaded()[/Users/NeoRiley/Documents/Infrared5/clients/clientName/source/johnBranch/src/1.0_jgrden/src/main/flex/com/clientName/clientAppName/spaces/SpaceCreator.as:102
GroupTest: group load complete

As you can see, you get the calling Class fine and line number. Nice huh?

Where do I get the code?!?

Glad you asked!  It’s hosted on Google code and you can check it out with any SVN client at this URL:

http://osflash-xray.googlecode.com/svn/trunk/

And the snazy Xray Interface app??

You can download the SWF based Xray app here

The future of Xray?

As usual, I’m sure Xray’s development will be driven by need on projects and by people who request features.  If anyone cries loud enough, I’m sure I’ll do what I can.  As I come to need more features that AS2 used to support, I’ll get around to implementing them.  But for now, it works well in AS3, and does what I need it to do, which is introspection and the ability to modify properties at runtime to see what’s going on with the application.  Much of my work these days is being a consultant on new gigs every couple of months and Xray really helps me cut through the felgercarb in mere sentons.

Also, there’s XrayViewer by Marc Hughes

Marc’s the one that did the work on the filter component for Xray’s log output, and came up with a really VERY cool AIR app that lets you load a SWF and inspect it ;)

http://rogue-development.com/xrayviewer.html

My Blog moved…now for the fun

Well, thanks to Andy (and yes, i told him I’d point my finger at him if this didn’t work) I updated yesterday to WordPress 2.6.2.  The upgrade “said” it went well, but in the end, the pages wouldn’t respond and restarting the server/mysql didn’t seem to help.

Soo, after a bit of thought and research, I decided to move it to wordpress like we have with Papervision3D’s blogs.  The nice thing is that WP gets updated automatically for me and I get the latest greatest stuff.  The downside is I lost my theme ;( and probably a fair amount of you may not realize the RSS feed has changed.

I apologize, but I actually think this is a better move for RockonFlash in the long run.  Plus, Luke Hubbard had so graciously given me free space for the last 3 yrs on his server and the Database was said to be “huge”.  So, I’m glad to not take advantage of him on that anymore – LUKE YOU ROCK \m/

[ update ]  The rss redirect is working so people shouldn’t notice a change ;) but if you’ve lost the feed or know someone who wants it, please use the new one

http://rockonflash.wordpress.com/feed

[ another update ] Andy totally redeemed himself by trading in a perfectly good van for a moped to take us to Colorado.  Just kiddin ;)   He gave me a nice little PHP script to handle the site redirects ;)   yay Andy!

Posted in oops!. 4 Comments »