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:
authorAlexander Romanov <a.romanov@blend4web.com>2016-07-04 11:01:32 +0300
committerAlexander Romanov <a.romanov@blend4web.com>2016-07-04 11:01:32 +0300
commitfe44eacf78736f99bdfd3bc3ac86abd17e8ad514 (patch)
treed455a08416a08ea5a8bd2debd5afb8ef1deb63ea /source/blender/gpu/shaders
parent9269574089a742130f02c0a1184a19d94f0e665d (diff)
Environment lighting for the GLSL mode
Environment lighting (aka ambient) is a key component of any renderer. It's implemented like the Environment lighting of BI render for Approximate Gather mode. It support "Sky Color" and "White" Environment lighting modes. It would be great if the user could see actual lighting conditions right in the Blender viewport instead of waiting for the renderer to complete the final image, exporting for external renderer or for a game engine. Before: {F113921} After: {F113922} Example file: {F319013} Original author: valentin_b4w Alexander (Blend4Web Team) Reviewers: valentin_b4w, campbellbarton, merwin, brecht Reviewed By: brecht Subscribers: panzergame, youle, duarteframos, AlexKowel, yurikovelenov, dingto, Evgeny_Rodygin Projects: #rendering, #opengl_gfx Differential Revision: https://developer.blender.org/D810
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 9914c4bb362..02e9ba1c8c3 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2182,6 +2182,13 @@ void shade_madd_clamped(vec4 col, vec4 col1, vec4 col2, out vec4 outcol)
outcol = col + max(col1 * col2, vec4(0.0, 0.0, 0.0, 0.0));
}
+void env_apply(vec4 col, vec4 hor, vec4 zen, vec4 f, mat4 vm, vec3 vn, out vec4 outcol)
+{
+ vec3 vv = normalize(vm[2].xyz);
+ float skyfac = 0.5 * (1.0 + dot(vn, -vv));
+ outcol = col + f * mix(hor, zen, skyfac);
+}
+
void shade_maddf(vec4 col, float f, vec4 col1, out vec4 outcol)
{
outcol = col + f * col1;