X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=billboardfrag.glsl;h=39fd71d135d1d36fb9fe820fc9eef3a79082e9cc;hb=724a80cbecb587d1d069f7999758181b10d92f73;hp=94d15dcb2f1e477e90ed7cba724dedfcc4f49308;hpb=c80f817e984fbabbadef14fc11bf0fa7385bc89b;p=clouds.git diff --git a/billboardfrag.glsl b/billboardfrag.glsl index 94d15dc..39fd71d 100644 --- a/billboardfrag.glsl +++ b/billboardfrag.glsl @@ -4,7 +4,18 @@ uniform sampler2D tex; in vec2 texCoord; out vec4 FragColor; uniform bool modulate; +uniform bool debug; +uniform bool debugColor; +uniform float debugVal; void main() { + if (debugColor) { + FragColor = color; + return; + } + if (debug) { + FragColor = mix(vec4(1, 1, 1, 0), vec4(1, 0, 0, 1), debugVal); + return; + } // Cf = color from fragment, Ct = color from texture // Cc = color from texture environment -- not set, defaults to (0,0,0,0) // Af = alpha from fragment, At = alpha from texture @@ -14,8 +25,11 @@ void main() { // GL_MODULATE: C // C = Cf * Ct // A = Af * At - FragColor = color * f; + FragColor = color * (f + 0.03); // the +0.03 is a hack to get lighter clouds! } else { + // "That is, the colors in the frame buffer are multiplied by the + // attenuation ratio of the billboard texture and then the colors in + // the texture are added" // GL_BLEND: // C = Cf * (1-Ct) + Cc * Ct // A = Af * At