]> 0250250Artist Editor1001-1021021042799season1100-101526262001456789101112131415161314279900142799001427990013311670013311670013311670013311670014279900142799001427990014279900142799002945001722220652118202131250250191190250250Workspace1000-10180184001250250001250214231230250250Output1002-102202230025191180427242799126114279900042799low1101-1014303030029191180427242799130114279900042799high1102-1013343430033191180427242799134114279900042799bleh1103-1012383830037191180427242799138114279900042799bleh1104-10114242300411911804272427991421142799000331167pee11105-1010464630045191860331233116714611331167000331167pee01106-109505030049191860331233116715011331167000331167pee21107-108545430053191860331233116715411331167000331167gridsize1108-1077070042799blackness1109-106595930058191180427242799159114279900042799tmp1110-105636330062191180427242799163114279900042799gridsize1111-104676730066191180427242799167114279900300697909726409762331167170113311670032070 ]]> Preferences). // predefined variables used to animate light direction uniform float cos_time_0_2PI, sin_time_0_2PI; // artist variable to control season uniform float season; // varying variables passed to fragment shader varying float Diffuse; varying vec3 Specular; varying vec2 TexCoord0; varying float angle; varying float zdep; void main(void) { // calculate vertex position in eye coordinates vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; // compute the transformed normal vec3 tnorm = gl_NormalMatrix * gl_Normal; // compute the light vector pointing toward the sun, in model coordinates // x,y compose the longitude and z the (seasonal) lattitude of the nadir point. vec3 lightVec = normalize(gl_NormalMatrix * vec3(cos_time_0_2PI, season,sin_time_0_2PI)); // compute the reflection vector vec3 reflectVec = reflect(-lightVec, tnorm); // compute a unit vector in direction of viewing position vec3 viewVec = normalize(vec3 (-ecPosition)); angle = 1.0 - dot(viewVec, tnorm); // Calculate a diffuse light intensity Diffuse = dot(lightVec, tnorm); // Pass texture coordinates fragment shader TexCoord0 = vec2 (gl_MultiTexCoord0); // output final vertex information gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } ]]> gridlen * (1.0-backCol.r) ) ? 1.0 : 0.0; // magenta (inverse green) newCol.g = (distance(TexCoord0, bgPos + magenta) > gridlen * (1.0-backCol.g) ) ? 1.0 : 0.0; // yellow (inverse blue) newCol.b = (distance(TexCoord0, bgPos + yellow) > gridlen * (1.0-backCol.b) ) ? 1.0 : 0.0; vec4 sampleCol; vec2 newPos; bool cont = (newCol.r + newCol.g + newCol.b != 0); for (int y = -2; y < 4 && cont; y += 2) { for (int x = -2; x < 2 && cont; x += 2) { if (x == 0 && y == 0) x = 2; else if (y != 0 && x == -2) { x -= y / 2; } newPos = bgPos + vec2(halfWidth*float(x), float(y) * halfWidth ); sampleCol = texture2D(image, newPos, -100.0).rgba; newCol.r = (distance(TexCoord0, newPos + cyan) > gridlen * (1.0-sampleCol.r) ) ? newCol.r : 0.0; newCol.g = (distance(TexCoord0, newPos + magenta) > gridlen * (1.0-sampleCol.g) ) ? newCol.g : 0.0; newCol.b = (distance(TexCoord0, newPos + yellow) > gridlen * (1.0-sampleCol.b) ) ? newCol.b : 0.0; // take no more samples if already black cont = (newCol.r + newCol.g + newCol.b > 0); } } if ( f > 15.0) { gl_FragColor = newCol; } else { // blend gl_FragColor = mix(backCol, newCol, (f-2.0)/13.0); } } } return; } ]]>