I’m using box2dLights with libgdx, but just as a field-of-view tool for the player. So I was wondering if there was a way to eliminate just the lighting part of it and keep the shadow-casting. What I mean is to have the black parts of this image (http://i.imgur.com/zwkAOr4.png) remain, but I don’t want the fade into darkness as it moves away from the player as if there is a light coming form the player. Where there are no shadows, I just want normal graphics displayed with no lighting. Preferably, I’d like to do it in a way that I can also use the lighting in other areas of the game.
I would test using isDiffuseFlag as true and light color as white. Then make light with huge distance so fallof don’t affect it(much)
static public boolean isDiffuse;
You could also tweak the pixel shader always output pure white color instead of vertex color.
Nice! That actually worked pretty good. http://imgur.com/bOTZRZT
Is there no significant performance hit for raising the distance so high? I set mine to 1000 before it almost completely got rid of the fade away. It seems fine, but I’m on a slow computer now.
Thanks for the quick answer, and excellent job on the library. It’s quite a nice piece of work.
If anyone else wants to do this, here is the code I used:
@handler = RayHandler.new(world)
RayHandler.isDiffuse = true
@central_light = PointLight.new(@handler, 400)
@central_light.soft = true
@central_light.softness_length = 1.2
@central_light.color = Color.new(0.80, 0.80, 0.80, 1.0)
@central_light.distance = 1000
Each ray cast will cost some amount more. If this is gonna be problem just modify the shader to output white.