CS4 Second Life Tree Superior to PV3D

Intro

When it comes to creating Second Life foliage in Flash 3D, Flash CS4 is far superior in ease of use, code required, and portability.

Creating a Second Life Tree in CS4 Flash

Creating a Second Life Tree in CS4 Flash

To see a demo and grab the source files click the links below:

Source

Demo

Given that I like Papervision3D so much, you’ll find the following analysis very unbiased. But it surprised me, and made me think a little about the direction I’m headed. I’m not giving up Papervision3D, there are too many things that PV3D can do that CS4 can’t. But I’m definitely blending CS4 with Papervision3D whenever a savings like this can be found.

Ease of Use

The steps required to create the Second Life tree graphic for use in the 3D environment for CS4 and PV3D are given below. CS4 requires no programming and PV3D is programming intensive.

CS4, No Programming Required

To create the Second Life Tree in CS4 Flash follow these steps

  1. Import the front and side tree “png” images onto the Flash Stage.
  2. Turn them both into movie clips
  3. Rotate one 90 degrees with the 3D rotation tool and use the 3D translation tool to overlap them at their centers
  4. Turn both into a movie clip and check the linkage of that movie clip for export

PV3D, Programming Intensive

  1. Create a Tree Primitive (see the Post on Second Life Tree)
  2. Import the Tree Primitive into a BasicView wrapper program
  3. Instantiate two BitmapFileMaterials and load your images into them
  4. Create a MaterialList and load your Image materials into it
  5. Load your MaterialList into your Tree Method

Counting lines of code was the real eye opener, it really shows the advantage of having the native z component in Flash 10.

Code Required

All things considered CS4 beats Papervision3D hands down in the number of lines (fewer) required to code the same user experience: 23 to 243, a factor of 10.

Comparision of Lines of Code Required

Comparison of Lines of Code Required

Portability

Like Papervision3D, CS4 runs on Windows, Mac, and Linux. But with CS4 you can run your Second Life tree with Papervision3D, Away3D, Sandy3D, or any other 3D package running in the Flash 10 player.

The code for the CS4 Second Life Tree is given below:

CS4 Code

package {
import flash.display.Sprite;
import flash.display.*;

public class SLTreePackage extends Sprite
{
private var tree:SLTree= new SLTree();
public function SLTreePackage()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
addChild(tree);
tree.x=stage.stageWidth/2;
tree.y=stage.stageHeight/4;
//Start Tree Rotating
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
tree.rotationY+=1;
}
}
}

4 Responses to CS4 Second Life Tree Superior to PV3D

  1. Rene says:

    Wow…I haven’t used CS4 yet, but I should definitely start :). Thanks for the post Mike.

    • Mike Lively says:

      Thanks for your comment. Flash & Math says it’s 5 times faster … Papervision3D forum claims no great improvement in performance.

      I think the great improvement is in ease of use (no learning curve – advantage of having native z), the motion editor (which you can create an animation engine from – will do this in the book), and pixel bender.

  2. Rene says:

    Hey Mike, have you compared speeds between CS4 and PV3D? I can estimate that CS4 is faster than PV3D, but how much faster?

  3. Rene says:

    cool thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: