Page 1 of 1

[15.21] Shadow not cast on trains correctly

Posted: Fri Jun 16, 2017 11:21 pm
by mrgnl
Description: Shadows from trees (and possibly other entities) are not case on trains correctly.

Steps to reproduce:
  • Lay a north-south railway east of a tree.
  • Place a train on the rail.
  • Drive train past tree.
Result: Tree shadow only cast on lower part of train.

Expected result: Tree shadow cast on entire train.

Video of problem (YouTube): here
Log (Pastebin): here
Savegame (Google Drive): here

Image

Re: [15.21] Shadow not cast on trains correctly

Posted: Sat Jun 17, 2017 7:55 am
by Rseding91
That's because trains use special rendering to stay above most entities and the shadows on the trees are baked into the tree sprite.

Re: [15.21] Shadow not cast on trains correctly

Posted: Sat Jun 17, 2017 7:00 pm
by mrgnl
Rseding91 wrote:That's because trains use special rendering to stay above most entities and the shadows on the trees are baked into the tree sprite.
True as that might be, as a player :roll: I expect the shadow to be cast correctly on a train. All players will experience this issue/feature.

I noticed the topic was moved to 'not a bug'. It would be great if you could mention that in your response. And, now that I've discovered this 'verdict': since we're seeing a graphical glitch I think that, even though technically it's intended to be rendered this way, it's an issue as it doesn't look&feel right. Please consider moving this to "Minor issues" instead.

Technical:
Simply rendering entities from top to bottom doesn't work with items (like trains, trees, etc) that span a larger area. Therefore it might be worth considering rendering entities' shadows separately. Or to do so on at least the 'HIGH' graphics setting (which I'm running on in this example). Personally I'd put correctly rendering shadows very close to high-res graphics (especially since this is disabled by default and shadows are enabled by default).

Re: [15.21] Shadow not cast on trains correctly

Posted: Sun Jun 18, 2017 5:19 pm
by Rseding91
In order to render shadows independent of the entities we would need to go over every entity in the game and separate the shadow from the entity. That has several downsides to fix what is an extremely minor thing you almost never notice while playing:
  • It will take hundreds of man hours
  • It will increase the VRAM usage because now what was 1 combined sprite is now 2
  • It will reduce render performance because what was 1 combined sprite is now 2
  • It increases the render code for each entity because now each has to render a normal sprite and a shadow
  • It increases the entity prototype definition complexity because the shadow sprite and the normal sprite both have to be defined with perfect scaling/shifting
All of that to fix some minor graphics quirks for shadows. It still won't fix things like the train renders on top of some entities when in vertical/angled orientations and probably wouldn't fix the shadows thing completely either.

So, that's why we decided that this isn't a bug.

Re: [15.21] Shadow not cast on trains correctly

Posted: Wed Jun 21, 2017 11:06 am
by mrgnl
Since there's no 'like' feature on this forum, one more post from my end: Thanks Rseding91, love the detail! I understand the impact of such a change and the classification. Good luck with getting .15 out there and thanks for all the hard work.