Skip to content
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

UV texture map appears to be wrong #43

Closed
MatisHudon opened this issue Jun 19, 2019 · 5 comments
Closed

UV texture map appears to be wrong #43

MatisHudon opened this issue Jun 19, 2019 · 5 comments

Comments

@MatisHudon
Copy link

Hello,

I have been trying to load a model with a non trivial texture Map (Kd_map), I think there is a problem with the texture mapping. To be sure I altered the chessboard texture of the teapot with asymmetries and rendered it with redner, I also opened the same model with the modified texture in meshlab, and saw that the mapping were really different. I've tried to reverse "(1-x)" the uvs_pool when loading the obj file but I couldn't get the same mapping as in meshlab so it appears more complex than that.

@BachiLi
Copy link
Owner

BachiLi commented Jun 21, 2019

Hi,

If there is something wrong I think it's in the uv map of the model but not the texture mapping code. Can you share the model, textures, and expected results?

@MatisHudon
Copy link
Author

Hi,

I understand your concern. However, I have tried many obj/mtl with texture and not one loads correctly. For example a Free obj from CGTrader: https://www.cgtrader.com/items/234469/download-page. If you load it in meshlab you can see the expected result (note that you might need to edit file paths in the mtl file). You can load it with the pose estimation tutorial with this camera setup:

cam = pyredner.Camera(position = torch.tensor([0.0, 80.0, 200.0]),
                      look_at = torch.tensor([0.0, 80.0, 0.0]),
                      up = torch.tensor([0.0, 1.0, 0.0]),
                      fov = torch.tensor([55.0]), # in degree
                      clip_near = 1e-2, # needs to > 0
                      resolution = (256, 256),
                      fisheye = False)

@BachiLi
Copy link
Owner

BachiLi commented Jun 26, 2019

Looks like a bug in the obj loader. Let me check.

@BachiLi
Copy link
Owner

BachiLi commented Jun 26, 2019

Looks like obj textures conventionally have (0, 0) at lower left, so I need to flip y coordinate to obtain correct uv mapping. I added a flag "flip_tex_coords" in load_obj and set the default to true (similar to Mitsuba). Now the rendering matches MeshLab's result:

rendering
target

meshlab
meshlab_screenshot

Let me know if the latest commit fixed your problem or not.

@MatisHudon
Copy link
Author

I was suspecting something like this. Perfect it works now, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants