kensonuken Posted May 12, 2010 Share Posted May 12, 2010 I was just checking the code of Houdini Fur shader which was not kajiya kay... Is there any possibility where we can use kajiya kay shader in Houdini? or can we modify the current kajiya kay shader to Houdini shader? here is the prman code that I have . ///////////////////////////// //////////////////////////////////////////////////////////////////////////////// // based on ATI's paper 'Hair Rendering and Shading', by Thorsten Scheuermann // // 3D application research group, ATI research Inc. //////////////////////////// // this is a hair rendering technique originally made for polygon hair models // // a mix of Kajiya-Kay hair shader model, and Marscher's model, presented at // // Siggraph2003 //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // shifting specular highlights along lenght of hair vector shifttangent( vector Tn; normal Nf; float shift; ) { vector shiftedt = Tn + shift * Nf; return normalize(shiftedt); } /* Specular strand lighting */ float strandspecular( vector Tn, Vn, Ln; float exponent; ) { vector Hn = normalize(Ln + Vn); float dotth = Tn.Hn; float sinth = max( 0.0, sqrt( 1.0 - dotth * dotth ) ); float diratten = smoothstep(-1.0, 0.0, dotth); return diratten * pow( sinth, exponent); } /* Main */ surface tshair( //color tshair( float Ka, Kd, Ks; //ambient, diffuse, specular coefficients float shift; // primary specular highlight shift float shift2; // secondary specular highlight shift float exponent; // primary specular exponent float exponent2; // secondary specular exponenet float specmask; // specular mask, to shift secondary spec color Cdiff; // surface color,sometimes bound to geo color Cbase; // hair base color color Ctip; // hair tip color color Cspec; // primary specular color color Cspec2; // secondary specular color normal Nn; // normal vector vector Vf; // viewer vector ) { /* We're going to need dPdv for direction, P for the illuminance * construct, and the v coordinate for the color blend in the color * contribution. */ extern vector dPdv; extern point P; extern float v; vector T = normalize(dPdv); normal Nf = faceforward( Nn, Vf ); vector t1 = shifttangent( T, Nf, shift - .5); vector t2 = shifttangent( T, Nf, shift2 - .5); float dottin = T.Vf; color Cdd = 0; color Css = 0; illuminance( P, Nf, PI/2 ) { extern vector L; extern color Cl; vector Ln = normalize(L); uniform float nondiff = 0; lightsource("__nondiffuse", nondiff); if (nondiff < 1) { /* Scaled diffuse term. Note that in the paper they use * ambient occlusion to fake the hair shadowing. */ Cdd = clamp( mix( .25, 1.0, Nf.Ln), 0, 1); } uniform float nonspec = 0; lightsource("__nonspecular", nonspec); if (nonspec < 1) { /* Primary specular */ Css = Cspec * (1-nonspec) * strandspecular( t1, Vf, Ln, exponent); /* Secondary specular */ Css += Cspec2 * (1-nonspec) * specmask * strandspecular( t2, Vf, Ln, exponent2); } } return Cdd * mix( Cbase, Ctip, v) * (Ka*ambient() + Kd * Cdd ) + Ks * Css; } I want to use this shader in Mantra... any possibility? Quote Link to comment Share on other sites More sharing options...
lisux Posted May 12, 2010 Share Posted May 12, 2010 Code it in VEX, is pretty much the same as RSL. Quote Link to comment Share on other sites More sharing options...
kelvincai Posted May 14, 2010 Share Posted May 14, 2010 check the prman.h in $HFS\houdini\vex\include there is a section in help for converting RSL codes to VEX. They are very similar. Quote Link to comment Share on other sites More sharing options...
kensonuken Posted May 16, 2010 Author Share Posted May 16, 2010 well then lets do it even the diffuse term looks quiet different in this... so i will be starting first since this would be my first shader in vex but please help me out in executing this shader... 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.