Game Development Community

T3D 1.1 Beta 3 - Basic Lighting FPS Havled When Moving - NOT A BUG

by Steve Acaster · in Torque 3D Professional · 10/24/2010 (3:52 pm) · 13 replies

T3D 1.1 B3

Win7

Target
FrameRate, Basic Lighting

Issue
I noticed that when using Basic Lighting the frame rate halves whenever the player is moving, making everything suddely laggy. (I'm thinking those stencil shadows are involved ... though I do have a personal prejudice against them ...)

Repeat
Make a scene ... with stuff! get metrics(fps); on the go so you can see the framerate. Switch to "lowest" quality lighting in the options ctrl+O. Make a note of your fps, then move around and watch it drop dramatically.

Suggest
Some sort of fix, as the lowest lighting setttings aren't going to save any performance if they lag like a lazy dawg when the player moves around

[EDIT]
It seems to be due to Ai/multiple Players - so I still reckon it's the stencil shadow, though the fps didn't fluctuate in 1.1 beta2 with Ai in the scene and a moving player/cam.

#1
10/25/2010 (10:30 am)
Just to point out - this isn't an issue in T3D 1.1 Beta 2.
#2
10/25/2010 (4:07 pm)
Logged as TQA-1189 for the QA team to verify.
#3
10/25/2010 (7:22 pm)
Ok, so I created a new project. I loaded a mission. I went and stood on the terrain where there were no objects. I changed my values to lowest. I'm getting about 400 fps in directx debug mode full. I move around and it goes to about 380 - 390 and 400 ish still. So, Do I need to be around shapes?
#4
10/25/2010 (7:59 pm)
No you need Ai/players ... it's gotta be the multiple stencil shadows (educated guess), if I kill the Ai's, fps remains stable when moving, with Ai's (and thus multiple stencil shadows - guess) when the player moves (and I only have the player moving) the fps takes a big hit.

Though it still doesn't get affected in this way in 1.1 beta 2, fps remain constant regardless of player movement.
#5
10/26/2010 (5:25 am)
On Mac build 1.0.1 I'm seeing the same issue...
I have 4 AIPlayers and the FPS sits at a constant rate...until I have one of them move and the FPS drops from 60fps to about 12...

#6
10/29/2010 (6:13 pm)
And after disabling shadows for BL - the fps remains constantly high.
core/scripts/client/defaults.cs.

So I reckon that's stencil shadow issue confirmed - though as I said 1.1beta2 didn't have this issue.
#7
02/10/2011 (3:20 pm)
Hey Steve, I'm looking into this issue.

Are you guys only noticing the framerate drop when you guys move? I'm noticing a 20-30 FPS drop just by having these actors in the scene.
#8
02/10/2011 (4:30 pm)
Quick check again ...

It's a bit laggy with the shadows in BL anyway (with lots of actors) but there's a real hit to fps when moving around (50%).

As I remember this wasn't an issue in 1.1 beta2.
#9
02/11/2011 (11:17 am)
The Basic Lighting shadow is not a stencil shadow.

It is a decal that is recalculated every time the player moves. The operation for gathering and clipping the decal triangles can be quite expensive (all CPU) and it is highly dependent on the geometry that you are moving over. The more dense a triangular mesh your shadow is intersecting with, the slower the decal generation process, and the bigger the framerate hit.

However, if you are sitting still then it shouldn't be recalculating the decal and the cost of the shadow should be extremely cheap (single, relatively small draw call).

When this technique was used against the relatively low poly worlds in TGE, it worked pretty well and looked really good for the time. But when people start to use polysoup collision meshes and decal meshes with multiple thousands of triangles to be clipped, it gets expensive really fast.

I'd honestly be surprised if you didn't see the same performance impact of moving around in Torque 3D 1.1 Beta 2. Perhaps the scene you were moving around in (or the geometry you were standing on) was much lower poly when you were testing then? For example, Deathball Desert used to have *far* fewer meshes and polys than it does now.
#10
02/11/2011 (11:43 am)
*surrenders*

You've got me, Matt.

I just transported my current Beta 3 (very complicated) "scene/ai/the whole shabang" back to Beta2 and with the action in full flow, I do see the same reduction in frames per second whilst moving around with the stencil shadows - [edit] decal shadows!

My beta2 test scene was very simple (though with twice the Ai) and I don't see the same fps hit moving around in it after transporting it to beta 3.

So I'm mistaken on the beta2/3 difference.

[edit]
Ray, if you want to mark this as Resolved, I'm satisfied.
#11
02/11/2011 (1:46 pm)
Do all objects create their shadows even if not rendering them?

That is...objects too far from the camera shouldn't even update their shadow (which means no render, no clip, etc). And is there a way to tweak how far from the camera those decal shadows should occur still? I saw some values in the playerdata datablocks but tweaking them seem to have no effect...
#12
03/31/2011 (1:45 pm)
So i did some memory optimizations to the decal clipping and went from 17fps in my test case to over 100fps. There are a couple more optimizations i can potentially do here and have entered tickets for them (THREED-1539), but for now i need to move on.

This doesn't magically solve this issue.. if you have enough shadowed objects running around on really high poly geometry really near the camera you will run into it again, but it should take more effort to get there.

#13
03/31/2011 (3:11 pm)
@Bryan - I've exposed two prefs for T3D 1.1. $pref::ProjectedShadow::fadeStartPixelSize and $pref::ProjectedShadow::fadeEndPixelSize for controling the BL projected shadow lod. You can see in ProjectedShadow constructor that these were previously hard coded to 200 and 35.