I have tried to render Minetest nodes like lego-like bricks, by making common Mineclonia nodes like stone render as fixed nodeboxes and putting little studs on them. By default, this leads to an extreme FPS drop, because nodeboxes are not culled when occluded – i.e. all their faces are still rendered. You can see this in wireframe debug mode.
With a very simple (quite a bit too simple) patch I can demonstrate that not rendering nodeboxes is easily achievable: By not rendering nodeboxes that have nodes on each of their faces, the rendering speeds up noticeably.
Faster nodebox rendering
Faster nodebox rendering
- Attachments
-
- mineclonia-lego-nodebox-rendering-patch.jpg (47.21 KiB) Viewed 1818 times
-
- mineclonia-lego-nodebox-node-definition.jpg (33.15 KiB) Viewed 1818 times
cdb_b9da8bbc6338
Re: Faster nodebox rendering
sfan5 posted two related issues in the #minetest IRC channel:
https://github.com/minetest/minetest/issues/6409 Efficient ways to render layered nodes like default:snow (discuss)
https://github.com/minetest/minetest/issues/6409 Efficient ways to render layered nodes like default:snow (discuss)
https://github.com/minetest/minetest/issues/9126 Mesher should discard triangles more aggressively[…] snow in Minetest Game (default:snow) renders slowly which was stated as a reason to not use it so much in mapgen v6.
A quick look in wireframe mode or just viewing the nodes from below with noclip mode reveals why: There are 6 faces per snow node, neighboring snow is not combined to a single face at all, like normal full-cube nodes are. The same applies to slabs, too. The bad thing is that all 6 faces appear to be rendered for each single node, even those you can't see. No wonder why paramat was opposed to add tons of snow to v6. :D
Avoiding rendering single faces of nodes can avoid even more rendering work than just not rendering entire nodes.The mesher only ever attempts to optimize plain, solid nodes.
This can lead to pathological situations where more than half of a mapblock's geometry is never actually drawn.
- Attachments
-
- minetest-issue-9126-wireframe.jpg (93.24 KiB) Viewed 1815 times
cdb_b9da8bbc6338
Re: Faster nodebox rendering
Likely inspired by the above, x2048 started optimizing nodebox rendering: https://github.com/x2048/minetest/tree/nodeboxes
So far (2022-05-03) there exist only two commits on this branch:
https://github.com/x2048/minetest/commi ... ebe098ab11 Add infrastructure to optimize nodeboxes
https://github.com/x2048/minetest/commi ... 89e5b60919 Limit culling to faces that touch the node boundary
The underlying idea is to not render the faces touching solid nodes or other nodeboxes.
You can see in the screenshot below that the bottom face of the snow is not rendered.
So far (2022-05-03) there exist only two commits on this branch:
https://github.com/x2048/minetest/commi ... ebe098ab11 Add infrastructure to optimize nodeboxes
https://github.com/x2048/minetest/commi ... 89e5b60919 Limit culling to faces that touch the node boundary
The underlying idea is to not render the faces touching solid nodes or other nodeboxes.
You can see in the screenshot below that the bottom face of the snow is not rendered.
- Attachments
-
- minetest-snow-bottom-side-not-rendered.jpg (9.04 KiB) Viewed 1812 times
cdb_b9da8bbc6338
Re: Faster nodebox rendering
The snow optimizations of x2048 got merged; adjacent faces of snow nodes are no longer rendered.
https://github.com/minetest/minetest/pull/12262 Avoid rendering invisible faces of simple nodeboxes
sfan5 noted during the review that this must only happen for opaque nodes, as otherwise glass looks different.
https://github.com/minetest/minetest/pull/12262 Avoid rendering invisible faces of simple nodeboxes
sfan5 noted during the review that this must only happen for opaque nodes, as otherwise glass looks different.
cdb_b9da8bbc6338
Re: Faster nodebox rendering
This is cool, Minetets speedup
Who is online
Users browsing this forum: No registered users and 1 guest