26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

Appendix E<br />

STANDARD BUILT-IN FILTERS<br />

In this section the required <strong>RenderMan</strong> <strong>Interface</strong> filters are defined. Keep in mind that the<br />

filter implementations may assume that they will never be passed (x, y) values that are<br />

outside the ([−xwidth/2, xwidth/2], [−ywidth/2, ywidth/2]) range.<br />

E.1 Box Filter<br />

RtFloat<br />

RiBoxFilter (RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth)<br />

{<br />

return 1.0;<br />

}<br />

E.2 Triangle Filter<br />

RtFloat<br />

RiTriangleFilter (RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth)<br />

{<br />

return ( (1.0 – fabs(x)) / (xwidth*0.5) )<br />

* ( (1.0 – fabs(y)) / (ywidth*0.5) ) ;<br />

}<br />

E.3 CatmullRom Filter<br />

RtFloat<br />

RiCatmullRomFilter (RtFloat x, RtFloat y, RtFloat xwidth, RtFloat ywidth)<br />

{<br />

RtFloat r2 = (x*x + y*y);<br />

RtFloat r = sqrt(r2);<br />

return (r >= 2.0) 0.0 :<br />

(r < 1.0) (3.0*r*r2 – 5.0*r2 + 2.0) : (–r*r2 + 5.0*r2 – 8.0*r + 4.0);<br />

195

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

Saved successfully!

Ooh no, something went wrong!