UV 座標を使って縞模様を描くシェーダーを作ってみましょう。
global proc makeShader5()
{
string $shname = `shadingNode -asShader surfaceShader`;
string $setname = `sets -renderable true -noSurfaceShader true -empty`;
connectAttr ($shname + ".outColor") ($setname + ".surfaceShader");
string $sampler = `shadingNode -asUtility samplerInfo`;
expression -o $shname
-s ("float $val = " + $sampler + ".u % 0.05 * 20.0;"
+ "if($val >= 0.0 && $val < 0.1)"
+ "{"
+ " ocr = 0.0;"
+ " ocg = 0.0;"
+ " ocb = 0.0;"
+ "}"
+ "else"
+ "{"
+ " ocr = 1.0;"
+ " ocg = 1.0;"
+ " ocb = 1.0;"
+ "}");
sphere;
sets -e -fe $setname;
}
global proc makeShader5()
string $shname = `shadingNode -asShader surfaceShader`;
string $setname = `sets -renderable true -noSurfaceShader true -empty`;
connectAttr ($shname + ".outColor") ($setname + ".surfaceShader");
string $sampler = `shadingNode -asUtility samplerInfo`;
expression -o $shname
-s ("float $val = " + $sampler + ".u % 0.05 * 20.0;"
+ "if($val >= 0.0 && $val < 0.1)"
+ "{"
+ " ocr = 0.0;"
+ " ocg = 0.0;"
+ " ocb = 0.0;"
+ "}"
+ "else"
+ "{"
+ " ocr = 1.0;"
+ " ocg = 1.0;"
+ " ocb = 1.0;"
+ "}");
"float $val = " + $sampler + ".u % 0.05 * 20.0;"
if($val >= 0.0 && $val < 0.1)
{
ocr = 0.0;
ocg = 0.0;
ocb = 0.0;
}
else
{
ocr = 1.0;
ocg = 1.0;
ocb = 1.0;
}
sphere;
sets -e -fe $setname;