-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Unexpected rendering result wrt to the object's distance to the camera #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @unlugi! Thank you for bringing this issue up. I was able to reproduce your issue. We will look into it and get back to you soon! |
@unlugi
Now if there is more faces per bin than the number specified, our rasterizer loses it's mind (lol!) and overflows and thus causes the issue that you see. So you need to set the So if you set
The result you get for We will add a fix in the future to notify users that there has been an overflow so that they need to set this to a higher value. Also, alternatively you could run a naive rasterizer by setting
which doesn't do any tiling, but is slower, and you would get: |
@gkioxari |
Summary: Since coarse rasterization on cuda can overflow bins, we detect when this happens for memory safety. See #348 . Also try to print a warning. Reviewed By: patricklabatut Differential Revision: D33065604 fbshipit-source-id: 99b3c576d01b78e6d77776cf1a3e95984506c93a
This is still a good idea! |
First of all, thank you for the great library!
I'm using Pytorch3D (nightly build 0.2.0 on Ubuntu 16.04) to render some models from the ShapeNet dataset. I noticed that the rendering result changes when I change the distance of the camera to the object. You can find the code, sample results and the .obj file below. (Note: I have implemented a custom shader called SoftFlatShader which is flat_shading followed by softmax blending: you can also find it below.)
`
import os
import torch
import torch.nn as nn
from skimage.io import imread, imsave
from pytorch3d.io import load_objs_as_meshes
from pytorch3d.io import load_obj
from pytorch3d.structures import Meshes
from pytorch3d.renderer import Textures
from pytorch3d.renderer import (
look_at_view_transform,
FoVPerspectiveCameras,
PerspectiveCameras,
PointLights,
DirectionalLights,
Materials,
RasterizationSettings,
MeshRenderer,
MeshRasterizer,
SoftPhongShader,
HardPhongShader,
HardFlatShader,
SoftSilhouetteShader,
SoftGouraudShader,
HardGouraudShader,
BlendParams,
softmax_rgb_blend
)
from pytorch3d.renderer.mesh.shading import flat_shading
class SoftFlatShader(nn.Module):
def load_untextured_mesh(mesh_path, device):
def render_mesh(mesh, R, T, device, img_size=512):
def render_depth(mesh, R, T, device, img_size=512):
if name == "main":
`
When the dist_to_cam parameter is 1, the rendering result is weird(white rectangle on the windshield). I was wondering why this happens?


This is the output for dist_to_cam=0.6:


This is the model file:
model_normalized.zip
The text was updated successfully, but these errors were encountered: