Jump to content

Liquid not rendered properly on top of Airflow Tiles or Solar Panels (+how to fix)


llunak
  • Branch: Live Branch Version: Linux Fixed

Liquid is not rendered properly on top of certain surfaces such as Airflow Tiles or Solar Panels. Small amounts are not rendered at all, larger amounts strangely float. This is annoying visually, and it may e.g. cause the soggy feet debuff without an "obvious" reason.

a.thumb.jpg.6248354013cab8635a2da275dfd5a227.jpg

How to fix (as far as I can judge, given that the C++ sim code can't be easily decompiled):

- As can be seen, the "solid" tiles are in fact not formed by a solid element, but contain a gas (Airflow Tile) or vacuum (Solar Panel).

- Presumably the problem is that the code checks if the tile below is filled with a solid or liquid element, which fails here, so the code decides to render the liquid as falling.

- A fix would be to also check if the tile below is a constructed tile, but it seems that wouldn't work, as Solar Panel does not seem to set Sim.Cell.Properties.ConstructedTile for whatever reason.

- It should however work to check for Sim.Cell.Properties.LiquidImpermeable. Both Airflow Tile and Solar Panel set those (Solar Panel in MakeBaseSolid.ConvertToSolid()), and logically if a tile is LiquidImpermeable then for the purposes of liquid it should act the same way as solid tiles.

 

I imagine this must have been already reported, but since this is a bug in the C++ sim code, it can't be fixed at least in a mod (I've spent quite some time on this), so it'd be really nice if it got a somewhat higher priority to fix, especially since a fix appears to be fairly simple.

 


Steps to Reproduce

See picture. Build an Airflow Tile and drip water on top of it.

 

  • Like 3



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

this is NOT a sim bug, the sim works perfectly fine , is however entirely irrelevant for this issue as it has nothing to do with rendering.

its more of a quirk/bug in how the liquid shader works. in short, the different border thresholds that affect the rendering of these liquid tiles overlap with each other, leading to the liquid not rendering.

the top border threshold of the liquid rendered is determined by the mass of the tile, the less mass, the higher the distance from the top border of the tile.

normally the liquid shader connects to the center of a solid tile (you can see that sometimes with poi doors or the modded airlock door).

this can obviously not be done for tiles that are a gas ( vacuum counts as gas ), so no connecting to the center if the tile + a minimum buffer in the bordering liquid tile is applied. this (rather generous) buffer offset is put there to prevent the liquid from clipping into the gas tile.(this is what you describe as "falling", its technically not falling but it just appears during that as liquids fall always in gas)

now, these 2 factors collide here:

assuming there are 100px of height in the tile

the liquid mass defines the liquid height to f.e. 80px below the top tile border for a low mass liquid.

the "prevent liquid rendering inside gas tiles" part however sets a minimum of f.e. 25px from the tile border that is adjacent to this tile for the lower border of the liquid, making both exclusion zones overlap with each other,  0-25px blocked by tile offset from the gas below, 20-100px blocked by low mass, resulting in no liquid being rendered.

the uneven "blobs" exist because, while these offsets are a set number, the liquid shader applied some variance when rendering the borders to not have straight lines

Edited by SGT_Imalas

Share this comment


Link to comment
Share on other sites

I see. I couldn't find the place where liquid drawing was handled in the C# code (the few placer that seemed relevant are apparently actually unused code), so I assumed it was the C++ sim code that handled the liquid drawing.

That said, even though I got wrong where this is handled, I don't see how it changes much what I said about how it could be improved.

2 hours ago, SGT_Imalas said:

normally the liquid shader connects to the center of a solid tile (you can see that sometimes with poi doors or the modded airlock door).

this can obviously not be done for tiles that are a gas

Obviously? This is a screenshot of an Airflow Tile hacked to make the tile solid ("simCellOccupier.doReplaceElement = true;").
 

b.thumb.jpg.d22dcd39157da62391ced55bb35f1a8f.jpg

If I look hard, I can see the water inside the tile, but this is still a big improvement over the current situation. And unlike the floating or invisible water, I could even convince myself that this is actually correct. So this in fact can be done for gas tiles that are LiquidImpermeable buildings, wherever it is that this is handled.

In fact, since any larger amount of water cannot ever(?) have gas below it or to the side of it for more than a split of a second, liquid could probably always be made to reach into gas tiles that are not above, and it would look fine. But, really, either way, even if imperfect, would be an improvement over what it is now.

EDIT: With Solar Panel this is somewhat ugly, although I'd still consider that to be an improvement. Presumably this could be handled by reaching only very little into LiquidImpermeable building tiles (which would also handle the mentioned POI or Airlock mod door drawing).

c.thumb.jpg.8f6ea495fbbbea1ab4f88a86eee81759.jpg

Edited by llunak

Share this comment


Link to comment
Share on other sites

31 minutes ago, llunak said:

Obviously? This is a screenshot of an Airflow Tile hacked to make the tile solid ("simCellOccupier.doReplaceElement = true;").

yes obviously, as these tiles are now solid tiles and dont allow any form of gas inside of them.

airflow tiles (and the vacuum of solar panels) are always handled as the gas that occupies the cell, not the tile building, as they cannot physically occupy the tile they are in (since that would break the "airflow" part of them)

If you would change the shader to behave like that it would break every single border to all gas tiles, as the shader can only check if the tile is a gas or not

Edited by SGT_Imalas

Share this comment


Link to comment
Share on other sites

6 minutes ago, SGT_Imalas said:

yes obviously, as these tiles are now solid tiles and dont allow any form of gas inside of them.

airflow tiles (and the vacuum of solar panels) are always handled as the gas that occupies the cell, not the tile building, as they cannot physically occupy the tile they are in (since that would break the "airflow" part of them)

So? I wrote "hacked" because it's a temporary hack to show how that would be rendered, not because I suggest that as a solution.

6 minutes ago, SGT_Imalas said:

If you would change the shader to behave like that it would break every single border to all gas tiles, as the shader can only check if the tile is a gas or not

Which is why my actual suggestion was to extend the place to check whether a tile is solid or LiquidImpermeable. Surely the shader can check more if made so.

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...