NVIDIAGameWorks/kaolin

Running the test code did not yield results

yejr0229 opened this issue · 3 comments

I run this test code by kaolin,I suppose get a triangle,but get a completely black image:

import kaolin as kal
import torch
import numpy as np
import cv2

face_verts = np.array([[-0.5, 0.5], [0.5, 0.5], [-0.5, -0.5]])
face_vertices_image = torch.from_numpy(face_verts)[None, None, :, :].float().cuda()

face_vertices_z = -torch.ones_like(face_vertices_image)[:, :, :, 0]
face_normals_z = torch.ones_like(face_vertices_image)[:, :, :, 0]

face_attributes = [
torch.ones((1, 1, 3, 1), device='cuda')
]

height = 1024
width = 1024
image_features, soft_mask, face_idx = kal.render.mesh.dibr_rasterization(
height, width, face_vertices_z,
face_vertices_image, face_attributes, face_normals_z,
)

mask = image_features[0].squeeze(0)
cv2.imwrite("mask.png", (mask.detach().cpu() * 255).numpy().astype(np.uint8))

pass

kaolin version:0.10.0
torch1.11.0+cu11.5

gpu:1080Ti

Hi @yejr0229 , please test the newer easy_render API.

Closing