Jump to content

mia_material VOP OP


kelvincai

Recommended Posts

Just quickly ported 3delight's mia_material RSL codes to VEX.

Instead of making a VEX SHOP and reinvent the wheel to add texture functions etc, I thought why not make it a VOP and use it like Specular VOP. Then, the workflow is like in Hypershade, using it as a mia_material, and plugging different nodes (ie. Texture VOP) in the VOP level.

It is still just a proof of concept and ad-hoc port the RSL code to VEX, so the codes are still very messy. Is this workflow okay, or just waste of my time?

post-5581-127247850223_thumb.jpg

post-5581-127247853525_thumb.jpg

post-5581-127247854792_thumb.jpg

post-5581-127247855855_thumb.jpg

VOPArchitectural.otl

Link to comment
Share on other sites

Only had a quick look so far, but really really awesome job. The mia_ style architectural shader has always been something I've missed in houdini and your vop covers that nicely :-)

In terms of having it as a VOP rather than a VEX Shop: initially I wasn't sure, but I think it works pretty well. As you said it's a bit like in hypershade. So yes, I think that was the right choice. I shall play with it further when I have time to see how it goes.

So yes, awesome work and look forward to seeing how you improve it.

Link to comment
Share on other sites

- Added a Normal input, so you could plug in a Bump Map / Displace Along Normal for bump mapping, or other nodes to modify the Normal;

- Added some interface of the VOP;

- Removed the dependence of <prman.h>, so it wouldn't accidentally convert other nodes' VEX codes;

Included a custom Bump VOP which takes a color as an input instead of only a float of the Displace Along Normal. So, you could use the same Texture node for colors and bump.

VOPArchitectural.otl

VOPBump.otl

Link to comment
Share on other sites

Custom BSDF function for PBR?

I am kind of stuck at the above problem for PBR, or the PBR look has to be different than the mp/raytrace look. Any experts here can help?

Unfortunately afaik for H10.0 you can't write your own bsdf for PBR. You can only combine those built-in. Maybe someone closer to SESI can tell if there are any prospects for changing this situation.

Link to comment
Share on other sites

  • 3 weeks later...

Latest version I am using on my reel. Sorry that I didn't update the shader for awhile. I am spending much time working on my reel and only develop the shader when I need to.

1. Fixed a bug of thin wall and fresnel refraction. It might happen because of different implementation of 3delight and VEX of fresnel();

2. Added ray level and threshold control of reflection. Threshold control is hidden though as I didn't fully test it yet;

3. Added translucency (mia_material style, so it is only approximation. Use SSS if you want accurate translucency);

4. Added diffuse, specular, reflection, refraction, etc, export variables, for extra image planes output.

A test render of this shader in a production scene with v_gilight and HDRI reflection environment.

VOPArchitectural.otl

post-5581-127445544445_thumb.jpg

Edited by kelvincai
Link to comment
Share on other sites

  • 1 month later...

Unfortunately afaik for H10.0 you can't write your own bsdf for PBR. You can only combine those built-in. Maybe someone closer to SESI can tell if there are any prospects for changing this situation.

from my (very recently acquired and still limited) understanding of importance sampling and path tracing I believe you would ALSO need to supply a PDF (probability distribution function) to go with the BSDF (this presumably handles the weighting of the path tracing samples used to compute indirect irradiance - I'm guessing here - I haven't seen any documentation that claims this is what is happening in PBR, I am just assuming that it is. I'm also assuming that's the reason that only certain 'popular' BSDF's have been included with PBR - ie these are the ones where the PDF is 'obvious' (eg apparently there is no exact PDF for say a Cook-Torrence BSDF, whereas for say an AShikmhin Shirley BSDF there is a corresponding PDF, so thus the latter is included but the former isn't)

as Symek says the inner workings of how these are defined in PBR mode don't seem to have been exposed yet - at least in H10.x

Link to comment
Share on other sites

Hi Stu,

Thanks for the input. BSDF is a PDF itself, while PDF is a more general term which could apply to statistics and other fields. What we need might be only a Ward BSDF, which we might be able to manipulate to match mia.

Another advantage of custom BSDF is that we could use measured data from the labs, so that we don't even have to shade and match the physical materials in real world (lack of artistic freedom though). Anyway, I didn't have time to look at it further yet, neither does production demand it. Let's wait till 11 and see if we are freed then.

Edited by kelvincai
Link to comment
Share on other sites

Hi Stu,

Thanks for the input. BSDF is a PDF itself, while PDF is a more general term which could apply to statistics and other fields. What we need might be only a Ward BSDF, which we might be able to manipulate to match mia.

Another advantage of custom BSDF is that we could use measured data from the labs, so that we don't even have to shade and match the physical materials in real world (lack of artistic freedom though). Anyway, I didn't have time to look at it further yet, neither does production demand it. Let's wait till 11 and see if we are freed then.

you could be right but from what I have read the PDF needed for importance sampling is NOT exactly the same as the BSDF required to compute irradiance - the math is over my head but that's what I gleaned from reading various papers - eg:

http://www.cs.princeton.edu/gfx/proj/brdf/brdf.pdf

from that paper:

"Effective importance sampling strategies are known only for the

simplest Lambertian and Phong models, and generalizations such

as Lafortune's cosine lobes [1997]. More complex BRDFs, including

both measured data and physically-based analytic models (such

as Cook-Torrance [1982], which has been used for over 20 years)

have no corresponding importance sampling strategies."

the Ompf forum is great for this stuff (if you didn't know about it already) - some very clever people on there:

http://ompf.org/forum/index.php

anyway take what I say with a pinch of salt, calculus isn't my strong suite :)

Link to comment
Share on other sites

Ward does seem like a good choice (though from the included BSDF's it looks like Ashikmhin might be a good choice as well, since its physically plausible, and seems to be able to fit measured data relatively well compared to some of the other analytical models)

there's a paper on implementation of the ward BSDF here (including some discussion of the associated function for importance sampling): http://www.graphics.cornell.edu/~bjw/wardnotes.pdf

Link to comment
Share on other sites

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...