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

How to solve shadows that appear in rendering #1686

Open Frq-F opened 10 months ago

Frq-F commented 10 months ago

When I used Pytorch3D to render the tooth model, shadows appeared, making some teeth unable to be clearly displayed. Where should I modify and remove shadows? I tried three types of light sources to render, but I found that none of them could solve this problem. As shown in the figure below, the teeth in the upper left corner are shaded, and the shape of the teeth is not clearly rendered.

U_final

bottler commented 10 months ago

I can't see the image. Mesh Rendering in PyTorch3D doesn't model shadows, the effect must be from elsewhere, e.g. lighting or texture.

Frq-F commented 10 months ago

Thank you for your suggestion. After adjusting the position of the point light source, the shadows no longer appear.

code: verts_rgb = torch.ones_like(verts) textures=TexturesVertex(verts_features=verts_rgb) lights = PointLights(device=device,location=((1, 0, 0),))

I tried to calculate the normal of the model again and assign it to the texture. I have found that no matter what angle, the rendered image using normal information will not show shadows. Why is this?

bottler commented 10 months ago

What is meant by "calculate the normal again"? The normals depend only on the verts and faces of the mesh - they are not related to the texture, the light or the camera. So they won't change. And what do you mean by "assign it to the texture"?

Note that these color changes are just the specular and diffuse components of lighting on the material, they aren't shadows e.g. of part of the mesh on other parts.