facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.7k stars 1.3k forks source link

Renders looking unrealistic/Odd Colors #1781

Closed abhimanyuchadha96 closed 2 months ago

abhimanyuchadha96 commented 5 months ago

If you do not know the root cause of the problem / bug, and wish someone to help you, please post according to this template:

🐛 Bugs / Unexpected behaviors

The renders don't look the real 3D object as the colors are off and details are also missing. Mostly the 3D objects that are white in color or have some amount of white in them are coming out grayish. Not sure if this is a bug or just the SoftPhongShader and/or RasterizationSettings need to be updated with a specific value.

NOTE: Please look at the existing list of Issues tagged with the label 'bug`. Only open a new issue if this bug has not already been reported. If an issue already exists, please comment there instead..

Instructions To Reproduce the Issue:

lights = DirectionalLights(device=device, direction = [self.centroid])
RasterizationSettings(
            image_size=2048,
            blur_radius=0,
            faces_per_pixel=1, bin_size = 100
        )

All other camera parameters are default taken from https://colab.research.google.com/github/facebookresearch/pytorch3d/blob/stable/docs/tutorials/render_textured_meshes.ipynb#scrollTo=CDQKebNNfBMI

bottler commented 5 months ago

The color of the lighting is  defaulted. See https://github.com/facebookresearch/pytorch3d/blob/main/pytorch3d/renderer/lighting.py#L164-L166 . So you can only see anything close to white at a specular highlight. If you want white things to be white, perhaps you could just use more ambient lighting, e.g. change the balance between the components, which should add to 1 in each channel, to something like

lights = DirectionalLights(
    device=device,
    ambient_color=((1.0, 1.0, 1.0),),
    diffuse_color=((0., 0., 0.),),
    specular_color=((0., 0., 0.),),
    direction = [self.centroid])