Jump to content

Questions about large worlds with Babylon.JS


HeadClot
 Share

Recommended Posts

On 2016-04-27 at 11:22 AM, Dal said:

You don't get visible seams unless the LOD of the tiles is different... but it does kinda need to be if you want a very large world for performance reasons.

 

16 hours ago, joshcamas said:

This shouldn't happen, I don't think. :D

Here's what i mean: http://www.babylonjs-playground.com/#RXVB8#0

Both terrain tiles have same subdivisions amount and seam is still visible. I guess this happens because of smooth mesh shading.

Link to comment
Share on other sites

10 minutes ago, Dal said:

@gugis That's interesting... I don't get that issue when using noise. I wonder if the images are not pixel-perfect or possibly an issue in the way the GroundFromHeightmap function works?

Also, I tried to merge the meshes to see if it could hide the seam but they disappear... not sure why! http://www.babylonjs-playground.com/#RXVB8#2

Images are ok. Same problem with meshes created in modeling software. Also what do you mean by "using noise"?

Link to comment
Share on other sites

1 hour ago, Gugis said:

Images are ok. Same problem with meshes created in modeling software. Also what do you mean by "using noise"?

I created a terrain using a perlin noise function to generate the height data programmatically rather than using an image. I didn't notice any seams then.

Also, if you look at joshcamas' editor linked above, I can't see any seams there either....

snip.PNG

Link to comment
Share on other sites

It looks like there's something wrong with the heightmap data, not with using tiles. See how they don't match up? That looks like maybe some sort of compression with the image (but it looks like a raw type so probably not) or just problems with the image.

Where did these heightmaps come from?

Whenever I start my editor, I plan on whenever you import a heightmap (since you rarely import more than one per terrain, I would think(?)) it automatically splits it up into multiple images, and then I think I would use my own groundfromheightmap function, since I don't think it supports many file types. Idk tho

Link to comment
Share on other sites

RE: seams

I've been working recently on a terrain system using the same theory behind Dal's 'Endless Terrain' from Nov last year. One of the the differences being it allows for non-power of 2 LOD levels, and has varying LOD levels sizes even within the same segment to increase the flexibility. This has meant developing a re-usable method to remove the seams between different LOD levels, which works by essentially duplicating all vertices on both sides of the seam (and with a lot of code....). This is almost in a usable state so should have something to share soon, and could easily feed into a chunk based system. (also agree with josh/Dal on the example above, it must be the heightmap data if the vertices are perfectly aligned).

Does anyone have a robust 'chunking' terrain system we could add the LOD onto? With the right system is should just be a case of replacing 'createGroundFromHeightMap' with a version of the new function i'm creating. It sounds like what you have Josh may be similar that, although we are replacing the same function so may need to merge them somehow!

Link to comment
Share on other sites

1 hour ago, Xeonzinc said:

RE: seams

I've been working recently on a terrain system using the same theory behind Dal's 'Endless Terrain' from Nov last year. One of the the differences being it allows for non-power of 2 LOD levels, and has varying LOD levels sizes even within the same segment to increase the flexibility. This has meant developing a re-usable method to remove the seams between different LOD levels, which works by essentially duplicating all vertices on both sides of the seam (and with a lot of code....). This is almost in a usable state so should have something to share soon, and could easily feed into a chunk based system. (also agree with josh/Dal on the example above, it must be the heightmap data if the vertices are perfectly aligned).

Does anyone have a robust 'chunking' terrain system we could add the LOD onto? With the right system is should just be a case of replacing 'createGroundFromHeightMap' with a version of the new function i'm creating. It sounds like what you have Josh may be similar that, although we are replacing the same function so may need to merge them somehow!

That sounds great! I think we could use @joshcamas chunking system (with his permission) for that, as it seems to work well.

Link to comment
Share on other sites

11 hours ago, Dal said:

I created a terrain using a perlin noise function to generate the height data programmatically rather than using an image. I didn't notice any seams then.

Also, if you look at joshcamas' editor linked above, I can't see any seams there either....

snip.PNG

Zoom in closer and you will notice seams :)

Link to comment
Share on other sites

Does anyone has a good article, link, reference about generating procedural large landscapes ?

I mean some dynamically computed landscape, but not randomly, so that when the user passes back into a location he went before he can see the same part of the land than before ?

Link to comment
Share on other sites

4 minutes ago, jerome said:

Does anyone has a good article, link, reference about generating procedural large landscapes ?

I mean some dynamically computed landscape, but not randomly, so that when the user passes back into a location he went before he can see the same part of the land than before ?

Well that's easy... you just need to either:

a ) Use image files and load the same image each time you visit the same tile (you can modify the image file just by drawing shapes and brush images onto a 2d canvas and saving it out... either painting manually or by code).

b ) More commonly, use a noise function such as perlin noise or simplex noise. These will take a seed number as a parameter and as long as you always use the same seed, they will always generate the same height data at the same location when you feed in the same x,y coordinates.

Link to comment
Share on other sites

Ok nice answer :-)

but I'm afraid I didn't explained well what I meant by "dynamically computed not randomly" , I was thinking about something less randomly thant a perlin noise.

Maybe something like a very large global map, depicting zones with grassy plains, forests, mountains, lakes, rivers... everything undetailed. Something we could have at the state or country level on Earth on a geographic map knowing the player will only be the size of a human walking in this landscape.

And then a  procedural function to dynamically compute, from this map (and maybe seeds associated to map subparts), what the user really sees at his level when evolving in his environment.

This would be mix between a predefined large map (so a fixed set of data at the level of landscape world) and a procedural rendering based on stored and reused random seeds.

The idea is to have a very very large landscape, dynamically computed around the player and that this global landscape and what the player can see is always the same when he came back to a former location or when he replays the game several times.

 

not sure I'm very clear though

Link to comment
Share on other sites

1 hour ago, jerome said:

Ok nice answer :-)

but I'm afraid I didn't explained well what I meant by "dynamically computed not randomly" , I was thinking about something less randomly thant a perlin noise.

Maybe something like a very large global map, depicting zones with grassy plains, forests, mountains, lakes, rivers... everything undetailed. Something we could have at the state or country level on Earth on a geographic map knowing the player will only be the size of a human walking in this landscape.

And then a  procedural function to dynamically compute, from this map (and maybe seeds associated to map subparts), what the user really sees at his level when evolving in his environment.

This would be mix between a predefined large map (so a fixed set of data at the level of landscape world) and a procedural rendering based on stored and reused random seeds.

The idea is to have a very very large landscape, dynamically computed around the player and that this global landscape and what the player can see is always the same when he came back to a former location or when he replays the game several times.

 

not sure I'm very clear though

I think what you want is just an evolution of the same basic concept...

You can use multiple "octaves" of noise and layer different noise algorithms and erosion algorithms on top of eachother at different scales etc. until you get something that looks natural. As long as all the algorithms are seed/input based the result is predictable and constant. You could then mix that with image textures that use different colours/shades to map out the different regions and biomes...

You could just have a map with the mountainous areas drawn in red and the desert areas drawn in green for example, then you convert the world coordinates to texture coordinates and pick the colour in the shader... then based on what colour you get you multiply the values of the noise to make it more or less bumpy, maybe clamp it or multiply with other sorts of texture that cause different kinds of features to appear etc. etc.

Its really hard to get natural looking noise and features though and its computationally expensive. You need to combine loads of algorithms and really tweak it for hours using trial and error to see how it looks and trying to do it in realtime can really hit performance. Most people just use existing software tools like Terragen to generate nice terrain height images as its a lot easier and gives better looking results.

Personally I think hand-sculpted terrains look much better. Procedural generation is great but in practice it tends to lead to huge, boring landscapes that aren't fun to explore. As with most things in computer games, we can't really put in the scale and detail of real life so we have to make things smaller and more exaggerated. Doing that in a way that looks good and plays well really requires an artist's touch and a lot of thought about the flow of the game and how the player will progress from different towns, regions, biomes etc. 

I just want to create a huge paged terrain that will let us sculpt a nice looking terrain ourselves, but using things like erode tools and heightmap stamp tools to help the process.

Link to comment
Share on other sites

i think i can fix collision problem i know that just need  solve this problem first

first problem ( LOD simulation in Vertex Shader ) solution we need make more vertex in center and less in around

second Problem ( infinite scene )  solution move all vertex   with camera position and make height with new position

and still texture management it is easy i hope

if we can fix all problems we do infinite Terrain in GPU 

 

 

 

Link to comment
Share on other sites

1 hour ago, NasimiAsl said:

i think i can fix collision problem i know that just need  solve this problem first

first problem ( LOD simulation in Vertex Shader ) solution we need make more vertex in center and less in around

second Problem ( infinite scene )  solution move all vertex   with camera position and make height with new position

and still texture management it is easy i hope

if we can fix all problems we do infinite Terrain in GPU 

 

 

 

Check out https://github.com/darrylryan/BabylonTerrain I think it handles both those problems already.

There's also other problems as a result. When you have different LODs you need to morph between them. I never got that to look right. 

Plus... If the geom moves around to centre itself under the camera everything else is going to need to do likewise...

Also we need a way to paint the terrain and to page in new tiles or heightmap data... Having infinitely repeating noise doesn't look good.

In the end I gave up on that approach because it got mind boggling, but maybe you will have better ideas :)

Link to comment
Share on other sites

i dont have LOD :) I simulate that it means i don't create new face or vertex i just collect more vertex in center so center smooth and you see more detail 

and no need any morph :) ( you don't calculate anything and still have top fps)

about move every thing  i haven't no idea for yet  in first i need make just Terrain nothing else we can make  it after have this ( usually i don't thing anything else when i fix a problem we solve that part when we wanna do that )

in shader builder we have color replace and a lot of tools for make  needed noise and needed or move texture . you can make your wanted

http://www.babylonjs-playground.com/#1TYWYB#20

http://www.babylonjs-playground.com/#1TYWYB#21

http://www.babylonjs-playground.com/#1TYWYB#22

we just need solution for collision and  physics i don't know when we have dynamic  morph geometry what happen in physics but still we can   find a solution for that too :)

 

 

Link to comment
Share on other sites

19 hours ago, Gugis said:

Zoom in closer and you will notice seams :)

Those are image seams, not height seams. However, tis true... we need to figure out a fix. I believe it's due to the images being "fuzzy" and ofc the edges do not share such fuzzyness. Will need to find a way to fix this.

Link to comment
Share on other sites

I think we should form a project group on this to make an awesome terrain system for babylon. Its something very much needed for lots of games, but its also maybe not something on the immediate roadmap for the core devs, so its a good thing for us to build together as a community I think.

Before I start a new system though I am very interested to see what results @NasimiAsl will achieve. It looks interesting so far and he's certainly very smart :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...