Search - User list
Full Version: How to determine material based on light path
Root » Technical Discussion » How to determine material based on light path
AnsonSavageBYU
Blender has a kind of cool feature where the type of light path can be used as a boolean in a shader network to mix between different kinds of shaders. For example, in this image:



a light path node is used to make it so any rays directly from the camera make the material have a green color, while any other rays see the object as red.

I noticed that Houdini has some kind of light path expression [www.sidefx.com]. Could I use light path expressions to get a similar result in Karma? If so, how?

Thanks!
jsmack
AnsonSavageBYU
a light path node is used to make it so any rays directly from the camera make the material have a green color, while any other rays see the object as red.

I noticed that Houdini has some kind of light path expression . Could I use light path expressions to get a similar result in Karma? If so, how?

I don't think you can use LPE in shaders, they are only applied to AOVs. Karma CPU supports Mantra shaders; if you make a shader using VEX material builder the renderstate/raylevel information allows for ray path switching.
AnsonSavage
Okay, I can confirm that using a raybounce node does work with a Mantra Vex material imported into Karma. I can also confirm it doesn't work with Karma XPU. I wasn't sure how to use a renderstate node, but that does sound interesting.

Thanks so much for the help!
jsmack
AnsonSavage
I can also confirm it doesn't work with Karma XPU. I wasn't sure how to use a renderstate node, but that does sound interesting.

XPU doesn't support Mantra VEX materials, so that makes sense.

For materialX materials that work with XPU, the Karma rayimport node can import the raylevel. I'm not sure if it works with XPU or not as not all the variables are importable in both engines.
jsmack
Here's a simple example that works with XPU and CPU
eikonoklastes
This is pretty nuts. Thanks for the info.
AnsonSavage
Hey, this is awesome, it works great!

Thanks so much
AnsonSavage
Does anyone know how to implement this in RenderMan for Houdini?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB