sibarrick Posted January 19, 2006 Share Posted January 19, 2006 Two questions, it's ages since I looked at this Renderman has Du(x),Dv(x) and du,dv and Mantra has Du(x),Dv(x) and DPds, DPdt I can't remember how you get the mantra equilvalent of du,dv is it just Du(s) and Dv(t) or is it something to do with dPds and dPdt? And finally why no du and dv in mantra, wouldn't it make life easier when converting shaders? And finally finally why no Du and Dv VOPs? Or have I missed them somewhere? Is that more than 2 questions? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 19, 2006 Share Posted January 19, 2006 Hey Simon, sibarrick said: I can't remember how you get the mantra equilvalent of du,dv is it just Du(s) and Dv(t) or is it something to do with dPds and dPdt? 23913[/snapback] As I understand it, MANTRA PRMAN =================================== dPds = dPdu*du dPds/Du(s) = dPdu Du(P) = dPdu*du or Du(P)*du Du(P)/Du(s) = dPdu or Du(P) Du(s) = du dPdt = dPdv*dv dPdt/Dv(t) = dPdv Dv(P) = dPdv*dv or Dv(P)*dv Dv(P)/Dv(t) = dPdv or Dv(P) Dv(t) = dv n/a = Deriv(a,b) However, I find that Du(P) or Dv(P) (and equivalent, with or without the division) gives smoother/better results than dPds or dPdt. Maybe it's because Du(x,...) defaults to "smooth" derivs and dPd[s|t] maybe doesn't (?) ... dunno. sibarrick said: And finally why no du and dv in mantra, wouldn't it make life easier when converting shaders?And finally finally why no Du and Dv VOPs? Or have I missed them somewhere? Is that more than 2 questions? I guess we don't need them in VEX because they already exist as Du(s) and Dv(t)... And there are quite a few things missing in VOPs, so given that this stuff is a little more esoteric than the other functions, I'm not surprised it's missing from VOPS (haven't checked) -- but yeah, they should be there... Cheers! Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 20, 2006 Author Share Posted January 20, 2006 Thanks once again Mario, what would I do without you. As ever you have more than answered my question. I'll have to print this out and pin it on my wall. Pleased to find out I was right in my original assumption too, that's probably a first! Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 20, 2006 Share Posted January 20, 2006 You're most welcome, but I have to warn you that I've never been absolutely, categorically, 100% certain about these equivalences. Mainly because it's almost impossible to do direct comparisons between the two renderers -- shading rates, dicing, and other things being slightly different and all. About all I can say is that I'm about 95% sure about them... But, I know there are some people lurking around here who know, beyond the shadow of a doubt, whether they are correct or not. I would like to invite said people to either correct or confirm them (hint, hint, nudge, nudge) so we can maybe put them up on the wiki (along with some other mantra<->prman mappings) e.g: the (small) difference between Du(P) and dPds in Mantra is a little puzzling to me... Quote Link to comment Share on other sites More sharing options...
lisux Posted January 20, 2006 Share Posted January 20, 2006 Hi guys. My question is about the use of Du and Dv. I think that Du and Dv are the derivates in both parametric directions u and v. In practice is a representation of the rate of changing/variation of the surface shape, i think. Ok, they are very important because is the way the render uses to get the normal surfaces, using cross product. Well, i am curious about other uses of this data in shading, what effects can you achieve using them, for what tasks are useful, etc ... Thanks Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 20, 2006 Author Share Posted January 20, 2006 Well the reason I've used them before and in this case is for createing lines. In the current case I spotted an outline shader in the renderman book that I hadn't tried before. This was motivated by another thread on this forum. Anyway it uses the derivatives to scale an edge rolloff function so that the line is a uniform thickness. In the past I used them in a similar way as a scale factor either to prevent aliasing in striped and spotty procedural textures or to actually reduce the number of stripes as the surface "tightens" see the woodcut example in the advanced renderman book. Other than that I haven't touched them which is why I can never remember the conversions. I expect Mario has some fancy uses for them which I'd love to hear about too they are no doubt extremely useful. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 20, 2006 Author Share Posted January 20, 2006 Mario Marengo said: About all I can say is that I'm about 95% sure about them...But, I know there are some people lurking around here who know, beyond the shadow of a doubt, whether they are correct or not. I would like to invite said people to either correct or confirm them (hint, hint, nudge, nudge) so we can maybe put them up on the wiki (along with some other mantra<->prman mappings) e.g: the (small) difference between Du(P) and dPds in Mantra is a little puzzling to me... 23936[/snapback] Here's something that I found puzzling. In the VEX Layered shader the filterwidth function is defined as float filterwidth(float x) { return max(abs(Du(x))+abs(Dv(x)), VOP_MIN_FILTER_SIZE); } However in renderman it is defined as filterwidth(x) max(abs(Du(x)*du)+abs(Dv(x)*dv), MINFILTERWIDTH) This suggests that it should translate as filterwidth(x) max(abs(Du(x)*Du(s))+abs(Dv(x)*Du(t)), MINFILTERWIDTH) Any thoughts????? Really would be nice to get something from Sesi on this I think I'll email support about it and try and clear it up. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 20, 2006 Share Posted January 20, 2006 sibarrick said: Here's something that I found puzzling.In the VEX Layered shader the filterwidth function is defined as float filterwidth(float x) { return max(abs(Du(x))+abs(Dv(x)), VOP_MIN_FILTER_SIZE); } However in renderman it is defined as filterwidth(x) max(abs(Du(x)*du)+abs(Dv(x)*dv), MINFILTERWIDTH) 23947[/snapback] Hmmm... that looks OK to me (and jibes with the table above, assuming it's accurate). Mantra's Du(x) is a differential (it's already multiplied by du), whereas PRMan's Du(x) is a derivative (hasn't been scaled by du). So the VEX expression abs(Du(x)) maps to the RSL expression abs(Du(x)*du), and similarly for v. So I'd say that's correct as written. I've put the table up on the wiki so it can be easily corrected by people who know better than me As far as applications of this stuff.... there are lots and lots of things they can be used for -- one typical application (besides the NPR ones that Simon mentioned) is for all things relating to measuring surface curvature (min,max.mean,gaussian,etc), which in turn is useful for a bunch'o'things... derivatives are your friends! Cheers! Quote Link to comment Share on other sites More sharing options...
edward Posted January 20, 2006 Share Posted January 20, 2006 You guys know about $HH/vex/include/prman.h right? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 20, 2006 Share Posted January 20, 2006 edward said: You guys know about $HH/vex/include/prman.h right? 23950[/snapback] Yes It contains two of the mappings, namely: #define dPdu (dPds/Du(s)) #define dPdv (dPdt/Dv(t)) Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 20, 2006 Author Share Posted January 20, 2006 Mario Marengo said: Hmmm... that looks OK to me (and jibes with the table above, assuming it's accurate).Mantra's Du(x) is a differential (it's already multiplied by du), whereas PRMan's Du(x) is a derivative (hasn't been scaled by du). 23949[/snapback] Doh, yes I just translated the du and dv to Du(s) and Du(t) and didn't notice that mantra's Du(x) isn't the same as Renderman Du(x), it's too confusing to have two things named the same but working completely differently! That's was the gotcha that I was desperatley trying to remember 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.