L B Posted January 26, 2012 Share Posted January 26, 2012 There have been many discussions about culling performance. Notably: http://www.leadwerks.com/werkspace/topic/4449-showhide-heavy-trees/ http://www.leadwerks.com/werkspace/topic/3995-entity-cull-time-optimization/ http://www.leadwerks.com/werkspace/topic/3956-model-setviewrange-causes-crash/ Josh often says that he needs a scene file to test. Here is one, along with the 3D model "filler.gmf" used in it. http://localhostr.com/file/rg5ZGkP/Culling.sbx http://localhostr.com/file/xT1HJD0/Filler.gmf http://localhostr.com/file/QIcDJF8/FillerLOD1.gmf Here is a screenshot of the performance assessment: I want to stress the following points: The polygon count is 25k, which is nothing for Leadwerks. Draw time is 1ms. The world time is of 7ms, 5 of which are taken by entity cull time. This is enormous. I often get 6 or even 7ms taken by the cull time, out of the total 7ms. There seems to be 2376 entities drawn, whereas the square is 24x24=576 cubes. The other entities are the directional light. Perhaps the LOD counts as 2, but even then, it's not 2376. If you don't see performance drops yet, try multiplying that grid 4, 8, or 16 times. Then you'll notice cull time starts to rise in the 30-60ms. Another interesting point is that when you look down from the basic camera view, there seems to be a massive glitch in culling. Although no entities are in view (screenshot shows some only to indicate how I lowered the view, but you can lower further to show none), almost all the entities and polygons are still drawn. Also note that culling still takes the most of the render time. This seems to indicate frustrum culling is not only slow but bugged. This needs to be fixed, as it causes massive drops in performance for apparently no reason. Or, there needs to be a way for us to disable culling in that case. I'm interested in learning how. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 26, 2012 Share Posted January 26, 2012 It's working as I would expect. The world time is of 7ms, 5 of which are taken by entity cull time. This is enormous. I often get 6 or even 7ms taken by the cull time, out of the total 7ms. Culling has a cost, but typically also results in savings because entities get skipped. If all entities are onscreen, there will be no savings to balance this cost. Another interesting point is that when you look down from the basic camera view, there seems to be a massive glitch in culling. Although no entities are in view (screenshot shows some only to indicate how I lowered the view, but you can lower further to show none), almost all the entities and polygons are still drawn. Also note that culling still takes the most of the render time. This seems to indicate frustrum culling is not only slow but bugged. It's drawing a lot of meshes for the shadow render. The directional light shadow does not just render what you see, it renders anything the directional light sees that might cast a shadow into your field of view. An object can be offscreen, but still cast a shadow that falls onscreen. The directional light shadow renders three passes for the different light volumes the shadow uses. If you disable shadows you will see that the number of entities drawn corresponds perfectly to what you see onscreen. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
L B Posted January 26, 2012 Author Share Posted January 26, 2012 I see, thanks for the reply. Can I somehow disable culling or improve its performance though? Quote Link to comment Share on other sites More sharing options...
Josh Posted January 26, 2012 Share Posted January 26, 2012 In normal usage culling will result in a massive improvement to otherwise unplayable framerates. If you pack thousands of entities into a small space, of course performance will be bad. It's fine for polygon counts to be high, but you should keep the number of passes / meshes as low as possible. This is the nature of modern graphics hardware. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
L B Posted January 26, 2012 Author Share Posted January 26, 2012 Can I somehow disable culling or improve this specific case then? Quote Link to comment Share on other sites More sharing options...
LordHippo Posted January 26, 2012 Share Posted January 26, 2012 Can I somehow disable culling or improve this specific case then? I think Josh already answered it: It's fine for polygon counts to be high, but you should keep the number of passes / meshes as low as possible. This is the nature of modern graphics hardware. BTW, is this high number of objects your requirement? Quote Ali Salehi | Programmer Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64 LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17 Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 26, 2012 Share Posted January 26, 2012 Just some extra info for you from your test map and objects with all FX on and settings at max. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
YouGroove Posted January 27, 2012 Share Posted January 27, 2012 @Marleys Ghost : Why in your case it's ok compared to Lazlo ? What you have done differently ? the materials of objects ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 27, 2012 Share Posted January 27, 2012 Same scene, same model, nothing changed the pics were for additional info. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
L B Posted January 28, 2012 Author Share Posted January 28, 2012 Same scene, same model, nothing changed the pics were for additional info. Not to mention your killer GPU, vs my puny 9600 GT. Quote Link to comment Share on other sites More sharing options...
LordHippo Posted January 28, 2012 Share Posted January 28, 2012 Not to mention your killer GPU, vs my puny 9600 GT. But the culling time should be dependent on the GPU, as far as occlusion culling is not used. Quote Ali Salehi | Programmer Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64 LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17 Link to comment Share on other sites More sharing options...
Josh Posted January 28, 2012 Share Posted January 28, 2012 But the culling time should be dependent on the GPU, as far as occlusion culling is not used. You mean CPU, right? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
LordHippo Posted January 28, 2012 Share Posted January 28, 2012 You mean CPU, right? Yeah. I meant "should NOT be dependent on the GPU". Quote Ali Salehi | Programmer Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64 LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17 Link to comment Share on other sites More sharing options...
L B Posted January 28, 2012 Author Share Posted January 28, 2012 Oh, right. Well in that case, let me rectify my statement: Your killer CPU versus my puny 2.3 GHz Dual-Core. Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 28, 2012 Share Posted January 28, 2012 Oh, right. Well in that case, let me rectify my statement: Your killer CPU versus my puny 2.3 GHz Dual-Core. More than likely, as I said Just some extra info for you from your test map and objects. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Scott Richmond Posted January 29, 2012 Share Posted January 29, 2012 Can I somehow disable culling or improve this specific case then? Yes, you can: Framework fw(CREATENOW); fw.main.world.SetCullRange(20.0F, 250.0F, 500.0F); // Near, Medium and Far view ranges for(int x = 0; x < 100; x++) { for(int y = 0; y < 100; y++) { for(int z = 0; z < 1; z++) { Model *model = new Model(); model->Load("abstract::oildrum.gmf"); model->SetViewRange(VIEWRANGE_NEAR, RECURSIVE); model->Move(x, y, z); } } } That'll spawn 10,000 oildrums and only render ones 20 meters around the camera. Seems to work fairly well for me. 1 Quote Programmer, Modeller Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64 Visual Studio 2008 | Photoshop CS3 | Maya 2009 Website: http://srichnet.info 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.