summaryrefslogtreecommitdiffstats
path: root/src/demos/dualDepthPeeling/shaders/wsum_final_fragment.glsl
blob: 76c0293fce5f3471b5701587f9fcd78f31a75410 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//--------------------------------------------------------------------------------------
// Order Independent Transparency with Weighted Sums
//
// Author: Louis Bavoil
// Email: sdkfeedback@nvidia.com
//
// Copyright (c) NVIDIA Corporation. All rights reserved.
//--------------------------------------------------------------------------------------

uniform samplerRECT ColorTex;
uniform vec3 BackgroundColor;

// Sum(A_i * C_i) + C_bg * (1 - Sum(A_i))
void main(void)
{
	vec4 S = textureRect(ColorTex, gl_FragCoord.xy);
	gl_FragColor.rgb = S.rgb + BackgroundColor * (1.0 - S.a);
}