KOS OpenGL: maximum triangles on-screen?
- bbmario
- DCEmu Freak
- Posts: 88
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Wed Feb 05, 2014 5:58 am
- Has thanked: 9 times
- Been thanked: 3 times
KOS OpenGL: maximum triangles on-screen?
Based on your tests, what is the maximum amount of triangles on-screen that the DC can handle, in order to achieve a decent FPS? I'm asking this because i'm currently setting the limits for game artists in our project, and i'm trying to find a good balance. Also, does anyone know any benchmark demos for the latest KOS OpenGL code?
- BlueCrab
- The Crabby Overlord
- Posts: 5652
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: KOS OpenGL: maximum triangles on-screen?
There's a big difference between the maximum amount of triangles on the screen and what you'll actually get in practice. After all, you're going to have other things going in a real game that you wouldn't have in a benchmark (audio, physics, etc).
There are benchmark programs included with KOS that you can mess around with (examples/kgl/benchmarks) to give yourself an idea, but like I said, ideal conditions (nothing but rendering) and realistic conditions are two very different things...
There are benchmark programs included with KOS that you can mess around with (examples/kgl/benchmarks) to give yourself an idea, but like I said, ideal conditions (nothing but rendering) and realistic conditions are two very different things...
- bbmario
- DCEmu Freak
- Posts: 88
- Joined: Wed Feb 05, 2014 5:58 am
- Has thanked: 9 times
- Been thanked: 3 times
Re: KOS OpenGL: maximum triangles on-screen?
I agree. It depends on the game, your culling algorithm, etc. And i understand that a lot of testing will be involved and art will have to change a lot during the course of development. But i wanted to get a rough idea of the power, so i can have some rules of thumb: 1000 polys for a first-person gun model + hands is OK, 2000 for a character is too much, should be 500. Etc.
Re: KOS OpenGL: maximum triangles on-screen?
This is something ph3nom is going through right now as well. He's making a game together with an artist. Maybe you want to send him a private message and draw his attention to this thread
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KOS OpenGL: maximum triangles on-screen?
Truth is, the example benchmarks, are poor examples of a best case scenario.
Look at the benchmarks, calling rand() for each component of every vertex is a worst case scenario.
And those examples use immediate mode, not glDrawArrays. So, things can be optimized from those examples.
Using glDrawArrays you can easily hit some several thousand vertices per frame at 60-30 fps.
It all depends on how you arrange your render engine.
Look at the benchmarks, calling rand() for each component of every vertex is a worst case scenario.
And those examples use immediate mode, not glDrawArrays. So, things can be optimized from those examples.
Using glDrawArrays you can easily hit some several thousand vertices per frame at 60-30 fps.
It all depends on how you arrange your render engine.
Re: KOS OpenGL: maximum triangles on-screen?
I made some tests recently with this model:
... and here is what I got:
1. Immediate mode, single model with interpolated animation + dynamic lighting:
2. Immediate mode, 5 models with interpolated animation + dynamic lighting:
3. Immediate mode, 5 models with interpolated animation, NO lighting:
4. Arrays, 5 models with interpolated animation + dynamic lighting:
5. Arrays, 5 models with interpolated animation, NO lighting:
So I guess glNormalPointer() is kinda broken. I got the same artifacts with a single static model and it only happens with arrays.
Anyway, I decided to avoid using lighting and swithed to "baked" vertex colors, so
6. Arrays, 5 models with interpolated animation + vertex colors:
I'm not sure if everything was compiled with optimizations, since I have no clue how to switch between "debug" and "release" modes or whatever it is called in gcc\makefiles etc (anyone willing to explain, please? From what I've read, it is something to do with "-o" flag, but where exactly am I supposed to specify it?), and whether or not switching to triangle strips worth the effort, but so far I'm glad with the result.
And I'd like to thank PH3NOM for all the hard work he put into improving KGL.
ps: sorry for bad english, if any.
Spoiler!
1. Immediate mode, single model with interpolated animation + dynamic lighting:
Spoiler!
Spoiler!
Spoiler!
4. Arrays, 5 models with interpolated animation + dynamic lighting:
Spoiler!
Spoiler!
Anyway, I decided to avoid using lighting and swithed to "baked" vertex colors, so
6. Arrays, 5 models with interpolated animation + vertex colors:
Spoiler!
I'm not sure if everything was compiled with optimizations, since I have no clue how to switch between "debug" and "release" modes or whatever it is called in gcc\makefiles etc (anyone willing to explain, please? From what I've read, it is something to do with "-o" flag, but where exactly am I supposed to specify it?), and whether or not switching to triangle strips worth the effort, but so far I'm glad with the result.
And I'd like to thank PH3NOM for all the hard work he put into improving KGL.
ps: sorry for bad english, if any.
- BlueCrab
- The Crabby Overlord
- Posts: 5652
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: KOS OpenGL: maximum triangles on-screen?
By default, KOS compiles things with the -O2 flag (so, optimization level 2) and with frame pointers turned off. Unless you changed things in the default setup, you've got normal optimizations turned on.111 wrote:I'm not sure if everything was compiled with optimizations, since I have no clue how to switch between "debug" and "release" modes or whatever it is called in gcc\makefiles etc (anyone willing to explain, please? From what I've read, it is something to do with "-o" flag, but where exactly am I supposed to specify it?), and whether or not switching to triangle strips worth the effort, but so far I'm glad with the result.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KOS OpenGL: maximum triangles on-screen?
You are welcome my friend! It is good to see people trying to do things with it111 wrote:And I'd like to thank PH3NOM for all the hard work he put into improving KGL.
A question, what model format is that? I can probably help with some ideas to optimize things a bit if you dont mind sharing your render routine code.
And do you unpack / interpolate all 5 models each frame?
Because that consumes a large amount of CPU time that is not being used by OpenGL.
What I am getting at is that to really test the speed of OpenGL rendering, a raw throughput benchmark would be to unpack / interpolate that model 1x and then render that 1 model 5x each frame ( simply adjust the translation matrix each render pass to render the model at a given position )
And it will be hard to determine your issues with dynamic lighting without looking at your code...
Re: KOS OpenGL: maximum triangles on-screen?
thanks, BlueCrab.
===================
But here is part of the code:
As I said before, lightning is more or less fine in immediate mode.
===================
it's a simple custom format. Nothing fancy - just a list or vertices, normals, uvs, colors, indices and keyframes, one after another, so I can fread() everything.PH3NOM wrote: A question, what model format is that?
thanks, but I don't really aim for the best possible optimization (at least right now), I just needed something simple to work with.I can probably help with some ideas to optimize things a bit if you dont mind sharing your render routine code.
But here is part of the code:
Spoiler!
that is exactly what I am doing. Like this:What I am getting at is that to really test the speed of OpenGL rendering, a raw throughput benchmark would be to unpack / interpolate that model 1x and then render that 1 model 5x each frame ( simply adjust the translation matrix each render pass to render the model at a given position )
Spoiler!
well, everything works just fine on Windows. I checked exported normals manually in a hex editor and during debug, so I'm sure everything is correct there. All arrays have the same size i.e. 1 vertex = 1 normal = 1 uv = 1 color.And it will be hard to determine your issues with dynamic lighting without looking at your code...
As I said before, lightning is more or less fine in immediate mode.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: KOS OpenGL: maximum triangles on-screen?
I see you are using a skeletal mesh format - these are much more efficient in memory usage but much more demanding on CPU usage on DC since it has no GPU T&L.
I am curious how much of your frame time is spent on preparing the mesh for render?
Frame Interpolations are especially taxing on the DC's CPU, as you have to transform the mesh to the skeleton in 2 positions and interpolate between the 2...
A simple optimization I have done is keep 2 frame buffers for your model, one for each frame of animation being interpolated.
This way can save some real CPU time ( in a best case scenario, you only have to interpolate between the 2 prepared meshes and can avoid all quaternion math transforms per vertex each frame ), but then consumes more memory, so we need to understand the tradeoffs here...
You do not post the code for your kmVec3, kmMat4, or kmQuaternion math functions.
These are all functions that can be easily optimized using the SH4 SIMD FPU fast vector math operations...
I am curious how much of your frame time is spent on preparing the mesh for render?
Frame Interpolations are especially taxing on the DC's CPU, as you have to transform the mesh to the skeleton in 2 positions and interpolate between the 2...
A simple optimization I have done is keep 2 frame buffers for your model, one for each frame of animation being interpolated.
This way can save some real CPU time ( in a best case scenario, you only have to interpolate between the 2 prepared meshes and can avoid all quaternion math transforms per vertex each frame ), but then consumes more memory, so we need to understand the tradeoffs here...
You do not post the code for your kmVec3, kmMat4, or kmQuaternion math functions.
These are all functions that can be easily optimized using the SH4 SIMD FPU fast vector math operations...
Re: KOS OpenGL: maximum triangles on-screen?
No, this is not exactly a skeletal animation (I almost implemented it first, but I had some troubles with exporting\assigning skinning data the way I wanted (only 1 bone per vertex with weight = 1), so I went for a simpler approach). It's an "object transform" animation (used in games like resident evil 1-3, gta3 etc) I think it is pretty obvious (looking at the character's knees and elbows) that model is split into several parts, so keyframes only hold transforms of those objects. Which is good, compared to morphing (i.e. MD2 etc).
The model is WIP and left unoptimized specially for testing purposes. The final one (and others) will have around 1000-1200 triangles.
Still, it is a temporary solution i.e. I won't build arrays at run time later.
Perhaps I should do more tests with static meshes only (we'll see, once that clipping issue is gone).
The model is WIP and left unoptimized specially for testing purposes. The final one (and others) will have around 1000-1200 triangles.
I have not checked this yet (not that I know how to use profiling tools).I am curious how much of your frame time is spent on preparing the mesh for render?
Still, it is a temporary solution i.e. I won't build arrays at run time later.
it's from kazmath lib.You do not post the code for your kmVec3, kmMat4, or kmQuaternion math functions.
I'll consider that, thanks.These are all functions that can be easily optimized using the SH4 SIMD FPU fast vector math operations...
Perhaps I should do more tests with static meshes only (we'll see, once that clipping issue is gone).