Today I improved the speed of the occluder, added the new occluder sub boxes to The Escape demo entities, and no and behold the saving in drawing less entities to the GPU was EXACTLY the cost of calculating the occlusion. At least it is no more expensive any more! It also means some levels with enclosed levels will see a performance boost, but you will notice a subtle drop if you have a completely open level with nothing to hide behind (naturally).
Moved onto defeating the two performance spikes when in high combat. I fixed one which was caused by the enemy calculating too many paths, now they spread that work out. And the second I continue to work on this evening, caused by too many raycasts. Not sure how to solve this, but deciding to spend my brain energy on this rather than a pretty blog.
Better blog Friday, and some nice shots :) Going to eat now, then back to the code!!
Enjoy your meal Lee,looking forward to the next release.
ReplyDeleteLee, you should try the method Unity uses. They pre-bake the occlusion data on static entities and thus there are no calculations at runtime and you only get performance boosts.
ReplyDelete+1 Excellent suggestion!
DeleteYeah I think the pre baked occlusion culling is called PVS (potentially visible set).
ReplyDeletehttp://en.wikipedia.org/wiki/Potentially_visible_set
http://www.bc.edu/content/dam/files/schools/cas_sites/cs/local/bach/2004/04DerekCarr.pdf
Strangely enough I ended up reading up on the same Unity stuff, lol. I was going to ask if it may be a better idea to calculate it beforehand rather than on the fly. Not sure how that would handle new things popping up on the map, but would be good for set in stone maps, possibly not so much with a more sandbox style game, unless it could add new data in on the fly also.
ReplyDeleteThey have several methods, some of which also include the ability to handle dynamic objects at runtime while retaining the baked static data. This link explains it more.
Deletehttp://docs.unity3d.com/Manual/OcclusionCulling.html
wow - deja vu :D
ReplyDelete