|
Revision 7347
(checked in by robert, 1 year ago)
|
Added depth peeling shaders from Steffen Frey
|
| Line | |
|---|
| 1 |
/* |
|---|
| 2 |
Steffen Frey |
|---|
| 3 |
Fachpraktikum Graphik-Programmierung 2007 |
|---|
| 4 |
Institut fuer Visualisierung und Interaktive Systeme |
|---|
| 5 |
Universitaet Stuttgart |
|---|
| 6 |
*/ |
|---|
| 7 |
|
|---|
| 8 |
uniform sampler2D tex; |
|---|
| 9 |
uniform sampler2D normalDepthMap; |
|---|
| 10 |
|
|---|
| 11 |
uniform float width; |
|---|
| 12 |
uniform float height; |
|---|
| 13 |
|
|---|
| 14 |
varying float depthInCamera; |
|---|
| 15 |
|
|---|
| 16 |
void main( void ) |
|---|
| 17 |
{ |
|---|
| 18 |
vec2 texCoord = vec2(gl_FragCoord.x/width, gl_FragCoord.y/height); |
|---|
| 19 |
|
|---|
| 20 |
float prevDepth = texture2D(normalDepthMap, texCoord).w; |
|---|
| 21 |
|
|---|
| 22 |
if(depthInCamera > prevDepth + 0.0005) |
|---|
| 23 |
discard; |
|---|
| 24 |
|
|---|
| 25 |
gl_FragColor = vec4(gl_Color.xyz, 0.3); |
|---|
| 26 |
gl_FragDepth = depthInCamera; |
|---|
| 27 |
} |
|---|