BachiLi / redner

Differentiable rendering without approximation.
https://people.csail.mit.edu/tzumao/diffrt/
MIT License
1.39k stars 139 forks source link

Rendering with interpolated vertex colors instead of texture? #63

Closed francoisruty closed 5 years ago

francoisruty commented 5 years ago

hi, is it possible to render with redner a mesh with vertex colors, instead of using a texture?

BachiLi commented 5 years ago

As mentioned in https://github.com/BachiLi/redner/issues/12, no. But since there is more than one request I might add it in the future. I still think that vertex color is not the "right thing" to do since 1) It is difficult to do proper texture filtering on vertex space. 2) It does not make much sense to use the same sampling rate for both geometry and material.

I think the proper way of doing this is to use a texture (especially now we have automatic uv generation wrapper code thanks to xatlas) and play with the texture resolution. It also plays better with all the convolutional neural network stuffs.

francoisruty commented 5 years ago

ok, I'll find a workaround, thanks for the info (NOTE: I agree using vertex colors is not good but some 3D models that have been dimensionnally reduced by PCA use vertex colors for color information, as it's easier to manipulate with PCA, so in this case the choice is not up to me unfortunately)

BachiLi commented 5 years ago

Good point. I will add vertex color sometimes this week.

francoisruty commented 5 years ago

that would be awesome, let me know if you need any help, I'd be glad to give you a hand

BachiLi commented 5 years ago

Done. See test_vertex_color.py. I added a color field to the Shape data structure and a use_vertex_color flag in the material so that one can use the color field. Feel free to propose changes

Here's an example fitting grey color to a uniformly random vertex color field. rendering: out vertex color visualization: out_color

francoisruty commented 5 years ago

thanks very much, I'll test this