PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.99k stars 1.18k forks source link

Trouble UV Mapping Image Texture to Mesh #2683

Closed abhihjoshi closed 5 months ago

abhihjoshi commented 1 year ago

I am currently having some trouble mapping an image texture onto a mesh. The cube in my particular case is such that its faces are of 3 vertices, not 4. I have the face vertex indices, the vertices (i.e. their coordinate points), and also the texture coordinates. I also have a list of the texture coordinates that correspond to each face. I am confused how to put these together or if I need more information to properly UV map the textures onto the meshes.

Also, I am currently using the Python APIs to convert the mesh to USD. I would really appreciate any help on this matter and I am also happy to share my .obj/.mtl and .png files for the mesh I am trying to convert.

Could someone provide an example of the code of how I might go about accomplishing this. I am still a little new to USD, so any explanation of how this works is much appreciated!

The current methods I am using are GetPointsAttr, GetFaceVertexCountsAttr, GetFaceVertexIndicesAttr. Also, to set my texture coordinates, I use

self.texcoords = UsdGeom.PrimvarsAPI(self.prim).CreatePrimvar("st",
                                    Sdf.ValueTypeNames.TexCoord2fArray,
                                    UsdGeom.Tokens.varying)
self.texcoords.Set(texcoords)

Thanks!

jesschimein commented 1 year ago

Filed as internal issue #USD-8698

spiffmon commented 1 year ago

Hi @awesome-aj0123 , I think this question might be more appropriate for the ASWF #wg-usd-assets or #wg-usd slack channels?

abhihjoshi commented 1 year ago

Where can I join these channels?

jesschimein commented 12 months ago

Hi Abhishek, You can find the #wg-usd-assets or #wg-usd slack channels in the ASWF slack instance! Here's an invite to the Slack instance. (Note: the link expires in 30 days) https://join.slack.com/t/academysoftwarefdn/shared_invite/zt-23cgkn377-yoUK4SZDDo1bVeoQqUOy3Q

On Thu, Sep 14, 2023 at 6:01 PM Abhishek Joshi @.***> wrote:

Where can I join these channels?

— Reply to this email directly, view it on GitHub https://github.com/PixarAnimationStudios/OpenUSD/issues/2683#issuecomment-1720342166, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARL2WZPK2IW2REIEBKOXIDLX2OSEZANCNFSM6AAAAAA4VQR4UQ . You are receiving this because you commented.Message ID: @.***>

spiffmon commented 5 months ago

Closing this, hoping you found useful advice on ASWF, @awesome-aj0123 .