Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
LOD, gigantic Terrains #433086
11/22/13 21:27
11/22/13 21:27
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
Let us take for example Skyrim, just how big the world is!
Now I was wondering how you could realize huge worlds areas with the acknex engine without killing fps or crashing the game because there are no nexus left etc...

We would have to reduce more and more details the further the camera goes away and force to only show a maximum amount of entities etc., in other words a LOD system.

That is the same trick these guys are using:
Youtube

Did anybody already worked on that, will or is it a feature for the acknex engine?
In other words, does the acknex engine support any kind of LOD?
And will it be improved if it is already available?

Greetings Chuck

Last edited by Random; 11/22/13 21:31.


Re: LOD, gigantic Terrains [Re: Random] #433087
11/22/13 21:53
11/22/13 21:53
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
You can use Chunked Terrain. But this is also very limited.

Currently I'm working on real unlimited terrain. And by unlimited I mean unlimited (the only limiting factor would be HDD space, but that's not a problem on modern PCs).

My trick is, the whole world (terrain) is splitted into tiles. Each tile is saved on HDD in a custom file format where vertex position data (only Z position) is saved and maybe the normals too. And the texture as external file.

Now I create only a bunch of unique terrain tiles on level loading via ent_clone. These unique terrain tiles will be updated with the tile data saved on HDD. For example: you have a really huge world consist of 10,000 terrain tiles. If you would load them all via ent_create or ent_morph into the engine, the nexus limit would be reached very quickly. Instead there are just, for example, 32 unique terrain tiles, as much as the camera clipping distance allows to show.

Now, if the player moves forwad, the tiles behind the camera, which moves away from the player, are "freed". This means the texture will be remove from video memory via ent_purge, and the ENTITY* of this unique tile will be available for the tile which comes closer to the player. Now this tile will be filled with the vertex data which we saved on HDD and load the new texture on this terrain tile entity.

The BIG advantage by reading vertex data from HDD is, no new Nexus memory is needed. So you can do unlimited terrain.

The biggest disadvantage is, that filling the terrain tile with the vertex data consums processor speed and therfore FPS. But this can be reduced to a minimum by using small tile sizes and by filling the vertex data of a tile not in a whole frame, instead splittng the vertex data reading into several frames. This will keep the FPS high and the player won't notice the loading.

Another problem is the "var" limit of -999.999 to 999.999. For this problem I don't have tested any solution yet. But one approach would be, to define zones of your world, if the player walks into a new zone, the whole level will be shifted in X and Y direction (this should be really fast, maybe the user will only notice a framerate drop for less than a second).

I hope this was understandable wink

Re: LOD, gigantic Terrains [Re: oliver2s] #433089
11/23/13 02:34
11/23/13 02:34
Joined: Apr 2012
Posts: 62
wrekWIRED Offline
Junior Member
wrekWIRED  Offline
Junior Member

Joined: Apr 2012
Posts: 62
I am facing the same challenge when it comes to terrain LoD. Allot of things are bothering me when it comes to implementing this feature. I'm limited to -2000000 to 2000000 quants in world size. I need to save poly and using large poly size with detail map texture makes the terrain polygon shake so I have to eliminate the detail texture and use plain texture instead. I wanted to use my own terrain LoD but loading different LoD for each tile is slowing things down and I also have to work with each node's texture Lod. Haven't tried loading z position of each vertex yet but I'm wondering how to use it in a way that it would line well with other tiles.

Then after solving the terrain LoD problem you still have to figure out how to load and unload terrain entities which is I'm trying to figure out with the terrain problem.

Re: LOD, gigantic Terrains [Re: wrekWIRED] #433090
11/23/13 05:27
11/23/13 05:27
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
These are both pretty naive approaches, and unlikely to perform well in a real environment. If I had to take a guess, I would say Oliver2s' method is currently performing good because he is hitting the filesystem cache pretty hard (can you try to flush it completely and then retry your code?)

The problem is that HDDs are inherently slow and it may take up to two complete rotations of the platters until the head is over a chunk of data you want to read, and that assumes that the HDDs is completely spun up already and not serving anything else. Just loading on demand won't cut it, you should look into pre-loading chunks that are not yet visible, but in vicinity to already visible chunks, to avoid doing the HDD roundtrip in a blocking manner (as in: Read them in the background).

And the file format is also important, it may make sense to duplicate data in a way that allows you to just read data in sequence instead of having to seek around all the time. The Just Cause 2 guys ended up writing a system that uses multiple layers of terrain detail with duplicated data that allows them to just read in a huge chunk of the file at once as the player moves through the world. Their post mortem may give you some ideas.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: LOD, gigantic Terrains [Re: WretchedSid] #433091
11/23/13 08:35
11/23/13 08:35
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I like Oliver's approach, but another problem could arise when it becomes necessary to load a lot of objects corresponding to each terrain tile (vegetation, buildings etc.).
I think high nexus usage can be avoided by using sys_malloc/sys_free, but they are also time consuming operations...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: LOD, gigantic Terrains [Re: WretchedSid] #433092
11/23/13 09:35
11/23/13 09:35
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: JustSid
The problem is that HDDs are inherently slow


Sure. But that's a compromise between speed and size of level. I could preload everything into Nexus. But as we all know, this very limited in case of big levels. So loading data from HDD is a good compromise for me.

Re: LOD, gigantic Terrains [Re: oliver2s] #433093
11/23/13 10:43
11/23/13 10:43
Joined: May 2013
Posts: 155
N
NeoDumont Offline
Member
NeoDumont  Offline
Member
N

Joined: May 2013
Posts: 155
Perhaps you may check out my Neomill Project "Tradmill" script in the C-Script/WDL section. Its written in C-Script/wld but rather simple and should be understood easily and could be translated into Lite C quickly.

Once you understood how the Neomill treadmill script works you could improve the scipt building your own LOD Lite-C script for terrain tiles.

You may need to change the 9 Tile Treadmill into a 16 tile treadmill or with even more tiles.

Let the tiles far away from you loaded in as simple low poly mdls or hmps and the terrain you are on or nearby in high poly quality.

The only disadvantage of my scripted mill is that all tiles must be files and therefor are visible for the Gamer.

Anyway, check ouut it if you haven't alread. It can be downloaded from the acknex resourece download section (code section)

Greets

J. Hunke

Re: LOD, gigantic Terrains [Re: NeoDumont] #433094
11/23/13 11:06
11/23/13 11:06
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
I'm still testing my treadmill script I explained above. The data (height of each vertex) can also be loaded into RAM and therefore don't needed to be loaded from HDD all the time. Only the textures need to be loaded at runtime from HDD (as I explained above too). Loading vertex height data into RAM would consum around 40 MB of memory with 20,000 tiles. In my world scale that would be an area of 576 kmē.

But as sivan mentioned. There's still the problem with unique entities on the terrain (buildings, vegetation, etc..) which increases the nexus.

Re: LOD, gigantic Terrains [Re: oliver2s] #433095
11/23/13 11:22
11/23/13 11:22
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: oliver2s
I could preload everything into Nexus. But as we all know, this very limited in case of big levels. So loading data from HDD is a good compromise for me.

Hence why I said streaming it in in the background. Or just use asynchronous I/O, and you don't even have to touch the threading stuff.
Seriously, try it with a cold filesystem cache and see if it's still a good trade-off to just load on demand.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: LOD, gigantic Terrains [Re: WretchedSid] #433096
11/23/13 11:25
11/23/13 11:25
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: JustSid
Originally Posted By: oliver2s
I could preload everything into Nexus. But as we all know, this very limited in case of big levels. So loading data from HDD is a good compromise for me.

Hence why I said streaming it in in the background. Or just use asynchronous I/O, and you don't even have to touch the threading stuff.
Seriously, try it with a cold filesystem cache and see if it's still a good trade-off to just load on demand.


Yes, I'm still testing...

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1