pmh47 / dirt

DIRT: a fast differentiable renderer for TensorFlow
MIT License
312 stars 63 forks source link

About render normal map #110

Closed lll-gen closed 2 years ago

lll-gen commented 2 years ago

hello, i used dirty to render the normal map and the result looks different from the normal map from pifuhd, can you tell me why? Below is my rendering code: **_vertices_split, faces_split = dirt.lighting.split_vertices_by_face(m_v, m_f) vertices_split = tf.concat([vertices_split, tf.ones_like(vertices_split[:, :, -1:])], axis=2) vertices_view_split = tf.einsum('evi,ij->evj', vertices_split, view_matrix) projected_vertices_split = tf.einsum('eij,jk->eik', vertices_view_split, projection_matrix) vertex_normals_split = dirt.lighting.vertex_normals_pre_split(vertices_split, faces_split)

vertex_normals_split = tf.tile(vertex_normals_split[np.newaxis, ...], (tf.shape(m_v)[0], 1, 1))

normals = dirt.rasterise_batch(
    background=tf.zeros([1, height, width, 3]),
    vertices=projected_vertices_split,
    vertex_colors=vertex_normals_split,
    faces=tf.tile(tf.cast(faces_split, tf.int32)[np.newaxis, ...], (tf.shape(m_v)[0], 1, 1))
)_**

img1. This is the dirty rendering result: img2 This is the normal map from PIFUHD: img

Can you tell me why their colors are so different?

lll-gen commented 2 years ago

The result of dirt is rendering the normal of smpl.

I re-upload the normal map of pifuhd and dirt.

Can you tell me why their colors are so different?

dirt pifuhd