Jump to content
Search Community

Vector assets to Bitmaps

BladePoint test
Moderator Tag

Recommended Posts

I have not yet decided to take the plunge into Starling, but my Flash game doesn't have a crazy amount of stuff flying around so I'm hoping I won't really need it. However, it does have vector artwork that tweens through a lot of translating, rotating, scaling, and opacity changes. I recently tested it out on a Pentium 4, and the animation gets rather choppy. If I was using Bitmaps with TweenMax, would it improve performance?

 

My other concern is how the Bitmaps would look at higher resolutions. If I scaled up my vector to 1920x1080 and made my Bitmap at the same resolution, then used TweenLite to shrink it down, would that work?

 

var myVectorArt:Sprite = new vectorArt();

var bmd:BitmapData = new BitmapData(1920,1080);
bmd.draw(myVector)
myBitmap = new Bitmap(bmd);
TweenLite.to(myBitmap, 0, {width:1280,height:720});
Link to comment
Share on other sites

There isn't an easy answer to this - in some cases yes, blitting/bitmaps would yield better performance but sometimes it's the opposite. I wouldn't recommend shrinking down your bitmap, that's for sure. That would be quite wasteful because you'd be forcing Flash to not only render more pixels than it really needs, but also interpolate, antialias, and render them at a transformed size. 

 

If you've got a lot of vectors that DON'T change on every frame, you'd probably see a performance improvement if you baked them onto a bitmap, yes. Vectors can be CPU-intensive to render on every frame. 

 

Either way, it sounds like your performance bottleneck has nothing to do with ActionScript execution but rather graphics rendering. My encouragement would be to experiment with blitting and maybe Starling to see if it yields good results. That doesn't mean you need to build your entire game with it yet - just do some experiments and see how the frame rate looks. 

 

Good luck!

Link to comment
Share on other sites

Thanks for the reply. That's interesting that motionless vector art still requires a lot of CPU for just sitting there on the screen.

 

The vector art that I've been testing has 2500 points and nearly fills the screen. Turning it into a bitmap makes things significantly smoother. But I just read that BitmapData is uncompressed, and I noticed that my Flash file's memory usage jumped by 10 MB. It seems everything has it's pros and cons. To summarize:

 

1. Keep it as vector art.

PROS: The artwork looks crisp and keeps the file size down.

CONS: Very CPU intensive so animation will be choppy on less powerful systems.

 

2. Convert it to a Bitmap.

PROS: Animates faster. File size still low.

CONS: Looks fuzzy when zoomed in on high resolution devices. Also eats up a lot of memory.

 

3. Export/Import as PNG.

PROS: Animates faster, but increases file size. Does not use a lot of memory.

CONS: Looks fuzzy when zoomed in on high resolution devices.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...