I am experimenting on the new ‘mat’ context and it's awesome, but I am having issues to understand how the new export components work, if I connect anything let's say in the ‘basecolor’ input of a principled shader that is not exported as a AOV if I unplug it it works ok, am I missing something?
Thanks in advanced.
New principled shader export issue
3412 4 1- mzigaib
- Member
- 949 posts
- Joined: April 2008
- Offline
- rafal
- Staff
- 1449 posts
- Joined: July 2005
- Offline
Try turning on the “Add Baking Exports to Shader Layers” on the ROP node.
Indeed the export components may be tricky, depending on how the shader was built. If the shader (or material) node has output connectors for exported parameters (ie, export variables were created with Parameter VOP), then things should work smoothly. But it the shader does not have the output connectors (ie, export variables were created with Bind VOP), then extra work is required. We will try to improve the workflow in the future, so no extra work is required.
When you use Principled Shader alone, Mantra uses it directly and sees all its export variables. But when you connect something to ‘basecolor’, VOPs need to auto-generate a wrapper shader that calculates and passes value for the ‘basecolor’ parameter to the shader call to principled shader. In that setup, the exports from principled shader call need to be propagated to (exported further by) the wrapper. VOPs can do that if they see output connectors on the shader node.
But principled shader does not have individual output connectors for each exported parameter. Instead, it packages the calculated exports into the layer struct. But it does so only if “Add Baking Exports to Shader Layer” is turned on. Then, the wrapper shader can retrieve the packaged values from the shader layer struct and export them as own export variables available to mantra.
Indeed the export components may be tricky, depending on how the shader was built. If the shader (or material) node has output connectors for exported parameters (ie, export variables were created with Parameter VOP), then things should work smoothly. But it the shader does not have the output connectors (ie, export variables were created with Bind VOP), then extra work is required. We will try to improve the workflow in the future, so no extra work is required.
When you use Principled Shader alone, Mantra uses it directly and sees all its export variables. But when you connect something to ‘basecolor’, VOPs need to auto-generate a wrapper shader that calculates and passes value for the ‘basecolor’ parameter to the shader call to principled shader. In that setup, the exports from principled shader call need to be propagated to (exported further by) the wrapper. VOPs can do that if they see output connectors on the shader node.
But principled shader does not have individual output connectors for each exported parameter. Instead, it packages the calculated exports into the layer struct. But it does so only if “Add Baking Exports to Shader Layer” is turned on. Then, the wrapper shader can retrieve the packaged values from the shader layer struct and export them as own export variables available to mantra.
Edited by rafal - Feb. 28, 2017 11:58:17
- mzigaib
- Member
- 949 posts
- Joined: April 2008
- Offline
That did the trick! thanks for the tip!
Just one last question, if I also connect something on the base color I don't get this color multiplied by the ‘point color’ even if the option is on, the work around that I came up with is to create my own parameter ‘Cd’ and multiply it in the same level before enter the input, is that the best approach for this?
Just one last question, if I also connect something on the base color I don't get this color multiplied by the ‘point color’ even if the option is on, the work around that I came up with is to create my own parameter ‘Cd’ and multiply it in the same level before enter the input, is that the best approach for this?
- jsmack
- Member
- 7803 posts
- Joined: Sept. 2011
- Offline
- mzigaib
- Member
- 949 posts
- Joined: April 2008
- Offline
-
- Quick Links