Wolfwood Posted May 23, 2007 Share Posted May 23, 2007 (edited) Sample: Fur.mpg Edited May 23, 2007 by Wolfwood Quote Link to comment Share on other sites More sharing options...
JT Posted July 17, 2007 Share Posted July 17, 2007 Hey everyone! I have a question: How do you guys write shaders? I'm looking through a few of the papers mentioned in this thread, and I'm looking at bfx's mention of Dan B Goldman's "Fake Fur Rendering", as well as Kajiya and Kay's paper, Rendering Fur with Three Dimensional Textures. For example, we have from Dan's paper (which seems to be the kajiya and kay shading model), Diffuse = Kd * sin(T,L) Spec = Ks * pow( (T.L * T.E + sin(T,L)* sin(T,E)), phong) So, should the Diffuse contribution simply be Kd multiplied by the sin of the angle between the tangent vector and light vector? i.e. in VEX: float Kd = 1; (should be variable in the shader's function header) vector T = normalize(dPdt); vector Diff = 0; illuminance(P,N,PI) { vector nL = normalize(L); Diff += Kd * sin( acos( dot(T, nL) ) ); } Cf = Diff; Is this the correct way to interprete the formulas? JT Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 18, 2007 Share Posted July 18, 2007 Is this the correct way to interprete the formulas? Hi there, I don't know that paper, but as far as translating those two formulas into VEX, I'd say it looks OK -- except that maybe you could simplify sin(acos(x)) into sqrt(1-x^2). Also, you can safely pull the constants Kd and Ks out of the summation... and maybe call shadow() in case there's a shadow shader attached.... Here's a sketch with some of those extra details: #pragma label Ka "Ambient Amplitude" #pragma label Kd "Diffuse Amplitude" #pragma label Ks "Specular Amplitude" #pragma label rough "Specular Roughness" surface simplehair ( float Ka = 1; // ambient amplitude float Kd = 1; // diffuse amplitude float Ks = 1; // specular amplitude float rough = 0.05; // specular roughness vector Cd = 1; // "hidden" surface color // sometimes bound to geo ) { vector T = normalize(dPdt); vector E = normalize(-I); float TE = dot(T,E); vector Cdiff = 0, Cspec = 0; illuminance(P,N,M_PI) { shadow(Cl); // run the shadow shader, if any vector nL = normalize(L); float TL = dot(T,nL); float sTL = sqrt(1.0-TL*TL); // sin(T.L) Cdiff += Cl * sTL; Cspec += Cl * pow(TL*TE + sTL*sqrt(1.0-TE*TE),1.0/rough); } Cf = Cd * (Ka*ambient() + Kd*Cdiff) + Ks*Cspec; } HTH. P.S: I just took a quick peek at Dan's paper, and those two formulas are just the begining... he then spends the rest of the paper developing a heap'o'stuff to compensate for what's missing in that simple model... just thought I'd mention it. Quote Link to comment Share on other sites More sharing options...
horizon1231 Posted September 6, 2007 Share Posted September 6, 2007 (edited) check it Edited July 16, 2008 by horizon1231 Quote Link to comment Share on other sites More sharing options...
edward Posted September 7, 2007 Share Posted September 7, 2007 For reference, you could always consult the VEX Hair SHOP that comes with Houdini. Quote Link to comment Share on other sites More sharing options...
kensonuken Posted August 26, 2008 Share Posted August 26, 2008 Hey Mario can u send some output renders of your shader? Quote Link to comment Share on other sites More sharing options...
kensonuken Posted August 26, 2008 Share Posted August 26, 2008 does it looks as good as this one? http://forums.odforce.net/index.php?act=at...ost&id=5457 Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted August 26, 2008 Share Posted August 26, 2008 does it looks as good as this one?http://forums.odforce.net/index.php?act=at...ost&id=5457 No. That thing I posted at the beginning of this thread wasn't a shader; it was a vop that calculated the tube normal of an RiCurve (or open poly line in houdini-speak)... not even remotely in the neighborhood of something that could be called a shader. The work that both Arno Zinke and Mark Visser have done is light years ahead of any hair-related thing I've posted anywhere at odForce. I'd suggest you either use the shader that comes with Mark's Fuzzy Toolkit, or the one that's bundled with H9.5. (and possibly the encrypted version that Arno posted elsewhere in his hair thread if it still works with the current Mantra versions). And no; none of the above are supplied in the form of vex code that you can tinker with... think about it. Cheers. Quote Link to comment Share on other sites More sharing options...
kensonuken Posted August 27, 2008 Share Posted August 27, 2008 The one that comes with Mark's Fuzzy Toolkit is compiled version and seems to work only with 9.1. Btw where can i find that shader. I thought to use Kajiya Kay model but Marks Fuzzy looks interesting..... The reason why im asking this is that I want to generate fur in Rendertime... with output per lights and passes like Pbowmar example of exporting per lights. If I have vex code or vop for it then it will be easy for me to tweak and integrate with the new Cvex to get the desired output... Quote Link to comment Share on other sites More sharing options...
kensonuken Posted September 10, 2009 Share Posted September 10, 2009 (edited) Ive just checked out the shader code and found that its the Kajiya kay model which is giving nice looking fur and giving the output and the quality that Ive expected... Edited September 10, 2009 by kensonuken Quote Link to comment Share on other sites More sharing options...
danilo2 Posted July 4, 2010 Share Posted July 4, 2010 Hi! I've downloaded the arno hair shader. And I see in the scene that the code of this shader is only "#include "arno_hair_far_field_circular_v_1_9.vfl"". I understeand that this shader is compiled without source code? I'm right? Thank you Quote Link to comment Share on other sites More sharing options...
symek Posted July 4, 2010 Share Posted July 4, 2010 Hi! I've downloaded the arno hair shader. And I see in the scene that the code of this shader is only "#include "arno_hair_far_field_circular_v_1_9.vfl"". I understeand that this shader is compiled without source code? I'm right? Thank you And no; none of the above are supplied in the form of vex code that you can tinker with... think about it. Quote Link to comment Share on other sites More sharing options...
Jason Posted July 5, 2010 Share Posted July 5, 2010 To boot: the far field shaders are famously slow, unpredictable and unstable-- and kinda unavailable If I were you, I'd use kajiya plus two specular terms of your own, a simple hack gain a similar effect to the double specular the Marschener shader gives you. Quote Link to comment Share on other sites More sharing options...
Marc Posted July 6, 2010 Author Share Posted July 6, 2010 Does anyone know what model the current Houdini hair shader is using? I'm always intrigued by these discussions when it seems like the built in shader does a pretty good job out the box. M Quote Link to comment Share on other sites More sharing options...
symek Posted July 6, 2010 Share Posted July 6, 2010 Does anyone know what model the current Houdini hair shader is using? I'm always intrigued by these discussions when it seems like the built in shader does a pretty good job out the box. M vectorvop_hairspec(vector nn, V, T; float exp;) { // Specular illumination model from: // James T. Kajiya and Timothy L. Kay (1989) "Rendering Fur with Three // Dimensional Textures", Computer Graphics 23,3, 271-280 ... } Quote Link to comment Share on other sites More sharing options...
Marc Posted July 6, 2010 Author Share Posted July 6, 2010 ah yeah.... um... I knew that, of course. Thanks SYmek! Quote Link to comment Share on other sites More sharing options...
symek Posted July 6, 2010 Share Posted July 6, 2010 No problem, I love to copy/pasting things around Quote Link to comment Share on other sites More sharing options...
danilo2 Posted July 6, 2010 Share Posted July 6, 2010 (edited) Thank you Symek! No problem, I love to copy/pasting things around Symek could you please tell me where have you found this info? When I'm looking into shaders in houdini I can see 2 materials (with vop vex surface shaders - but they have no comments) and a "Vex Hair" shader, which is not this one, what you're talking about. Am I right? Edited July 6, 2010 by danilo2 Quote Link to comment Share on other sites More sharing options...
symek Posted July 6, 2010 Share Posted July 6, 2010 $HFS/houdini/vex/include/voplib.h. The ultimate vops' handbook. Quote Link to comment Share on other sites More sharing options...
danilo2 Posted July 6, 2010 Share Posted July 6, 2010 $HFS/houdini/vex/include/voplib.h. The ultimate vops' handbook. Ahh of course! Thank you I forgot about this little "handbook", you've shown me some time ago 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.