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
0
Question by Kaji-Atsushi · Jan 04, 2013 at 11:52 AM · terraingameobjectsoptimize

Optimizing Thousands of game objects...

I've been procedurally placing cubes/rocks/spheres on my terrain and I've racked up about 1500 draw calls or so. I'm wondering what are the best ways to go about optimizing this.

I do realize there have been a few questions very similar to this. But I thought I'd ask it again to see if I can get new ideas or more elaborate explanations

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
1

Answer by Graham-Dunnett · Jan 04, 2013 at 01:46 PM

Basically you are asking about not drawing objects that are not visible. There are two approaches that spring to mind:

  1. Use Occlusion culling. Unity has a built in system, available to Pro users, which can help determine when objects are occluded (not visible). This requires that the objects don't moving, so works only for static objects.

  2. Use a home-grown solution. You know more about your game level than anyone else. Perhaps you "know" that objects in a certain part of the scene cannot be visible from certain other areas. In my zombie-horror-survival game, if my player is in the kitchen, she cannot see zombies in the basement or bedrooms. If she is in the landing area, near the stairs, then she can see zombies in the kitchen and bedrooms. (Well, only if they are by the doors.) This is all invented of course, but I mean in such a game you can know in advance and based on the scene areas of visibility. So, using colliders/triggers/AABBs you can do some simple occlusion logic. (If the player is in box7, she can only see zombies in boxes 2, 5 and 8). Authoring these boxes is the hard part.

I would propose that in your game, which is terrain based, there may be areas hidden by hills, so some simple occlusion system should be easy to experiment with, and might even be a 2d problem, so you only need to look at axis aligned squares.

Alternatively, every frame fire a ray at a random selection of boxes/spheres/rocks. If a collision happens with another object, the rock/whatever cannot be seen, so stop drawing it. Else the cube/rock is visible. You cannot possibly do this for all 1500 objects every frame, which is why I suggest choosing some random objects to test against. This will probably cause objects that are visible to not be drawn. So you may need some other approach to resolve this.

Note that Unity will always perform camera culling, so any object that is not in the field of view of the camera will not be drawn.

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 Kaji-Atsushi · Jan 04, 2013 at 07:57 PM 0
Share

Thanks for your reply, the game is actually an 3D First person camera/shooter type game, so Terrain would be like halo or any game like that. But I've been attempting or hoping I could populate my terrain procedurally with rocks and things by applying rigidbody to all of those rocks and things. and basically have it rain down and settle itself upon my terrain. And then I would remove the rigidbody component once it has settled. I've been successful with this idea up to the part of the camera seeing a thousand rocks/objects or so atop of the terrain.

I was hoping this would be a really neat way of populating my terrain with rocks and objects. I haven't seen anyone using this method before, and maybe the trouble of trying to optimize those thousands of objects is the reason why I havent seen this method.

And if you were curious, I believe my game does require individual rocks layered upon a terrain. Either that or I need to find a way to make holes in a typical terrain mesh, but even that idea may not give me exactly want for my game concept.

I'll tryout those methods you mentioned.

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

9 People are following this question.

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

Related Questions

Optimizing vegetation. 3 Answers

Prebuilt gameobject bundles without Prefab instancing behavior. 0 Answers

i cant see anything in the game! 6 Answers

Make a simple tree 1 Answer

How do I fix my terrain, its too reflective/plastic? 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