Game Development Community

Hardware Instancing Problem

by Richard Marrevee · in Torque 3D Professional · 01/10/2014 (7:00 am) · 18 replies

Recently my gfx-card broke down, so I bought a new one. The old one was an Asus Geforce GTX 440, the new one is an Asus Geforce GTX 660. The strange thing is that hardware instancing seems to be disabled. Where I had around 1000-2000 drawcalls with the old card I now see 4000-6000 drawcalls (these are more or less the same amount when I used the old card with instancing disabled). I ran into this problem while I used windows XP, but a recent change to windows 7 (64 bit) gives the same result. Is there anybody who sees the same behaviour or can point me in the right direction to solve this, or has a solution?

I am using T3D 3.0 at the moment, with most of the changes to 3.5 added.

Thanks, help will be appreciated.

Richard

About the author

Started programming in 1984 on an Oric, when time progressed switched to MSX, Amiga and finally the Windows PC with T3D. Now developing an epic fantasy game: The Master's Eye. Creator of the DoorClass pack and VolumetricFog pack @ richardsgamestudio.com


#1
01/10/2014 (11:34 am)
Try and check to make sure that your instancing is set to something, the hardcoded default is something useless like 200.

In core/scripts/client/defaults.cs add and then tweak this value if you don't have it anywhere.

$pref::TS::maxInstancingVerts = "1000";//yorks this need to be added manually here
#2
01/10/2014 (2:03 pm)
I have set this to 1500. Also, shanging this value doesn't influence the amount of drawcalls, so I am a little confused about this.
#3
01/11/2014 (4:45 am)
Digging further into this problem. In another mission, which has a much higher framerate it seems that it is switching very fast between instanced and not instanced when looking at the amount of drawcalls.

Also placing some points in the code where instancing is used, these points are reached, so it seems that instancing is working, but for some strange reason it doesn't show up in a decrease of drawcalls.

Very strange :(

Edit:

Changing the value does affect the number of drawcalls, allthough the effect on fps seem to be small, I get the more or less the same fps when I disable instancing completely.

The only thing which confuses me is that there are more drawcalls then there were before with the same settings.
#4
01/13/2014 (6:31 am)
Win7 64bit / GTX 660Ti

I noticed performance drop with T3D after the NVIDIA driver update from October 2013. Beside a drop in FPS, the rendering isn't very smooth; a slight "stuttering" is noticeable (even with 80 FPS). Drivers are updated last week with 332.21 but that didn't solve anything.
#5
01/13/2014 (8:30 am)
Could it be some kind of setting in the NVIDIA driver. As said, in one mission I see the amount of drawcalls switching very fast from an amount that was expected to an amount twice as big.

Edit:

Another thing I noticed is an increase in fps when switching off instancing completely, allthough it seems that this is not happening in every situation.
#6
01/15/2014 (1:25 am)
I played with the NVIDIA settings without any good result.

Spent a whole day optimising my T3D version again and noticed a few things regarding performance (drawcalls / fps). It's known stuff but you never know:

- Onload mesh scripts can get corrupt when setting parameters in the shape editor (like detail). I had several meshes that "lost" their imposters.
- FOV and screen resolution have great impact on the amount of drawcalls. With a new GPU / monitor and therefore new settings can have effect on the performance. Make sure you compare with the previous settings.
- The defaults.cs (-> prefs.cs) script with the options GUI is outdated. Settings like textureScalar, detailScale, lodScale, detailAdjust etc. need to updated IMO to fit modern GPU's if you keep on using the autodetect button.
#7
01/15/2014 (1:33 pm)
I have tried changing a few settings of the NVIDIA driver but to no success. I've also noticed that I get the best fps when completely disabling hardware instancing in T3D.
#8
01/18/2014 (3:52 am)
If I'm correct it depends on the amount of polys of the objects if you can profit from instancing or not. I saw a NVDIA whitepaper from a few years back where the "turning point" was around 1000 vertices. More geometry would not be worth it and even slowing down because of the use of the GPU for that. There's also a minimum of polys to profit from instancing.
#9
01/18/2014 (5:52 am)
I did a little benchmarking:

instancing: 0 Polycount: 2579000 Drawcalls: 6085 max fps: 29.6
instancing: 1000 Polycount: 2572000 Drawcalls: 1537 max fps: 29.8
instancing: 2000 Polycount: 2571000 Drawcalls: 1527 max fps: 29.7

For this I used every time the same scene/mission/view.

The strange thing is the fluctuation in polycount, which in my opinion shouldn't occur when using the same view.
#10
01/19/2014 (6:47 am)
It's strange indeed. If you reduce the amount of drawcalls to a third and this doesn't do anything (significant) to fps,
I wonder what's going on?!

These results I got from a mission with a pretty big forest file (4469kB):

Instancing	Polycount	Drawcalls	 FPS

0			6141329		  4819		 53
128			6200587		  3693		 53
256			6168463		  3638		 54
512			6175459		  3241		 54
1024		6130470		  3210		 53
2048		6137550		  3071		 54
4096		6201579		  2855		 52
8192		6219306		  1602		 52
16384		6191633		  1610		 52
32768		6162475		  1616		 52
65536		6134379		  1621		 52
131072		6178770		  1616		 52
#11
01/19/2014 (7:42 am)
@Nils:
Could this be caused by the NVIDIA driver? If so, then I will try to get a response from them.
#12
01/20/2014 (8:04 am)
@Richard; I'm not sure, I'm also not an expert on this. I'll try to do some tests with a GTX480 and older drivers.
#13
01/20/2014 (11:42 am)
@Nils:
To be honest, it ain't my cup of tea either. I'm very interested in the results you get with the GTX480.
#14
01/20/2014 (8:05 pm)
Did a test with a GTX460 in an old machine with the exact same settings as the GTX660 in a new one. It's not the target kind of system with these settings, so the FPS is in this case quite low.

Gefore GTX460 / QuadCore 2.4 / 8GB RAM
1920 x 1080 / NVIDIA Driver 320.57 (August 2013)
Settings "High" / MSAA 4x / ANI 8x / PostFx / WindFx

Instancing	Polycount	Drawcalls	 FPS

0			6069265		  4798		 25
128			6117398		  3651		 25
256			6088553		  3622		 25
512			6076900		  3192		 25
1024		6077798		  2907		 25
2048		6127565		  2906		 24
4096		6122419		  2906		 24
8192		5997385		  1625		 24
Since 8192 verts is the sweet spot, I didn't go any further than that

You can see that the FPS does also not decrease even when the drawcalls are reduced to a third.

I think you can make the conclusion that it's not driver related.
#15
01/22/2014 (12:54 pm)
I see. Do you have any idea what the cause of this might be then? I was under the assumption that a reducing the drawcalls should result in a better fps, but these test show otherwise.
#16
01/26/2014 (10:37 pm)
@Richard; I did some searching and stumbled upon this thread today; I think this explains a lot.

I my case I have a 6000k polycount (that's huge) and all kinds of pixel shaders enabled. This means that my GPU is running at almost 100%, while the CPU isn't. If your scene is GPU bound you won't see a difference if you'd reduce the drawcalls by turning on instancing.

This is NVIDIA's info on that:

Quote:
When to NOT use instancing

If your application is heavily GPU bound or you have all unique mesh objects in your world. Instancing has the benefit of spending less time in DX and in the driver preparing data for a begin/end pair. Instancing reduces this overhead; however, if you have plenty of CPU to spare, then instancing won't help you. Currently, not many applications are GPU bound.

This means that your scene, with a 2000k polycount might have the exact same bottleneck as mine, and won't see improvement with instancing until you reduced that drastically.

I think the first thing to do is diving further into LOD'ing out even more then we already did...
#17
01/26/2014 (11:07 pm)
So when I turned off SSAO, Lightrays and DOF, and reduced the PSSM texture size from 1024 to 512, I get a max fps of 76 (instead of 53). Especially SSAO did the trick with this scene.
#18
01/27/2014 (1:27 pm)
@Nils: I think you're right about the bottleneck. Adding more LOD-stages to the models gives some approvement in fps.