torchdrivesim.rendering.pytorch3d ================================= .. py:module:: torchdrivesim.rendering.pytorch3d .. autoapi-nested-parse:: PyTorch3D-based renderers, used by default in TorchDriveSim. Attributes ---------- .. autoapisummary:: torchdrivesim.rendering.pytorch3d.is_available Exceptions ---------- .. autoapisummary:: torchdrivesim.rendering.pytorch3d.Pytorch3DNotFound Classes ------- .. autoapisummary:: torchdrivesim.rendering.pytorch3d.RenderingBlend torchdrivesim.rendering.pytorch3d.Pytorch3DRendererConfig torchdrivesim.rendering.pytorch3d.Shader2D torchdrivesim.rendering.pytorch3d.Pytorch3DRenderer Functions --------- .. autoapisummary:: torchdrivesim.rendering.pytorch3d.construct_pytorch3d_cameras Module Contents --------------- .. py:data:: is_available :value: True .. py:exception:: Pytorch3DNotFound Bases: :py:obj:`ImportError` Import can't find module, or can't find name in module. .. py:class:: RenderingBlend Bases: :py:obj:`enum.Enum` Blending choices from pytorch3d. May be ignored by other renderer types. https://pytorch3d.readthedocs.io/en/latest/modules/renderer/blending.html .. py:attribute:: hard :value: 'hard' .. py:attribute:: soft :value: 'soft' .. py:attribute:: sigmoid :value: 'sigmoid' .. py:class:: Pytorch3DRendererConfig Bases: :py:obj:`torchdrivesim.rendering.base.RendererConfig` Configuration of pytorch3d-based renderer. .. py:attribute:: backend :type: str :value: 'pytorch3d' .. py:attribute:: differentiable_rendering :type: RenderingBlend .. py:class:: Shader2D(device='cpu', background_color: Tuple[float, float, float] = (0, 0, 0), blend=RenderingBlend.soft) Bases: :py:obj:`torch.nn.Module` Shader that ignores lighting, based on https://github.com/facebookresearch/pytorch3d/issues/84 .. py:attribute:: background_color :value: (0, 0, 0) .. py:attribute:: blend .. py:method:: forward(fragments, meshes, **kwargs) -> torch.Tensor .. py:class:: Pytorch3DRenderer(cfg: Pytorch3DRendererConfig, *args, **kwargs) Bases: :py:obj:`torchdrivesim.rendering.base.BirdviewRenderer` Renderer based on pytorch3d, using an orthographic projection and a trivial shader. Works on both GPU and CPU, but CPU is very slow. .. py:attribute:: cfg :type: Pytorch3DRendererConfig .. py:attribute:: renderer .. py:method:: render_rgb_mesh(mesh: torchdrivesim.mesh.RGBMesh, res: torchdrivesim.utils.Resolution, cameras: torchdrivesim.rendering.base.Cameras) -> torch.Tensor Renders a given mesh, producing BxHxWxC tensor image of float RGB values in [0,255] range. .. py:method:: make_renderer(res, blend, background_color) :classmethod: .. py:function:: construct_pytorch3d_cameras(cameras: torchdrivesim.rendering.base.Cameras) -> pytorch3d.renderer.FoVOrthographicCameras