Page 1 of 1

View terrain at any distance

Posted: Wed Jan 13, 2021 13:29
by MisterE
Would this be easy/possible to implement?

The idea is shamelessly taken from veloren
Image
https://veloren.net/

Veloren only recently implemented viewing terrain at any distance.

Some rough ideas of how it could be done: either save map data as the server loads it, or generate a preview from the seed. The goal is to get: 1) approximate average color of the nodes (pixels), and 2) height map of the terrain. Then, a simple pixelated image of the terrain color is mapped to a mesh of he terrain height and this is displayed in the distance. Each mapblock in the distance is its own rough mesh and image, and these are generated when the map is loaded, saved by the server, and sent to clients if/as they request them. When I say mesh, I mean a very rough mesh to save data. The trees and buildings, for example, should not be included. Basically, the mesh approximates the shape of the base terrain. As a player gets close to a mapblock, the mapblock is loaded, and details become visible like normal.

Infinite viewing is not necessary... just, send a large viewing range using this method would do.

Re: View terrain at any distance

Posted: Wed Jan 13, 2021 14:53
by freshreplicant
I think I saw a video about this being implemented in Veloren the other day actually. I don't have the technical know-how to weigh in, but from a users perspective this would be amazing.

Re: View terrain at any distance

Posted: Wed Jan 13, 2021 16:07
by Linuxdirk
This actually was in the game once and was called "farmesh" but it was removed for some reason.

Re: View terrain at any distance

Posted: Wed Jan 13, 2021 17:24
by MisterE
Looking up farmesh, it looks like it was a good start, but go abandoned. It really would be nice for core devs to have another go at it

Re: View terrain at any distance

Posted: Wed Jan 13, 2021 18:02
by v-rob
Part of the problem with the farmesh is that it only previews generated terrain. If your map has a gigantic city or a huge crater from TNT blasts, the farmesh would only show what the map originally looked like. For small-scale buildings and suchlike, this isn't a problem, but largely modified maps aren't represented well.

Plus, the farmesh was from when nodes were hardcoded. Some more work would be necessary to make it work with Minetest's greater game versatility now. Even more so, the farmesh could only accurately (ish) represent 2D noise mapgens. 3D noise don't look quite right with the farmesh. Lua mapgens, which AFAIK can't be pre-generated, present even more of a problem.

So, while I do like the farmesh (when I occasionally play 0.3.1, I almost always turn it on), it presents a lot of problems for modern Minetest, and some thought would be necessary to reimplement it in a usable way.

Re: View terrain at any distance

Posted: Thu Jan 14, 2021 00:06
by Dragonop
v-rob wrote:
Wed Jan 13, 2021 18:02
Part of the problem with the farmesh is that it only previews generated terrain. If your map has a gigantic city or a huge crater from TNT blasts, the farmesh would only show what the map originally looked like. For small-scale buildings and suchlike, this isn't a problem, but largely modified maps aren't represented well.
Still better than a window into the cyan void, just hide it under some fog

Re: View terrain at any distance

Posted: Thu Jan 14, 2021 04:04
by rubenwardy
As well as farmesh, there's also farmap which was level of detail based - you'd see actual things in the distance at a lower resolution

Bedrock supports massive view ranges without these tricks which look terrible

Re: View terrain at any distance

Posted: Thu Jan 14, 2021 08:46
by AspireMint
Idea: If you could edit mapblock (not in db), before it is sent, maybe it would be possible to view things in distance.
I mean, remove nodes that are not visible but still rendered in client which slows down things,
replace nodes that has running jobs (abm) or mesh to dummy nodes, or remove unnecessary blocks,
and just send "shell" (eg. dirt_with_grass blocks, not dirt lying under it).
And level of modified mapblock would depend on player settings (low-end device friendly).
So something like this: minetest.on_send_mapblock = function(player, mapblock) should return modified mapblock
(settings - player:get_mapblock_settings() ?)