Filterwidth
From Odwiki
These functions are used for estimating the shading filter size, based on the differentials reported by Mantra. They are essential for doing antialiasing. In some contexts (like SOPs), the necessary information for deriving the filter size is unavailable, and so these functions will simply return a small constant value.
(Describing the reason for that "OP_SHADER" bit will need a few entries on organizing code to be context-sensitive... starting to think about how to put that together... WIP). Mario.
#define MINFILTWIDTH 1.0e-6 #if defined(VOP_SHADING) || defined(VOP_COP2) || defined(OP_SHADER) // Float Attributes float filterwidthX(float x) { return max (abs(Du(x)) + abs(Dv(x)), MINFILTWIDTH); } // 2D Float pairs (like s,t) float filterwidthST(float ss,tt) { return max(filterwidthX(ss),filterwidthX(tt)); } // 3D Vector float filterwidthP(vector p) { return max(sqrt(area(p)), MINFILTWIDTH); } // 4D Vector4 float filterwidthP4(vector4 pT) { vector p3 = set(pT.x,pT.y,pT.z); return max(sqrt(area(p3)), MINFILTWIDTH); } #else // Fallback functions for contexts that don't provide derivs. float filterwidthX(float x) { return 0.0025; } float filterwidthST(float ss,tt) { return 0.0025; } float filterwidthP(vector p) { return 0.0025; } float filterwidthP4(vector4 pT) { return 0.0025; } #endif



