Tweak underground/loader layer render order

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Tweak underground/loader layer render order

Post by Deadlock989 »

Hi again,

I feel like I (and others) posted about this before but can't locate it.

When an entity has a layered structure, the layers seem (in most cases) to get drawn in this order, from the "bottom" up:
  • Terrain / tiles
  • Belts or belt-like things
  • Shadows (draw_as_shadow = true)
  • Everything else, from left to right and then top to bottom
So if you have an entity with a separate shadow layer, and the shadow overlaps a neighbouring entity that is a belt, the shadow gets drawn over the belt. If the neighbouring entity is something else, say, a furnace, the shadow is not drawn over the furnace. This all makes sense - belts are flat on the ground, or they were until 0.17 at least - so it usually looks good.

The problem is with undergrounds and loaders, for any sprite structure defined in the direction_in and direction_out components. These seem to be drawn over the shadows but under everything else, as if they were higher priority than shadows and belts but lower priority than most other entities. This means that ugly shenanigans occur when underneathies and loaders are positioned immediately to the south of any entity which goes outside of tile bounds:

You can see it here with furnace entities:

Image

And with other vanilla entities that go outside tile boundaries too, like refineries:

Image

Another oddity / inconsistency between loaders and underneathies. With underneathies, non-belt sprite structure is drawn behind belts in front of it, as it should be. With loaders, though, the sprite structure is drawn on top of belts in front of it ...

Image

Best case: could we have some control over where sprite structure is rendered? A "render order" parameter?

Failing that, could the direction_in and direction_out components of both underneathies and loaders be adjusted within the base game data, so that they are not drawn with the same priority as the flat belt part but with the same priority as other tall structures? Could loaders also be tweaked so that they are drawn in exactly the same way as underneathies?
Last edited by Deadlock989 on Tue Mar 19, 2019 12:33 am, edited 1 time in total.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Tweak underground/loader layer render order

Post by Deadlock989 »

Just to add - it was possible to work around this in 0.16 and before by making sure that sprites stay within tile boundaries. However, now that belts themselves are 1.125 tiles tall, anything that accommodates them has to also move outside tile boundaries, so the issue is now a lot more common.
Post Reply

Return to “Implemented mod requests”