Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 Chris Kaynor · Nov 27, 2015 at 11:04 AM · assetbundleunity 4.6unity 4tangenttangents

Asset Bundle and Mesh Missing Tangents

I just tracked down a problem in a game we are making, that turned out to be caused by a mesh loaded from an asset bundle not having any tangents.

The symptom was that, on some devices (Nexus 6 and iPad Mini 1st gen, as examples), a mesh was not rendering properly - the lighting was wrong, and the mesh just looked bad. Upon some investigation, we discovered that the problem would go away if we did not load the mesh from an asset bundle, and had the mesh built directly into the build. This, however, was not a valid solution, as the build was already close to the 100MB IPA limit. Upon further investigation, I discovered that the mesh did not have any tangents loaded, but only when built into the asset bundle. The lack of tangents was visible in editor (which did not have the rendering problem), as well as on the problematic devices. I confirmed this both by checking the Mesh.tangents array size, as well as hacking the shader to output the tangents as the color, whereby they were completely black when loaded from an asset bundle, but seemed reasonable when loaded straight from the main package. The fbx in both cases is identical, as well as the import settings, where Tangents is set to Calculate.

I was able to work around the problem by adding code to calculate tangents on the meshes loaded from asset bundles, however this is less than ideal as it requires the meshes to be set to "Read/Write Enabled", as well as just requiring extra load time.

The question then is: Is this a known problem in Unity 4.6? Is there something wrong with the way we are building or loading the asset bundles. Is there a better way to work around the problem?

For building the asset bundle, we are using BuildPipeline.BuildAssetBundle with a potentially different asset as the main asset (this bundle has a few meshes in it, two of which have the problem), and the mesh's FBX is in the assets list. We are using the options: CollectDependencies | DeterministicAssetBundle. I have also tried adding CompleteAssets to that list, however it had no effect. The download of the asset bundle is occurring with WWW.LoadFromCacheOrDownload, and the load then uses AssetBundle.LoadAll().

We have are using Unity 4.6.8f1 and 4.6.7f1 for Android, and 4.6.8p3 (the version distributed on the forums) for iOS.

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 JenyaGk · Mar 29, 2016 at 05:12 PM 0
Share

@Chris $$anonymous$$aynor Hello, Did you found how to fix it? I have same problem.

avatar image Chris Kaynor JenyaGk · Mar 29, 2016 at 05:24 PM 0
Share

We ended up just hacking around the problem by using a variation of the shader that did not require the tangents, as they were not really needed for that rendering anyways.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Font8 · Aug 18, 2017 at 10:57 PM

https://docs.unity3d.com/ScriptReference/PlayerSettings-stripUnusedMeshComponents.html

Ensure that Unity isn't stripping your meshes of tangent data. We had this issue and setting StripUnusedMeshComponents to 0 fixed it for us. You can either write a script to set it or go into PlayerSettings.asset and change it in your text editor.

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 fffMalzbier · Nov 27, 2015 at 11:08 AM

I'm not sure if it's impacting the asset bundles but maybe the optimize mesh option in the playersettings could lead to this behavior. If unity do not sees for whatever reason that the tangents are used, it will try to strip them out to save some file and memory size.

Comment
Add comment · Show 1 · 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 Chris Kaynor · Nov 30, 2015 at 05:51 PM 0
Share

We just tried making the asset bundle with Optimize $$anonymous$$esh off, and it had no effect.

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

7 People are following this question.

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

Related Questions

Can't get steamworks.NEt 7.0.0 to Work in Unity 4.6 0 Answers

Import game for Nook 0 Answers

Unity is not responding at launch 0 Answers

Tangent affected by model's UV, shader uses custom texcoord 1 Answer

How to import the object from server to unity 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