Topic: Question: How many Tri's (roughly) can maratis handle?

Hi, before i start building content i just wanna know
how many Tri's maratis3d can handle on screen at once?
are there any data about polycount range for models?
per submesh?
etc.
just a roughly estimated count would help.

Re: Question: How many Tri's (roughly) can maratis handle?

There is no theoretical limits, it depend a lot what platform you target and the rendering you want to use,
for an iPhone for example you should try to have less than 5000 triangles visible at the same time.

For a recent computer, I would say less than 100 000 visible at the same time if you are using baked shadows, and if you are using dynamic lightning and shadow map, try to reduce the polygon count. It will depend a lot on your 3d card.

Most important is to try to subdivide your environment.

Re: Question: How many Tri's (roughly) can maratis handle?

Ah thanks i was wondering the same.

Searching a bit,  i found this (for performances):

Modern graphics cards are really good at pushing a lot of polygons, but they have quite a bit of overhead for every batch that you submit to the graphics card. So if you have a 100-triangle object it is going to be just as expensive to render as a 1500-triangle object. The "sweet spot" for optimal rendering performance is somewhere around 1500-4000 triangles per mesh.

Re: Question: How many Tri's (roughly) can maratis handle?

I thought I would try pushing Maratis to see how far it could go. I tried loading a high poly model one of my colleagues is working on, currently at 486k tris. Using the 3DSMax exporter it made a 159MB .mesh file. That didn't load. I think it gave up part way through or something. We exported it as .obj and then took it through blender which made a 50MB .mesh file which loaded perfectly. It didn't take long to load and definitely didn't have any problem rendering almost 500k tris. Much as I'm sure some other engines are more optimised, Maratis seems to hold up pretty well.

I will do a couple more tests, throwing as many polys as I can, along with textures, animation and shader work and see if I can get any GPU bottleneck for rendering at all.

Mech1
Mech2

Artist's CG Talk thread

EDIT: I wouldn't suggest that 500k tris is an acceptable amount for an in game character model, I was just pointing out that Maratis seems to hold up pretty well

Last edited by Nistur (2012-01-16 20:27:40)

Re: Question: How many Tri's (roughly) can maratis handle?

Nice,
what will be interesting also is to compare with something like Unity,
it could be good to create the same scene and to look at the speed and memory used.

Re: Question: How many Tri's (roughly) can maratis handle?

I'm not sure if there's a difference between unity pro and free, but I know some people who have pro licenses. I can have a go at getting a scene in both at some point and try to give you some metrics

Re: Question: How many Tri's (roughly) can maratis handle?

I think the difference is the free version of unity doesn't allow dynamic shadows.

Re: Question: How many Tri's (roughly) can maratis handle?

So, I've started having a play around with Unity. Apart from the fact that it has more features than Maratis, I don't think that it's that much better. I haven't got any numbers yet to back up the performance, but the development experience seems to be pretty awkward. I asked one of my colleagues to help me with the interface because very little made sense to me at first glance. I guess with a couple of tutorials I would get into the Unity mindset and things would make sense. Maratis, on the other hand, I didn't need a tutorial, was nice and simple smile

Ok, so I did build a standalone .exe for Unity but I haven't been able to get the mech model from Umar yet, so I removed the model from my Maratis test too.
Unity runs at ~5% CPU with ~17MB memory.
Maratis runs at ~49% CPU with ~71MB memory.

When I added the model to Maratis, the CPU usage went up to 95% and the memory to 103MB. As soon as I can get the model into unity, I will be able to see whether the model has significantly more overhead than in Unity, but as it stands, it's clear that something's working harder than it needs to. All I have is 1 light, a box (/plane) with box collision and the standard Sponza controller.

Still, I don't think it's that bad a result for Maratis. Unity has millions of dollars poured into it's development and has been optimised a lot *shrug*

EDIT: This PC Is an AMD Phenom II X2 550 @ 3.1GHz with only 2 cores unlocked

EDIT EDIT: Unity doesn't seem to want to load the mech model, whatever format we give it, obj, fbx, whatever... Oh well, I'd best get back to work

Last edited by Nistur (2012-01-24 14:25:00)

Re: Question: How many Tri's (roughly) can maratis handle?

thanks for the testing,
about the cpu usage, I noticed that it was high, I don't know how to reduce that it happen even with an empty program (we probably need to add a wait to the thread or something)

but for the memory usage, Im surprised, at start it should not take more than 25mb (not 71)
Maratis takes 22mb on my windows for ex

Re: Question: How many Tri's (roughly) can maratis handle?

It wasn't an entirely empty scene, it was the box.mesh stretched into a floor with SponzaFPS mouse control script and 2 lights.

If there's any more testing you would like me to do, I can try and throw similar things at Unity. I'm also still chasing up some things about the PSP work, so if I can't get that to finish up, I might try and do a bit of code profiling, see if I can work out where the memory is hiding and what's taking so many CPU cycles.

I seem to remember that, if you let a process just run on, it will eat up as much CPU power as it can (in this case 49% makes sense as it's almost all of one core...) what you usually have to do is stick a sleep() at the end of the loop. I haven't checked if Maratis does this yet, but it's potentially what might cause the phantom CPU usage.

Re: Question: How many Tri's (roughly) can maratis handle?

still, with a box and a script, there is something wrong, did you used the last release or your svn build ?

yes, someone told me about this sleep() thing, there is not, in fact I'm not sure how to set the duration of it

Re: Question: How many Tri's (roughly) can maratis handle?

I was using the latest svn version without any modifications, built with scons.

if you put sleep(10); at the end of the loop, the thread will sleep for 10ms. It won't have any effect at all (until you're really pushing the CPU) apart from just letting the OS know that you're not actually using so much power. Still wouldn't explain why the model suddenly made the CPU shoot up so much, but then again, I guess ~500k tris probably has something to do with that.

With regards to the memory usage, like I said, I'm not getting much done with the PSP stuff right now, so I may as well put that on hold for now. I've done some memory management at work, so if you want, I can try to take a quick look at that. Might be interesting to make a profiler plugin for Maratis actually tongue

Re: Question: How many Tri's (roughly) can maratis handle?

You said you used Sponza camera, is there a chance that the sponza mesh was still in memory ?
The website release of Maratis with Yo-frankie demo opened uses 36mo (I don't have a svn build where i am)

Some memory test would be very nice to do, there is not some build-in tools to debug it ? (I use one with xcode, but i don't know if it exist with visual or on linux)

Re: Question: How many Tri's (roughly) can maratis handle?

I have checked that there is nothing apart from the box.mesh in the meshs/ directory. I have no idea what's happening :S

There are some tools on various platforms that will allow you to do CPU/memory profiling, but very few are cross platform and will allow for Maratis users to optimise their games properly. Not sure if that's important to you. What I was thinking is that we can add a MProfilerContext to MEngine, and then create macros to do something like the following:

#define M_FUNCTION_PROFILE() \
MProfileStack func(__FILE__, __FUNCTION__);

Which will wrap up checking if there's a profile plugin attached and will release at the end of the scope. I actually had a look at profilers before and Shiny Profiler looks nice and simple to make into a plugin smile

With regards to memory management, it would probably be a bit more hassle as it means overriding new/delete globally so you can keep track of the memory yourself. Not as painful as my fopen hack as C/C++ will allow overriding them wink but that can tie into the MProfileStack again, then you can print out the memory as it's been saved, with the file and function it was allocated in. Of course you don't want to have either of these things running in a production build, but if they're wrapped in a plugin, will allow projects to test what's happening, and the MProfileStack class should take minimal overhead if there's no profiler. Can even create a FinalRelease player build which defines M_FUNCTION_PROFILE in the build process, so it's not even implemented.

EDIT: I had a quick look at memory profiling, and found this which basically explains what I mean, but if we have the MProfileStack, we can actually point out when and where the allocation came from

Last edited by Nistur (2012-01-24 16:27:59)

Re: Question: How many Tri's (roughly) can maratis handle?

In the short term what we need most is at least a global check of the memory using an existing debugger/profiler, there is some ready made and visual tools, what I mean is we should spend the energy to do some investigation first. I don't think there is huge leaks as it was checked for the previous release, but it's a long time it has not been made.

Also, doing benchmarks like you did with the big mesh is very important.

Re: Question: How many Tri's (roughly) can maratis handle?

I will try and do some benchmark tests with the mech mesh and svn revisions, unless you have an archive of previous builds I can use.

If there's anything more detailed you want, I can quickly plug in either memory or CPU profilers I recommended within a matter of hours to get a quick reading on what sort of things are heaviest. I was just suggesting wrapping it up nicely so it could be used by others in future.

Re: Question: How many Tri's (roughly) can maratis handle?

I'm curious to see more of the comparison and test with big meshs and maybe unity. I also would like to be sure about what is happening with the used memory you recorded.

To check the svn version, I ran it with xcode and debug instruments, and opened/closed YoFrankie example,
Maratis was using 10mb at start > 32mb with YoFrankie, it came back at 10mb when closed.
The instruments recorded 4 leaks, basically 192bytes from Maratis and 400bytes from Bullet physics.

There is maybe some leak linked with the big mesh you use but I don't understand...

Re: Question: How many Tri's (roughly) can maratis handle?

I'll send myself the mech mesh and do some tests at home. I wasn't using any profiler to get the numbers, I just glanced at windows task manager.

It's unfortunate that I can't seem to load the mech into unity, no matter how hard I try sad

Re: Question: How many Tri's (roughly) can maratis handle?

is it not working also when exporting from Blender ?
(at least a good point for Maratis)

I tried to load YoFrankie when packaged, and the memory seems to react approximately the same, from 10 to 32 to 10, without bigger picks than the unpacked one. Good to see smile

Re: Question: How many Tri's (roughly) can maratis handle?

you was right for the sleep, it put the cpu usage down.

Re: Question: How many Tri's (roughly) can maratis handle?

I had a go with 2 versions of Maratis, the first being built with Visual Studio from svn, the second being the precompiled download, both have similar results. The download went up to 89MB with YoFrankie, the svn version stopped at 74MB strangely.

Re: Question: How many Tri's (roughly) can maratis handle?

strange... is it on windows ? windows 7 ? (I only have xp)
on macosx, there is something called inactive memory, when debugging memory xcode show that the memoy used is 32mb, but the monitor shows 100mb (active+inactive). Is it like that with win 7 ?

Re: Question: How many Tri's (roughly) can maratis handle?

I will have to have a closer look at the memory, I've been a bit busy tonight unfortunately. I do know that often applications preallocate a larger amount of memory than they need. I will do it after I've finished the little changes I've done to the package manager.

But yes, it's Windows 7 x64 on both machines I've tried it on.

I might try to do the profiler at the weekend, I am interested what it might come up with. I will have to see if I can mark memory on the stack as well as the heap. If you would prefer the code not submitted I will keep it locally.

Re: Question: How many Tri's (roughly) can maratis handle?

Just found on the net, someone using Maratis as a renderer smile :

http://dlsite.blogimg.jp/RG12372/imgs/7/2/7270774f.jpg

Nistur edit: update image URL as original one expired

Re: Question: How many Tri's (roughly) can maratis handle?

Nice, where did you find that?