mark
Actually, I believe that there's a compile time switch to turn off smoothing in shader . This means you have to recompile your shader to change the smoothing behaviour.
Hmmm… gotta look at the docs again… which might take me 5 days or so…sheesh!, I complain about the VEX docs, but the PRMan docs (w.r.t RSL) are all over the place – the info's usually there, but good luck finding it! :roll:
mark
The most obvious way to see what the extrapolate option does is to write a quick little shader to compute normals with an option to turn extrapolate on/off. Use the SHOP viewer to run your shader on a sphere or torus and watch the patch boundaries appear and disappear.
Aha!
Yup. Got it now, thanks.
So…..
If we wanted to take advantage of these controls in a generic way (and expose them in our shaders), we can't use dPds and dPdt anymore since these options are already cooked into their values, so we build our own… but then what are the settings when the globals (dPds|dPdt) get computed?
After some testing (on a bunch of different geometry), I'm getting the best matches with “extrapolate” ON, and “smoothing” OFF (which is the reverse of what the docs give as default).
Can you confirm this? Or is there something wrong with my test?
Here's what I'm using to check:
#pragma choice test “N” “Normals”
#pragma choice test “dP” “Derivatives”
#pragma label amp “Amplitude”
#pragma label extrap “Extrapolate”
#pragma hint extrap toggle
#pragma label smooth “Smoothing”
#pragma hint smooth toggle
surface
testExtrapolate(string test=“N”; float amp = 1; int extrap=1,smooth=1)
{
vector global,local;
if(test==“dP”) {
global = normalize(dPds);
local = normalize(Du(P,“extrapolate”,extrap,“smooth”,smooth) *
Du(s,“extrapolate”,extrap,“smooth”,smooth));
} else {
global = normalize(N);
local = normalize(computenormal(P, “extrapolate”, extrap,“smooth”,smooth));
}
Cf = abs(global-local)*amp;
}
Thanks Mark!