-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Choice of texture interpolation method #618
Comments
@Dragoo417 You could actually implement this yourself. e.g. if you are using the UV textures class you could subclass this to create a custom class and override the pytorch3d/pytorch3d/renderer/mesh/textures.py Lines 880 to 957 in cc08c6b
|
Oh, I didn't think of that. Thank you for pointing it out ! |
I finally got around to try this and encoutered a problem: I subclassed |
Can you paste the relevant parts of your code? |
My custom class: class NoInterpolationTexturesUV(TexturesUV):
def sample_textures(self, fragments, **kwargs) -> torch.Tensor:
print("hi")
# same code as in base class And I use it as such: tex = NoInterpolationTexturesUV(
verts_uvs=[verts_uvs], # Comes from loading an .obj file
faces_uvs=[faces_uvs], # Comes from loading an .obj file
maps=self._adversarial_texture_tensor
)
myMesh = Meshes(
verts=[verts.to(self._device)], # Comes from loading an .obj file
faces=[faces.verts_idx.to(self._device)], # Comes from loading an .obj file
textures=tex
) Thank you for your swift reply. Let me know if anthing more is needed. |
That should work. If you render myMesh you should see "hi". If you ever call |
I do actually call Edit: I looked at the code and it looks like I would have to override the |
The easiest thing for now would be to define extend in your own class
This is the same as the extend in TexturesUV except I replace |
This works perfectly, thanks a lot for your time and have a nice day ! |
Summary: 3 extend functions in textures.py updated to call `self.__class__` rather than create a new object of its type. As mentioned in #618 . Reviewed By: bottler Differential Revision: D28281218 fbshipit-source-id: b9c99ab87e46a3f28c37efa1ee2c2dceb560b491
Choice of texture interpolation method
Motivation
It would be useful to be able to choose the interpolation method used to sample the texture of a mesh. I would like that the visible texture on the mesh matches the texture as closely as possible but it is not possible for now. I believe it is fixed as bilinear for now, which yields blurry patches of colors for low resolution textures.
The text was updated successfully, but these errors were encountered: