Jump to content

Oren-Nayar-Wolff model


rendertan

Recommended Posts

Hi

I've been reading some things, doing some exercises in my RSL&VEX adventures, and thought i could share some of the results.

Basically, been reading about the Wolff diffuse BRDF, made the implementation in RSL, checked and rechecked everything, everything seems ok. I didn't had access to Wolff's original paper though, since it's available only by subscription to the users of Optical Society of America, but i found the Michael Oren, Shree K. Nayar, and Lawrence Wolff paper, "Improved Diffuse Reflection Models for Computer Vision", that covered the Wolff model.

Just to make sure i got everything right, i spent some time in maxima&gnuplot, and everything matches

wolfflambertsingleor2.th.pngwolfflambertmultikx6.th.png

This model was meant for smooth dielectric surfaces, the first graph shows the outgoing reflected radiance as the incident angle varies, of the Wolff model with an IOR of 1.5, with the Lambert response as a comparision, and the 2nd graph, the same, only with a group of curves for the Wolff model with varying IORs from 1.2 to 2.0 range.

As for the indispensable teapots, first one uses the Lambertian diffuse term, the second one the Wolff diffuse term.

teapotlambertmx6.th.jpgteapotwolffym1.th.jpg

I have a doubt regarding the Wolff model though, to be more precise, the scaling factor Q, which is similar to the surface albedo parameter in Lambert's law. The last paper mentioned, says that the value of Q is very nearly constant over most incidence and reflectance angles, and should be treated as a constant, unless you need very precise results, but i'm assuming this would be critical only for a Shape-from-Shading utilization right?

To make matters worse, the expression for Q is quite complex, Chandrasekhar's H function, and my math level isn't quite at this level, yet at least...., so Q is an constant scaling parameter as mentioned in "Surface Radiance Correction for Shape-From-Shading".

If anyone bothers taking a look at the papers, what are your opinions regarding this parameter? Is it worth it implementing the expression for this parameter at all, or this scenario only makes sense in Shape-from-Shading, or where correct measurements are expected?

Anyway, the VEX implementation of the Oren-Nayar-Model follows, i didn't had time to plot it though. It's the full model with inter-reflections, not the qualitative model with 2 coefficients, i'm not sure if Houdini's Oren-Nayar implementation in its diffuse() shadeop is the qualitative model, or the full model with inter-reflections, i'll just have to do some test renders later to compare.

Oren_Nayar_Wolff_diffuse.vfl

As for the RSL versions, the Wolff model, and the Oren-Nayar-Wolff, i can post them later, as soon as i find out why i can't upload .sl attachments :)

P.S.: and btw, Happy New Year everyone ;)

Link to comment
Share on other sites

Hi Mario, Jason, everyone

Thanks for adding the .sl support ;)

Here follows a small test image of the Lambertian model, and the Wolff and Oren-Nayar-Wolff models with varying roughness and IOR values (i think my area light was a bit too intense though :ahem: )

onwmap1ph1.th.png

I attached as well the VEX implementation of the Wolff model, and the RSL implementations of both models.

About the look of it, well, the Wolff model up to IOR 1.6, seems to behave a bit like the Minnaert model with a high K value, having a limb darkening effect, i suppose this could be useful to model the appearance of plastic perhaps, with a specular highlight having its intensity driven by a Fresnel term as well.

Wolff_diffuse.vfl

Wolff_diffuse.sl

OrenNayarWolff_diffuse.sl

One question though, about the .vfl files: is it possible to have a shader in more than 1 language in a .vfl file, i mean, can i use for instance, a #pragma rendermask VMantra and do the VEX shader code, and then another #pragma rendermask for RSL code, or for GLSL code? It would be nice to have GLSL preview of the VEX shaders, but i'm not sure how if this is doable at all, or if i need separate shader files for each language.

Edited by rendertan
Link to comment
Share on other sites

One question though, about the .vfl files: is it possible to have a shader in more than 1 language in a .vfl file, i mean, can i use for instance, a #pragma rendermask VMantra and do the VEX shader code, and then another #pragma rendermask for RSL code, or for GLSL code? It would be nice to have GLSL preview of the VEX shaders, but i'm not sure how if this is doable at all, or if i need separate shader files for each language.

In theory, the best we can have right now is either "OGL OGL2 VMantra" or "OGL OGL2 RIB" as your Render Mask. The code paths haven't tested too extensively but I just tried "OGL OGL2 VMantra" and it worked.

Try this:

- Start off with a New SHOP Material Type that uses GLSL. (ie. File > New Operator Type, etc...)

- Now in the Type Properties, add VMantra to the Render Mask value in the first tab (Basic).

- Now in the Code tab, enable VEX/RenderMan Shader toggle as well in the gear icon.

Here's a file that hopefully works for you. In the viewport, it should be reddish while in Mantra it should be bluish.

testDualShader.hip

Link to comment
Share on other sites

In theory, the best we can have right now is either "OGL OGL2 VMantra" or "OGL OGL2 RIB" as your Render Mask. The code paths haven't tested too extensively but I just tried "OGL OGL2 VMantra" and it worked.

Try this:

- Start off with a New SHOP Material Type that uses GLSL. (ie. File > New Operator Type, etc...)

- Now in the Type Properties, add VMantra to the Render Mask value in the first tab (Basic).

- Now in the Code tab, enable VEX/RenderMan Shader toggle as well in the gear icon.

Here's a file that hopefully works for you. In the viewport, it should be reddish while in Mantra it should be bluish.

Hi Edward

Thanks for the information and the file, going to take a close look at this, and hopefully add GLSL support to the previous shaders. Thanks once again.

Link to comment
Share on other sites

  • 4 weeks later...
I am so using this diffuse term. Thanks dude!

GW

You're welcome, altough i have to say that the majority of the work was Larry Gritz's, i just extended this based on those papers i mentioned earlier by Michael Oren, Shree Nayar, and Lawrence Wolff.

I'll post some updated versions here soon, i'm playing with GLSL atm, hopefully to be able to add GLSL previews for this and future shaders (need to write a GLSL vim syntax file first though, but if anyone is interested in such things, there's a nice project, called QShaderEdit, by Ignacio Castano, which used to work at NVidia iirc, or did some work at NVidia, not sure atm, but the shader editor is quite nice, able to deal with Cg, ARB, and GLSL shaders).

Link to comment
Share on other sites

  • 3 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...