Questions RE flowing liquids

Post Reply
karlexceed
Member
Posts: 34
Joined: Sun Jan 05, 2020 22:35
GitHub: karlexceed
In-game: karlexceed

Questions RE flowing liquids

by karlexceed » Post

I decided to try creating a mod that adds liquid mercury. It was mostly straightforward, but there are a few things that I have questions about.

You can check out the WIP mod here: https://github.com/karlexceed/liquid_mercury/tree/main

First, am I correct that setting drowning above 1 will have no effect? I tried setting it to 10, but the player doesn't seem to drown any faster.

Second, I removed paramtype = "light" and tried setting post_effect_color to {a=0, r=255, g=255, b=255}, but I am still able to see when submerged:
screenshot_20231209_235647.png
screenshot_20231209_235647.png (220.83 KiB) Viewed 2225 times
And lastly, I am getting this weird dark shade at the edge of flowing sections, after removing paramtype = "light":
screenshot_20231209_235640.png
screenshot_20231209_235640.png (956.73 KiB) Viewed 2225 times
Are these drawing issues basically just a case of the engine not being set up to handle opaque liquids?

User avatar
Blockhead
Moderator
Posts: 2840
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Questions RE flowing liquids

by Blockhead » Post

The engine really doesn't seem to be able to handle nodes that aren't drawtype normal and at the same time don't have paramtype light. You'll notice the flowing liquids case a shadow as if they are a full node even when they are partial, along with the bad lighting on some of them. - in the middle of those three at the bottom there would have 0 light from anything else on the horizontal axes around it, so it's drawn oddly dark. I tried messing around with glow = 14, and light source = 1 and so on, but it doesn't really help.

Here's a visualisation of the difference between cobble and the flowing corner node of mercy - two screenshots, same camera position; GIMP difference mode between layers and then cranking the exposure up. Very similar shadow.
Attachments
cobble_mercury_diff.png
cobble_mercury_diff.png (83.31 KiB) Viewed 2205 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Desour
Member
Posts: 1578
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Questions RE flowing liquids

by Desour » Post

A node can only store light info if it has paramtype="light". You'll always want to set this for all drawtypes but normal, as Blockhead already said.

The a in {a=0, r=255, g=255, b=255} is alpha. 0 means that the color is fully transparent.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

karlexceed
Member
Posts: 34
Joined: Sun Jan 05, 2020 22:35
GitHub: karlexceed
In-game: karlexceed

Re: Questions RE flowing liquids

by karlexceed » Post

That's funny - I had assumed that the alpha value was inverse of that. Sure enough, setting that to 255 solved for the view from underneath the liquid.

And adding paramtype = "light" back looks correct now as well with the correct alpha set. Now if only there was reflectivity/albedo...

User avatar
Blockhead
Moderator
Posts: 2840
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Questions RE flowing liquids

by Blockhead » Post

karlexceed wrote:
Mon Dec 11, 2023 03:25
That's funny - I had assumed that the alpha value was inverse of that. Sure enough, setting that to 255 solved for the view from underneath the liquid.

And adding paramtype = "light" back looks correct now as well with the correct alpha set. Now if only there was reflectivity/albedo...
Good to hear things look good now, but I had thought that you were also asking that the liquids be opaque to light at the engine level, such that if you were trapped in a hole under a layer of mercury between layers of glass, it would block light out. I don't think that's possible. But if that's not what you're after then at least I guess this thread has run its course.
Last edited by Blockhead on Mon Dec 11, 2023 07:43, edited 1 time in total.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Nininik
Member
Posts: 948
Joined: Thu Apr 06, 2023 01:55
GitHub: nininik0
IRC: nininik
In-game: nininik
Location: CA, Team thunderstrike headquarters
Contact:

Re: Questions RE flowing liquids

by Nininik » Post

I have a rhing where some of my liquids are invisible for some weird reason
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯

User avatar
Blockhead
Moderator
Posts: 2840
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Questions RE flowing liquids

by Blockhead » Post

Nininik wrote:
Mon Dec 11, 2023 05:27
I have a rhing where some of my liquids are invisible for some weird reason
Please ask in a different thread and post a screenshot and version info.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

karlexceed
Member
Posts: 34
Joined: Sun Jan 05, 2020 22:35
GitHub: karlexceed
In-game: karlexceed

Re: Questions RE flowing liquids

by karlexceed » Post

Blockhead wrote:
Mon Dec 11, 2023 03:29
I had thought that you were also asking that the liquids be opaque to light at the engine level, such that if you were trapped in a hole under a layer of mercury between layers of glass, it would block light out. I don't think that's possible.
That does seem to be the case, at least to some extent. Being submerged in the liquid will block out most of the light (I currently have the alpha set to 250), and as an experiment, I made a glass platform with mercury above and it seems to block at least some of the light from above, though it's nowhere near as dark as it should be if the mercury were totally opaque.
screenshot_20231211_022542.png
screenshot_20231211_022542.png (635.21 KiB) Viewed 2098 times
And it also works the other direction - I placed some torches underneath the mercury layer and could see them from above.

karlexceed
Member
Posts: 34
Joined: Sun Jan 05, 2020 22:35
GitHub: karlexceed
In-game: karlexceed

Re: Questions RE flowing liquids

by karlexceed » Post

Additional info: It seems that the light transmission works exactly like water, which is unsurprising. More layers means a greater reduction in brightness.

14 layers of mercury is basically pitch black, which is the same as water, and tracks with the information from this page: https://wiki.minetest.net/Light

User avatar
Blockhead
Moderator
Posts: 2840
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Questions RE flowing liquids

by Blockhead » Post

karlexceed wrote:
Mon Dec 11, 2023 08:46
Additional info: It seems that the light transmission works exactly like water, which is unsurprising. More layers means a greater reduction in brightness.

14 layers of mercury is basically pitch black, which is the same as water, and tracks with the information from this page: https://wiki.minetest.net/Light
Right, the wiki is accurate on the behaviour of liquids. I think it would be nice to be able to have opaque liquids or maybe even liquids with a defined light attenuation per node, say 2-3. I probably wouldn't relate it to the texture alpha directly. But that's just a feature request.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests