[Not needed] Allow specification of custom lamp light picture for type = "basic"

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

[Not needed] Allow specification of custom lamp light picture for type = "basic"

Post by Deadlock989 »

Following this thread.

From the wiki for LightDefinition:
type
Type: Types/string

Default: "basic"

Either "basic" or "oriented". If the type is "oriented", the following properties are read additionally to the other properties:

picture - Types/Sprite, mandatory
rotation_shift - Types/float, optional
It would be very useful to be able to specify a custom sprite for "basic"-type lights as well. The default Factorio sprite (light-medium.png) has a surprising amount of nearly dead/invisible space around it, close to 50% of the width/height of the sprite. This works well and gives a nice effect for small lamps, which is what it was intended for - but for larger lamps, we're now looking at extending the renderer search parameters to get large off-screen lamps to render properly, which is going to have an impact on performance - and with the default sprite, a fair whack of that impact is going to be for correctly rendering something which is 99-100% invisible.

You can sort of work around this by using type = "oriented" and then specifying a very small scale for the sprite, but this feels a bit dodgy and I'm not certain it won't break at some point. If we could specify a sprite for type = "basic", I would be able to decrease the size of the lamp radius without much/any visible effect, which would remove the need to increase the renderer search radius, or at worst, make that increase considerably smaller.

For context, the default Factorio lamp sprite is on the left (with a black background added), the one I would like to use (or similar) is on the right:
lamps.png
lamps.png (169.81 KiB) Viewed 636 times
Last edited by Deadlock989 on Fri Oct 04, 2019 2:09 pm, edited 1 time in total.
Image

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [Request] Allow specification of custom lamp light picture for type = "basic"

Post by posila »

In my mind, using oriented light type for custom sprite is the correct way to do it. Only meaningful difference between basic and oriented light (besides basic light globally using utility-sprites.light-small or utility-sprites.light-medium) is that the basic light automatically sets scale of the sprite so the size becomes final size of the sprite in tiles. Setting scale = 32 / width, should do the same to your oriented light definition.

I might change basic light to be generated procedurally in shader and provide parameters to modify its properties in the future.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [Request] Allow specification of custom lamp light picture for type = "basic"

Post by Deadlock989 »

posila wrote:
Fri Oct 04, 2019 12:01 pm
In my mind, using oriented light type for custom sprite is the correct way to do it. Only meaningful difference between basic and oriented light (besides basic light globally using utility-sprites.light-small or utility-sprites.light-medium) is that the basic light automatically rescales the sprite so that size becomes diameter in tiles. Setting scale = 32 / width, should do the same to your oriented light definition.

I might change basic light to be generated procedurally in shader and provide parameters to modify its properties in the future.
Yeah, I ended up on scale 0.125 (the sprite is 256x256) by trial and error, and then Bilka helped me in the Discord to understand why that was.

I'm happy with that if it's fine to use oriented type lights on a non-oriented entity.

Shader-generated lights would be brilliant - it would be awesome to have parameters for fluctuation/flicker etc. that work in any light definition, not just those working visualisations that support them.

Cheers
Image

Post Reply

Return to “Modding interface requests”