Merge pull request #19799 from Ultimaker/CURA-12188_build_plate_z_fighting

[CURA-12188] Fix build plate z-fighting
This commit is contained in:
HellAholic 2024-11-08 11:26:34 +01:00 committed by GitHub
commit 2c42766b6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 5140 additions and 3477 deletions

View File

@ -252,19 +252,23 @@ class BuildVolume(SceneNode):
if not self.getMeshData() or not self.isVisible():
return True
theme = self._application.getTheme()
if not self._shader:
self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "default.shader"))
self._grid_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "grid.shader"))
theme = self._application.getTheme()
self._grid_shader.setUniformValue("u_plateColor", Color(*theme.getColor("buildplate").getRgb()))
self._grid_shader.setUniformValue("u_gridColor0", Color(*theme.getColor("buildplate_grid").getRgb()))
self._grid_shader.setUniformValue("u_gridColor1", Color(*theme.getColor("buildplate_grid_minor").getRgb()))
plate_color = Color(*theme.getColor("buildplate").getRgb())
if self._global_container_stack.getMetaDataEntry("has_textured_buildplate", False):
plate_color.setA(0.5)
self._grid_shader.setUniformValue("u_plateColor", plate_color)
renderer.queueNode(self, mode = RenderBatch.RenderMode.Lines)
renderer.queueNode(self, mesh = self._origin_mesh, backface_cull = True)
renderer.queueNode(self, mesh = self._grid_mesh, shader = self._grid_shader, backface_cull = True)
renderer.queueNode(self, mesh = self._grid_mesh, shader = self._grid_shader, backface_cull = True, transparent = True, sort = -10)
if self._disallowed_area_mesh:
renderer.queueNode(self, mesh = self._disallowed_area_mesh, shader = self._shader, transparent = True, backface_cull = True, sort = -9)
renderer.queueNode(self, mesh = self._disallowed_area_mesh, shader = self._shader, transparent = True, backface_cull = True, sort = -5)
if self._error_mesh:
renderer.queueNode(self, mesh=self._error_mesh, shader=self._shader, transparent=True,

View File

@ -360,8 +360,8 @@ geometry41core =
((v_prev_line_type[0] != 1) && (v_line_type[0] == 1)) ||
((v_prev_line_type[0] != 4) && (v_line_type[0] == 4))
)) {
float w = size_x;
float h = size_y;
float w = max(0.05, size_x);
float h = max(0.05, size_y);
myEmitVertex(v_vertex[0] + vec3( w, h, w), u_starts_color, normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left
myEmitVertex(v_vertex[0] + vec3(-w, h, w), u_starts_color, normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "ankermake_m5_platform.obj",
"has_machine_quality": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "ankermake_m5_extruder_0" },
"platform_texture": "ankermake_m5.png",
"preferred_material": "generic_pla",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "ankermake_m5c_platform.obj",
"has_machine_quality": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "ankermake_m5c_extruder_0" },
"platform_texture": "ankermake_m5c.png",
"preferred_material": "generic_pla",

View File

@ -11,6 +11,7 @@
"platform": "dagoma_sigma_pro.obj",
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_textured_buildplate": true,
"has_variants": true,
"machine_extruder_trains": { "0": "dagoma_sigma_pro_extruder" },
"platform_texture": "dagoma_sigma_pro.png",

View File

@ -11,6 +11,7 @@
"platform": "dagoma_sigma_pro.obj",
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_textured_buildplate": true,
"has_variants": true,
"machine_extruder_trains":
{

View File

@ -15,6 +15,7 @@
"preferred_material": "generic_pla",
"preferred_quality_type": "normal",
"machine_extruder_trains": { "0": "fdmextruder" },
"has_textured_buildplate": false,
"supports_usb_connection": true,
"supports_network_connection": false,
"supports_abstract_color": false,

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "oducceu",
"platform": "flyingbear_platform.obj",
"has_textured_buildplate": true,
"platform_texture": "flyingbear_platform.png",
"quality_definition": "flyingbear_base"
},

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "oducceu",
"platform": "flyingbear_platform.obj",
"has_textured_buildplate": true,
"platform_texture": "flyingbear_platform.png",
"quality_definition": "flyingbear_base"
},

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "barrnet",
"platform": "flyingbear_platform.obj",
"has_textured_buildplate": true,
"platform_texture": "flyingbear_platform.png",
"quality_definition": "flyingbear_base"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_adonis.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_adonis_extruder" },
"platform_offset": [
0,

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_hidra.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_hidra_extruder_0",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_hidra_plus.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_hidra_plus_extruder_0",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_230.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_230_extruder_0" },
"platform_texture": "Magna2_230.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_230.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_230_dual_extruder_0",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_300.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_300_extruder_0" },
"platform_texture": "Magna2_300.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_300.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_300_dual_extruder_0",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_400.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_400_extruder_0" },
"platform_texture": "Magna2_400.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_400.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_400_dual_extruder_0",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_500.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_2_500_extruder_0" },
"platform_texture": "Magna2_500.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_2_500.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_2_500_dual_extruder_0",

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_magna.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_i_extruder" },
"platform_offset": [
0,

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_magna_SE.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_SE_extruder" },
"platform_texture": "hellbot_magna_SE.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_SE_300.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_SE_300_extruder" },
"platform_texture": "Hellbot_Magna_SE_300.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "Hellbot_Magna_SE_Pro.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "hellbot_magna_SE_Pro_extruder" },
"platform_texture": "Hellbot_magna_SE_Pro.png"
},

View File

@ -10,6 +10,7 @@
"file_formats": "text/x-gcode",
"platform": "hellbot_magna.obj",
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains":
{
"0": "hellbot_magna_dual_extruder_1",

View File

@ -12,6 +12,7 @@
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_materials": true,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "koonovo_base_extruder_0" },
"platform_texture": "koonovo.png",
"preferred_material": "generic_pla",

View File

@ -11,6 +11,7 @@
"platform": "moai.obj",
"has_machine_quality": true,
"has_materials": false,
"has_textured_buildplate": true,
"machine_extruder_trains": { "0": "peopoly_moai_extruder_0" },
"platform_texture": "moai.jpg"
},

View File

@ -58,6 +58,7 @@
],
"has_machine_quality": true,
"has_materials": true,
"has_textured_buildplate": true,
"has_variants": true,
"machine_extruder_trains": { "0": "ultimaker_sketch_sprint_extruder" },
"platform_offset": [

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_200_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_250_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_300_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},

View File

@ -7,6 +7,7 @@
"visible": true,
"author": "Nail` Gimadeev (C)",
"platform": "uni_mini_platform.stl",
"has_textured_buildplate": true,
"platform_texture": "uni.png",
"quality_definition": "uni_base"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,7 @@ fragment =
float majorLine = min(majorGrid.x, majorGrid.y);
gl_FragColor = mix(minorGridColor, u_gridColor0, 1.0 - min(majorLine, 1.0));
gl_FragColor.a = u_plateColor.a;
}
vertex41core =
@ -88,6 +89,7 @@ fragment41core =
float majorLine = min(majorGrid.x, majorGrid.y);
frag_color = mix(minorGridColor, u_gridColor0, 1.0 - min(majorLine, 1.0));
frag_color.a = u_plateColor.a;
}
[defaults]