R2 Core Shaders

R2DebugNormalCompression.frag
Go to the documentation of this file.
1 /// \file R2DebugNormalCompression.frag
2 /// \brief Treats the input data as a normal vector, compresses it, and writes it to the first fragment output.
3
4 #include "R2Normals.h"
5
6 uniform vec4 data;
7
8 layout(location = 0) out vec4 R2_out;
9
10 void
11 main (void)
12 {
13 vec3 n = data.xyz;
14 vec2 nc = R2_normalsCompress (n);
15 vec3 nd = R2_normalsDecompress (nc);
16 R2_out = vec4 (nd, 1.0);
17 }
layout
layout(location=0) in vec3 R2_vertex_world_position
World-space position.
R2Normals.h
Functions for transforming normal vectors.
R2_normalsDecompress
vec3 R2_normalsDecompress(const vec2 n)
Definition: R2Normals.h:34
R2_normalsCompress
vec2 R2_normalsCompress(const vec3 n)
Definition: R2Normals.h:17