I’m new to Panda3D but have used Blender and done scene-graph style 3d in VRML/X3D (way back when ).
I’m trying to get to grips with terrain in Panda3D. The tutorials and documentation point me to the HeightfieldTesselator and the GeoMipTerrain plus some other very impressive community contributions. Given my need for LODs I like the look of the GeoMipTerrain.
I am experimenting by creating model of the real world using geographical gridded height data and aerial photography as my texture. My texture looks great in GIMP but terrible in Panda and full of artefacts. It is of a higher resolution than my terrain height-posts however. Does GeoMipTerrain down-sample a texture to match the terrain resolution?
Can you use a pre-created mesh (say from Blender) for the terrain or is there something special about terrains in Panda (maybe for the sake of gravity or some physics function?) that makes proceedural generation the best route.
Does Panda use the texture as a bump map (or automatically derive a bump map from it)? It looks like it does and I need to be able to turn this off.
If I save a GeoMipTerrain as a BAM, will it keep all my LODs and handle them automatically or do I need to manually cut the terrain up and set LOD-distances etc like I would have done in the bad old days of VRML?
I suppose I am basically asking “What is the canonical approach to terrain generation in Panda3D?” To narrow the question down, let’s assume I’m building a finite model.
I don’t think there is a canonical approach. There are as many different approaches to terrain as there are applications. However, there is absolutely no reason not to use a pre-created mesh from Blender as your static terrain model.
Tools such as GeoMipTerrain are designed to make terrain modeling easier, particularly in the cases when you need to have a very large terrain that automatically LOD’s in and out as you cross it. But if your terrain is not enormous, you may not need this LOD feature, and your static mesh may serve just as well (or better). Modern GPU’s can handle quite a lot of vertices without breaking a sweat. Or, if you really do need LOD, you can even implement your own LOD on static mesh by simply diving the terrain into pieces and creating two copies of each piece.
As to your specific questions, let me see what I can do:
Please ensure your texture size is a power of 2, e.g. 512x512 or 1024x1024, but not 800x800. Panda will automatically downscale textures to the next smaller power of 2 when you load them unless you tell it not to. In the case of the GeoMipTerrain height field, your texture must be a power of 2 + 1, e.g. 513x513 or 1025x1025.
Unless you’re referring to the height field of the GeoMipTerrain (which isn’t the same thing at all), there is no automatic bump map generation.
I don’t think you can save a GeoMipTerrain as a BAM. But there’s not any reason to want to do this; you would just create your GeoMipTerrain at runtime, every time you need to use it. It’s dynamic, so it’s based in code.
It may be that a static mesh is the way to go for now.
My texture uses power of two dimensions but isn’t square (it is 4096 x 2048).
My heightmap is much lower resolution (512 x 256 - so maybe in this case I don’t really need LODs). Because they have the same proportions, I expected it not to cause a problem.
Playing with the near and far values improved the image but didn’t get rid of the bizarre ‘lumpiness’ in the terrain - which is at a much finer resolution than the height map. That’s why I wondered if Panda was deriving a bump map from my texture (which I’m adding as a colour map - maybe that’s wrong, but I couldn’t see another option).
I’ll maybe build the terrain in Blender and import that to see how this approach works.
So a couple of thoughts come to mind as I read your post.
Your texture being 4096x2048 is probably best treated as two 2048x2048 images or as eight 1024x1024 images. If I were doing this I would divide it into eight images and create eight nodes parented to a master ‘terrain’ node.
As far as LOD manipulation of the terrain mesh there is probably a way to avoid LOD based issues at the borders of the different nodes but I’ve never actually had to deal with that problem.
It’s important to remember that the convention for the GeoMipTerrain is 1 pixel equals 1 panda unit. This of course can be scaled to your desire but that is the starting point.
#EDIT: So it looks like your using a smaller resolution heightmap than your texture- it’s pretty much the same concept- two 256x256 GeoMipTerrain objects.