Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl85
1 files changed, 43 insertions, 42 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl
index 7fb4ee51a96..f05b3396428 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_lut_frag.glsl
@@ -1,46 +1,47 @@
out vec4 FragColor;
-void main() {
- vec3 N, T, B, V;
-
- float NV = ( 1.0 - (clamp(gl_FragCoord.y / BRDF_LUT_SIZE, 1e-4, 0.9999)));
- float sqrtRoughness = clamp(gl_FragCoord.x / BRDF_LUT_SIZE, 1e-4, 0.9999);
- float a = sqrtRoughness * sqrtRoughness;
- float a2 = a * a;
-
- N = vec3(0.0, 0.0, 1.0);
- T = vec3(1.0, 0.0, 0.0);
- B = vec3(0.0, 1.0, 0.0);
- V = vec3(sqrt(1.0 - NV * NV), 0.0, NV);
-
- setup_noise();
-
- /* Integrating BRDF */
- float brdf_accum = 0.0;
- float fresnel_accum = 0.0;
- for (float i = 0; i < sampleCount; i++) {
- vec3 H = sample_ggx(i, a2, N, T, B); /* Microfacet normal */
- vec3 L = -reflect(V, H);
- float NL = L.z;
-
- if (NL > 0.0) {
- float NH = max(H.z, 0.0);
- float VH = max(dot(V, H), 0.0);
-
- float G1_v = G1_Smith_GGX(NV, a2);
- float G1_l = G1_Smith_GGX(NL, a2);
- float G_smith = 4.0 * NV * NL / (G1_v * G1_l); /* See G1_Smith_GGX for explanations. */
-
- float brdf = (G_smith * VH) / (NH * NV);
- float Fc = pow(1.0 - VH, 5.0);
-
- brdf_accum += (1.0 - Fc) * brdf;
- fresnel_accum += Fc * brdf;
- }
- }
- brdf_accum /= sampleCount;
- fresnel_accum /= sampleCount;
-
- FragColor = vec4(brdf_accum, fresnel_accum, 0.0, 1.0);
+void main()
+{
+ vec3 N, T, B, V;
+
+ float NV = (1.0 - (clamp(gl_FragCoord.y / BRDF_LUT_SIZE, 1e-4, 0.9999)));
+ float sqrtRoughness = clamp(gl_FragCoord.x / BRDF_LUT_SIZE, 1e-4, 0.9999);
+ float a = sqrtRoughness * sqrtRoughness;
+ float a2 = a * a;
+
+ N = vec3(0.0, 0.0, 1.0);
+ T = vec3(1.0, 0.0, 0.0);
+ B = vec3(0.0, 1.0, 0.0);
+ V = vec3(sqrt(1.0 - NV * NV), 0.0, NV);
+
+ setup_noise();
+
+ /* Integrating BRDF */
+ float brdf_accum = 0.0;
+ float fresnel_accum = 0.0;
+ for (float i = 0; i < sampleCount; i++) {
+ vec3 H = sample_ggx(i, a2, N, T, B); /* Microfacet normal */
+ vec3 L = -reflect(V, H);
+ float NL = L.z;
+
+ if (NL > 0.0) {
+ float NH = max(H.z, 0.0);
+ float VH = max(dot(V, H), 0.0);
+
+ float G1_v = G1_Smith_GGX(NV, a2);
+ float G1_l = G1_Smith_GGX(NL, a2);
+ float G_smith = 4.0 * NV * NL / (G1_v * G1_l); /* See G1_Smith_GGX for explanations. */
+
+ float brdf = (G_smith * VH) / (NH * NV);
+ float Fc = pow(1.0 - VH, 5.0);
+
+ brdf_accum += (1.0 - Fc) * brdf;
+ fresnel_accum += Fc * brdf;
+ }
+ }
+ brdf_accum /= sampleCount;
+ fresnel_accum /= sampleCount;
+
+ FragColor = vec4(brdf_accum, fresnel_accum, 0.0, 1.0);
}