diff options
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl index 67a22073a4b..c00edb06100 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl @@ -4,7 +4,7 @@ uniform float ImageTransparencyCutoff = 0.1; #endif uniform mat4 ProjectionMatrix; -uniform mat3 normalWorldMatrix; +uniform mat4 ViewMatrixInverse; uniform float alpha = 0.5; uniform vec2 invertedViewportSize; uniform vec4 viewvecs[3]; @@ -33,7 +33,6 @@ layout(location=1) out float revealageAccum; /* revealage actually stored in tra void main() { vec4 diffuse_color; - vec3 diffuse_light = vec3(1.0); #ifdef V3D_SHADING_TEXTURE_COLOR diffuse_color = texture(image, uv_interp); @@ -51,30 +50,22 @@ void main() vec3 nor = normalize(normal_viewport); #endif -#ifdef V3D_LIGHTING_MATCAP + /* -------- SHADING --------- */ +#ifdef V3D_LIGHTING_FLAT + vec3 shaded_color = diffuse_color.rgb; + +#elif defined(V3D_LIGHTING_MATCAP) bool flipped = world_data.matcap_orientation != 0; vec2 matcap_uv = matcap_uv_compute(I_vs, nor, flipped); - diffuse_light = texture(matcapImage, matcap_uv).rgb; -#endif + vec3 matcap = textureLod(matcapImage, matcap_uv, 0.0).rgb; + vec3 shaded_color = matcap * diffuse_color.rgb; -#ifdef V3D_SHADING_SPECULAR_HIGHLIGHT - vec3 specular_color = get_world_specular_lights(world_data, vec4(materialSpecularColor.rgb, materialRoughness), nor, I_vs); -#else - vec3 specular_color = vec3(0.0); +#elif defined(V3D_LIGHTING_STUDIO) + vec3 shaded_color = get_world_lighting(world_data, + diffuse_color.rgb, materialSpecularColor.rgb, materialRoughness, + nor, I_vs); #endif -#ifdef V3D_LIGHTING_STUDIO -# ifdef STUDIOLIGHT_ORIENTATION_CAMERA - diffuse_light = get_camera_diffuse_light(world_data, nor); -# endif -# ifdef STUDIOLIGHT_ORIENTATION_WORLD - vec3 normal_world = normalWorldMatrix * nor; - diffuse_light = get_world_diffuse_light(world_data, normal_world); -# endif -#endif - - vec3 shaded_color = diffuse_light * diffuse_color.rgb + specular_color; - /* Based on : * McGuire and Bavoil, Weighted Blended Order-Independent Transparency, Journal of * Computer Graphics Techniques (JCGT), vol. 2, no. 2, 122–141, 2013 |