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 tonydemot · Feb 09, 2012 at 03:39 PM · renderingobjectscullingocclusion

creating custom occlusion culling?

if you have the unity free version is there any way of creating a simple occlusion cull with say raycast?

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

2 Replies

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

Answer by adrenak · Feb 13, 2012 at 04:57 AM

Occlusion culling, ie. not rendering objects that are infront of the camera but are not seen is not available in Unity Free.

I had done something like a custom Occlusion Culling before.

STEPS:

  1. Identify objects that can be seen only from certain places. This maybe anything - a high polymesh behind a building that can be seen only when you go behind the building. Or maybe objects that are inside a room and can be seen only when you are infront of the door of the room etc. disabling the renderer of high poly assets in the scene can lead to an increase in performance.

  2. Identify all the places ( which I called 'cells' ) from which the object can be seen. Only when the player/camera comes in the cell the object which can be seen only from that cell is rendered. Renderer can be switch on by using : renderer.enabled = true;
    What I did was I placed box colliders in all such places with their trigger on. These trigger colliders had a javascript called "OC.js".

I don't have the script now, but it was easy to comprehend and was something like this :

 var objThatCanBeCulled : Renderer[]; //array of objects that can be culled when the player/camera come to this cell
 
 function OnTriggerEnter(other : collider){
 
     if(other.gameObject.tag == "player"){
         for(i = 0 ; i < objThatCanBeCulled.size ; i ++){
             objThatCanBeCulled[i].enabled = true;  //turn off the renderer of all the objects
         }
     }
 }
 
 //similarly use OnTriggerExit to turn off the renderers 
 

If I am not wrong, then Occlusion Culling in Unity is done using grids. Here, I did it using block triggers. This way is explicit and a bit manual, so you have to use it more carefully other wise it might give you unfavorable results. However if used well, it can give you results you would expect with occlusion culling (only a little less ) - example if you are making something like the good old Wolfenstein3D ( the old FPS with a lot of rooms to be opened ), then you can turn off the renderer of the objects in the room that hasn't been opened yet. For that you would need a different script system, but the concept is the same, if you can't see it, don't draw it.

There are also other ways to improve frame rate by different kinds of culling processes. Unity automatically applies frustum culling. Apart from that you can use distance fog, or layerCullDistances, both of which are explained in the Unity manual and can be really usefull. You can also use LOD ( level of detail ) method.

I hope this helped!

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 tonydemot · Feb 13, 2012 at 05:59 PM 0
Share

thank you this really did help

avatar image
0

Answer by frenchfaso · Apr 22, 2013 at 09:13 PM

Yes there is indeed, InstantOC it's a ray-based dynamic occlusion culling and LOD system for Unity, compatible with all versions of Unity. You can grab it on the Asset Store for 15$

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

6 People are following this question.

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

Related Questions

Occlusion Culling question. 1 Answer

Unity iPhone 1.6 has dynamic occlusion culling? 1 Answer

Unity equivalent of ARB_occlusion_query (glGetQueryObject)? 0 Answers

Umbra Occlusion Culling on Android? 1 Answer

using OnBecameVisible or IsVisible with occlusion culling in Unity Pro 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