From 390ef63a8da4c3e89b2f61526b641b1b2b82f42d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 18 Feb 2012 16:59:52 +0100 Subject: unify shader names(2) --- .../dualDepthPeeling/shader/dual_peeling_blend.fp | 17 ++++++ .../dualDepthPeeling/shader/dual_peeling_blend.vp | 13 +++++ .../dualDepthPeeling/shader/dual_peeling_final.fp | 28 +++++++++ .../dualDepthPeeling/shader/dual_peeling_final.vp | 13 +++++ .../dualDepthPeeling/shader/dual_peeling_init.fp | 13 +++++ .../dualDepthPeeling/shader/dual_peeling_init.vp | 13 +++++ .../dualDepthPeeling/shader/dual_peeling_peel.fp | 67 ++++++++++++++++++++++ .../dualDepthPeeling/shader/dual_peeling_peel.vp | 16 ++++++ .../dualDepthPeeling/shader/front_peeling_blend.fp | 15 +++++ .../dualDepthPeeling/shader/front_peeling_blend.vp | 13 +++++ .../dualDepthPeeling/shader/front_peeling_final.fp | 17 ++++++ .../dualDepthPeeling/shader/front_peeling_final.vp | 13 +++++ .../dualDepthPeeling/shader/front_peeling_init.fp | 16 ++++++ .../dualDepthPeeling/shader/front_peeling_init.vp | 16 ++++++ .../dualDepthPeeling/shader/front_peeling_peel.fp | 25 ++++++++ .../dualDepthPeeling/shader/front_peeling_peel.vp | 16 ++++++ src/demos/dualDepthPeeling/shader/shade.fp | 40 +++++++++++++ src/demos/dualDepthPeeling/shader/shade.vp | 14 +++++ src/demos/dualDepthPeeling/shader/wavg_final.fp | 29 ++++++++++ src/demos/dualDepthPeeling/shader/wavg_final.vp | 13 +++++ src/demos/dualDepthPeeling/shader/wavg_init.fp | 19 ++++++ src/demos/dualDepthPeeling/shader/wavg_init.vp | 16 ++++++ src/demos/dualDepthPeeling/shader/wsum_final.fp | 18 ++++++ src/demos/dualDepthPeeling/shader/wsum_final.vp | 13 +++++ src/demos/dualDepthPeeling/shader/wsum_init.fp | 16 ++++++ src/demos/dualDepthPeeling/shader/wsum_init.vp | 16 ++++++ .../dualDepthPeeling/shaders/dual_peeling_blend.fp | 17 ------ .../dualDepthPeeling/shaders/dual_peeling_blend.vp | 13 ----- .../dualDepthPeeling/shaders/dual_peeling_final.fp | 28 --------- .../dualDepthPeeling/shaders/dual_peeling_final.vp | 13 ----- .../dualDepthPeeling/shaders/dual_peeling_init.fp | 13 ----- .../dualDepthPeeling/shaders/dual_peeling_init.vp | 13 ----- .../dualDepthPeeling/shaders/dual_peeling_peel.fp | 67 ---------------------- .../dualDepthPeeling/shaders/dual_peeling_peel.vp | 16 ------ .../shaders/front_peeling_blend.fp | 15 ----- .../shaders/front_peeling_blend.vp | 13 ----- .../shaders/front_peeling_final.fp | 17 ------ .../shaders/front_peeling_final.vp | 13 ----- .../dualDepthPeeling/shaders/front_peeling_init.fp | 16 ------ .../dualDepthPeeling/shaders/front_peeling_init.vp | 16 ------ .../dualDepthPeeling/shaders/front_peeling_peel.fp | 25 -------- .../dualDepthPeeling/shaders/front_peeling_peel.vp | 16 ------ src/demos/dualDepthPeeling/shaders/shade.fp | 40 ------------- src/demos/dualDepthPeeling/shaders/shade.vp | 14 ----- src/demos/dualDepthPeeling/shaders/wavg_final.fp | 29 ---------- src/demos/dualDepthPeeling/shaders/wavg_final.vp | 13 ----- src/demos/dualDepthPeeling/shaders/wavg_init.fp | 19 ------ src/demos/dualDepthPeeling/shaders/wavg_init.vp | 16 ------ src/demos/dualDepthPeeling/shaders/wsum_final.fp | 18 ------ src/demos/dualDepthPeeling/shaders/wsum_final.vp | 13 ----- src/demos/dualDepthPeeling/shaders/wsum_init.fp | 16 ------ src/demos/dualDepthPeeling/shaders/wsum_init.vp | 16 ------ 52 files changed, 505 insertions(+), 505 deletions(-) create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_blend.fp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_blend.vp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_final.fp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_final.vp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_init.fp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_init.vp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_peel.fp create mode 100644 src/demos/dualDepthPeeling/shader/dual_peeling_peel.vp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_blend.fp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_blend.vp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_final.fp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_final.vp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_init.fp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_init.vp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_peel.fp create mode 100644 src/demos/dualDepthPeeling/shader/front_peeling_peel.vp create mode 100644 src/demos/dualDepthPeeling/shader/shade.fp create mode 100644 src/demos/dualDepthPeeling/shader/shade.vp create mode 100644 src/demos/dualDepthPeeling/shader/wavg_final.fp create mode 100644 src/demos/dualDepthPeeling/shader/wavg_final.vp create mode 100644 src/demos/dualDepthPeeling/shader/wavg_init.fp create mode 100644 src/demos/dualDepthPeeling/shader/wavg_init.vp create mode 100644 src/demos/dualDepthPeeling/shader/wsum_final.fp create mode 100644 src/demos/dualDepthPeeling/shader/wsum_final.vp create mode 100644 src/demos/dualDepthPeeling/shader/wsum_init.fp create mode 100644 src/demos/dualDepthPeeling/shader/wsum_init.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_blend.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_blend.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_final.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_final.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_init.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_init.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_peel.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/dual_peeling_peel.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_blend.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_blend.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_final.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_final.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_init.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_init.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_peel.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/front_peeling_peel.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/shade.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/shade.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/wavg_final.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/wavg_final.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/wavg_init.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/wavg_init.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/wsum_final.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/wsum_final.vp delete mode 100644 src/demos/dualDepthPeeling/shaders/wsum_init.fp delete mode 100644 src/demos/dualDepthPeeling/shaders/wsum_init.vp (limited to 'src') diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_blend.fp b/src/demos/dualDepthPeeling/shader/dual_peeling_blend.fp new file mode 100644 index 0000000..3ba7cf9 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_blend.fp @@ -0,0 +1,17 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +uniform samplerRECT TempTex; + +void main(void) +{ + gl_FragColor = textureRect(TempTex, gl_FragCoord.xy); + // for occlusion query + if (gl_FragColor.a == 0) discard; +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_blend.vp b/src/demos/dualDepthPeeling/shader/dual_peeling_blend.vp new file mode 100644 index 0000000..1d0edfc --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_blend.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = gl_ModelViewMatrix * gl_Vertex; +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_final.fp b/src/demos/dualDepthPeeling/shader/dual_peeling_final.fp new file mode 100644 index 0000000..ec57117 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_final.fp @@ -0,0 +1,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; +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_final.vp b/src/demos/dualDepthPeeling/shader/dual_peeling_final.vp new file mode 100644 index 0000000..1d0edfc --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_final.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = gl_ModelViewMatrix * gl_Vertex; +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_init.fp b/src/demos/dualDepthPeeling/shader/dual_peeling_init.fp new file mode 100644 index 0000000..1c6234a --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_init.fp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_FragColor.xy = vec2(-gl_FragCoord.z, gl_FragCoord.z); +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_init.vp b/src/demos/dualDepthPeeling/shader/dual_peeling_init.vp new file mode 100644 index 0000000..583aad4 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_init.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = ftransform(); +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_peel.fp b/src/demos/dualDepthPeeling/shader/dual_peeling_peel.fp new file mode 100644 index 0000000..2d61b89 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_peel.fp @@ -0,0 +1,67 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#extension ARB_draw_buffers : require + +uniform samplerRECT DepthBlenderTex; +uniform samplerRECT FrontBlenderTex; + +#define MAX_DEPTH 1.0 + +vec4 ShadeFragment(); + +void main(void) +{ + // window-space depth interpolated linearly in screen space + float fragDepth = gl_FragCoord.z; + + vec2 depthBlender = textureRect(DepthBlenderTex, gl_FragCoord.xy).xy; + vec4 forwardTemp = textureRect(FrontBlenderTex, gl_FragCoord.xy); + + // Depths and 1.0-alphaMult always increase + // so we can use pass-through by default with MAX blending + gl_FragData[0].xy = depthBlender; + + // Front colors always increase (DST += SRC*ALPHA_MULT) + // so we can use pass-through by default with MAX blending + gl_FragData[1] = forwardTemp; + + // Because over blending makes color increase or decrease, + // we cannot pass-through by default. + // Each pass, only one fragment writes a color greater than 0 + gl_FragData[2] = vec4(0.0); + + float nearestDepth = -depthBlender.x; + float farthestDepth = depthBlender.y; + float alphaMultiplier = 1.0 - forwardTemp.w; + + if (fragDepth < nearestDepth || fragDepth > farthestDepth) { + // Skip this depth in the peeling algorithm + gl_FragData[0].xy = vec2(-MAX_DEPTH); + return; + } + + if (fragDepth > nearestDepth && fragDepth < farthestDepth) { + // This fragment needs to be peeled again + gl_FragData[0].xy = vec2(-fragDepth, fragDepth); + return; + } + + // If we made it here, this fragment is on the peeled layer from last pass + // therefore, we need to shade it, and make sure it is not peeled any farther + vec4 color = ShadeFragment(); + gl_FragData[0].xy = vec2(-MAX_DEPTH); + + if (fragDepth == nearestDepth) { + gl_FragData[1].xyz += color.rgb * color.a * alphaMultiplier; + gl_FragData[1].w = 1.0 - alphaMultiplier * (1.0 - color.a); + } else { + gl_FragData[2] += color; + } +} diff --git a/src/demos/dualDepthPeeling/shader/dual_peeling_peel.vp b/src/demos/dualDepthPeeling/shader/dual_peeling_peel.vp new file mode 100644 index 0000000..b49aeff --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/dual_peeling_peel.vp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Dual Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec3 ShadeVertex(); + +void main(void) +{ + gl_Position = ftransform(); + gl_TexCoord[0].xyz = ShadeVertex(); +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_blend.fp b/src/demos/dualDepthPeeling/shader/front_peeling_blend.fp new file mode 100644 index 0000000..81385aa --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_blend.fp @@ -0,0 +1,15 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +uniform samplerRECT TempTex; + +void main(void) +{ + gl_FragColor = textureRect(TempTex, gl_FragCoord.xy); +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_blend.vp b/src/demos/dualDepthPeeling/shader/front_peeling_blend.vp new file mode 100644 index 0000000..817857b --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_blend.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = gl_ModelViewMatrix * gl_Vertex; +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_final.fp b/src/demos/dualDepthPeeling/shader/front_peeling_final.fp new file mode 100644 index 0000000..dbc9a65 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_final.fp @@ -0,0 +1,17 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +uniform samplerRECT ColorTex; +uniform vec3 BackgroundColor; + +void main(void) +{ + vec4 frontColor = textureRect(ColorTex, gl_FragCoord.xy); + gl_FragColor.rgb = frontColor + BackgroundColor * frontColor.a; +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_final.vp b/src/demos/dualDepthPeeling/shader/front_peeling_final.vp new file mode 100644 index 0000000..817857b --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_final.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = gl_ModelViewMatrix * gl_Vertex; +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_init.fp b/src/demos/dualDepthPeeling/shader/front_peeling_init.fp new file mode 100644 index 0000000..fdaaa79 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_init.fp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec4 ShadeFragment(); + +void main(void) +{ + vec4 color = ShadeFragment(); + gl_FragColor = vec4(color.rgb * color.a, 1.0 - color.a); +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_init.vp b/src/demos/dualDepthPeeling/shader/front_peeling_init.vp new file mode 100644 index 0000000..b005d0c --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_init.vp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec3 ShadeVertex(); + +void main(void) +{ + gl_Position = ftransform(); + gl_TexCoord[0].xyz = ShadeVertex(); +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_peel.fp b/src/demos/dualDepthPeeling/shader/front_peeling_peel.fp new file mode 100644 index 0000000..7f58b3e --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_peel.fp @@ -0,0 +1,25 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +uniform samplerRECT DepthTex; + +vec4 ShadeFragment(); + +void main(void) +{ + // Bit-exact comparison between FP32 z-buffer and fragment depth + float frontDepth = textureRect(DepthTex, gl_FragCoord.xy).r; + if (gl_FragCoord.z <= frontDepth) { + discard; + } + + // Shade all the fragments behind the z-buffer + vec4 color = ShadeFragment(); + gl_FragColor = vec4(color.rgb * color.a, color.a); +} diff --git a/src/demos/dualDepthPeeling/shader/front_peeling_peel.vp b/src/demos/dualDepthPeeling/shader/front_peeling_peel.vp new file mode 100644 index 0000000..b005d0c --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/front_peeling_peel.vp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Depth Peeling +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec3 ShadeVertex(); + +void main(void) +{ + gl_Position = ftransform(); + gl_TexCoord[0].xyz = ShadeVertex(); +} diff --git a/src/demos/dualDepthPeeling/shader/shade.fp b/src/demos/dualDepthPeeling/shader/shade.fp new file mode 100644 index 0000000..94f8dcc --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/shade.fp @@ -0,0 +1,40 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency Fragment Shader +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +uniform float Alpha; + +#define COLOR_FREQ 30.0 +#define ALPHA_FREQ 30.0 + +#if 1 +vec4 ShadeFragment() +{ + float xWorldPos = gl_TexCoord[0].x; + float yWorldPos = gl_TexCoord[0].y; + float diffuse = gl_TexCoord[0].z; + + vec4 color; + float i = floor(xWorldPos * COLOR_FREQ); + float j = floor(yWorldPos * ALPHA_FREQ); + color.rgb = (fmod(i, 2.0) == 0) ? vec3(.4,.85,.0) : vec3(1.0); + //color.a = (fmod(j, 2.0) == 0) ? Alpha : 0.2; + color.a = Alpha; + + color.rgb *= diffuse; + return color; +} +#else +vec4 ShadeFragment() +{ + vec4 color; + color.rgb = vec3(.4,.85,.0); + color.a = Alpha; + return color; +} +#endif diff --git a/src/demos/dualDepthPeeling/shader/shade.vp b/src/demos/dualDepthPeeling/shader/shade.vp new file mode 100644 index 0000000..2f0a4ba --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/shade.vp @@ -0,0 +1,14 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency Vertex Shader +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec3 ShadeVertex() +{ + float diffuse = abs(normalize(gl_NormalMatrix * gl_Normal).z); + return vec3(gl_Vertex.xy, diffuse); +} diff --git a/src/demos/dualDepthPeeling/shader/wavg_final.fp b/src/demos/dualDepthPeeling/shader/wavg_final.fp new file mode 100644 index 0000000..034491c --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wavg_final.fp @@ -0,0 +1,29 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Average Color +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +uniform samplerRECT ColorTex0; +uniform samplerRECT ColorTex1; +uniform vec3 BackgroundColor; + +void main(void) +{ + vec4 SumColor = textureRect(ColorTex0, gl_FragCoord.xy); + float n = textureRect(ColorTex1, gl_FragCoord.xy).r; + + if (n == 0.0) { + gl_FragColor.rgb = BackgroundColor; + return; + } + + vec3 AvgColor = SumColor.rgb / SumColor.a; + float AvgAlpha = SumColor.a / n; + + float T = pow(1.0-AvgAlpha, n); + gl_FragColor.rgb = AvgColor * (1 - T) + BackgroundColor * T; +} diff --git a/src/demos/dualDepthPeeling/shader/wavg_final.vp b/src/demos/dualDepthPeeling/shader/wavg_final.vp new file mode 100644 index 0000000..5c07236 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wavg_final.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Average Color +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = gl_ModelViewMatrix * gl_Vertex; +} diff --git a/src/demos/dualDepthPeeling/shader/wavg_init.fp b/src/demos/dualDepthPeeling/shader/wavg_init.fp new file mode 100644 index 0000000..e50aeb0 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wavg_init.fp @@ -0,0 +1,19 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Average Color +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +#extension ARB_draw_buffers : require + +vec4 ShadeFragment(); + +void main(void) +{ + vec4 color = ShadeFragment(); + gl_FragData[0] = vec4(color.rgb * color.a, color.a); + gl_FragData[1] = vec4(1.0); +} diff --git a/src/demos/dualDepthPeeling/shader/wavg_init.vp b/src/demos/dualDepthPeeling/shader/wavg_init.vp new file mode 100644 index 0000000..3d3d25a --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wavg_init.vp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Average Color +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec3 ShadeVertex(); + +void main(void) +{ + gl_Position = ftransform(); + gl_TexCoord[0].xyz = ShadeVertex(); +} diff --git a/src/demos/dualDepthPeeling/shader/wsum_final.fp b/src/demos/dualDepthPeeling/shader/wsum_final.fp new file mode 100644 index 0000000..76c0293 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wsum_final.fp @@ -0,0 +1,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); +} diff --git a/src/demos/dualDepthPeeling/shader/wsum_final.vp b/src/demos/dualDepthPeeling/shader/wsum_final.vp new file mode 100644 index 0000000..8264811 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wsum_final.vp @@ -0,0 +1,13 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Weighted Sums +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +void main(void) +{ + gl_Position = gl_ModelViewMatrix * gl_Vertex; +} diff --git a/src/demos/dualDepthPeeling/shader/wsum_init.fp b/src/demos/dualDepthPeeling/shader/wsum_init.fp new file mode 100644 index 0000000..5cccb14 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wsum_init.fp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Weighted Sums +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec4 ShadeFragment(); + +void main(void) +{ + vec4 color = ShadeFragment(); + gl_FragColor = vec4(color.rgb * color.a, color.a); +} diff --git a/src/demos/dualDepthPeeling/shader/wsum_init.vp b/src/demos/dualDepthPeeling/shader/wsum_init.vp new file mode 100644 index 0000000..5445325 --- /dev/null +++ b/src/demos/dualDepthPeeling/shader/wsum_init.vp @@ -0,0 +1,16 @@ +//-------------------------------------------------------------------------------------- +// Order Independent Transparency with Weighted Sums +// +// Author: Louis Bavoil +// Email: sdkfeedback@nvidia.com +// +// Copyright (c) NVIDIA Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +vec3 ShadeVertex(); + +void main(void) +{ + gl_Position = ftransform(); + gl_TexCoord[0].xyz = ShadeVertex(); +} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_blend.fp b/src/demos/dualDepthPeeling/shaders/dual_peeling_blend.fp deleted file mode 100644 index 3ba7cf9..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_blend.fp +++ /dev/null @@ -1,17 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -uniform samplerRECT TempTex; - -void main(void) -{ - gl_FragColor = textureRect(TempTex, gl_FragCoord.xy); - // for occlusion query - if (gl_FragColor.a == 0) discard; -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_blend.vp b/src/demos/dualDepthPeeling/shaders/dual_peeling_blend.vp deleted file mode 100644 index 1d0edfc..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_blend.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = gl_ModelViewMatrix * gl_Vertex; -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_final.fp b/src/demos/dualDepthPeeling/shaders/dual_peeling_final.fp deleted file mode 100644 index ec57117..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_final.fp +++ /dev/null @@ -1,28 +0,0 @@ -//-------------------------------------------------------------------------------------- -// 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; -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_final.vp b/src/demos/dualDepthPeeling/shaders/dual_peeling_final.vp deleted file mode 100644 index 1d0edfc..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_final.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = gl_ModelViewMatrix * gl_Vertex; -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_init.fp b/src/demos/dualDepthPeeling/shaders/dual_peeling_init.fp deleted file mode 100644 index 1c6234a..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_init.fp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_FragColor.xy = vec2(-gl_FragCoord.z, gl_FragCoord.z); -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_init.vp b/src/demos/dualDepthPeeling/shaders/dual_peeling_init.vp deleted file mode 100644 index 583aad4..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_init.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = ftransform(); -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_peel.fp b/src/demos/dualDepthPeeling/shaders/dual_peeling_peel.fp deleted file mode 100644 index 2d61b89..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_peel.fp +++ /dev/null @@ -1,67 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -#extension ARB_draw_buffers : require - -uniform samplerRECT DepthBlenderTex; -uniform samplerRECT FrontBlenderTex; - -#define MAX_DEPTH 1.0 - -vec4 ShadeFragment(); - -void main(void) -{ - // window-space depth interpolated linearly in screen space - float fragDepth = gl_FragCoord.z; - - vec2 depthBlender = textureRect(DepthBlenderTex, gl_FragCoord.xy).xy; - vec4 forwardTemp = textureRect(FrontBlenderTex, gl_FragCoord.xy); - - // Depths and 1.0-alphaMult always increase - // so we can use pass-through by default with MAX blending - gl_FragData[0].xy = depthBlender; - - // Front colors always increase (DST += SRC*ALPHA_MULT) - // so we can use pass-through by default with MAX blending - gl_FragData[1] = forwardTemp; - - // Because over blending makes color increase or decrease, - // we cannot pass-through by default. - // Each pass, only one fragment writes a color greater than 0 - gl_FragData[2] = vec4(0.0); - - float nearestDepth = -depthBlender.x; - float farthestDepth = depthBlender.y; - float alphaMultiplier = 1.0 - forwardTemp.w; - - if (fragDepth < nearestDepth || fragDepth > farthestDepth) { - // Skip this depth in the peeling algorithm - gl_FragData[0].xy = vec2(-MAX_DEPTH); - return; - } - - if (fragDepth > nearestDepth && fragDepth < farthestDepth) { - // This fragment needs to be peeled again - gl_FragData[0].xy = vec2(-fragDepth, fragDepth); - return; - } - - // If we made it here, this fragment is on the peeled layer from last pass - // therefore, we need to shade it, and make sure it is not peeled any farther - vec4 color = ShadeFragment(); - gl_FragData[0].xy = vec2(-MAX_DEPTH); - - if (fragDepth == nearestDepth) { - gl_FragData[1].xyz += color.rgb * color.a * alphaMultiplier; - gl_FragData[1].w = 1.0 - alphaMultiplier * (1.0 - color.a); - } else { - gl_FragData[2] += color; - } -} diff --git a/src/demos/dualDepthPeeling/shaders/dual_peeling_peel.vp b/src/demos/dualDepthPeeling/shaders/dual_peeling_peel.vp deleted file mode 100644 index b49aeff..0000000 --- a/src/demos/dualDepthPeeling/shaders/dual_peeling_peel.vp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Dual Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec3 ShadeVertex(); - -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0].xyz = ShadeVertex(); -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_blend.fp b/src/demos/dualDepthPeeling/shaders/front_peeling_blend.fp deleted file mode 100644 index 81385aa..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_blend.fp +++ /dev/null @@ -1,15 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -uniform samplerRECT TempTex; - -void main(void) -{ - gl_FragColor = textureRect(TempTex, gl_FragCoord.xy); -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_blend.vp b/src/demos/dualDepthPeeling/shaders/front_peeling_blend.vp deleted file mode 100644 index 817857b..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_blend.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = gl_ModelViewMatrix * gl_Vertex; -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_final.fp b/src/demos/dualDepthPeeling/shaders/front_peeling_final.fp deleted file mode 100644 index dbc9a65..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_final.fp +++ /dev/null @@ -1,17 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -uniform samplerRECT ColorTex; -uniform vec3 BackgroundColor; - -void main(void) -{ - vec4 frontColor = textureRect(ColorTex, gl_FragCoord.xy); - gl_FragColor.rgb = frontColor + BackgroundColor * frontColor.a; -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_final.vp b/src/demos/dualDepthPeeling/shaders/front_peeling_final.vp deleted file mode 100644 index 817857b..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_final.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = gl_ModelViewMatrix * gl_Vertex; -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_init.fp b/src/demos/dualDepthPeeling/shaders/front_peeling_init.fp deleted file mode 100644 index fdaaa79..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_init.fp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec4 ShadeFragment(); - -void main(void) -{ - vec4 color = ShadeFragment(); - gl_FragColor = vec4(color.rgb * color.a, 1.0 - color.a); -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_init.vp b/src/demos/dualDepthPeeling/shaders/front_peeling_init.vp deleted file mode 100644 index b005d0c..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_init.vp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec3 ShadeVertex(); - -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0].xyz = ShadeVertex(); -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_peel.fp b/src/demos/dualDepthPeeling/shaders/front_peeling_peel.fp deleted file mode 100644 index 7f58b3e..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_peel.fp +++ /dev/null @@ -1,25 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -uniform samplerRECT DepthTex; - -vec4 ShadeFragment(); - -void main(void) -{ - // Bit-exact comparison between FP32 z-buffer and fragment depth - float frontDepth = textureRect(DepthTex, gl_FragCoord.xy).r; - if (gl_FragCoord.z <= frontDepth) { - discard; - } - - // Shade all the fragments behind the z-buffer - vec4 color = ShadeFragment(); - gl_FragColor = vec4(color.rgb * color.a, color.a); -} diff --git a/src/demos/dualDepthPeeling/shaders/front_peeling_peel.vp b/src/demos/dualDepthPeeling/shaders/front_peeling_peel.vp deleted file mode 100644 index b005d0c..0000000 --- a/src/demos/dualDepthPeeling/shaders/front_peeling_peel.vp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Depth Peeling -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec3 ShadeVertex(); - -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0].xyz = ShadeVertex(); -} diff --git a/src/demos/dualDepthPeeling/shaders/shade.fp b/src/demos/dualDepthPeeling/shaders/shade.fp deleted file mode 100644 index 94f8dcc..0000000 --- a/src/demos/dualDepthPeeling/shaders/shade.fp +++ /dev/null @@ -1,40 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency Fragment Shader -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -uniform float Alpha; - -#define COLOR_FREQ 30.0 -#define ALPHA_FREQ 30.0 - -#if 1 -vec4 ShadeFragment() -{ - float xWorldPos = gl_TexCoord[0].x; - float yWorldPos = gl_TexCoord[0].y; - float diffuse = gl_TexCoord[0].z; - - vec4 color; - float i = floor(xWorldPos * COLOR_FREQ); - float j = floor(yWorldPos * ALPHA_FREQ); - color.rgb = (fmod(i, 2.0) == 0) ? vec3(.4,.85,.0) : vec3(1.0); - //color.a = (fmod(j, 2.0) == 0) ? Alpha : 0.2; - color.a = Alpha; - - color.rgb *= diffuse; - return color; -} -#else -vec4 ShadeFragment() -{ - vec4 color; - color.rgb = vec3(.4,.85,.0); - color.a = Alpha; - return color; -} -#endif diff --git a/src/demos/dualDepthPeeling/shaders/shade.vp b/src/demos/dualDepthPeeling/shaders/shade.vp deleted file mode 100644 index 2f0a4ba..0000000 --- a/src/demos/dualDepthPeeling/shaders/shade.vp +++ /dev/null @@ -1,14 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency Vertex Shader -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec3 ShadeVertex() -{ - float diffuse = abs(normalize(gl_NormalMatrix * gl_Normal).z); - return vec3(gl_Vertex.xy, diffuse); -} diff --git a/src/demos/dualDepthPeeling/shaders/wavg_final.fp b/src/demos/dualDepthPeeling/shaders/wavg_final.fp deleted file mode 100644 index 034491c..0000000 --- a/src/demos/dualDepthPeeling/shaders/wavg_final.fp +++ /dev/null @@ -1,29 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Average Color -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -uniform samplerRECT ColorTex0; -uniform samplerRECT ColorTex1; -uniform vec3 BackgroundColor; - -void main(void) -{ - vec4 SumColor = textureRect(ColorTex0, gl_FragCoord.xy); - float n = textureRect(ColorTex1, gl_FragCoord.xy).r; - - if (n == 0.0) { - gl_FragColor.rgb = BackgroundColor; - return; - } - - vec3 AvgColor = SumColor.rgb / SumColor.a; - float AvgAlpha = SumColor.a / n; - - float T = pow(1.0-AvgAlpha, n); - gl_FragColor.rgb = AvgColor * (1 - T) + BackgroundColor * T; -} diff --git a/src/demos/dualDepthPeeling/shaders/wavg_final.vp b/src/demos/dualDepthPeeling/shaders/wavg_final.vp deleted file mode 100644 index 5c07236..0000000 --- a/src/demos/dualDepthPeeling/shaders/wavg_final.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Average Color -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = gl_ModelViewMatrix * gl_Vertex; -} diff --git a/src/demos/dualDepthPeeling/shaders/wavg_init.fp b/src/demos/dualDepthPeeling/shaders/wavg_init.fp deleted file mode 100644 index e50aeb0..0000000 --- a/src/demos/dualDepthPeeling/shaders/wavg_init.fp +++ /dev/null @@ -1,19 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Average Color -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -#extension ARB_draw_buffers : require - -vec4 ShadeFragment(); - -void main(void) -{ - vec4 color = ShadeFragment(); - gl_FragData[0] = vec4(color.rgb * color.a, color.a); - gl_FragData[1] = vec4(1.0); -} diff --git a/src/demos/dualDepthPeeling/shaders/wavg_init.vp b/src/demos/dualDepthPeeling/shaders/wavg_init.vp deleted file mode 100644 index 3d3d25a..0000000 --- a/src/demos/dualDepthPeeling/shaders/wavg_init.vp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Average Color -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec3 ShadeVertex(); - -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0].xyz = ShadeVertex(); -} diff --git a/src/demos/dualDepthPeeling/shaders/wsum_final.fp b/src/demos/dualDepthPeeling/shaders/wsum_final.fp deleted file mode 100644 index 76c0293..0000000 --- a/src/demos/dualDepthPeeling/shaders/wsum_final.fp +++ /dev/null @@ -1,18 +0,0 @@ -//-------------------------------------------------------------------------------------- -// 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); -} diff --git a/src/demos/dualDepthPeeling/shaders/wsum_final.vp b/src/demos/dualDepthPeeling/shaders/wsum_final.vp deleted file mode 100644 index 8264811..0000000 --- a/src/demos/dualDepthPeeling/shaders/wsum_final.vp +++ /dev/null @@ -1,13 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Weighted Sums -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -void main(void) -{ - gl_Position = gl_ModelViewMatrix * gl_Vertex; -} diff --git a/src/demos/dualDepthPeeling/shaders/wsum_init.fp b/src/demos/dualDepthPeeling/shaders/wsum_init.fp deleted file mode 100644 index 5cccb14..0000000 --- a/src/demos/dualDepthPeeling/shaders/wsum_init.fp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Weighted Sums -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec4 ShadeFragment(); - -void main(void) -{ - vec4 color = ShadeFragment(); - gl_FragColor = vec4(color.rgb * color.a, color.a); -} diff --git a/src/demos/dualDepthPeeling/shaders/wsum_init.vp b/src/demos/dualDepthPeeling/shaders/wsum_init.vp deleted file mode 100644 index 5445325..0000000 --- a/src/demos/dualDepthPeeling/shaders/wsum_init.vp +++ /dev/null @@ -1,16 +0,0 @@ -//-------------------------------------------------------------------------------------- -// Order Independent Transparency with Weighted Sums -// -// Author: Louis Bavoil -// Email: sdkfeedback@nvidia.com -// -// Copyright (c) NVIDIA Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -vec3 ShadeVertex(); - -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0].xyz = ShadeVertex(); -} -- cgit v1.2.3