I wonder how can a liquid node's side rendered in opengl_vertex.glsl

For people working on the C++ code.
Post Reply
badentry
Member
Posts: 36
Joined: Tue Jul 09, 2024 07:56

I wonder how can a liquid node's side rendered in opengl_vertex.glsl

by badentry » Post

In shaders.cpp there's a

Code: Select all

std::string vertex_shader = m_sourcecache.getOrLoad(name, "opengl_vertex.glsl");
processing waving liquid feature, and in `opengl_vertex.glsl` I found

Code: Select all

pos.y += (snoise(wavePos) - 1.0) * WATER_WAVE_HEIGHT * 5.0;
which triggered a bug that made liquid rendering go through solid block.

That's an unwanted behavior, so I want to implement a `lim(pos.y, no_wave_liquid_bottom, no_wave_liquid_top)` or some conditional statement works similar to this, so that I can limit the buggy downwards rendering behavoir to the bottom of the liquid node with a state of waving liquid is not yet enabled.

But I don't know how sides are rendered in opengl in minetest, and how to modify it's height. I spent some time going through the code I think is related, it seems the pos.y just indicates y pos of the rendered liquid node, not y pos of side or node height or something. In other words I didn't find the corresponding code. I think maybe go blind searching only will take me considerable time for nothing, so while I'm on this, I think I'd better post a topic for help.

Please help.

Post Reply