How to - Multiple texture in GeoMipTerrain from heightmap

Hello everyone,
I just met Panda3D and saw its potential. Now im learning Panda and making my dream-game in C++.
I just wanna ask something to you guys, im learning about terrains in panda and i can load GeoMipTerrain from a heightmap file. Also i can apply texture to it. Here is some code and screenshots;

void Background::LoadTerrain(string _mapname) {
	GeoMipTerrain terrain("terrain");
	const string _heightmap_file = "bin/neuera/maps/" + _mapname + "/height.png";

	NodePath terrainNP = terrain.get_root();

	PT(Texture) sandTexture = TexturePool::load_texture("bin/neuera/tex/dirt.png");

	PT(TextureStage) sandStage = new TextureStage("sandStage");
	terrainNP.set_texture(sandStage->get_default(), sandTexture);
	terrainNP.set_tex_scale(sandStage->get_default(), LVector2(5, 5));


But its applying one texture to entire terrain. I found @wezu 's level editor and its amazing!
Im just wondering is it possible to apply multiple texture to GeoMipTerrain like this? ;


Im searching but could not found too much information about this (especially in C++)
Thanks for your time and im sorry about my english…

First of all, greetings, and welcome to the forum! I hope that you find your time here to be positive! :slight_smile:

I think that these days that sort of thing is done in a shader.

In short, the shader would take in whatever data is provided–for example, the normal-vector of a given vertex in the terrain, or its height, or a sample from a particular texture–and use that to blend between various textures.

You might be able to do something similar with Texture Combine Modes–although I suspect that it would be less flexible.

1 Like

Thank you, yes i heard about shaders and im searcing about it. Also looking to wezu’s editor and trying to understand it to implement C++. But im new at all of this but i really want to learn sort of things. So, do you have any suggestion or maybe some github-source to practice? And thank you for the answer i really appreciate it.

For these subjects specifically? Nothing much offhand, I’m afraid.

The manual has some basic shader-examples, I think. Otherwise, I’d suggest searching the forums for examples.

(And if you don’t find examples here, then searching the internet at large.)

And the answer is my pleasure. :slight_smile: