armory/raw/smaa_edge_detect/smaa_edge_detect.vert.glsl

30 lines
738 B
Plaintext
Raw Normal View History

2016-06-14 12:33:11 +02:00
#version 450
#ifdef GL_ES
precision highp float;
#endif
#define SMAA_RT_METRICS vec4(1.0 / 800.0, 1.0 / 600.0, 800.0, 600.0)
#define mad(a, b, c) (a * b + c)
in vec2 pos;
out vec2 texCoord;
out vec4 offset[3];
const vec2 madd = vec2(0.5, 0.5);
void main() {
// Scale vertex attribute to [0-1] range
texCoord = pos.xy * madd + madd;
// Edge Detection Vertex Shader
//void SMAAEdgeDetectionVS(vec2 texcoord, out vec4 offset[3]) {
offset[0] = mad(SMAA_RT_METRICS.xyxy, vec4(-1.0, 0.0, 0.0, -1.0), texCoord.xyxy);
offset[1] = mad(SMAA_RT_METRICS.xyxy, vec4( 1.0, 0.0, 0.0, 1.0), texCoord.xyxy);
offset[2] = mad(SMAA_RT_METRICS.xyxy, vec4(-2.0, 0.0, 0.0, -2.0), texCoord.xyxy);
//}
gl_Position = vec4(pos.xy, 0.0, 1.0);
}