User Guide

3D Basics 451
Determining whether anti-aliasing is supported
Not all 3D renderers can perform the additional calculations that anti-aliasing requires. If
you have a 3D sprite that you want to anti-alias, check first that the 3D renderer supports
anti-aliasing. The renderers that currently support anti-aliasing include the Director software
renderer, and DirectX 5.2 and DirectX 7.0.
If the 3D sprite is in channel 1 of the Score, you would test the
antiAliasingSupported
property of sprite 1, as shown in the following example:
if sprite(1).antiAliasingSupported = TRUE then
Turning on anti-aliasing
If the
antiAliasingSupported property is TRUE, you can turn on anti-aliasing for the 3D sprite
by setting the sprites
antiAliasingEnabled property to TRUE.
sprite(1).antiAliasingEnabled = TRUE
For example, if you have a 3D sprite in channel 5 and you want to turn on anti-aliasing for the
sprite when it first appears on the Stage, you would write a beginSprite script and attach it to
the sprite. Your script should contain Lingo as shown in the following example:
on beginSprite
-- check whether anti-aliasing is supported by the current 3D renderer
if sprite(5).antiAliasingSupported = TRUE then
-- if it is, turn on anti-aliasing for the sprite
sprite(5).antiAliasingEnabled = TRUE
end if
end beginSprite
Turning off anti-aliasing
If you plan to animate any part of a 3D sprite, you might want to turn anti-aliasing off
temporarily to improve the animation performance. To do this, set the
antiAliasingEnabled
property for the sprite to
FALSE. You can then set it back to TRUE when the animation is
complete.
It is a good idea to turn anti-aliasing on and off on separate handlers. For example, you might
want to animate a model, camera, or light while the mouse button is held down and stop the
animation when the mouse button is released. In that case you would turn off anti-aliasing in a
mouseDown handler and turn it back on in a mouseUp handler, as shown in the following example:
on mouseDown
-- user interaction/animation is about to start so turn
-- anti-aliasing OFF
sprite(1).antiAliasingEnabled = FALSE
-- start animation
end
on mouseUp
-- stop animation
-- the interaction/animation has ended so turn
-- anti-aliasing ON
sprite(1).antiAliasingEnabled = TRUE
end