0
\$\begingroup\$

In our game, shadows generated for dynamic objects through a shadowmap render on the wrong sides of walls.

Here you can see the issue: In the top right corner you see the shadow from a box I placed on the upper floor. This box casts shadows both on the upper floor, the lower floor and the second box placed on the lower floor. Shadow cast through walls

The shadowmap is generated by the engine and we have no access to it. The only thing we can influence is the projection of the shadows onto the scene in the shader. I read through some tutorials about shadow-mapping, but none address the issue of walls or buildings with multiple floors.

\$\endgroup\$
6
  • \$\begingroup\$ It looks like this is the correct shadow result (object closer to the light casts shadows on objects further from the light) with the wrong light setup (you're using the light on the second floor to illuminate the first floor). You're simulating a building made of glass, where the sun shines in through the ceiling and passes through the floors, rather than a real building where windows/light fixtures in each room shine light within it, and do not pass through the walls/floors/etc. Does the first floor not have its own light source? \$\endgroup\$ Commented Aug 13, 2021 at 12:36
  • \$\begingroup\$ There is only one global light source for dynamic shadows, usually the sun. Buildings usually are meant to have static shadows set through a light map. \$\endgroup\$ Commented Aug 13, 2021 at 14:03
  • \$\begingroup\$ Sounds like a fairly engine-specific problem. Can you share any details about the engine you're using? That can help users familiar with that engine advise on how to configure the lightmap generation to consider only selected shadow casters per receiving surface. \$\endgroup\$ Commented Aug 13, 2021 at 14:08
  • \$\begingroup\$ Game is a mod of Battlefield 2 and its using Refractor 2 engine \$\endgroup\$ Commented Aug 13, 2021 at 20:11
  • \$\begingroup\$ Is the floor a 2D plane or a box with some thickness? What could be causing it is that the box's bottom face is very close, exactly on, or slightly below the floor, and that this "confuses" the engine somehow, but I'm not sure. If the box is static geometry, you could maybe try moving it slightly higher. Or maybe you could tweak the floor somehow. \$\endgroup\$ Commented Aug 14, 2021 at 23:31

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.