Mcronin Posted April 9, 2003 Share Posted April 9, 2003 I am building a cel shader in VOPs based on a Renderman Shader I found. The Renderman Shader uses this macro, filterwidth. It's supposed to filter the outline I guess, and I need some help figuring out how to implement this in VOPs. I have all the other pieces for the shader pretty much, but my edges are pretty harsh, and I understand this macro presumably will fix that problem. I will gladly submit the shader to the codex section if some one can help me out. Some explanation; x is the result of the absolute value of the dot product of N and I. I guess Du() and Dv() return derivatives of x, but Calc wasn't exactly my strongest subject:angry: This is my main sticking point, the derivative thing. I'm guessing du and dv are analogous to dPds and dPdt, and I can make MINFILTWIDTH a constant, make all this crap a vector and use Max Vector Component. I'm going to stop typing now, because I'm giving myself a headache just by thinking about the word "derivative". Can anyone help? I'm so close to getting this done and time is short. #ifndef MINFILTWIDTH # define MINFILTWIDTH 1.0e-6 #endif /* The filterwidth macro takes a float and returns the approximate * amount that the float changes from pixel to adjacent pixel. */ #define filterwidth(x) max (abs(Du(x)*du) + abs(Dv(x)*dv), MINFILTWIDTH) Quote Link to comment Share on other sites More sharing options...
Mcronin Posted April 9, 2003 Author Share Posted April 9, 2003 Hold the phone, think I just figured it out. Quote Link to comment Share on other sites More sharing options...
edward Posted April 9, 2003 Share Posted April 9, 2003 I think you can use the Shading Derivative vop for Du(x). The equivalent vex expression should be this (without the additional multpies of du & dv) max(abs(Du(x))+abs(Dv(x)), MINFILTWIDTH) Quote Link to comment Share on other sites More sharing options...
Mcronin Posted April 9, 2003 Author Share Posted April 9, 2003 Thanks Edward, I just discovered Shading Derivative before you posted, but I may be having another problem... I'll probably be posting again shortly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.