1
\$\begingroup\$

I currently have something like this using box2Dlights Player point light with hard shadows

Ideally, I would like objects casting shadows to be lit, so the object is lit but there is still a shadow cast around it. Right now the object is covered by shadow. I am aware of the soft and softnesslength settings in box2dlights but this is not really what I'm looking for. Softness seems to light up a certain radius from the player rather than just lighting objects. It ends up kind of weird looking: Player point light with softness length = 1.5f So for example in the above picture, I would want the entire grey box to be lit, and none of the area to the left/right/behind it to be lit.

Any thoughts would be appreciated. Thanks

\$\endgroup\$
0
\$\begingroup\$

the RayHandler render creates a black and white mask and mask the alpha channel with it, so some parts are darker

what you can do is detect that an object should now lighten (maybe with the use of RayHandler.pointAtLight(x,y), or calculate the radious of the light )

and edit the mask so the whole area of the object is totally white(or as light as the edge of it)

my guess would be to edit the RayHandlers Render method. you can see there that it clears the mask to be black and adds the white areas where the lights are.

// line 312:
for (Light light : lightList) {
    light.render();
}

so just add your white rectangles there and they will be lit.

and of course to set the Softness to a low or zero value.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.