Page 1 of 1

Offshore pump underwater_pictures - tile renderer?

Posted: Fri Aug 13, 2021 6:18 pm
by kirazy
What does this mean?
Drawn by tile renderer when water animation is enabled.
From: https://wiki.factorio.com/Prototype/Off ... aphics_set

The goal here is to replicate this graphics_set with an assembling-machine prototype using working visualisations, but I have no idea what that means/implies about how those sprites are handled. What's special about the tile renderer?

Re: Small documentation improvement requests

Posted: Sat Aug 14, 2021 1:51 pm
by posila
kirazy wrote:
Fri Aug 13, 2021 6:18 pm
The goal here is to replicate this graphics_set with an assembling-machine prototype using working visualisations, but I have no idea what that means/implies about how those sprites are handled. What's special about the tile renderer?
The rendering pipeline has several separate renderers, of which the most important and most complex ones are TileRenderer, EntityRenderer and ChartRenderer. They have their own separate set of 255 render layer, so if you saw water-tile or ground-tile render layer, they used to be actually TileRenderer's render layers, not EntityRenderer's ... so if an entity uses those layers, the entity will be still drawn above tiles. But, tile renderer doesn't even use RenderLayer enum anymore (I think since 0.17), so water-tile and ground-tile were left in the game just in case someone uses them.

What is special about TileRenderer is, I suppose, that it is heavily optimized around the assumption that tiles almost never change, as opposed to entities that are expected to change every single tick. So tile renderer caches per-chunk vertex data, ready to be just used in a draw call, and it also caches terrain rendered previous frame, so it can just reuse most of it (#FFF333) ... so if offshore pump wants to draw something under water (which is possible to do, because animated water is re-rendered every frame using the cached vertex data, and is not reused from bitmap from previous frame), it has to do something special to inject its own sprite into TileRenderer to draw before it renders the water.

And it is so special, generic sprite definition can't do it ... so you can't replicate it in working visualization.

Re: Small documentation improvement requests

Posted: Sat Aug 14, 2021 5:57 pm
by kirazy
posila wrote:
Sat Aug 14, 2021 1:51 pm
And it is so special, generic sprite definition can't do it ... so you can't replicate it in working visualization.
I've managed to come close with some alpha blending in the sprites. :D

Thanks for the explanation, I appreciate it. :)