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-31 14:32:53 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2018-06-01 12:01:55 +0300
commitc450966e9562eb352b869f3b554d60a42dea2fa1 (patch)
tree8cdf507041087221dbf07c66f476b8618312872d /source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
parent3b2d3a3cd11d07945b18252359378ffadddfe3bd (diff)
Workbench: Material specific settings for the specular
- Uses the roughness setting of the basic eevee material - renamed gloss_mir to roughness - set default of roughness to 0.25 - renamed ray_mirror to metallic - cleaned up material rna (BI mirror struct) - use BLINN phong model - normalize incoming/outgoing specular light - when using camera oriented studiolight, the SolidLight will be used for specular highlights - EXPERIMENT: when in world oriented studiolight only the shadow direction will be used. - change the settings of the internal light to make scenes more readable
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl')
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
index 2cc0ff3723d..c0f58271a8c 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
@@ -1,5 +1,9 @@
uniform int object_id = 0;
-uniform vec3 object_color = vec3(1.0, 0.0, 1.0);
+
+layout(std140) uniform material_block {
+ MaterialData material_data;
+};
+
#ifdef OB_TEXTURE
uniform sampler2D image;
#endif
@@ -13,11 +17,12 @@ in vec2 uv_interp;
layout(location=0) out uint objectId;
layout(location=1) out vec4 diffuseColor;
+layout(location=2) out vec4 specularColor;
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
#ifdef WORKBENCH_ENCODE_NORMALS
-layout(location=2) out vec2 normalViewport;
+layout(location=3) out vec2 normalViewport;
#else /* WORKBENCH_ENCODE_NORMALS */
-layout(location=2) out vec3 normalViewport;
+layout(location=3) out vec3 normalViewport;
#endif /* WORKBENCH_ENCODE_NORMALS */
#endif /* NORMAL_VIEWPORT_PASS_ENABLED */
@@ -25,12 +30,16 @@ void main()
{
objectId = uint(object_id);
#ifdef OB_SOLID
- diffuseColor = vec4(object_color, 0.0);
+ diffuseColor = vec4(material_data.diffuse_color.rgb, 0.0);
#endif /* OB_SOLID */
#ifdef OB_TEXTURE
diffuseColor = texture(image, uv_interp);
#endif /* OB_TEXTURE */
+#ifdef V3D_SHADING_SPECULAR_HIGHLIGHT
+ specularColor = vec4(material_data.specular_color.rgb, material_data.roughness);
+#endif
+
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
#ifdef WORKBENCH_ENCODE_NORMALS
if (!gl_FrontFacing) {