Shaders - Arnold for Katana
Arnold Shaders
Further Reading |
---|
KtoA supports all the Arnold shaders. See the Arnold User Guide for the full documentation on the Arnold shaders. |
To create a shader network material and assign it you must create one or more nodes of type ArnoldShadingNode, one NetworkMaterial node, and one MaterialAssign node. Information about creating and assigning shaders can be found here.
Arnold shaders available via the NetworkMaterialCreate
KtoA Examples
Painted metal
Painted Metal shader network
Car paint
This simple to use shader is useful for creating car paint materials. It supports three layers: base_layer, specular and clear_coat.
noise -> bump2d -> car_paint.coat_normal
Mix shader
The mix_shader shader is used to blend or add two shaders (including light AOVs).
Mix shaders used in shading network
Flake shader
This shader creates a procedural flake normal map that can be used for materials such as car paint.
A tutorial that uses the flakes shader can be found here.
Flakes → car_paint.normal
Clip geo
The clip_geo shader makes a shape a 'clipping shape'. A clipping shape clips geometry from any shape that intersects with it.
trace_set name (objects_to_clip) given to clip_geo shader (left) and clipping object (right).
Bump mapping based on a 3d input
cell_noise.outr -> bump3d.map -> standard_surface.normal
Bump mapping based on a 2d texture map
Bump2d -> car_paint.coat_normal
Remapping values with a ramp shaders
Range shaders used to remap values in a shading network
Displacement Shading
Displacement maps can be an excellent tool for adding surface detail that would take far too long using regular modeling methods.
There are two ways to set up displacement in KtoA. The first, if you only need one shader node (such as an image node for height displacement) is to create a Material node. You can then add an arnoldDisplacementShader (and also an arnoldSurfaceShader for the surface shading):
- Only
int
,float
,point
,vector
,normal
,color
andstring
parameters are supported. - Default values are always zero for parameters.
- Widgets are not set for
color
parameters. - Only one output parameter is supported.
- No array or structured input or output parameters.
- Closures are not supported.
- Only a single shader can be defined on each node.
- Including other header files is not supported.
- Global variables (u, v, etc.) are not supported as parameter defaults.
OSL Inline Shader Workflow
After editing the code, either externally or in the code editor, the Compile button needs to be pressed to generate the parameters. In case of a compilation error, no parameters will be added to the node, and a compilation_errors text field will contain the errors from the OSL compiler.
The code and the parameters can be compiled using python, for example:
osl = NodegraphAPI.GetNode('myNode')
from ktoa import recompileOSL
recompileOSL(osl)
errors = osl.getParameter('parameters.compilation_errors')
if errors is None:
# successful compilation
pass
else:
print('Errors: \n%s' % errors.getValue(0.0))