Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenricoturri1966 <enricoturri@seznam.cz>2022-04-07 13:59:11 +0300
committerenricoturri1966 <enricoturri@seznam.cz>2022-04-07 13:59:11 +0300
commita4435d214f3c5ed4111e474666fde5d431ea3501 (patch)
tree82ed4a41a7d4ae3bc4dc186c4554701c3bb11f95 /resources
parent0995cfc658dfbfdbc61fde451d32d06a9195b9a7 (diff)
Shader mm_contour - Customizable offset to calculate the correction to avoid z-fighting (MESA driver needs bigger one)
Diffstat (limited to 'resources')
-rw-r--r--resources/shaders/110/mm_contour.vs3
-rw-r--r--resources/shaders/140/mm_contour.vs3
-rw-r--r--resources/shaders/mm_contour.vs4
3 files changed, 7 insertions, 3 deletions
diff --git a/resources/shaders/110/mm_contour.vs b/resources/shaders/110/mm_contour.vs
index f75ff1077..b37394b61 100644
--- a/resources/shaders/110/mm_contour.vs
+++ b/resources/shaders/110/mm_contour.vs
@@ -2,6 +2,7 @@
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
+uniform float offset;
attribute vec3 v_position;
@@ -9,6 +10,6 @@ void main()
{
// Add small epsilon to z to solve z-fighting between painted triangles and contour lines.
vec4 clip_position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
- clip_position.z -= 0.00001 * abs(clip_position.w);
+ clip_position.z -= offset * abs(clip_position.w);
gl_Position = clip_position;
}
diff --git a/resources/shaders/140/mm_contour.vs b/resources/shaders/140/mm_contour.vs
index 2f6419b8d..679291ba6 100644
--- a/resources/shaders/140/mm_contour.vs
+++ b/resources/shaders/140/mm_contour.vs
@@ -2,6 +2,7 @@
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
+uniform float offset;
in vec3 v_position;
@@ -9,6 +10,6 @@ void main()
{
// Add small epsilon to z to solve z-fighting between painted triangles and contour lines.
vec4 clip_position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
- clip_position.z -= 0.00001 * abs(clip_position.w);
+ clip_position.z -= offset * abs(clip_position.w);
gl_Position = clip_position;
}
diff --git a/resources/shaders/mm_contour.vs b/resources/shaders/mm_contour.vs
index f85fefb80..8423362e4 100644
--- a/resources/shaders/mm_contour.vs
+++ b/resources/shaders/mm_contour.vs
@@ -1,9 +1,11 @@
#version 110
+uniform float offset;
+
void main()
{
// Add small epsilon to z to solve z-fighting between painted triangles and contour lines.
vec4 clip_position = gl_ModelViewProjectionMatrix * gl_Vertex;
- clip_position.z -= 0.00001 * abs(clip_position.w);
+ clip_position.z -= offset * abs(clip_position.w);
gl_Position = clip_position;
}