Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
0
Question by sdevet · Feb 02, 2014 at 04:19 AM · meshnormaltangents

Missing tangents on some vertices

I'm calculating tangents for simple polygons using the method described here: http://answers.unity3d.com/questions/7789/calculating-tangents-vector4.html

Most of the tangents are good. However, some are missing. missing tangents

In the attached diagram tangent vectors are in blue, normals in red. The three vertices on the top have no tangents (actually tangents of length zero) while the remaining vertices are fine. As a result, the bump mapping becomes smooth near the bad vertices.

This occurs on every polygon in the scene, and always only on the vertices on the extreme +x edge of the polygons.

Any ideas?

missing tangents.jpg (121.8 kB)
Comment
Add comment · Show 2
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 supernat · Feb 02, 2014 at 07:08 AM 0
Share

According to that last entry in the thread, the guy suggests setting the r value to 0 if the dividend is 0, but really dividing 1 by 0 would result in infinity, not 0. Considering you're just going to normalize the result anyway, maybe you should try setting it to 1.0 when the dividend of the r value is 0.

avatar image sdevet · Feb 02, 2014 at 02:26 PM 0
Share

I replaced the calculation of r with:

 float div = s1 * t2 - s2 * t1;
 float r = div == 0.0f ? 1.0f : 1.0f / div;;

but there is no change to the calculated tangents. I'll try this with a simple mesh rather than a procedural mesh, so it's easier to debug.

1 Reply

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

Answer by sdevet · Feb 02, 2014 at 03:04 PM

Mission accomplished!

I was using the first code here: http://answers.unity3d.com/questions/7789/calculating-tangents-vector4.html , but the triangles array is too small and data was missing.

But I should have been using the more efficient (and commented) code a little further down the page that does not try to truncate the triangle array.

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

19 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

Related Questions

Mesh triagnles/surface with normals 1 Answer

Preserving Mesh Normals and Smoothing 2 Answers

Programmatically generated skinned mesh not lit while animating 1 Answer

problem with mesh.normal? 0 Answers

normal issue -2 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