NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

depth image render

pysmeeatioj opened this issue · comments

Is there a way to render depth using nvdiffrast? And can it remain differentiable? What about the normal map?

Yes, both are possible. For depth, compute per-vertex camera-space depths and use the interpolate op with that as a vertex attribute to get a differentiable depth map. Similarly, to render a normal buffer, construct per-vertex normal vectors in any space you like, and interpolate those to get a per-pixel result.

Yes, both are possible. For depth, compute per-vertex camera-space depths and use the interpolate op with that as a vertex attribute to get a differentiable depth map. Similarly, to render a normal buffer, construct per-vertex normal vectors in any space you like, and interpolate those to get a per-pixel result.

Thank you for your prompt reply! Are there any examples or tutorials for reference?

A comment reply here appears to contain an example of interpolating a depth value, but I haven't tested if it works. For normal vectors, the solution is similar. See, e.g., here for an example of normal buffer computation in a different project built on top of nvdiffrast.

image
image
thinks, it works! I get normal map by the depth gradient. And it is differentiable.

op of nvd

Can you share your code example for obtaining the normal map?