// LS/PT: zShader // // Simply maps the Y coordinate to a gray-scale color. // 1 meter is fully bright, and 0 is dark. Outside // that range is clamped. // // Why is it called "zShader" then? It's a misnomer! // // poly@omino.com david van brink 2007 // @version 2.0 flags { return(COLOR); // we will modify the color of the texture } process: sa // 'sa' is an instance of a Shader Object. { maxHeight = 1.0; g = sa.wPos[2] / maxHeight; // y coordinate, 1 = white, 0m = black if(g < 0.0) g = 0; if(g > 1.0) g = 1.0; sa.color[1] = g; sa.color[2] = g; sa.color[3] = g; sa.luminous = 1.0; sa.diffuse = 0; sa.specular = 0; sa.mirror = 0; sa.transparency = 0; } // eof