-
Notifications
You must be signed in to change notification settings - Fork 250
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
Expected format for textures? #13
Comments
Hi Justin, my CUDA kernel is the same as the original CUDA code in the Chainer inplementation by the authors. I am not an expert in Computer Graphics and I don't to give you an incorrect answer, so I think it will be better to ask the original authors. Please let me know if you have any additional questions. |
Thanks! I'll ask over at the original repo. |
Did you ever figure this out? I looked on the issues page of the original implementation, and didn't find your question. |
@jbohnslav Yes, after looking at the code again I figured it out. For each face, the texture tensor contains a discretized set of samples (in barycentric coordinates) of linear combinations of the colors for each vertex; during rasterization these sampled colors are re-sampled to generate the actual colors of faces. The texture_size controls the number of color pre-samples per face. More concretely, suppose texture_size = T. Then textures has shape (N, F, T, T, T, 3), with the following semantics (up to a possible permutation of vertices): textures[n, f, T - 1, 0, 0] is the RGB color of vertex 0 for face f Other elements of the textures matrix give linear combinations of the colors at vertices, so for example: textures[n, f, 0, 0, 0] is 0 |
Thanks so much! |
I'm having a hard time understanding the way that textures are represented inside the renderer.
It seems internally (e.g. from the texture optimization example) that textures are stored in Tensors of shape
(batch_size, num_faces, texture_size, texture_size, texture_size, 3)
which I understand as representing a 3D grid of size texture_size^3 of RGB value for each face. How does this relate to the per-vertex UV texture coordinates that are stored in .obj files?
The CUDA kernel for loading textures appears to be bilinearly sampling the RGB values from the texture images, but I am having a hard time understanding exactly what is happening inside this kernel and exactly what it returns. Can you give a brief explanation?
The text was updated successfully, but these errors were encountered: