# Cashgen - (kinda) Infinite Procedural World Generator

**URL:** <https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131>\
**Category:** Game Development\
**Tags:** unreal-engine\
**Created:** [May 6, 2016, 4:37pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131 "2016-05-06T16:37:03Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 9, 2016, 6:32pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/123 "2016-12-09T18:32:07Z")

</div>

> [@n00854180t;635670](#):
>
> AFAIK there’s some stuff for that either in the thread for the OceanPlugin, or in another thread related to it. Not sure how it worked, though, but for the needs of this project specifically I’m not sure what would work best since you need some sort of data about the terrain elevation to do it - distance fields, height map in the material, etc., which of course is an when the terrain is created at runtime.

Yeah I had a look at it, but it only accepts one heightmap for the whole level. The whole plug-in is massive overkill for what I want anyway. I just need a nice looking water material that I can put on one plane per tile and use a heightmap for wave . I’ll probably look at stripping something simple out of their code.

---

<div class="post-metadata">

**Author:** ![n00854180t](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@n00854180t](https://forums.unrealengine.com/u/n00854180t)\
**Post date:** [December 9, 2016, 6:59pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/124 "2016-12-09T18:59:02Z")

</div>

> [@mid\_gen;635680](#):
>
> Yeah I had a look at it, but it only accepts one heightmap for the whole level. The whole plug-in is massive overkill for what I want anyway. I just need a nice looking water material that I can put on one plane per tile and use a heightmap for wave . I’ll probably look at stripping something simple out of their code.

You might look at making the heightmap a parameter then feeding in the current tile’s heightmap as you move, but I’m not sure how well that would work.

---

<div class="post-metadata">

**Author:** ![Azarus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Azarus](https://forums.unrealengine.com/u/Azarus)\
**Post date:** [December 11, 2016, 5:35pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/126 "2016-12-11T17:35:51Z")

</div>

Hey!

Does this system allows making caves and other similar elements? Or is this just generating something like a heightmap? 🙂

Thanks

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 11, 2016, 8:41pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/127 "2016-12-11T20:41:14Z")

</div>

> [@Azarus;636461](#):
>
> Hey!
> 
> Does this system allows making caves and other similar elements? Or is this just generating something like a heightmap? 🙂
> 
> Thanks

Just heightmap based terrains this one.

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 11, 2016, 8:42pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/128 "2016-12-11T20:42:13Z")

</div>

Finally got round to the not terribly difficult but tedious job of adding geometry to hide the LOD seams.

Done 🆒

[http://image.prntscr.com/image/346d7bd7a5cc4d2ca3492c69344a9a8b.png](http://image.prntscr.com/image/346d7bd7a5cc4d2ca3492c69344a9a8b.png)

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 11, 2016, 8:46pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/129 "2016-12-11T20:46:55Z")

</div>

> [@n00854180t;635689](#):
>
> You might look at making the heightmap a parameter then feeding in the current tile’s heightmap as you move, but I’m not sure how well that would work.

There’s not really a ‘current’ tile as the player can be stood at an intersection of 4 tiles. Basically I need to make something that’s designed for this use case, off the shelf stuff just isn’t quite going to cut it!

---

<div class="post-metadata">

**Author:** ![qdelpeche](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/qdelpeche/32/776509_2.png) [@qdelpeche](https://forums.unrealengine.com/u/qdelpeche)\
**Post date:** [December 12, 2016, 3:50am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/130 "2016-12-12T03:50:03Z")

</div>

@mid_gen: This is an awesome plugin. Have you tested it on multiplayer or is it single player only?

---

<div class="post-metadata">

**Author:** ![n00854180t](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@n00854180t](https://forums.unrealengine.com/u/n00854180t)\
**Post date:** [December 12, 2016, 5:11am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/131 "2016-12-12T05:11:03Z")

</div>

> [@mid\_gen;636534](#):
>
> There’s not really a ‘current’ tile as the player can be stood at an intersection of 4 tiles. Basically I need to make something that’s designed for this use case, off the shelf stuff just isn’t quite going to cut it!

Draw all 4 heightmaps into one texture.

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 12, 2016, 9:15am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/132 "2016-12-12T09:15:43Z")

</div>

> [@n00854180t;636697](#):
>
> Draw all 4 heightmaps into one texture.

It’s just unnecessarily complicated trying to shoehorn something designed for static levels into a runtime generated, tiled one. Better to just make my own. I originally had a plane for the water per tile and it looked fine, I just didn’t have any nice water shaders so I dropped OceanPlugin in to look nice 🙂

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 12, 2016, 9:17am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/133 "2016-12-12T09:17:14Z")

</div>

> [@qdelpeche;636663](#):
>
> @mid_gen: This is an awesome plugin. Have you tested it on multiplayer or is it single player only?

I haven’t tried it in multiplayer yet. In principle it could work but would require a fair bit of work. Have two separate terrains tracking different pawns would work, but you’d need to do some interesting stuff to prevent overlaps when the rendered regions overlapped.

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 12, 2016, 9:17am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/134 "2016-12-12T09:17:57Z")

</div>

New video with erosion and LOD seam fixes :

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/1/bd1c98a554a2bdfe6596ac330a20de22173a0ea4.jpeg "CashGen - Procedural Realtime Terrain Generation Plugin for UE4 - Update 2016-12-12") ](https://www.youtube.com/watch?v=JPoEjBIOzY4)

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 14, 2016, 9:22am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/135 "2016-12-14T09:22:56Z")

</div>

Done a little work on biomes and materials.

I have one noise generator for the mountains, one for the rolling hills, and a constant -1 for the water parts.

I blend the mountain and hill generators using a third noise generator. I also pack some information in the vertex colour channels, R = Erosion, G = deposition, B = biome (the values from the third noise gen). So I’ve been able to start making the materials a little nicer instead of just crude height/slope based blends.

The shoreline blend now has some noise added and only appears on ‘hills’ biomes etc.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/b/2ebec727469d8b3adc5df14d648a1e9d7ccc181f.jpeg "CashGen - Procedural Realtime Terrain Generation Plugin for UE4 - Update 2016-12-14") ](https://www.youtube.com/watch?v=dM0blrBa3LY)

---

<div class="post-metadata">

**Author:** ![sivan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sivan](https://forums.unrealengine.com/u/sivan)\
**Post date:** [December 14, 2016, 4:04pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/136 "2016-12-14T16:04:17Z")

</div>

Hey, as a nice in the material setup, can you enable the possibility to modify some (practically 4) custom textures coverage runtime? I mean one or two kind of road texture and a burnt one to be used around destroyed objects (buildings, vehicles), and one for plough field. Probably a dynamic texture would work, if you want to use vertex colour for something else. Of course, no problem if it is out of focus, I think I can do it…

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 14, 2016, 4:21pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/137 "2016-12-14T16:21:23Z")

</div>

I’m not much a materials guy I’m afraid. The problem with packing things into the vertex colour channels is that the unit size of the terrain is pretty large when you get up close and the smoothing between vertices can be pretty ugly. I use some noise to make the material transitions a little more natural looking.

You can certainly pack whatever you want into the Vertex Colour information, it’s just a single line of code to adjust it.

Maybe decals would work well for what you’re after? Project a decal from the building onto the terrain? Haven’t tried it but in theory…

---

<div class="post-metadata">

**Author:** ![sivan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sivan](https://forums.unrealengine.com/u/sivan)\
**Post date:** [December 15, 2016, 9:16am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/138 "2016-12-15T09:16:34Z")

</div>

yes, for temporary textures decals are fine, maybe they are not the best from the point of view of performance… anyway, these things are really game specific, I will share it once I have time to make it.

---

<div class="post-metadata">

**Author:** ![ZioYuri78](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zioyuri78/32/1194615_2.png) [@ZioYuri78](https://forums.unrealengine.com/u/ZioYuri78)\
**Post date:** [December 15, 2016, 10:47am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/139 "2016-12-15T10:47:19Z")

</div>

Hey @mid-gen,

thanks for your work, the plugin is awesome, is a lot of code to learn (i love learn stuff 🙂 ), i have only a little, basically terrain not have collision, could be i miss something?

---

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [December 15, 2016, 10:55am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/140 "2016-12-15T10:55:23Z")

</div>

> [@ZioYuri78;638321](#):
>
> Hey @mid-gen,
> 
> thanks for your work, the plugin is awesome, is a lot of code to learn (i love learn stuff 🙂 ), i have only a little, basically terrain not have collision, could be i miss something?

It should have collision. It uses the Runtime Mesh Component to generate collision and the terrain mesh. I could be wrong.

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 15, 2016, 10:58am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/141 "2016-12-15T10:58:00Z")

</div>

> [@ZioYuri78;638321](#):
>
> Hey @mid-gen,
> 
> thanks for your work, the plugin is awesome, is a lot of code to learn (i love learn stuff 🙂 ), i have only a little, basically terrain not have collision, could be i miss something?

In the LOD configuration there is a boolean for enabling collision.

Bear in mind that collision cooking is on the game thread, in my testing you will start getting framerate hitches with tile sizes much over 40x40, depending on your system.

---

<div class="post-metadata">

**Author:** ![ZioYuri78](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zioyuri78/32/1194615_2.png) [@ZioYuri78](https://forums.unrealengine.com/u/ZioYuri78)\
**Post date:** [December 15, 2016, 11:11am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/142 "2016-12-15T11:11:24Z")

</div>

> [@mid\_gen;638329](#):
>
> In the LOD configuration there is a boolean for enabling collision.
> 
> Bear in mind that collision cooking is on the game thread, in my testing you will start getting framerate hitches with tile sizes much over 40x40, depending on your system.

Got it, thanks, i will make some test 🙂

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [December 19, 2016, 8:55am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/143 "2016-12-19T08:55:42Z")

</div>

Ok I’ve nearly got the grass spawning system back in…but I’m also thinking about what I’m going to work on next year. Also, the plugin is getting to the point where I can’t really go any further without getting into the realms of premature optimisation…how you want to tune the terrain and how complex your materials are will depend really on what you’re using it for.

I am going to freeze the plugin in the new year and just clear out the remaining bugs, clean up and comment the code properly, and then write up a few devblog articles describing the techniques involved. Some real world examples of multi-threading etc I think would be useful to people.

The code will remain on github so anyone feel free to carry on playing with it, I’ll accept pull requests or contributors.

[Previous page](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131.md?page=6)

[Next page](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131.md?page=8)
