Jump to content

How expensive are lights?


CaptainKipard

Recommended Posts

I'd like to know the answer to this too. I'd hope, in the modern world of hardware acceleration, that their impact would be negligible. I guess if an answer isn't forthcoming, you could make a test part with five or ten, the strap more and more to the craft until you find the frame rate drop. I don't believe KSP has a built in frame rate counter, but maybe there's a plugin?

Link to comment
Share on other sites

Beware that the game can display only a maximum of 64 pixel lights. The standard settings (in the graphics settings) only allow 8 or so.

You should try to minimize the amount of lights so the player is still able to put additional lights on his craft.

Link to comment
Share on other sites

Beware that the game can display only a maximum of 64 pixel lights. The standard settings (in the graphics settings) only allow 8 or so.

You should try to minimize the amount of lights so the player is still able to put additional lights on his craft.

Ok two it is then.

Lol!

Link to comment
Share on other sites

Ideally you should not ever use more than one realtime light per part, since it's extremely easy to go over default per-pixel light limit of 8 (or in some cases 4) lights. Using two spotlights is unreasonable unless you are making a part like a pod that won't be used in symmetry.

Aside from per-vertex lighting that is used as fallback for any lights going over the limit being ugly as sin, there is another factor: KSP is using forward renderer, so every single light makes scene rendering more expensive, forcing a redraw on every vertex and pixel it affects. As you can imagine, 64 per-pixel lights affecting enough on-screen geometry is an extremely undesirable scenario. In controlled environments of other games, developers using a forward renderer never ever use so many per-pixel lights - if a game really requires that many individual sources, it should use deferred rendering. Remember also the fact that the sun already eats up one per-pixel light slot, and mods like PlanetShine eat another.

Speaking of which, stock landing gear containing three light sources is an extremely bad example. Absolute majority of cases when excessive amount of light sources is used should have used emissive maps and emissive shaders to imitate the desired effect, be it a stop light, lit up lightbulb, crew pod windows and so on.

Edited by bac9
Link to comment
Share on other sites

Using two spotlights is unreasonable unless you are making a part like a pod that won't be used in symmetry.

I'm not really sure what you're saying here, so here is a shot of the part. There are two lights on either side of the forward hatch.

BTW it's based on another person's mod that seems to be dead. I'm not just ripping it off.

tqCj3mi.png

Link to comment
Share on other sites

Yeah, it might be justified here if you keep the beams from intersecting.

What I meant by the part you quoted is the fact that some parts (like stock spotlights) are most commonly used in symmetry-based groups (2x, 4x, etc), so light sources in them should be kept to a minimum, as players will inflate light counts very significantly even with one source per part.

Edited by bac9
Link to comment
Share on other sites

Yeah, it might be justified here if you keep the beams from intersecting.

Oh, I get it. I planned on making them intersect though, because they're meant to illuminate another docking port during docking. I guess I'll just change it to have one light in the middle somewhere.

Link to comment
Share on other sites

If you want the spotlights to light up one spot, then use this trick, it will look almost identical while being twice as cheap, provided your part has enough length to shift the light source back as far as possible. Just make sure no backward-facing triangles enter the light cone before the point where you have spotlights modeled, drop some emissive in appropriate places, and it will look gorgeous.

jIARdTp.jpg

Link to comment
Share on other sites

No, IVAs exist on an entirely separate layer and are rendered with a separate camera, properly configured light sources in parts can't enter them. That's how scattered light from my M27 cockpit works - there is a spotlight inside it with a huge cone, borders of which are perfectly matched to vertical window borders.

(IVAs also have completely wrong orientation which makes the only light source entering them from outside (sun) incorrect, but that's another story)

Edited by bac9
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...