From 21eb2a863ac43a993272a228b8e3500bf05b80d0 Mon Sep 17 00:00:00 2001 From: sadaszewski Date: Sat, 18 Feb 2023 18:16:22 +0100 Subject: [PATCH 1/2] Update renderer.py --- pyrender/renderer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyrender/renderer.py b/pyrender/renderer.py index f212907..894f650 100644 --- a/pyrender/renderer.py +++ b/pyrender/renderer.py @@ -599,6 +599,12 @@ def _bind_and_draw_primitive(self, primitive, pose, program, flags): if primitive.mode == GLTF.POINTS: glEnable(GL_PROGRAM_POINT_SIZE) glPointSize(self.point_size) + + # Disable depth mask if specified in material + if material.depthMask == False: + glDepthMask(GL_FALSE) + else: + glDepthMask(GL_TRUE) # Render mesh n_instances = 1 @@ -617,6 +623,9 @@ def _bind_and_draw_primitive(self, primitive, pose, program, flags): # Unbind mesh buffers primitive._unbind() + + # Depth mask is on by default in forward pass + glDepthMask(GL_TRUE) def _bind_lighting(self, scene, program, node, flags): """Bind all lighting uniform values for a scene. From 572070c7e7a80ddb1ed4fa68b872ba4a490e03dc Mon Sep 17 00:00:00 2001 From: sadaszewski Date: Sat, 18 Feb 2023 18:19:15 +0100 Subject: [PATCH 2/2] Update material.py --- pyrender/material.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyrender/material.py b/pyrender/material.py index 3ce9c2d..98dfe06 100644 --- a/pyrender/material.py +++ b/pyrender/material.py @@ -109,6 +109,8 @@ def __init__(self, self.wireframe = wireframe self._tex_flags = None + + self.depthMask = True @property def name(self): @@ -249,6 +251,16 @@ def textures(self): material. """ return self._compute_textures() + + @property + def depthMask(self): + return self._depthMask + + @depthMask.setter + def depthMask(self, value): + if not isinstance(value, bool): + raise TypeError('depthMask must be bool') + self._depthMask = value def _compute_transparency(self): return False