libgdx/box2d lights: change blur of lights

291 Views Asked by At

I was wondering whether it is possible to change the rate at which a lights intensity decareases over distance.

something like this: enter image description here

2

There are 2 best solutions below

1
Fungaria On BEST ANSWER

So I finally figuered it out. You have to write a custom shader that is essetially the same as the default one, but change the line that takes care of the interpolation:

"v_color = s*quad_colors;\n"

for example:

"v_color = s*2*quad_colors;\n"

halves the dropoff rate, while:

"v_color = (s*0)+quad_colors;\n"

gets rid of any blur (leaving out the "s" completely out won't work)

0
user2213117 On

I have the "v_color = squad_colors;\n" its in the vertex shader of the light source. See https://github.com/libgdx/box2dlights/blob/master/src/shaders/LightShader.java. However the above didn't work for me, the number you use must be a float. E.g."v_color = (s0.0)+quad_colors;\n"