|
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 float znear; |
|---|
| 9 |
uniform float zfar; |
|---|
| 10 |
|
|---|
| 11 |
//normal per vertx |
|---|
| 12 |
varying vec3 normalPerVertex; |
|---|
| 13 |
|
|---|
| 14 |
//depth in camera space |
|---|
| 15 |
varying float depthInCamera; |
|---|
| 16 |
|
|---|
| 17 |
vec3 fnormal(void) |
|---|
| 18 |
{ |
|---|
| 19 |
vec3 normal = gl_NormalMatrix * gl_Normal; |
|---|
| 20 |
normal = normalize(normal); |
|---|
| 21 |
return normal; |
|---|
| 22 |
} |
|---|
| 23 |
|
|---|
| 24 |
void main() |
|---|
| 25 |
{ |
|---|
| 26 |
gl_TexCoord[0] = gl_MultiTexCoord0; |
|---|
| 27 |
normalPerVertex = fnormal(); |
|---|
| 28 |
vec4 position = gl_ModelViewMatrix * gl_Vertex; |
|---|
| 29 |
depthInCamera = (abs(position.z) - znear) / (zfar - znear); |
|---|
| 30 |
gl_Position = ftransform(); |
|---|
| 31 |
} |
|---|