docstr: Test output when rendering a sphere that is beyond zfar with a SoftPhongShader.
  This renders a sphere of radius 500, with the camera at x=1500 for different
  settings of zfar.  This is intended to check 1) setting cameras.zfar propagates
  to the blender and that the rendered sphere is (soft) clipped if it is beyond
  zfar, 2) make sure there are no numerical precision/overflow errors associated
  with larger world coordinates
docstr_tok: ["Test","output","when","rendering","a","sphere","that","is","beyond","zfar","with","a","SoftPhongShader",".","This","renders","a","sphere","of","radius","500",",","with","the","camera","at","x=1500","for","different","settings","of","zfar",".","This","is","intended","to","check","1",")","setting","cameras.zfar","propagates","to","the","blender","and","that","the","rendered","sphere","is","(","soft",")","clipped","if","it","is","beyond","zfar",",","2",")","make","sure","there","are","no","numerical","precision\/overflow","errors","associated","with","larger","world","coordinates"]
code: def _simple_sphere_outside_zfar(self, rasterizer_type):
      """
      Test output when rendering a sphere that is beyond zfar with a SoftPhongShader.
      This renders a sphere of radius 500, with the camera at x=1500 for different
      settings of zfar.  This is intended to check 1) setting cameras.zfar propagates
      to the blender and that the rendered sphere is (soft) clipped if it is beyond
      zfar, 2) make sure there are no numerical precision/overflow errors associated
      with larger world coordinates
      """
      device = torch.device("cuda:0")
  
      # Init mesh
      sphere_mesh = ico_sphere(5, device)
      verts_padded = sphere_mesh.verts_padded() * 500
      faces_padded = sphere_mesh.faces_padded()
      feats = torch.ones_like(verts_padded, device=device)
      textures = TexturesVertex(verts_features=feats)
      sphere_mesh = Meshes(
          verts=verts_padded, faces=faces_padded, textures=textures
      )
  
      R, T = look_at_view_transform(1500, 0.0, 0.0)
  
      # Init shader settings
      materials = Materials(device=device)
      lights = PointLights(device=device)
      lights.location = torch.tensor(
          [0.0, 0.0, +1000.0], device=device
      )[None]
  
      raster_settings = RasterizationSettings(
          image_size=256, blur_radius=0.0, faces_per_pixel=1
      )
      for zfar in (10000.0, 100.0):
          cameras = FoVPerspectiveCameras(
              device=device,
              R=R,
              T=T,
              aspect_ratio=1.0,
              fov=60.0,
              zfar=zfar,
          )
          blend_params = BlendParams(
              1e-4 if rasterizer_type == MeshRasterizer else 0.5,
              1e-4,
              (0, 0, 1.0),
          )
          rasterizer = rasterizer_type(
              cameras=cameras, raster_settings=raster_settings
          )
          if rasterizer_type == MeshRasterizer:
              shader = SoftPhongShader(
                  blend_params=blend_params,
                  cameras=cameras,
                  lights=lights,
                  materials=materials,
              )
          else:
              shader = SplatterPhongShader(
                  device=device,
                  blend_params=blend_params,
                  cameras=cameras,
                  lights=lights,
                  materials=materials,
              )
          renderer = MeshRenderer(rasterizer=rasterizer, shader=shader)
          images = renderer(sphere_mesh)
          rgb = images[0, ..., :3].squeeze().cpu()
  
          filename = (
              "test_simple_sphere_outside_zfar_"
              f"{int(zfar)}_{rasterizer_type.__name__}.png"
          )
  
          # Load reference image
          image_ref = load_rgb_image(filename, DATA_DIR)
  
          if DEBUG:
              Image.fromarray(
                  (rgb.numpy() * 255).astype(np.uint8)
              ).save(DATA_DIR / ("DEBUG_" + filename))
  
          self.assertClose(rgb, image_ref, atol=0.05)
  
imports: import os
  import unittest
  from collections import namedtuple
  from itertools import product
  import numpy
  import torch
  from PIL import Image
  from pytorch3d.io import load_obj, load_objs_as_meshes
  from pytorch3d.renderer import AmbientLights, FoVOrthographicCameras, FoVPerspectiveCameras, look_at_view_transform, Materials, MeshRasterizer, MeshRenderer, MeshRendererWithFragments, OrthographicCameras, PerspectiveCameras, PointLights, RasterizationSettings, TexturesAtlas, TexturesUV, TexturesVertex
  from pytorch3d.renderer.fisheyecameras import FishEyeCameras
  from pytorch3d.renderer.mesh.shader import BlendParams, HardFlatShader, HardGouraudShader, HardPhongShader, SoftPhongShader, SoftSilhouetteShader, SplatterPhongShader, TexturedSoftPhongShader
  from pytorch3d.renderer.opengl import MeshRasterizerOpenGL
  from pytorch3d.structures.meshes import join_meshes_as_batch, join_meshes_as_scene, Meshes
  from pytorch3d.utils.ico_sphere import ico_sphere
  from pytorch3d.utils.torus import torus
  from .common_testing import get_pytorch3d_dir, get_tests_dir, load_rgb_image, TestCaseMixin
label_desc: Use image node_id 31 for calling the TestRenderMeshes obj's underlying member method code with example usage: obj._simple_sphere_outside_zfar(rasterizer_type) without return types