Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 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
2
Question by raj231 · Jan 27, 2015 at 08:03 AM · c#cameravuforia3dmodel

why camera is freezing while loading the 3D model

I'm doing Augmented Reality image recognition project (vuforia) and loading the .obj model from server when the image is recognized. The problem is, when my target found the loading text will start to display the percentage of load and if it comes at 99% and the camera is freezing to load the model. I'm not sure why the camera is freezing. How can we load model without freeze the camera?

 var objData = ObjReader.use.ConvertFileAsync (modelString, true, standardMaterial);
 
 while (!objData.isDone) {
 Debug.Log (" objData is not there");
 
 
 loadingText.text = "Loading... " + (objData.progress*100).ToString("f0") + "%";
 yield return loadingText.text;
 }
 //myHealth.Progress (100); // done
 loadingText.enabled = false;
 string modelName = objData.gameObjects [0].name;
 
 model = GameObject.Find (modelName); // find the model reference
 
 model.name = targetIDModel; // change the model name to targetID !!!
 }
 
 GameObject modelClone = Instantiate( model ) as GameObject; //clone the model 
 
 modelClone.transform.localPosition = Vector3.zero; // bring the clone to origin
 
 modelClone.transform.parent = itbModel.gameObject.transform; // pair the clone to the instantiated image target
 
 modelClone.transform.localScale = Vector3.one;
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

Answer by CHPedersen · Jan 27, 2015 at 08:06 AM

It freezes during load because Instantiate is sequential and takes place on the main thread. So, if the object is really big, it will take considerable time to load it and create a mesh for it, etc. Unity cannot render any frames while it does that work, too, so the camera freezes in the meantime.

The solution is to split the mesh up into a number of smaller meshes and load them one by one across several frames, such that frames are still rendered in between, user input still processed, etc.

You can still use Mesh.CombineMeshes to combine the loaded objects into one big mesh afterwards, if you really need them to be (though chances are you don't).

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 raj231 · Jan 27, 2015 at 08:15 AM 0
Share

The model size is 3 or 4 or 5$$anonymous$$B only and the model is loading from server url. I'm using obj reader plugin to load the model from server.

avatar image HappyLDE · Feb 19, 2015 at 05:48 PM 0
Share

You might want to download the model to client first then load it in memory.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

How to Switch/Change Front and back Vuforia AR Camera using a button? 0 Answers

Unity3d Vuforia Ground Plane Using UNET 2 Answers

Multiple Cars not working 1 Answer

Moving an object with Slider UI in vuforia Ground Plane (AR project using Unity 2018.2.8f1) 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