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 <jeroen@blender.org>2020-02-10 17:29:16 +0300
committerJeroen Bakker <jeroen@blender.org>2020-02-17 16:59:30 +0300
commite2e2a98573e060cf26ab5141550dcd64838afc40 (patch)
tree0c2bd99642340d1ce7a51c617f3cad4dfc56d886 /source/blender/draw/engines
parentd5d235c44facaf6dcb7b8242e2367901f7c78bd2 (diff)
Fix T73518: Normal Overlay
This change will not render the normals for faces that are hidden. Before we had instance drawing the hidden faces were registered in the index buffer. During the overlay refactoring the rendering was migrated to instance rendering. Instance rendering does not use the index buffer so the data was ignored. This patch stored the normal visibility in the .w part of the normal or for face normals it will set the normal to zero. The shader looks at this and renders the normals fully transparent when detected. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D6798
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r--source/blender/draw/engines/overlay/shaders/edit_mesh_normal_vert.glsl24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/edit_mesh_normal_vert.glsl b/source/blender/draw/engines/overlay/shaders/edit_mesh_normal_vert.glsl
index 2a00160836b..8833490e818 100644
--- a/source/blender/draw/engines/overlay/shaders/edit_mesh_normal_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/edit_mesh_normal_vert.glsl
@@ -4,8 +4,8 @@ uniform sampler2D depthTex;
uniform float alpha = 1.0;
in vec3 pos;
-in vec3 lnor;
-in vec3 vnor;
+in vec4 lnor;
+in vec4 vnor;
in vec4 norAndFlag;
flat out vec4 finalColor;
@@ -22,16 +22,28 @@ void main()
vec3 nor;
/* Select the right normal by cheking if the generic attrib is used. */
- if (!all(equal(lnor, vec3(0)))) {
- nor = lnor;
+ if (!all(equal(lnor.xyz, vec3(0)))) {
+ if (lnor.w < 0.0) {
+ finalColor = vec4(0.0);
+ return;
+ }
+ nor = lnor.xyz;
finalColor = colorLNormal;
}
- else if (!all(equal(vnor, vec3(0)))) {
- nor = vnor;
+ else if (!all(equal(vnor.xyz, vec3(0)))) {
+ if (vnor.w < 0.0) {
+ finalColor = vec4(0.0);
+ return;
+ }
+ nor = vnor.xyz;
finalColor = colorVNormal;
}
else {
nor = norAndFlag.xyz;
+ if (all(equal(nor, vec3(0.0)))) {
+ finalColor = vec4(0.0);
+ return;
+ }
finalColor = colorNormal;
}