• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Lapius · Sep 18, 2017 at 12:17 PM · uvuv mappingfbximporteruv coordinatesparser

UV tiling with already made coordinates.

Hi. I am making FBX parser in runtime and faced again the problem. FBX has information about vertices coordinates, IDs of those vertices how to make polygons (PolygonVertexIndex), UV coordinates, and UV indexes. Here is what you need: link text. The problem is that when I try to assign UV coordinates to mesh it says that UVs array MUST be the same as vertex array.

The problem is that mesh has 8 vertices (in the example), but Unwrapped UV has 14 vertices. One vertex on a mesh can have more than one UV coordinate vertex.

mesh.SetUVs() gives out of bounds error because vertex array is smaller than UV array.

I tried to use mesh.GetUVs() from the same object that was imported in Editor and it showed me 24 UV coordinates on the cube. While it has only 8 vertexes.

Any ideas how to put UV's with more vertices on an object while importing FBX?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by aleksandrk · Sep 18, 2017 at 02:12 PM

Hi! The mesh you're importing has 8 vertex coordinates, not 8 unique vertices. A unique vertex would be a set of position, uv and normal corresponding to the same vertex. You can get those depending on type of data (the linked file contains "Direct" and "IndexToDirect"). Direct means that the data is (nearly) ready, IndexToDirect means that it contains some data and indices into that data that map it to final layout. The amount of vertices in the first case is given by the number of entries in the array, and by the number of indices in the second case. To build the final triangles you need the data from PolygonVertexIndex, which gives you the indices of vertex coordinates, the data from normals and the data from UVIndex, which gives you the indices of UV coordinates.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lapius · Sep 19, 2017 at 10:35 AM 0
Share

So basically I need to create as many vertices as PolygonVertexIndex shows, map normals, and UVs?

avatar image aleksandrk Lapius · Sep 19, 2017 at 10:43 AM 0
Share

Yes, that's correct.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Assigning uv's to multiple faces 1 Answer

Help setting UV coordinates for code-generated plane 0 Answers

Tiling UV mapping? 3 Answers

UVW coordinates fbx destroyed after "hold on" / reread-fbx message inside Unity,.?? 0 Answers

dynamic created mesh with wrong render order 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges