01-shader-checker.blend


shader Checker(
    color Color_A = 0.0 ,
    color Color_B = 1.0 ,
    float Size = 2.0 ,
    output color Output_Color = color( 0.0, 1.0, 0.0 ) ,
    output color Output_Debug = color( 0.0 )
)
{
    // Transform coordinates to be local to the object
    point mappingPoint = transform("object",P) ;
    point _P = abs(mod(( Size * P+.00001), 2)) - 1 ;
        
    Output_Color = Color_A ;
    
    if ( 
         ( _P[0] >= 0 and _P[1] >= 0 and _P[2] >= 0 ) 
      or ( _P[0] <  0 and _P[1] <  0 and _P[2] >= 0 )
      or ( _P[0] >= 0 and _P[1] <  0 and _P[2] <  0 )
      or ( _P[0] <  0 and _P[1] >= 0 and _P[2] <  0 )
    )
    {
        Output_Color = Color_B ;
    }
    
}      

Posted

in

by