20.04.2015 Views

SEP # : 16 - Scilab

SEP # : 16 - Scilab

SEP # : 16 - Scilab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>SEP</strong> # : <strong>16</strong><br />

Title: anti­aliasing<br />

Version: 1.0<br />

Author: JB Silvy<br />

Review:<br />

Commented:<br />

State: Draft<br />

<strong>Scilab</strong>­Version: 5.2<br />

Vote:<br />

Created: Tuesday, 17 February 2009<br />

Abstract<br />

In this <strong>SEP</strong>, we discuss the introduction of full screen anti­aliasing (FSAA) to enhance <strong>Scilab</strong><br />

Graphics image quality. When used in <strong>Scilab</strong>, anti­aliasing would allow to remove staircase artifacts<br />

that appears in <strong>Scilab</strong> Graphics, especially for polylines. For more information on anti­aliasing in<br />

general, see [1].<br />

Background<br />

All <strong>Scilab</strong> versions until <strong>Scilab</strong> 5.1 are not able to activate full screen anti­aliasing. However, most<br />

of software having visualization capabilities use it to enhance their graphics quality. They have<br />

consequently an advantage upon us. Matlab does not have such a feature by default but some<br />

toolboxes [2] provide it. Anti­aliasing has also been requested in our bug data base [3].<br />

Rationale<br />

FSAA enhances image quality but also decreases graphic performances. When FSAA is activated, it<br />

also comes with a quality setting. The higher the setting, the better the quality, but also the lower are<br />

the performances. Practically, there are nowadays 4 standard settings which are “2x”, “4x”, “8x” and<br />

“<strong>16</strong>x”. The “4x” and “8x” are the more commonly used settings. With “2x”, the difference with no<br />

anti­aliasing is barely noticeable. The difference between “8x” and “<strong>16</strong>x” is also barely noticeable.<br />

Consequently, “4x” represent a good compromise between speed and quality whereas “8x” stands<br />

for the best quality.


Figure 1: Result of plot3d() in <strong>Scilab</strong> without anti­aliasing.<br />

Figure 2 : Result of plot3d() in <strong>Scilab</strong> with anti­aliasing 4x.


Figure 3 : Result of plot3d() in <strong>Scilab</strong> with anti­aliasing 8x.<br />

From <strong>Scilab</strong>, the anti­aliasing will be controlled per figure. A property “anti_aliasing” will be added<br />

to figure handles. This property value can be one of the following: “off”, “2x”, “4x”, “8x”, “<strong>16</strong>x”. If<br />

the property is set to “off”, anti­aliasing is disabled. Otherwise, the value stands for the anti­aliasing<br />

quality.<br />

An other approach would be to have only two or three possible values, more understandable by the<br />

user. The value could be chosen between “off” or “on” (actually setting quality to “4x”) or between<br />

“off”, “performance” (quality “4x”) and “quality” (quality “8x”).<br />

By default, the anti_aliasing will be turned off to avoid speed loss in already existing <strong>Scilab</strong> codes<br />

(such as Scicos). However, the default can be changed by modifying the default figure.<br />

Limitations<br />

As any OpenGL/JOGL development, this feature should be widely tested on different architectures.<br />

This will avoid bad surprises on low end computers.<br />

Moreover, anti­aliasing might not be supported by a few graphic configurations. In this case a<br />

warning will be send to the user that anti­aliasing won't work on his configuration.<br />

Example Usage<br />

// setting anti­aliasing by default


df = gdf();<br />

df.anti_aliasing = “4x”;<br />

plot();<br />

// changing anti_aliasing quality<br />

f = gcf();<br />

f.anti_aliasing = “<strong>16</strong>x”;<br />

f.anti_aliasing = “off”;<br />

Changelog<br />

1.0 – Initial Revision<br />

Copyright<br />

This document has been placed under the license CeCILL­B.<br />

Bibliography<br />

[1] Wikipedia – Anti­aliasing entry, http://en.wikipedia.org/wiki/Anti­aliasing<br />

[2] Myaa ­ My Anti­Alias for Matlab,<br />

http://www.mathworks.com/matlabcentral/fileexchange/20979<br />

[3] S. Ledru ­ <strong>Scilab</strong> Bug 2984 , http://bugzilla.scilab.org/show_bug.cgi?id=2984

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!