Arnold - C++ Shaders
|
OverviewThis page provides an example of a RenderMan OSL shader ported to Arnold's C++ shader development environment.
The Arnold shader is based on the OSL code,
colorByP.osl, but
with the following principle differences. sg->P // world space coordinates sg->Po // object space coordinates 2 However, because Arnold does not implement a transform() function if the xyz values of the shading point need to be measured from the origin of another coordinate system, the shader must "receive" the coordinate system as a "matrix". The following code performs the transformation. AtMatrix m = *AiShaderEvalParamMtx(k_matrix); AtMatrix mm = AiM4Invert(m); AtVector transformedP = AiM4PointByMatrixMult(mm, sg->P); The source of such a matrix is typically a Maya place3dTexture node.
|
© 2002- Malcolm Kesson. All rights reserved.