#[Solved] How to create a proper texture for PointLight2D

11 messages · Page 1 of 1 (latest)

haughty maple
#

I am wondering, how to properly create a texture for a PointLight2D when I want to use shadows and occluders?
I have a circular texture from the tutorial which works just fine, however if I create my own in inkscape in a cone shape, it does not work the same.
(I assume it is a problem with the transparency gradient in the texture?)

To visualise what I mean I have 4 images here:

The first image is with the texture from the tutorial. The others are done by me. The second is my cone shaped texture without an occluder in the way, third is approaching the occluder, and as soon as I get close enough the light disappears completely. Even if the occluder is in the way I would expect there to be light between the player and the occluder.

I suspect that the shape or the opaqueness of the texture is not correct, but I couldn't find any info on that.

hallow spindle
#

I didn't work with 2D lights yet, but this seems like the origin of your custom texture is not where your character is, but rather in the center of the complete texture.

#

I guess the engine computes your light coming from a point further to the right in your screenshot. When the light completely disappears that point is inside the occluder.

haughty maple
#

You Sir... or madam ... are a lifesaver

#

I would never have figured that out by myself.

#

Like I just had this weird misunderstanding, that I should move the LightNode around, like I would with a sprite

#

But if i instead just use the offset, but leave the origin the same it even looks the same in the editor, but yeah it just works

#

Another minor thing I learned in the meantime is, that I don't have to use the alpha channel in my texture but simply a gradient from black to white and that works as well

#

Thank you so much

haughty maple
#

[Solved] How to create a proper texture for PointLight2D

hallow spindle