Lighting hampers performance

We’ve noticed that we can’t offer a smooth 60+ FPS in our game at the current stage, which is a prerequisite. After some profiling, it turns out that our gamethread is mostly “CPU Stalling”, which means that our bottleneck is an issue with drawing and rendering. A quick glance at the recorded stats shows that indeed the drawtime shows extreme hitches.

Next, I’ve set t.HitchTreshold to 10ms, and did some test. The results can be found at http://hastebin.com/cilaxikebu.coffee. It looks like most of the hitches come from the rendering of light. This surprises me a lot.

For example, we have a simple ball in the game, which is just a spherical model with a ULightComponent. Somehow, this light component takes a hit of around 6ms. We’re not doing anything fancy with this light. How is it that light has such a hitchy impact? The impact it has seems to increase exponentially as you get closer to the source.

Is the light movable or stationary? And how does the rest of the lighting look in the game? Is the ball’s light overlapping with too many lights?

The ball, and thus the light are movable. Our only other source of light is a directional light; and the map is pretty much entirely static, as you can see in http://postimg.org/image/lcp5o4dsj/. There are no moving or dynamic things other than the players and the ball.

I did move the light inside the ball’s mesh. The light seems to get through so I figured all is well. I don’t think this is the cause of the issue.

Can you try using stationary lighting and build lighting? This will give you a bit of both worlds by having static lighting for distant meshes and dynamic lighting for other meshes as you get closer.

The idea is that the moving ball emits light. Not sure how I could make that ‘static’.