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:
authorJeroen Bakker <j.bakker@atmind.nl>2018-05-16 17:42:30 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2018-05-16 17:43:10 +0300
commite862bcd6c8cb218c2213ac4a05a11dd13dbdecbf (patch)
tree317f98432815c99e5cffd52947b567fdc4a3c400 /source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
parentdef1c3eb4b5c2926431a1c975839e7719f06b38e (diff)
Workbench: World based studio lighting
Disabled shadows for now as the calculation of the light direction is still to bogus.
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl')
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
index b6b13a117c5..6507f1ec707 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
@@ -2,8 +2,19 @@ vec3 get_world_diffuse_light(WorldData world_data, vec3 N)
{
vec4 result = world_data.diffuse_light_x_pos * clamp(N.x, 0.0, 1.0);
result = mix(result, world_data.diffuse_light_x_neg, clamp(-N.x, 0.0, 1.0));
- result = mix(result, world_data.diffuse_light_y_pos, clamp( N.y, 0.0, 1.0));
- result = mix(result, world_data.diffuse_light_y_neg, clamp(-N.y, 0.0, 1.0));
- result = mix(result, world_data.diffuse_light_z_pos, clamp( N.z, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_y_pos, clamp(-N.y, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_y_neg, clamp(N.y, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_z_pos, clamp(N.z, 0.0, 1.0));
return mix(result, world_data.diffuse_light_z_neg, clamp(-N.z, 0.0, 1.0)).xyz;
}
+
+vec3 get_camera_diffuse_light(WorldData world_data, vec3 N)
+{
+ vec4 result = world_data.diffuse_light_x_pos * clamp(N.x, 0.0, 1.0);
+ result = mix(result, world_data.diffuse_light_x_neg, clamp(-N.x, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_z_pos, clamp( N.y, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_z_neg, clamp(-N.y, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_y_pos, clamp( N.z, 0.0, 1.0));
+ result = mix(result, world_data.diffuse_light_y_neg, clamp(-N.z, 0.0, 1.0));
+ return result.xyz;
+}