2023-09-10 14:46:07 +00:00
|
|
|
in vec4 v_position;
|
|
|
|
out vec4 outColor;
|
|
|
|
|
|
|
|
void main() {
|
2023-10-17 19:07:05 +00:00
|
|
|
#ifdef VSMCUBE
|
2023-09-10 14:46:07 +00:00
|
|
|
float depth = length( vec3(v_position) ) / 20;
|
|
|
|
#else
|
|
|
|
float depth = v_position.z / v_position.w;
|
|
|
|
depth = depth * 0.5 + 0.5;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
float moment1 = depth;
|
|
|
|
float moment2 = depth * depth;
|
|
|
|
|
|
|
|
float dx = dFdx(depth);
|
|
|
|
float dy = dFdy(depth);
|
|
|
|
moment2 += 0.25*(dx*dx+dy*dy);
|
|
|
|
outColor = vec4( moment1, moment2, 0.0, 0.0);
|
2023-12-04 08:10:39 +00:00
|
|
|
}
|