Jordan Posted January 18, 2007 Share Posted January 18, 2007 Hi Everyone. Ever since I started using houdini, I have been skipped render metal surface is simply because of when anisotrophic is applied to polygonal model, I got my model looks faceted in the render. And i think as a houdini user, we need an anisotrophic shader which is compatible with polygonal model. Anyone would like to write this shader? jens, madjestic ?? If u guys are busy, please give us some insight to start? regards, jordan. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 18, 2007 Share Posted January 18, 2007 Render your polys as subdivision. All other ways are a hack. I think Mario tried to solve the problem for standard poly models and even he got stumped by this one. Quote Link to comment Share on other sites More sharing options...
kumpa Posted January 18, 2007 Share Posted January 18, 2007 may be s bit off topic, but what happens to uv coordinates when u render object as subdivision instead of having it subdivided by Subdivide SOP ? I noticed that uv's dont get smoothed properly. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 18, 2007 Share Posted January 18, 2007 The first thing you'll need is an anisotropic model that doesn't have the tangent space hard-coded into it (last I checked, the one that ships with Houdini had the parametric dPds and dPdt hard-coded into it). I believe I included a version of the Ward model (the same one that ships with Houdini) in my glass shader -- check toward the bottom of the glass.h file, there should be a couple of functions: brdf_aniso() and illum_aniso(), which take two vectors (x and y) which define (together with N) the tangent space. If you choose to use this one, then remove the fresnel weighing in illum_aniso(). Anyhoo... all you need to build a tangent space is a single reference vector, which you then combine with the surface normal (N) to build the space. This vector can come from several different places: 1. Bound to the surface as a varying vector attribute (per-point). 2. An arbitrary direction in an implicit space, like object space. 3. An arbitrary direction in a user-supplied reference space (otransform()). 4. there are probably others... but the one thing that is *not* an option for triangular polys is what's built into the default Houdini model: dPds and dPdt... Once you have a reference vector (say, "tanx"), then you can build a perpendicular to it as the secondary direction ("tany"). Here's a sketch: vector nN = normalize(N); vector x = normalize(tanx); vector y = normalize(cross(x,nN)); // And just in case "tanx" wasn't actually tangential to the surface: x = normalize(cross(nN,y)); Now you can pass x and y as the directions of anisotropy to your model. Hope that makes some sense. @simon: That other issue that I was struggling with a while back had to do with getting the gradient of a variable (like texture u or v). Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 18, 2007 Share Posted January 18, 2007 @simon: That other issue that I was struggling with a while back had to do with getting the gradient of a variable (like texture u or v). Doh! I thought it was related to this, sorry for the confusion.... Quote Link to comment Share on other sites More sharing options...
Jordan Posted January 19, 2007 Author Share Posted January 19, 2007 (edited) I believe I included a version of the Ward model (the same one that ships with Houdini) in my glass shader -- check toward the bottom of the glass.h file, there should be a couple of functions: brdf_aniso() and illum_aniso(), which take two vectors (x and y) which define (together with N) the tangent space. If you choose to use this one, then remove the fresnel weighing in illum_aniso(). Thanks for your patient, Mario. Since i am allow to copy and paste your code, I would hijack some another snippet code from somewhere else to mix and match. One more noob's question for you mario if u don't mind, how to compile the *.h file? it will be great if you can tell me in a simplify way like Step1 blah blah blah... Setp2 blah blah blah.. thanks in advance. Hi Simon, I did those hacks which u mentioned above, but it doesn't work all the times especially when you want some dirt-map on the metal-surface....( U know how's houdini handle UV when we turn on Polygons as Subdivision surfaces ) so i ended up render separate passes and comp it. And nevertheless, lately i am enjoying your toon shader so much. It is such a great input to the community. what about making your next input for this???? Edited January 19, 2007 by Jordan Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 19, 2007 Share Posted January 19, 2007 One more noob's question for you mario if u don't mind, how to compile the *.h file?it will be great if you can tell me in a simplify way like Step1 blah blah blah... Setp2 blah blah blah.. thanks in advance. The *.h file is written in VEX, and is meant to be #include'd in some shader file (.vfl) -- i.e: you wouldn't compile the header file (*.h) itself. But don't worry about it. Here's an example using Inline VOPs (no compiling needed): anisopoly.hip To see the effects of each tangent space method, go to /shop/Anisotropic_Ward and flip between the different modes using the "Tangent Space" menu. To see the effect under different transformations, choose one of the transformation takes I've included, and render at different frames. There are two inline vops that you should look at in the /vex/TestAniso SHOP VOP: 1. The "Space_Tangent" VOP is where the tangent space is defined. It switches between the different solutions, depending on what method was chosen. It's output are three vectors which, together, define the tangent space. They are aligned as follows: "tanx" is the u direction, "tany" is the v direction, and "tanz" points away from the surface and is the same as a normalized and front-facing N. 2. The "Illum_Ward" VOP is a modified version of Houdini's built-in anisotropic illumination model. The only modification from the original is that it takes the two directions of anisotropy as parameters (in our case, "tanx" and "tany"). Each of these methods has consequences when it comes to a transforming and/or deforming object. Roughly: Method: "Parametric UV" - Only useful with parametric surfaces (NURBs, Bezier) as well as Primitives, Implicits, and (usually) Meshes. - Anisotropy will "stick" to the surface under deformation and object- or world-space transformations. Method: "Bound Vector Attribute 'tanU'" - Useful for all primitive types, including polys (quads or triangles). - If "tanU" is defined before any deformations are applied, then it will stick under deformation. It will also stick under all transformations. Method: "Reference Direction in Object Space" - Useful for all primitive types, including polys (quads or triangles). - Will stick under world-space transformations. - Will *not* stick under object-space transformations (transform SOP) or deformations. Method: "Reference Direction in Named Space" - Useful for all primitive types, including polys (quads or triangles). - If passed a typical reference null, anisotropy will be independent of the object's space -- i.e: it will generally not stick under any transform/deform. Hope that helps clear things up a bit. Cheers! Quote Link to comment Share on other sites More sharing options...
stu Posted January 19, 2007 Share Posted January 19, 2007 Great example. Quote Link to comment Share on other sites More sharing options...
Jordan Posted January 20, 2007 Author Share Posted January 20, 2007 Thank you very much, Mario. Your instruction is very comprehensive. The *.h file is written in VEX, and is meant to be #include'd in some shader file (.vfl) -- i.e: you wouldn't compile the header file (*.h) itself.But don't worry about it. Here's an example using Inline VOPs (no compiling needed): By the way, Can you explain the relationship inbetween the header file and (.vfl) and how to compile .vfl file to usesable shader?( sorry, I know i am asking for more ) I eager to try to copy n paste some codes and compile it. much appreciated, jordan. Quote Link to comment Share on other sites More sharing options...
edward Posted January 20, 2007 Share Posted January 20, 2007 http://forums.odforce.net/index.php?showtopic=1568 http://www.fundza.com/houdini/basics/houdini_vex.html Quote Link to comment Share on other sites More sharing options...
Jordan Posted January 22, 2007 Author Share Posted January 22, 2007 http://forums.odforce.net/index.php?showtopic=1568http://www.fundza.com/houdini/basics/houdini_vex.html thanks edward. 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.