Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] 3D Object Performance

Author
Message
Nieb
9
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 6th May 2018 03:42 Edited at: 6th May 2018 03:43
Running into some odd performance issues.

I've got a 256x256[65,536] array of objects. Each object is only 2 triangles. It's only 260K vertices & 131K triangles, most any modern GPU should be able to handle this with ease.

I'm getting about 10FPS on each GPU I've tested it on. [ Geforce 620 , Geforce 650m , Geforce 1080 ]
Funny thing is the 1080 performs the worst of the bunch.

I tried creating a single object with the same 3D data in it [ 260K vertices & 131K triangles ].
Each GPU reports 60FPS no problem. So, it doesn't appear to be a GPU / 3D rendering bottleneck issue.

Perhaps there is a CPU bottleneck in the object code. I tried disabling collision and such, no performance change.
However, if I simply set the objects to be not visible, I get the 60FPS. Which is odd because as far as AppGameKit is concerned the objects still exist.


Any ideas?
Am I doing something wrong?
Is there a bug in AppGameKit?
Or is this just an inherent limitation of how AppGameKit works?


Test project attached.

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th May 2018 04:47 Edited at: 6th May 2018 04:52
64K+ objects is a lot of objects
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 6th May 2018 05:41
This post has been marked by the post author as the answer.
Nieb,

If they are invisible then they are not rendered. This means the GPU is not working to render them. Otherwise, the GPU is making 65K+ drawcalls which is killing your performance.

Might I introduce you to CreateMemblockfromObject() and AddObjectMeshfromMemBlock()? You need to find a way to reduce your drawcalls. Every object you have is forcing the GPU to find the texture. By making it one big object, it is only looking once.
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 6th May 2018 11:20 Edited at: 6th May 2018 11:30
For this kind of problem, you need this:
https://en.wikipedia.org/wiki/Binary_space_partitioning
I think you don't even need the CSG operations so it may stay simple.

A pre-calculation may be needed, but you can also create some sort of thread based calculation in realtime.
So you calculate one object each frame based on the distance, and it can get realtime.

After this is done, you can combine the objects in you tree-list via the mentioned meshfrommemblock workflow to optimize even further.
The bsps have also some disadvantages like that you need a recalculation every time you do a change in the objects, but with no object cutting 'CSG' operations, you won't get better results with any other method.
Result: Maximal possible performance.

Portal Culling is not an option, as you need manual design.

[/url]
puzzler2018
User Banned
Posted: 6th May 2018 11:36
64K individual objects - WOW - now wonder it booms

But then looking closer by testing the app.

What is the object in the .OBJ

It looks like a single plane to me, so why dont you just use

plane = createobjectplane( 100000,100000)

setobjectimage ( plane, "imagefile" )

setobjectrotateion ( plane, 90, 0, 0 )

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th May 2018 14:25
You may find this primitive pack from moon dog very useful
https://forum.thegamecreators.com/thread/215819

and it would work better than your objects by the looks
fubar
Nieb
9
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 7th May 2018 01:56
I was not aware each object had it's own drawcall. 65K drawcalls is huge, suprised it even runs at all.

I'll look into those MemBlock & Object/Mesh commands. Thanks for the info!

Login to post a reply

Server time is: 2024-04-20 02:20:54
Your offset time is: 2024-04-20 02:20:54