Menu

[r5769]: / G3D10 / data-files / shader / DefaultRenderer / DefaultRenderer_compositeWeightedBlendedOIT.pix  Maximize  Restore  History

Download this file

26 lines (18 with data), 667 Bytes

#version 330 compatibility
#include <compatibility.glsl>

/* sum(rgb * a, a) */
uniform sampler2D accumTexture;

/* prod(1 - a) */
uniform sampler2D revealageTexture;

void main() {
    int2 C = int2(gl_FragCoord.xy);
    float  revealage = texelFetch(revealageTexture, C, 0).r;
    if (revealage == 1.0) {
        // Save the blending and color texture fetch cost
        discard; 
    }

    float4 accum     = texelFetch(accumTexture, C, 0);

    float3 averageColor = accum.rgb / max(accum.a, 0.00001);


    // dst' =  (accum.rgb / accum.a) * (1 - revealage) + dst * revealage
    gl_FragColor = float4(averageColor, 1.0 - revealage);
}

Oh no! Some styles failed to load. 😵

Please try reloading this page

Get latest updates about Open Source Projects, Conferences and News.

Sign Up No, Thank you