kensonuken Posted August 15, 2008 Share Posted August 15, 2008 In the page Im planning to make out the ShiftTangent for each specular http://ati.amd.com/developer/gdc/scheuerma...irrendering.pdf can anybody guide me? Quote Link to comment Share on other sites More sharing options...
kensonuken Posted August 24, 2008 Author Share Posted August 24, 2008 I am mainly looking into secondary specular with tangent shift like described in the paper can anybody help me.. Quote Link to comment Share on other sites More sharing options...
rendertan Posted August 31, 2008 Share Posted August 31, 2008 (edited) I am mainly looking into secondary specular with tangent shift like described in the paper can anybody help me.. Hi, some time ago i did an RSL version of this, but haven't ported it to VEX, it should be easy though. The RSL version follows: //////////////////////////////////////////////////////////////////////////////// // 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; no rmal 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 */ 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; } Hope this helps. Btw, if you find any mistakes, please post corrections, i have to struggle a lot with math. P.S.: about the occlusion term, there's an interesting thread on the 3delight forums about Ivan Neulander and Michiel Van de Panne's hair occlusion, from "Rendering Generalized Cylinders with Paintstrokes", and an implementation by Luke Emrose - but from what i understood from this model (Scheuermann's, not Neulander & Panne), it's meant for polygon surfaces, not for actual hair geometry. Still i thought i should mention this, in case you want to explore with other hair illumination models, the url for this is: 3delight's thread on hair occlusion. Porting to VEX should be easy. Edited August 31, 2008 by rendertan Quote Link to comment Share on other sites More sharing options...
kensonuken Posted September 1, 2008 Author Share Posted September 1, 2008 hi rendertan beautiful!!! I would like to use this for curves.. can I? coz the primary requirement for me is the tangent shift.. with kajiya kay diffuse and spec model. But I would like to try Arno render tube like hair with specular shift in the paper. Can I do that for closeup shots? any further suggestions please... Quote Link to comment Share on other sites More sharing options...
kensonuken Posted September 1, 2008 Author Share Posted September 1, 2008 P.S.: about the occlusion term, there's an interesting thread on the 3delight forums about Ivan Neulander and Michiel Van de Panne's hair occlusion, from "Rendering Generalized Cylinders with Paintstrokes" Actually the thread was started by me? as it was a bit confusing to me.. Quote Link to comment Share on other sites More sharing options...
rendertan Posted September 1, 2008 Share Posted September 1, 2008 Well, you can try with hair systems, but have in mind that this shading model was developed for realtime use (games, etc..), and it's meant to mimic the appearance of hair highlights in polygonal surfaces. As for more information, there is a great thread here on odforce about rendering hair You might also want to check an interesting siggraph 2008 paper, Efficient Multiple Scattering in Hair Using Spherical Harmonics, by Jonathan T. Moon, Bruce Walter, and Steve Marschner. I haven't read this yet, but seems very interesting. You might also want to check realistic rendering of human hair. Quote Link to comment Share on other sites More sharing options...
kensonuken Posted September 2, 2008 Author Share Posted September 2, 2008 I saw the paper efficient Multiple scatter but i think scattering can be done using raytracing? any Shadow map based methods? I saw a site where a green idol sss was achieved using depth maps... But whats the case with this multiple scatter? did anybody tried it? Quote Link to comment Share on other sites More sharing options...
kensonuken Posted September 10, 2008 Author Share Posted September 10, 2008 Hey rendertan what if I want to convert this code to a node in Vex or I want to add different attributes on this.... like I want to get various other attributes apart from this... like exporting for each light into a image file for different passes etc like what pbowmar explained in the other thread. Can you suggest me how to do that? Coz I want to use these codes into vops and then use it. Any directions please...like how to do that...sample example would help well... Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted September 10, 2008 Share Posted September 10, 2008 Hey rendertan what if I want to convert this code to a node in Vex I thought you were working in RSL... or I want to add different attributes on this.... like I want to get various other attributes apart from this... like exporting for each light into a image file for different passes etc like what pbowmar explained in the other thread. Can you suggest me how to do that? Coz I want to use these codes into vops and then use it. Any directions please...like how to do that...sample example would help well... rendertan gave you the illumination function "tshair()" (very kind of him, I might add). That's the hard part: the algorithm. Now extract the BRDF from that and wrap it up into a VOP, just as Peter Bowmar's example wraps up the factory BRDF's, then you can use it inside an IlluminanceLoopVop to do per-light exports, just like he did in his example. Alternatively, just use it as-is and don't do per-light exports for this particular BRDF. I have money riding on what your next question will be... 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.