Dynamic textures on terrain map

I’m just starting out with Panda 3D and 3D graphics/programming in general. I’m working on a (mo)rpg as a learning project and I’m running into a problem understanding how to get my terrain setup.

The part I’m having the hardest time understanding is the texturing of the terrain. I’m wanting a dynamically generated texture map. So as it rains grass will grow by changing to an increasing greener texture or as enough traffic has crossed a patch of ground a road forms by changing to an increasing brown/rocky texture. I’m looking at roughly 50-70 texture possibilities.

The way I have it worked out in my head is to divide the ground into “3 foot” squares and have several texture map bmp/pngs that can be placed on those squares.

I have read up on creating the terrain height map as a gray scale image; that isn’t a problem. I read somewhere on the forums, although I didn’t understand it, about using a color mask and a custom shader. I’m going to do some googling on that solution but first wanted to see what others thought.

What is the best way of handling dynamic textures for terrain?

If I go with a color mask, will I be able to update it with python in real time?

Also, can my terrain have a gray scale bump map as well?

Any guidance, examples, links, etc will be greatly appreciated.


I have something similar as I am creating a city builder so I need to change textures in the event of any earthwork being done by the player.

It may be possible to reduce your texture count by using shaders to do some simple alterations (making the grass greener, to use your example).

Here is the shader I use: github.com/croxis/CityMania/blob … exture.sha
And here is my terrain manager code: github.com/croxis/CityMania/blob … ronment.py

Don’t mind the mess, I am not that good of a coder :slight_smile:

The terrain uses six textures, the first is a dynamically created 4 channel image which the shader uses to determine which texture to use. textures 2-5 are my grass, sand, snow and rock face. 6th texture is a grid texture.

Hope my code helps and let me know if you have any wtf moments, it will help me keep my code readable :slight_smile:

1 Like

You’re not the first person saying he’s just starting out, learning the language and the framework … and then talking about creating a very large project. And a MMO is propably the largest project there is. Just because the existing MMOs look so natural and polished it doesn’t mean everybody could do one, rather to the contrary. In a similar way you often got people who just created their first gun model and then ask how to create a First Person Shooter.

Nothing wrong with starting ambitious. My own project is ambitious and it was my first. It’s a space game and I started by creating the most basic step, placing a spaceship in a window and make it move through key input. Basically recreating the “Asteroids” sample, but took me long enough. Panda3D does not come with it’s own content pipeline, i.e. tools for animation, scripting etc. At some point you’ll need your own animated character, most likely you’ll have to learn Blender then.

Just realize the bigger your first project is, the later you will get palpable results.

If you want, use some assets I made: mediafire.com/?modtlwkghin Use gyedo’s work-in-progress editor to arrange the elements as seen in the included screenshot. Write a python file that imports the map. Then try to add collisions and a animated character as seen in the many “Roaming Ralph” samples in the forums.

This will already take you a while and then you can still worry about more complicated stuff.
Alternatively join existing projects and contribute to their art or coding.

Thanks for the assets, they’ll be helpful to get me started.

I’m completely aware of how ambitious a (mo)rpg is, let alone the fact I’m shooting for a completely dynamic world and life systems. However, like I said, I’m using it as a learning project. It may never progress to a playable level, but anything I learn along the way will be worth it.

My planned progression is:

  1. Initial terrain system (smaller then full map)
  2. Weather and Day/Night to affect the dynamic terrain
  3. Grass eating critters
  4. Critter eating animals

If I make it this far I’ll be extremely happy; but I’m not holding my breath.

Thanks again,