Jump to content

Why do lights cause FPS drop?


Recommended Posts

Why do lights cause FPS drop? Like, I can no longer activate any lights, out of fear that my game loses 25-50% of its FPS. Why is this, and how can i fight it so I can still use lights?

Maybe it's the unoptimized nature of Unity? I imagine that the engine is desperately calculating the physics when you make unexpected commands, but it might also be a bandwidth limit.

EladDv has a lot more knowledge than me on this topic. :) He's probably familiar with some aspects of Unity by now.

Edited by andrew123
Link to comment
Share on other sites

Lights hit the GPU pretty hard. Thing is in KSP, since any given vessel is a collection of separate objects, and each light (apart from the sun) is dynamic in a given scene, none of the usual 3D engine 'cheats' are available. There is no pre-cooking of textures, and there is no pre-defined static shadow-map. So rendering lights with how they affect textures on objects and how their shadow falls and so on, becomes an exponentially harder task per light that is added to the scene.

The framerate of KSP is determined by primarily two factors. There is the physics, which hit the CPU, and then there is graphics rendering, which obviously hit the GPU. If either of these are overloaded by calculations, your framerate will drop.

As far as rendering of lights go, the easy solution is to turn down in settings max number of rendered lights. The expensive solution is to upgrade your graphics card. As for physics, Unity/KSP only runs on one core for the time being - so until it gets proper multithreading and/or ability to offload some physics calculation to newer graphics cards (eg. nVidia with CUDA/PhysX enabled), you'll only see modest improvement by upgrading the CPU. As it is now, it is terribly inefficient.

Link to comment
Share on other sites

Llights are expensive to render. every part has to be checked against every light that's active based on game settings. Depending on the shader on each part, the calculations are per vertex and then per pixel of the texture maps (if you throw spec and normal maps in the mix), in successive passes. This has to be done for each frame. thousands of parts x hundreds of lights x multiple render passes = many many many calculations each frame. It's a good thing most of the lights in KSP don't cast shadows. watch your FPS go FPM when shadows get added to the mix.

Edited by nli2work
Link to comment
Share on other sites

Its simple... each light needs its own render pass... we have sunlight (1 render pass) and for each light you add, the game engine needs to perform another render pass for any object it hits. As KSP ships and scenes are made out of many single objects instead of large optimized mesh structures, the use of additional lights can kill performance pretty easy.

[edit] i just saw that nli2work explained it pretty decent... sorry for the double post.

Link to comment
Share on other sites

The framerate of KSP is determined by primarily two factors. There is the physics, which hit the CPU, and then there is graphics rendering, which obviously hit the GPU.

Sorry, but Unity don't uses CUDA or the like, witch means:

The calculation if the emmited light is hitting an surface witch would reflect it and how mutch that surface will reflect is done by the CPU. Only the result is passed to the GPU.

@ Zekes:

What you can do - if you have to reduce the framedrop - may be to reduce the values for the "pixel light count" and the "shadow cascades" in the settings/graphics tab. Because that would reduce the ammount of calculations needed for a light source.

Link to comment
Share on other sites

You might like to check the Glowstrips mod, which light up themselves but not other parts.

Huh?

Computers are simulating things - LIGHT sources, by definition, cast light/shadow as their rays fall on other objects. Working all this out takes a lot of processing, as others have explained.

Glowstrips (and similar) instead set their own brightness but tell the graphics engine that they aren't light-sources, so no calculation needed. The effect is like flourescent strips - bright on a dark background.

Link to comment
Share on other sites

Sorry, but Unity don't uses CUDA or the like, witch means:

The calculation if the emmited light is hitting an surface witch would reflect it and how mutch that surface will reflect is done by the CPU. Only the result is passed to the GPU.

@ Zekes:

What you can do - if you have to reduce the framedrop - may be to reduce the values for the "pixel light count" and the "shadow cascades" in the settings/graphics tab. Because that would reduce the ammount of calculations needed for a light source.

Thanks, I suspected that would help it but wasn't sure.

Link to comment
Share on other sites

I've used Glowstrips in 0.25 - works fine. I like placing pairs of strips each side of docking ports, and if on a space-station, each pair set to a different colour. Really helps with orienting your ship when docking - particularly if the ship is nightside of whatever it's orbiting.

I have quite an old Dell OPC with a very old graphics card - I just turn down to textures to 1/4 res and I also have to turns atmospheric effects down (so I get the reentry glow, but not the flames). Whilst framerates near surfaces or other vesseles occasionally drops such that times passes a bit slower than RL,I still find I can use lights reasonably, and the game still looks pretty good to me...

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...