// LS/PT: xyzShader // // Maps the coordinate to an RGB color. With an // appropriate UV map and closed mesh, this can // be part of a sculptie-production flow. // // poly@omino.com david van brink 2008 // @version 1.0 flags { return(COLOR); // we will modify the color of the texture } process: sa // 'sa' is an instance of a Shader Object. { maxSize = 1.0; // normalize to a 1m cube. r = sa.wPos[1] / maxSize; // x is red g = sa.wPos[2] / maxSize; // y is blue b = sa.wPos[3] / maxSize; // z is green if(r < 0.0) r = 0; if(r > 1.0) r = 1.0; if(g < 0.0) g = 0; if(g > 1.0) g = 1.0; if(b < 0.0) b = 0; if(b > 1.0) b = 1.0; sa.color[1] = r; sa.color[2] = b; sa.color[3] = g; // swap y & z... orients object correctly, and outside-out, // for a Y-cylinder map. sa.luminous = 1.0; sa.diffuse = 0; sa.specular = 0; sa.mirror = 0; sa.transparency = 0; } // eof