Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenOSL : Subsurface BSSRDF questions #2198

Open
boberfly opened this issue Jan 26, 2025 · 4 comments
Open

GenOSL : Subsurface BSSRDF questions #2198

boberfly opened this issue Jan 26, 2025 · 4 comments

Comments

@boberfly
Copy link

Hi,

I am just getting my head around translating MaterialX nodes from USD SDR schema into OSL for ingesting into an OSL-compatible renderer eg. Cycles in this case in Gaffer, but also for other renderers as this functionality will be generalised. I've already found some missing closures in Cycles eg. uniform_edf as well as oren_nayar_diffuse_bsdf differences and up-streamed them back to Blender.

Am I correct in my observations that subsurface_bssrdf isn't implemented yet from seeing this, despite the builtin in stdosl.h?
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl

Also is this going to be renamed from _bsdf to _bssrdf?

I'm looking to upstream this back to Cycles also, however their bssrdf defined in stdcycles.h has a lot more capabilities, but it's understandable that every renderer would have their own unique approaches. Would the correct way of adding these things be making a subsurface_bssrdf closure and add additional optional arguments when declaring the closure in Cycles as well as creating custom 'options' for the GenContext for OSL-gen to pass pre-processor defines to OSL for renderer-specific tweaks? And for modifying things like standard_surface.mtlx to allow specifying an enum eg. to change the method of the BSSDF, would you just fork and modify your own with the added enum/string?

Cheers

@boberfly
Copy link
Author

Here is an initial implementation for Cycles:
https://projects.blender.org/blender/blender/pulls/133612

@jstone-lucasfilm
Copy link
Member

This is a good note, @boberfly, and we still need to add support for subsurface_bsdf in both OSL testrender and MaterialXGenOsl.

Here's the location in Open Shading Language where support for subsurface_bsdf would be added, allowing us to leverage this support in MaterialXGenOsl:

https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/src/testrender/shading.cpp#L1786

With respect to the naming convention, we currently use the term BSDF generically, allowing it to encompass BSSRDF, BTDF, and BRDF terms, though we're open to proposals to improve this convention in the future.

@jstone-lucasfilm
Copy link
Member

@boberfly We've taken a first step to address the MaterialX side of this issue in #2204, and this may allow Blender Cycles to use its own subsurface_bssrdf implementation with MaterialX content in the future.

@boberfly
Copy link
Author

Thank you for looking into it @jstone-lucasfilm - yep we were discussing whether or not to support optional arguments but in the end decided to support the current closure arguments only. From having a look around I saw that random-walk is the best fit to default to as well as roughness at 1.0f and IOR of 1.4f for Cycles' implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants