Hello! I'm trying to write a custom bsdf for shading, which I believe is possible as described in these two docs pages:
https://www.sidefx.com/docs/houdini/vex/pbr.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/vex/functions/cvex_bsdf.html [www.sidefx.com]
The example section on the cvex_bsdf docs page describes three separate vex functions;
a creation function
an evaluation shader
and a sample shader
I don't currently see how or where in houdini that those would be implemented. I'm sure there's some core information I'm missing.
For this post, all I'm trying to do is get the example cvex_bsdf diffuse rendering on a object in Mantra.
---
Here's what I've tried:
I've tried to set it up in a materialBuilder in the /mat context. I've placed all those scripts into snippets together and separately, but the snippet claims that the return type (cvex) is not valid. That combined with the way the cvex_bsdf function calls for "diffuse_eval" as a string leads me to believe there's something else to it.
I've tried setting it up through a cvex builder. This looks promising, but the documentation on it is too sparse.
Your text to link here... [www.sidefx.com]
The cvexBuilder makes a cvex output, but I've not seen any examples on how to use it. I'm not sure if any snippet is creating usable information, or checking what is created by the output.
I have been able to use snippets for the built-in bsdfs, such as diffuse. I've included an image of that simple setup.
I'm not seeing what other nodes may help.
---
This has all been part of a whole research endeavor that lead me to write a whole raytracer from scratch in cops. I found out a lot from that process, but I'm hoping to upgrade to using houdini's renderers which should be a whole lot more efficient. Would appreciate all your help, or if you could lead me in the right direction.
How is the vex function cvex_bsdf implemented?
275 1 0-
- KaleWeaver
- Member
- 5 posts
- Joined: Oct. 2015
- Offline
-
- KaleWeaver
- Member
- 5 posts
- Joined: Oct. 2015
- Offline
Still looking for any information on how to use cvex_bsdf. Here's my research so far:
Vex Source Strings:
According to the cvex_bsdf documentation page [www.sidefx.com], The cvex_bsdf() function is looking for two CVEX shaders, an evaluation and sample shader. These are accessed by the cvex_bsdf() function as "VEX source strings."
I'm not entirely sure what VEX source strings are. Searches for that terminology mostly come up blank. I assume that as long as the shaders are named, placed in a Houdini accessible folder, or connected to the "creation" node (vex snippet maybe?), it might work.
I found that there are a number of existing CVEX shaders available as .vfl and .vex files in the installation folder.
C:\Program Files\Side Effects Software\Houdini 20.5.516\houdini\vex\CVex
For example, there's already existing diffuse_eval and diffuse_sample files. I don't know how to create one of these for myself, but It would be good information if these could be accessed from cvex_bsdf() to create a successful render.
I tried this using the material builder, simply using the example creation code from the cvex_bsdf() page. I created a new material builder, > created a bind with a blank bsdf, > connected to a snippet node, and placed in the creation code from the docs:
Fdiff = cvex_bsdf("diffuse_eval", "diffuse_sample", "label", "diffuse", "N", N);
I then connected the output to the surface_output's F(bsdf) input, and set Mantra to render PBR.
It doesn't error out on render, but there the result is black...
I've spent some time reading through the Mantra User guide, and there's some pages that show lots of functions, like the PBR lighting page, but I don't see examples on where these would be used.
https://www.sidefx.com/docs/houdini/render/pbrlighting.html [www.sidefx.com]
I was hoping there might be some available assets that may have used it, but Orbolt seem to have no available materials currently.
----
Broken links
This thread from ODFORCE clearly indicates prior activity using the cvex_bsdf() function.
https://forums.odforce.net/topic/20682-bsdf-bonanza-ggx-microfacets-disney-brdf-and-more/ [forums.odforce.net]
Sadly all the files and many images are lost to time.
Specifically, this comment seems to describe a bit of how to use it.
https://forums.odforce.net/topic/20682-bsdf-bonanza-ggx-microfacets-disney-brdf-and-more/?do=findComment&comment=124447 [forums.odforce.net]
The use of " simply call them via" and "$f" in the code make me think it's inline code somehow.
I did try to use a python shell to create shop nodes like recommended, but that errors out.
I believe some of their implementation would be in the SHOP context, instead of materials. I've occasionally seen SHOP referred to as a legacy context so I'm not sure if there's a different way to go about it now. It's difficult to find good information on what is expected in current versions.
There's also this forum post, where a pair of fur styling cvex shaders are described in what sounds very similar, here the CVEX shaders would live inside the SHOP network.
https://www.sidefx.com/forum/topic/25909/ [www.sidefx.com]
The "fur object hda" described there doesn't exist in the same form today, so that can't be investigated.
----
Hope to learn how this works.
Vex Source Strings:
According to the cvex_bsdf documentation page [www.sidefx.com], The cvex_bsdf() function is looking for two CVEX shaders, an evaluation and sample shader. These are accessed by the cvex_bsdf() function as "VEX source strings."
I'm not entirely sure what VEX source strings are. Searches for that terminology mostly come up blank. I assume that as long as the shaders are named, placed in a Houdini accessible folder, or connected to the "creation" node (vex snippet maybe?), it might work.
I found that there are a number of existing CVEX shaders available as .vfl and .vex files in the installation folder.
C:\Program Files\Side Effects Software\Houdini 20.5.516\houdini\vex\CVex
For example, there's already existing diffuse_eval and diffuse_sample files. I don't know how to create one of these for myself, but It would be good information if these could be accessed from cvex_bsdf() to create a successful render.
I tried this using the material builder, simply using the example creation code from the cvex_bsdf() page. I created a new material builder, > created a bind with a blank bsdf, > connected to a snippet node, and placed in the creation code from the docs:
Fdiff = cvex_bsdf("diffuse_eval", "diffuse_sample", "label", "diffuse", "N", N);
I then connected the output to the surface_output's F(bsdf) input, and set Mantra to render PBR.
It doesn't error out on render, but there the result is black...
I've spent some time reading through the Mantra User guide, and there's some pages that show lots of functions, like the PBR lighting page, but I don't see examples on where these would be used.
https://www.sidefx.com/docs/houdini/render/pbrlighting.html [www.sidefx.com]
I was hoping there might be some available assets that may have used it, but Orbolt seem to have no available materials currently.
----
Broken links
This thread from ODFORCE clearly indicates prior activity using the cvex_bsdf() function.
https://forums.odforce.net/topic/20682-bsdf-bonanza-ggx-microfacets-disney-brdf-and-more/ [forums.odforce.net]
Sadly all the files and many images are lost to time.
Specifically, this comment seems to describe a bit of how to use it.
https://forums.odforce.net/topic/20682-bsdf-bonanza-ggx-microfacets-disney-brdf-and-more/?do=findComment&comment=124447 [forums.odforce.net]
The use of " simply call them via" and "$f" in the code make me think it's inline code somehow.
I did try to use a python shell to create shop nodes like recommended, but that errors out.
I believe some of their implementation would be in the SHOP context, instead of materials. I've occasionally seen SHOP referred to as a legacy context so I'm not sure if there's a different way to go about it now. It's difficult to find good information on what is expected in current versions.
There's also this forum post, where a pair of fur styling cvex shaders are described in what sounds very similar, here the CVEX shaders would live inside the SHOP network.
https://www.sidefx.com/forum/topic/25909/ [www.sidefx.com]
The "fur object hda" described there doesn't exist in the same form today, so that can't be investigated.
----
Hope to learn how this works.
Edited by KaleWeaver - April 17, 2025 04:10:28
-
- Quick Links