World procedural generation library

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.

World procedural generation library

Postby klayr » Sat Apr 07, 2018 12:27 am

Hey !

I've been working on a cool open-source library project involving infinite, complex world procedural generation, and I'm looking for a community where I can share it :D
Since I'm using Irrlicht for rendering, I thought this forum was a good start !

The aim of the library is to generate a complex world with plenty of things (terrains, trees, bushes, rocks, biomes, clouds, buildings, dragons...) and then explore it in first person mode, or creating scenery or beautiful landscapes, maybe export them to files, and then use them in video games or 3D artworks... there is plenty of stuff you can do :wink:

Here are some visuals :

Image
Image

At the moment, I've only implemented the terrain and a tree generator. The lib implements a level of details features that enables to generate more details if needed.

I host the code on github ; https://github.com/BynaryCobweb/world/tree/spring_rework
You can see some (fake) example code in the "examples" folder, or in the irrlicht implementation ("modules/world3D").

Currently I'm doing a lot of work on it, that's why the most advanced version of the software isn't on "master".
I will publish a version as soon as I have fixed all the usability issues and done some bit refactoring :)

Don't hesitate to make suggestions ! It helps me a lot :D I'm also looking for other forums where I could share my library and get feedback on it !

Thank you
~Klayr~
klayr
 
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Postby devsh » Sat Apr 07, 2018 10:02 am

I could donate an old grass and foilage planter (multithreaded) if you want :)
Not much use because its not GPGPU but oh well...

P.S. unless you do your world generation using GPGPU it doesn't really have a use case anywhere in 2018-2020, even on mobile.
User avatar
devsh
Competition winner
 
Posts: 1855
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: World procedural generation library

Postby klayr » Sat Apr 07, 2018 2:32 pm

devsh wrote:I could donate an old grass and foilage planter (multithreaded) if you want :)
Not much use because its not GPGPU but oh well...


I'm interested in taking a look at it :)

devsh wrote:P.S. unless you do your world generation using GPGPU it doesn't really have a use case anywhere in 2018-2020, even on mobile.


The aim of my library is not to achieve things faster than the other ones, but to provide an extensive set of tools and a nice architecture so that generating a world procedurally becomes easy.
However I will surely implement GPGPU components, even if I haven't done that yet :)
klayr
 
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Postby devsh » Sat Apr 07, 2018 3:24 pm

Just don't spend too much time optimizing the CPU side of things.

CPU level of detail algorithms are painful to implement and optimize and basic transform feedback geometry/tessellation shader loops outperform them, and you end up throwing away your precious CPU code that took long to debug and pretty up in to the transh.

A cool approach to terrain rendering and editing is clip-maps, which are like Cascaded Shadow Maps but for terrain texturing (you could also possibly paint into them).
Essentially you replace a 2D texture with mipmaps by a 2D array texture where each layer is taken to be a part of a concentric mipmap chain (i.e. layer 0 is a 1024x1024 window into mipmap layer 0, layer 7 would be a a kinda 128kx128k window of the texture but of actual 1024x1024 textures), then you replace your textureLod(origTex,tc,lod) call with two calls to texture(arrayTex,vec3(tc,floor(lod))) and texture(arrayTex,vec3(tc,ceil(lod))) followed by manual interpolation to do the trilinear filtering by hand in your shader (anisotropic would require a bit more magic - but is possible from just 2 texture taps).

Then only issue s that you have to stream the data to the mipap layers as you walk in and out of areas, but with texture wrapping you only need to update new parts of the texture and there's no need to shift the entire content of the texture.
You can do this by using pixel unpack buffers or by rendering to the texture array.

Its essentially like idTech megatexture but without the complicated cache algorithm, and it lets you have insane ground texture resolutions, theoretically with a 1GB VRAM footprint you could have an effective resolution of 1 teratexel by 1 teratexel (enough to view a terrain the size of the earth with 1 pixel per mm).


Then you have the matter of of displacement mapping, your heightmap could also be stored the same way (although at lower overall resolution) and this is where the tessellation shader comes in, because your tessellated triangle size could be tied to the mip map level.
User avatar
devsh
Competition winner
 
Posts: 1855
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: World procedural generation library

Postby klayr » Sat Apr 07, 2018 8:58 pm

Thanks for your advices, I think I'm gonna look at that !
Do you think gpu programs are also suitable to generate assets without rendering them?
klayr
 
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Postby devsh » Mon Apr 09, 2018 11:42 am

Yes, totally but to use OpenGL to do that you need to instantiate a window (like our convert2BAW tool does).

However you could use OpenCL, CUDA or Vulkan if you really needed a headless tool for asset generation (I'd advise OpenCL because it would still run if you didnt have a GPU).
User avatar
devsh
Competition winner
 
Posts: 1855
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: World procedural generation library

Postby klayr » Tue Apr 10, 2018 11:56 am

All right ! I think I'll use openCL, I've already dealt a little bit with it.

Do you know any nice PCG community over the web where I can ask for advices on the latest procedural generation technologies ? I don't want to develop a lot of algorithms and then discover that what I've done is completely obsolete :)
klayr
 
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Postby devsh » Tue Apr 10, 2018 6:44 pm

Most of this sacred knowledge is in publications, so read that... alternatively there's always gamedev.net, but you'll always get 5 or so self-conflicting opinions and you'll end up having to straight to the source (pubs again).


There is value in open source implementation of those recent papers and bundling different techniques into a single framework.
User avatar
devsh
Competition winner
 
Posts: 1855
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: World procedural generation library

Postby klayr » Tue Apr 10, 2018 8:15 pm

Yeah, but doing it alone is a big load of work, and I have a lot to learn in this domain !

For the first release I'll let alone the optimisation, so it will be slow and thus pretty uncomfortable to use, because the features are mainly CPU-based...
But then I may start implementing moderns algorithms, and it would be cool to not make 5 attempts that happens to be trash... And this will eventually happen if I work alone in my corner...

So I hope I find at least some people to check what I'm doing and give me some feedback.

Anyway, do you have any interesting publications about things I could implement for a start ? I googled for clip maps, but I found article from 2006 or so... :)
klayr
 
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am


Re: World procedural generation library

Postby devsh » Mon Apr 16, 2018 12:12 pm

Here you go:
https://github.com/devshgraphicsprogramming/GrassGenerator

I didn't realize how old it was, almost 8 years!

It implements dithering of the vegetation map since you know... whether a plant is there or not is kinda binary.
User avatar
devsh
Competition winner
 
Posts: 1855
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: World procedural generation library

Postby klayr » Wed Apr 18, 2018 1:19 am

Thank you, I'll take a look !
klayr
 
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am


Return to Everything 2d/3d Graphics

Who is online

Users browsing this forum: No registered users and 1 guest