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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2022-03-29 13:00:33 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-03-29 17:28:19 +0300
commit31dc94461d738d3021300e1a2c4b239f1cd68aa1 (patch)
treefa5ed7c2e0c1649c18cafa2ed0a66cfcc2cb1dbe /source/blender/draw/intern/shaders/common_subdiv_lib.glsl
parent067ae9260f2a8109b3c421be13fac47b6843e098 (diff)
Fix T96356: artefacts with GPU subdivision and vertex paint mask
The lines paint mask IBO extraction was not implemented for GPU subdivision. For it to work, we also now need to preserve the subdivision loop to subdivision edge map, which until now was overwritten to store coarse edges (the map to coarse edges is still preserved). Also the paint flag stored in the 4th dimension of the loop normal buffer was not properly set for flat shaded faces, leading to other kind of artefacts and render issues.
Diffstat (limited to 'source/blender/draw/intern/shaders/common_subdiv_lib.glsl')
-rw-r--r--source/blender/draw/intern/shaders/common_subdiv_lib.glsl14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/draw/intern/shaders/common_subdiv_lib.glsl b/source/blender/draw/intern/shaders/common_subdiv_lib.glsl
index a620905622a..44048e73ee5 100644
--- a/source/blender/draw/intern/shaders/common_subdiv_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_subdiv_lib.glsl
@@ -107,6 +107,10 @@ struct PosNorLoop {
float flag;
};
+struct LoopNormal {
+ float nx, ny, nz, flag;
+};
+
vec3 get_vertex_pos(PosNorLoop vertex_data)
{
return vec3(vertex_data.x, vertex_data.y, vertex_data.z);
@@ -117,6 +121,16 @@ vec3 get_vertex_nor(PosNorLoop vertex_data)
return vec3(vertex_data.nx, vertex_data.ny, vertex_data.nz);
}
+LoopNormal get_normal_and_flag(PosNorLoop vertex_data)
+{
+ LoopNormal loop_nor;
+ loop_nor.nx = vertex_data.nx;
+ loop_nor.ny = vertex_data.ny;
+ loop_nor.nz = vertex_data.nz;
+ loop_nor.flag = vertex_data.flag;
+ return loop_nor;
+}
+
void set_vertex_pos(inout PosNorLoop vertex_data, vec3 pos)
{
vertex_data.x = pos.x;