CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.32k stars 4.14k forks source link

3D shadowcasting bug for weather with sight_penalty != 1.0 #65205

Open andrei8l opened 1 year ago

andrei8l commented 1 year ago

Describe the bug

Shadowcasting appears to pass through solid obstacles when the weather's sight_penalty is not 1.0.

Attach save file

Maple Glen-trimmed.tar.gz

Steps to reproduce

  1. Load save file.
  2. Make sure 3D fov is enabled
  3. Change weather to Snowstorm
  4. Look around up then back down
  5. You now have vision past the wall. You can already see some bad shadowcasting in step 3 when you look up.

Expected behavior

Zarro boogs.

Screenshots

Screenshot from 2023-04-20 14-06-07 There must be a floor to the south of the wall for this bug to occur in this test case

Correct shadowcasting, for reference ![Screenshot from 2023-04-20 14-05-26](https://user-images.githubusercontent.com/68240139/233348686-0bae14db-1dd8-4c5d-a0c0-b48c47f7c51a.png)

Versions and configuration

Additional context

Can be reproduced with 0.F so it's not a recent bug.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

SurFlurer commented 1 year ago

I can /confirm this is still happening on ec7537a . Let's keep it open.

SurFlurer commented 6 months ago

Here's another way to reproduce the bug.

edit: I screwed the code while digging for this bug lol. That's actually my fault.

edit 2: I was going to explain this scenario, but screwed up. At least I could post the original case here, using save file provided in #72508. After giving myself debug night vision and walking around, here you can see some of the pillar's shadows get truncated by the railroad, but the others' are not.

I believe it's because the railroad is considered outside and the concrete floors are not. Thus they have different transparency values when the weather is foggy. This, in combination with shadowcasting's different sweep directions ( shown in the picture ), led to this bug.

image