summaryrefslogtreecommitdiffstats
path: root/src/demos/dualDepthPeeling/shaders/dual_peeling_final.fp
blob: ec571173d6c55c4634156ff719693579557a9c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//--------------------------------------------------------------------------------------
// Order Independent Transparency with Dual Depth Peeling
//
// Author: Louis Bavoil
// Email: sdkfeedback@nvidia.com
//
// Copyright (c) NVIDIA Corporation. All rights reserved.
//--------------------------------------------------------------------------------------

uniform samplerRECT DepthBlenderTex;
uniform samplerRECT FrontBlenderTex;
uniform samplerRECT BackBlenderTex;

void main(void)
{
	vec4 frontColor = textureRect(FrontBlenderTex, gl_FragCoord.xy);
	vec3 backColor = textureRect(BackBlenderTex, gl_FragCoord.xy).rgb;
	float alphaMultiplier = 1.0 - frontColor.w;

	// front + back
	gl_FragColor.rgb = frontColor + backColor * alphaMultiplier;
	
	// front blender
	//gl_FragColor.rgb = frontColor + vec3(alphaMultiplier);
	
	// back blender
	//gl_FragColor.rgb = backColor;
}