I made a simple heightmap terrain pluging for Godot:

https://godotengine.org/asset-library/asset/231

<br>

<img src="https://user-images.githubusercontent.com/1311555/49705861-a5275380-fc19-11e8-8338-9ad364d2db8d.png" alt="" title="Image: https://user-images.githubusercontent.com/1311555/49705861-a5275380-fc19-11e8-8338-9ad364d2db8d.png"><br>

<br>

-----------------------------<br>

Old post with super-old version:<br>

https://godotengine.org/asset-library/asset/4<br><br>Feel free to ask questions here :)<br><br><br>

Been thinking of doing that too now that we have gdscript plugins api, I might be willing and interested in collaborating on improvements if you intend to keep this mit licensed.<br><br>edit: is there a workflow for importing height- and splat-maps generated in external tools yet? I'm guessing it's doable in shader anyway however it would be nice to have bundled.<br><br>edit2: Ok, the first thing to 'fix' would probably be to make sure that navigation still works while the terrain node is selected. :) But looks promising, I'll continue toying with it now...<br>

The plugin allows to export the heightmap as greyscale and normal map, but it should be doable to do importing. Images don't have enough color resolution (0-255) but should work. Otherwise it depends on which format you expect to load, because they might differ depending on the external tool used.<br><br>My plugin doesn't supports texture painting yet because I mainly wonder how to do it it can usually be done with additional vertex data, for example using UV2 to add two layers of textures with x and y values (0 = nothing, 1 = textured), however that means UV2 cannot be used with classic materials.<br><br>Most notably, I have an issue with Godot and texturing terrains, I cannot use any uniform in 3D shaders, so I cannot test anything related until it's fixed :s<br>Godot 3.0 should add many features that would be useful to terrains.<br><br>Also, just a note for future questions:<br>this is a GDScript plugin, if I find that a feature is too CPU-heavy (even when threaded), I may not implement it, and reserve this for a future C++ implementation in Godot 3.0.<br>

Whoa what do you mean you can't use uniforms in shaders? Is it a recent dev. build 'cause 2.1 seems to work for me. If it's a bug though I don't even... Scary.<br>

The plugin in its self is fantastic, the fact that it's implemented in gdscript means it deserve an instant awesome.<br><br>Good work!<br>

One behavior that i would change is that when you click on a surface it increases the height up to a certain point, then stops. My expected result would be for it to increase the height on that point indefinitely, until i let go of the mouse button. Or maybe I'm missing something? <br>

@Kiori&nbsp;yeah, currently you have to move the mouse a little bit for the editor to continue painting. That's because I paint inside the input() callback, I should do that in process() too.<br>

8 months later

@Zylann First and foremost I want to say I love your terrain plugin. I have spent the last couple of days working on improving it to do a vertex paint mode. I'm currently a bit stuck and I think you are probably the only person in the world who can actually help.

Modifying the menu to have a a vertex button and a dropper tool was the easy part: Image attatched:

The reason I am doing this is because last year I was halfway through developing my very own game using the blender game engine and switched to the Uchronia blender fork. During my development I stumbled across a way of using vertex colors to map seemeless terrain types. I was previously told it was only possible to seemlessly blend 4 terrain types, by using combinations of sin and cosine nodes I have managed to do 8, now 9 thanks to makign use of normals similiar to how your terrain engine has green and brown tiles. So if there is a slope it does this rocky texture.

As you can see from when I hooked up vertex color to diffuse this is what the terrain actually looks like just to further verify I am not lying or have cheated this process in any way shape or form: Here is how I linked up the nodes in the shader graph mode: I have found a way to change vertex colors within your terrain editor albeit crudely from code directly in the "_generate_mesh_at" function in terrain.gd using the lines of code:

var meshData = MeshDataTool.new()
meshData.create_from_surface(mesh, 0)
var vertexindex = meshData.get_vertex_count()
var vertexcolor = Color(0.0, 0.0, 1.0)
for i in range(0,vertexindex):
	meshData.set_vertex_color(i, vertexcolor)

This sets the terrain to Blue ( like you didn't know that already! :) )

I've tried to rewrite the entire data structure from 2D arrays to 3D arrays. Your previous structure had grid[x][y] which would return a vector3 if I'm not mistaken. I'm trying to rewrite it so that it can store grid[x][y][z] where z has 5 var's [x][y][0] is the vector3, 1 2 3 4 are going to be red green blue and alpha floats.

Anyway I've spent a long time trying to rewrite the code adding lots of [0]'s trying to trace the code back and I'm now really stuck and lost. I would really appreciate your help

Here's one of the error messages:

I have some code pastes of the work in progress I have done

modified terrain.gd: https://paste.ee/p/APYa8 modified terrain_brush.gd: https://paste.ee/p/NCICL modified terrain_plugin.gf: https://paste.ee/p/Kg7np And most importantly modified terrain_utils.gd: https://paste.ee/p/btrAc

Please obi wan kenobi you are my only hope

3 years later

Greetings. I wanted to ask if Git master is compatible with the upcoming Godot 4.0. If not is there a deadline as to when a working version will exist? I'm very eager to switch go the new Godot once it's out but unsure if this plugin will stop working and put the project I'm using it for on hold in terms of upgrading. Thank you.

The plugin does not work with Godot 4.0 yet, because that version of Godot is not ready for production. I will start working on that when it reaches beta stage, most likely.

8 months later

This is a great plugin! Really nice job! Thanks for sharing, it surely saved a lot of people from a bunch of work!

I have a question: I'm using an area on my player scene to detect floors. I noticed the area never returns any flags for colliding with the terrain heightmap collider. Any idea how to achieve that? I just need the terrain to be detectable by areas.

- Edit: I figured this is happening because areas don't trace static bodies so this is an issue not related to the this addon. Created a temp solution using line traces.

a year later

Hi, is there a way to apply a 512x512 colormap to the terrain after heightmap has been imported? Ive exported my terrain texture out from my terrain editor and do not wish to hand paint the terrain inside Godot. Instead I have a set of Color/Splat, normal, diffuse, spec and bump i wish to apply .