josemayi27 Posted February 22, 2015 Share Posted February 22, 2015 Hello All, I am working in a pretty big, closed environment and was looking around for ways to optimize performance. I am using babylon 2.0 and saw a few things while looking around documentation which might help me such as LOD, SceneOptimizer, octrees and shadow maps. All of these optimization techniques are great, but it looks like babylon only does frustum culling (at least by default) because whenever an object is caught in the camera's field of view the frame rate drops considerably (from 50-60 to 5-15) even if the object is behind another object and can't be seen. If occlusion culling is not possible with babylon at the moment, could anyone throw other optimization techniques my way? Right now, I haven't really optimized the scene at all, but am not sure whether the things I mentioned above will be enough to give me at least 40 frames when looking in the direction of a lot of "hidden" objects since they will still be rendered. Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted February 24, 2015 Share Posted February 24, 2015 Hey, I love trying to find ways to optimize big scenes with simple algorithms as add-ins =P A possible idea (never tried) :For each object in the field of view, launch a ray starting from the camera to each bounding box point of the object you are testing.If all rays intersect another objects, it means that the object is potentially hidden.Of course, this method is should be forbidden for big objects. What do you think ? Quote Link to comment Share on other sites More sharing options...
jahow Posted February 24, 2015 Share Posted February 24, 2015 Hey, Optimization and performance has been discussed in recent threads, for example this one: http://www.html5gamedevs.com/topic/12608-voxel-rendering-without-too-many-draw-calls/You can try to dig in these if you feel up for it! Occlusion culling is not part of BabylonJS AFAIK, and yes that would be a great addition! Although even without it you can still make pretty complex scenes and maintain decent framerate. What kind of scene are you basing your observations on? Can you maybe reproduce them in a playground (http://www.babylonjs-playground.com/) so we can maybe have a look at it? Quote Link to comment Share on other sites More sharing options...
josemayi27 Posted February 24, 2015 Author Share Posted February 24, 2015 Hey, I love trying to find ways to optimize big scenes with simple algorithms as add-ins =P A possible idea (never tried) :For each object in the field of view, launch a ray starting from the camera to each bounding box point of the object you are testing.If all rays intersect another objects, it means that the object is potentially hidden.Of course, this method is should be forbidden for big objects. What do you think ? Maybe something to explore, but wouldn't that be an expensive process? especially with bigger scenes? Hey, Optimization and performance has been discussed in recent threads, for example this one: http://www.html5gamedevs.com/topic/12608-voxel-rendering-without-too-many-draw-calls/You can try to dig in these if you feel up for it! Occlusion culling is not part of BabylonJS AFAIK, and yes that would be a great addition! Although even without it you can still make pretty complex scenes and maintain decent framerate. What kind of scene are you basing your observations on? Can you maybe reproduce them in a playground (http://www.babylonjs-playground.com/) so we can maybe have a look at it? Thanks for the info, I'll take a look! One of the environments I have in which I notice low framerate is in an airport environment. However, I haven't really done any optimizations (I'm sure after I optimize the scene, framerate will increase big time). I guess I was interested to see something like Occlusion Culling being implemented in Babylon. Unfortunately I'm not at liberty to post the scene (otherwise I would have done so). Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted February 24, 2015 Share Posted February 24, 2015 Yes it's expansive since it is done using the CPU side Occlusion culling is done in the GPU side using the driver's available functions (have to see if WebGL supports it, I don't know but I think it doesn't or it would have been implemented by Deltakosh ^^)This is why I suggest to test only objects in your field of view, you can add an interval in your tests like every seconds.The complexity is proportional to the number of objects you have in your field of view objects list. A bounding box has always 8 points. Are you sure to use instances for repeated objects also ? Quote Link to comment Share on other sites More sharing options...
reddozen Posted February 24, 2015 Share Posted February 24, 2015 I was not able to find a good way to do this. We are running some pretty complex scenes. What I recommend is playing off your octree, for subdividing the scene, then breaking things into rendering groups using something like the tag system. For example, we are going to tag some models as "inside" so based on our state machine, we can include or exclude those objects. We're also going to be setting up a max view range per object. We've just had to think up work-arounds where we can to keep the scene as simple as physically possible. Quote Link to comment Share on other sites More sharing options...
exc_html5 Posted May 24, 2016 Share Posted May 24, 2016 Hi guys! Were embarking on a similar large terrain type project and just wanted to follow up on this thread to see if y'all had any further progress. In the current version of Babylon, is it still frustrum culling only? If we are doing a canyon-like terrain on a large map (as a single mesh), it sounds like even if parts of the far canyon are not visible to the camera (far pieces of the mesh hidden behind part of the foreground canyon geo) it's still taking the performance hit of drawing whatever is behind it? So then at that point the only option would be to use a dynamic octree hightmap terrain generated in BJS? Otherwise we'd have to do some kind of tagging system like above and break the mesh up into many pieces? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 24, 2016 Share Posted May 24, 2016 Hello ! Yep breaking in pieces will work: you can subdivide your big mesh with smaller submeshes so the engine can remove them from active submeshes. Other great option is the one you mentioned: dynamic octree terrain. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.