libgdxbox2dbox2dlights

libgdx/box2d lights: change blur of lights


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


Solution

  • 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)