Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
avatar image
1
Question by jimmyfo · Sep 17, 2013 at 07:42 PM · uvvertexuv mappingmappingface

UV Mapping - by vertex or face? Weird banding

Hi, I have looked around quite a bit and understand the the [0..1] range for UV maps. However, I have read in different places the number of UVs to be assigned to a mesh - in some cases, it seems to be by the number of vertices, in other cases by the number of faces * 3 (in the case of shared vertices).

I ask because I've tried the following to UV map a sphere (I'd like it to look as it it does in the preview window on the lower right) using this wikipedia code:

             for (int i = 0; i < vertices.Count; i++) {
                 Vector3 dir = Vector3.Normalize(Vector3.zero - vertices[i]);
                 uvs.Add(new Vector2((0.5f + Mathf.Atan2(dir.z, dir.x)) / (2 * Mathf.PI), (0.5f - Mathf.ASin(dir.y)) / (Mathf.PI)));
             }


When I set the mesh UVs to be that list I create, that shows:

alt text

However, if I try to do it by face (adding a uv record for each vertex in each face, even if shared) I don't get anything at all. Thoughts?

uv1.png (383.8 kB)
Comment
Add comment · Show 1
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 whydoidoit · Sep 18, 2013 at 04:05 AM 0
Share

Well it's definitely by vertex - now as to the banding, I'm having a bad head day and can't quite figure out if the mapping function you are using is creating artefacts near the 1 point. It looks to me like something is returning a value of 1 or 0 at the start and end of the seam. Float inaccuracy? Something wrong with the function? Haven't got the brain power this morning to tell you I'm afraid :S

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Sep 18, 2013 at 06:09 AM

I can't test it, but I would say this:

     (0.5f + Mathf.Atan2(dir.z, dir.x)) / (2 * Mathf.PI)

Should be:

     (0.5f + Mathf.Atan2(dir.z, dir.x) / (2 * Mathf.PI))

You also divide the 0.5 by 2PI which doesn't make much sense.

edit

The same for the second value. Take another look at the wiki formula

Comment
Add comment · 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
0

Answer by DarkPixel · Oct 06, 2013 at 02:47 PM

Here's a good article that explain the possible problems (and how to solve them) with sphere UVs

Sphere Mesh Generation

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Shared vertices or vertices for each face? 0 Answers

How to get to know a mesh' faces normals? 0 Answers

Select a face of an object ingame 3 Answers

Vertex animation or uv animation ? which one is more efficient? 1 Answer

How can I convert the texture coordinates of the multi-spite to 0-1? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges