NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.35k stars 144 forks source link

Does texture(tex, uv) propagate any gradients to uv ? #20

Closed yataoz closed 3 years ago

yataoz commented 3 years ago

Hi,

I have a neural net that outputs a uv map, which will be used as input to the texture sampling op. I wonder if the texture op passes any gradients to the uv input during training? Thanks.

s-laine commented 3 years ago

Sorry for the late reply — yes, the texture op propagates gradients to the input uv tensor as you would expect. If using sampling mode 'nearest', these gradients will be zero because the sampling result is piecewise constant, but all other sampling modes involve interpolation between texels and therefore produce gradients for the texture coordinates.