diff options
Diffstat (limited to 'gfx/shaders/irradiance_map.frag')
-rw-r--r-- | gfx/shaders/irradiance_map.frag | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gfx/shaders/irradiance_map.frag b/gfx/shaders/irradiance_map.frag index 3cfe5b2..8200e73 100644 --- a/gfx/shaders/irradiance_map.frag +++ b/gfx/shaders/irradiance_map.frag | |||
@@ -13,6 +13,9 @@ uniform samplerCube Sky; | |||
13 | 13 | ||
14 | in vec3 Ray; | 14 | in vec3 Ray; |
15 | 15 | ||
16 | // DEBUG | ||
17 | // in vec2 Texcoord; | ||
18 | |||
16 | layout (location = 0) out vec4 Color; | 19 | layout (location = 0) out vec4 Color; |
17 | 20 | ||
18 | void main() | 21 | void main() |
@@ -29,8 +32,8 @@ void main() | |||
29 | // T | 32 | // T |
30 | vec3 N = normalize(Ray); | 33 | vec3 N = normalize(Ray); |
31 | vec3 B = (abs(N.x) - 1.0 <= EPS) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); | 34 | vec3 B = (abs(N.x) - 1.0 <= EPS) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); |
32 | vec3 T = cross(B, N); | 35 | vec3 T = normalize(cross(B, N)); |
33 | B = cross(N, T); | 36 | B = normalize(cross(N, T)); |
34 | 37 | ||
35 | int num_samples = 0; | 38 | int num_samples = 0; |
36 | vec3 irradiance = vec3(0.0); | 39 | vec3 irradiance = vec3(0.0); |
@@ -54,6 +57,8 @@ void main() | |||
54 | irradiance = PI * irradiance / float(num_samples); | 57 | irradiance = PI * irradiance / float(num_samples); |
55 | 58 | ||
56 | // For debugging in trace. | 59 | // For debugging in trace. |
60 | //irradiance = texture(Sky, Ray).rgb; | ||
61 | // irradiance = vec3(Texcoord, 0.0); | ||
57 | //irradiance = pow(irradiance, vec3(1.0/2.2)); | 62 | //irradiance = pow(irradiance, vec3(1.0/2.2)); |
58 | 63 | ||
59 | Color = vec4(irradiance, 1.0); | 64 | Color = vec4(irradiance, 1.0); |