World procedural generation library

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
klayr
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

World procedural generation library

Post by klayr »

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/
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~
Last edited by klayr on Tue Dec 04, 2018 12:17 am, edited 2 times in total.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: World procedural generation library

Post by devsh »

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.
klayr
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Post by klayr »

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 :)
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: World procedural generation library

Post by devsh »

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.
klayr
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Post by klayr »

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?
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: World procedural generation library

Post by devsh »

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).
klayr
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Post by klayr »

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 :)
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: World procedural generation library

Post by devsh »

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.
klayr
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Post by klayr »

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... :)
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: World procedural generation library

Post by devsh »

https://twvideo01.ubm-us.net/o1/vault/G ... on_and.pdf
http://drivenbynostalgia.com/files/Text ... dering.pdf
http://www.zib.de/hege/pdf/Clasen_2007- ... thesis.pdf

I'll upload my old grass generator to github when I have the time.
(It's multithreaded but with transform feedback you could make it GPGPU on GL 3.3 hardware)
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: World procedural generation library

Post by devsh »

Here you go:
https://github.com/devshgraphicsprogram ... sGenerator

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.
klayr
Posts: 6
Joined: Sat Apr 07, 2018 12:01 am

Re: World procedural generation library

Post by klayr »

Thank you, I'll take a look !
Post Reply