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:
authorClément Foucault <foucault.clem@gmail.com>2018-05-14 14:34:54 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-16 17:58:32 +0300
commitf1a5fd90bad851ccb9eef7bc59c3a8ebe39fe8b8 (patch)
tree0da7498d7479e534d08a60a0de68ffc552efc587 /source/blender/draw/engines/eevee
parente862bcd6c8cb218c2213ac4a05a11dd13dbdecbf (diff)
Shader Node Editor: Add Closure to RGB convertion node.
Patch D3205 by Kanzaki Wataru Only implemented in Eevee for now. Collapse a closure to RGBA so we can do NPR stuff on the resulting color. Use an emission shader to convert the color back to a closure. Doing this will break PBR and will kill any SSR and SSS effects the shader the shader rely on. That said screen space refraction and ambient occlusion are supported due to the way they are implemented.
Diffstat (limited to 'source/blender/draw/engines/eevee')
-rw-r--r--source/blender/draw/engines/eevee/eevee_screen_raytrace.c2
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl40
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl40
3 files changed, 41 insertions, 41 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c
index 56cc905d701..87395f94fbb 100644
--- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c
+++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c
@@ -68,9 +68,9 @@ static struct GPUShader *eevee_effects_screen_raytrace_shader_get(int options)
datatoc_common_uniforms_lib_glsl,
datatoc_bsdf_common_lib_glsl,
datatoc_bsdf_sampling_lib_glsl,
+ datatoc_ambient_occlusion_lib_glsl,
datatoc_octahedron_lib_glsl,
datatoc_lightprobe_lib_glsl,
- datatoc_ambient_occlusion_lib_glsl,
datatoc_raytrace_lib_glsl,
datatoc_effect_ssr_frag_glsl);
diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
index 6c21d7d6fef..0f76f8e1b8c 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
@@ -2,12 +2,6 @@
/* Based on Stochastic Screen Space Reflections
* https://www.ea.com/frostbite/news/stochastic-screen-space-reflections */
-#ifndef UTIL_TEX
-#define UTIL_TEX
-uniform sampler2DArray utilTex;
-#define texelfetch_noise_tex(coord) texelFetch(utilTex, ivec3(ivec2(coord) % LUT_SIZE, 2.0), 0)
-#endif /* UTIL_TEX */
-
#define MAX_MIP 9.0
uniform ivec2 halfresOffset;
@@ -183,40 +177,6 @@ const ivec2 neighbors[32] = ivec2[32](
out vec4 fragColor;
-void fallback_cubemap(
- vec3 N, vec3 V, vec3 W, vec3 viewPosition, float roughness, float roughnessSquared, inout vec4 spec_accum)
-{
- /* Specular probes */
- vec3 spec_dir = get_specular_reflection_dominant_dir(N, V, roughnessSquared);
-
- vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
- vec3 bent_normal;
-#ifdef SSR_AO
- float final_ao = occlusion_compute(N, viewPosition, 1.0, rand, bent_normal);
- final_ao = specular_occlusion(dot(N, V), final_ao, roughness);
-#else
- const float final_ao = 1.0;
-#endif
-
- /* Starts at 1 because 0 is world probe */
- for (int i = 1; i < MAX_PROBE && i < prbNumRenderCube && spec_accum.a < 0.999; ++i) {
- CubeData cd = probes_data[i];
-
- float fade = probe_attenuation_cube(cd, W);
-
- if (fade > 0.0) {
- vec3 spec = final_ao * probe_evaluate_cube(float(i), cd, W, spec_dir, roughness);
- accumulate_light(spec, fade, spec_accum);
- }
- }
-
- /* World Specular */
- if (spec_accum.a < 0.999) {
- vec3 spec = final_ao * probe_evaluate_world_spec(spec_dir, roughness);
- accumulate_light(spec, 1.0, spec_accum);
- }
-}
-
#if 0 /* Finish reprojection with motion vectors */
vec3 get_motion_vector(vec3 pos)
{
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl
index 429f6ea92e4..6c1571d5306 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl
@@ -72,6 +72,12 @@ struct GridData {
#define MAX_PLANAR 1
#endif
+#ifndef UTIL_TEX
+#define UTIL_TEX
+uniform sampler2DArray utilTex;
+#define texelfetch_noise_tex(coord) texelFetch(utilTex, ivec3(ivec2(coord) % LUT_SIZE, 2.0), 0)
+#endif /* UTIL_TEX */
+
layout(std140) uniform probe_block {
CubeData probes_data[MAX_PROBE];
};
@@ -196,6 +202,40 @@ vec3 probe_evaluate_planar(
return sample;
}
+void fallback_cubemap(
+ vec3 N, vec3 V, vec3 W, vec3 viewPosition, float roughness, float roughnessSquared, inout vec4 spec_accum)
+{
+ /* Specular probes */
+ vec3 spec_dir = get_specular_reflection_dominant_dir(N, V, roughnessSquared);
+
+ vec4 rand = texelfetch_noise_tex(gl_FragCoord.xy);
+ vec3 bent_normal;
+#ifdef SSR_AO
+ float final_ao = occlusion_compute(N, viewPosition, 1.0, rand, bent_normal);
+ final_ao = specular_occlusion(dot(N, V), final_ao, roughness);
+#else
+ const float final_ao = 1.0;
+#endif
+
+ /* Starts at 1 because 0 is world probe */
+ for (int i = 1; i < MAX_PROBE && i < prbNumRenderCube && spec_accum.a < 0.999; ++i) {
+ CubeData cd = probes_data[i];
+
+ float fade = probe_attenuation_cube(cd, W);
+
+ if (fade > 0.0) {
+ vec3 spec = final_ao * probe_evaluate_cube(float(i), cd, W, spec_dir, roughness);
+ accumulate_light(spec, fade, spec_accum);
+ }
+ }
+
+ /* World Specular */
+ if (spec_accum.a < 0.999) {
+ vec3 spec = final_ao * probe_evaluate_world_spec(spec_dir, roughness);
+ accumulate_light(spec, 1.0, spec_accum);
+ }
+}
+
#ifdef IRRADIANCE_LIB
vec3 probe_evaluate_grid(GridData gd, vec3 W, vec3 N, vec3 localpos)
{