-
Notifications
You must be signed in to change notification settings - Fork 601
Open
Description
With kaolin==0.16.0, when I use easy_render with the camera above the center of my mesh, and the camera looking straight down, I get a black image.
from kaolin.render.easy_render import render_mesh, default_lighting
from kaolin.io.usd import import_mesh
from kaolin.render.camera import Camera
import torch
from torchvision.transforms import ToPILImage
mesh = import_mesh("my_mesh.usd", triangulate=True, with_materials=True).to("cuda")
mesh.vertices.min(axis=0), mesh.vertices.max(axis=0)
center = (mesh.vertices.min(axis=0)[0] + mesh.vertices.max(axis=0)[0]) / 2
offset = 0.0
camera_y_position = 3.0
eye = torch.tensor([center[0], camera_y_position , center[2]], dtype=torch.float32)
at = torch.tensor([center[0] + offset, 0, center[2]], dtype=torch.float32)
lighting = default_lighting().to("cuda")
camera = Camera.from_args(
eye=eye,
at=at,
up=torch.tensor([0.0, 1.0, 0.0]),
fov=45,
width=512, height=512,
device='cuda'
)
with torch.jit.optimized_execution(False):
with torch.no_grad():
render = render_mesh(
camera,
mesh,
lighting,
)
ToPILImage()(render["render"][0].transpose(0, 2))
But if I add a slight offset, e.g. offset = 0.01
to either the X or Z coordinate, then I get a proper rendering.
prokolyvakis and Caenorst
Metadata
Metadata
Assignees
Labels
No labels