2
\$\begingroup\$

I'm having some problems with my current game. Short description: It's a 2D game where you have to avoid the lights or you lose HP.

My problem is the following one:

Luna Problem

Here is the rendering process:

  1. The background is drawn
  2. The Moon image is drawn
  3. The point light is applied
  4. The collision layer and the images attached to it are drawn
  5. Player is drawn
  6. The foreground image (on the top left and bottom middle)

My problem is that the rendering does not look realistic. I need some help on how I could make the light coming from "behind" the collisions and applying it everywhere.

Thanks for your help.

\$\endgroup\$
  • \$\begingroup\$ Do you mean that the light isn't diffused around corners? \$\endgroup\$ – oxysoft Mar 14 '14 at 10:52
  • \$\begingroup\$ I mean that i don't want the light to stop at the top of the branch but go "behind" the branch. \$\endgroup\$ – Kamigaku Mar 14 '14 at 14:17
1
\$\begingroup\$

ideally, you configure group/mask for your lights and objects. Using this, you can tell your point light to ignore those branches. See a great write-up here.

alternatively, as a brute force approach, you could render lights before you draw your branch (though you should REALLY use the mask approach above):

// draw all objects that should create shadows
batch.begin();
...
batch.end();

rayHandler.setCombinedMatrix(camera.combined);
rayHandler.updateAndRender();

// draw your branches that should not cast shadows
batch.begin();
...
batch.end();
\$\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.