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

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.