pytorch3d
pytorch3d copied to clipboard
How can I use OpenGL-related methods in PyTorch3D to render semi-transparent textures?
How can I use OpenGL-related methods in PyTorch3D to render semi-transparent textures? I want to achieve the effect shown in the image below, or does PyTorch3D support using the blend function like gl.glEnable(gl.GL_BLEND) in MeshRasterizerOpenGL?
In my scene, after rasterization, a single pixel might correspond to multiple faces. If I use MeshRasterizerOpenGL, its rasterization method is:
pix_to_face, bary_coords, zbuf = self.opengl_machinery(
meshes_gl_ndc, projection_matrix, image_size
)
The pix_to_face result always contains only one face (with a shape of [N, H, W, 1]). However, when I use MeshRasterizer, the rasterization method is rasterize_meshes, which allows modifying the result by setting faces_per_pixel. The reason I’m not choosing MeshRasterizer is that MeshRasterizerOpenGL is faster, and I don’t care about differentiability. Is it possible to achieve my requirement using MeshRasterizerOpenGL? Or how should I modify it to get the result I want? @amyreese @JaapSuter @thatch @yurimalheiros could anyone help me with it?