Jump to content

Culling Performance


L B
 Share

Recommended Posts

There have been many discussions about culling performance. Notably:

Josh often says that he needs a scene file to test. Here is one, along with the 3D model "filler.gmf" used in it.

Here is a screenshot of the performance assessment:

post-28-0-96510800-1327615026_thumb.png

 

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.

post-28-0-90566700-1327615431_thumb.png

 

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.

Link to comment
Share on other sites

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.

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

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.

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

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?

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

 

 

76561198023085627.png

Link to comment
Share on other sites

Just some extra info for you from your test map and objects with all FX on and settings at max.

 

post-12-0-14962500-1327621021_thumb.jpg

 

post-12-0-14157900-1327621041_thumb.jpg

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

Same scene, same model, nothing changed the pics were for additional info.

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

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.

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

 

 

76561198023085627.png

Link to comment
Share on other sites

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.

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

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.

  • Upvote 1

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...