Hopefully you never experience the frustration of trying to explain to a designer/pm/client why an object aliases when it scales in a SWF but not in Photoshop. After all, they don’t want a reason, just a solution. Had I known about MIP Mapping, I could have saved myself from at least a few of those conversations.
I’m hardly the first to post on this topic, but MIP Mapping is a under-appreciated feature of Flash Player that deserves some more attention. I first came across the subject while reading Papervision 3D Essentials. If you find yourself in a situation where you need to scale bitmaps in Flash, you should be aware of MIP Maps. MIP Maps are basically smaller, higher-quality versions of static bitmaps that Flash Player creates at runtime for use in scaling. When an object scales, Flash player gets the two closest-sized bitmaps from the MIP Map and interpolates to create a smoothed image.
This sounds great, but what do developers need to know and do in order to take full advantage of MIP Mapping?
- MIP Mapping only works for static bitmaps – don’t waste your time trying to optimize an object for MIP Mapping if the object in question is a MovieClip with
trueor an object with a filter applied.
- Start with even dimensions – odd dimension objects never get mapped, so you don’t get benefit from MIP Mapping
- Power of two dimensions work best – 2^n is always ideal for MIP Mapping. Keep in mind that your bitmaps don’t have to be square – you can mix and match powers of two for width and height.
- Enable smoothing for more improvement –
Bitmap.smoothing = true;will give you additional improvements in scaled quality.
- Use MIP Mapping in Papervision – MIP Mapping in Papervision increases performance when
BitmapMaterial.AUTO_MIP_MAPPINGis set to
Happy MIP Mapping!