Skip to content

Commit

Permalink
Optionally return the gbuffer from the renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
mworchel committed Dec 1, 2023
1 parent 710b63d commit a12a98b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion diffshadow/simple_renderer/simple_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _gbuffer_pass(self, mesh: Mesh, camera: Camera, resolution: Tuple[int, int])
return gbuffer


def render(self, meshes: List[Mesh], lights: List[Union[DirectionalLight, SpotLight, PointLight]], camera: Camera, resolution: Tuple[int, int]=(512, 512), ambient: float = 0.1, background: float = 0, use_shadows: bool = True, smoothing_kernel_width: int = 3, smoothing_kernel: KernelType = KernelType.Box, use_shadow_antialiasing: bool = True, return_visibility: bool = False, return_mask: bool = False):
def render(self, meshes: List[Mesh], lights: List[Union[DirectionalLight, SpotLight, PointLight]], camera: Camera, resolution: Tuple[int, int]=(512, 512), ambient: float = 0.1, background: float = 0, use_shadows: bool = True, smoothing_kernel_width: int = 3, smoothing_kernel: KernelType = KernelType.Box, use_shadow_antialiasing: bool = True, return_visibility: bool = False, return_mask: bool = False, return_gbuffer: bool = False):
# Apply model matrices and merge all meshes
scene_mesh = merge_meshes([m.with_applied_transform() for m in meshes])

Expand Down Expand Up @@ -177,5 +177,8 @@ def render(self, meshes: List[Mesh], lights: List[Union[DirectionalLight, SpotLi

if return_mask:
results += [ gbuffer['mask'] ]

if return_gbuffer:
results += [ gbuffer ]

return results[0] if len(results) == 1 else results

0 comments on commit a12a98b

Please sign in to comment.