Wierd issue with height maps

I created a map in L3DT (now I have done this many times) and when I try to load it into Panda3d I get the error cant load image. I then close out of my editor and restart computer, will load the same height map fine. Close and restart the program I made a few time and starts to give me the same message it cant rfead the image. I have tried png, jpg, bmp all to no avail. I create a brand new map and export everything the same and it works 100% of the time. Does Panda support the TX/HF ratio of 4 (eg hi-res texture 1024, hight field 256) Seems to be when I start to run into issues. Could it just be L3DT that is the issue here…or…the interface between the chair and keyboard :). My money is on the latter lol. I am trying to use the Bullet collisions instead of the one in the Roaming Ralph example as I feel that the Roaming Ralph will be too restricting to what I have planed. I would like to have a FPS and TPS (with the ability to switch between the two), swimming etc all that good stuff, and Bullet seems to give a developer a stronger control over a scene.

If there is better terrain generators that seem to work better with Panda I would love to hear them :slight_smile:

shore_HM

Here you need a shader, there was an example on the forum.

Let me note here that Roaming Ralph is not a good example of either the use or the capabilities of Panda’s built-in collision system, I do feel.

If Bullet is better-suited to your project, then well and good! However, please don’t discard the built-in system on the strength of Roaming Ralph! ^^;

1 Like

L3DT is a great tool and I’ve used it to great success with Panda.

You’ll need to copy-paste the precise error message (plus surrounding log) before we can begin to diagnose this issue.

Hey guys :). Dont get me wrong I Love L3DT, It seems that only a few of the maps I export seem to work proper, unless I export as optimized mesh and play with it in Blender.

Here is the errors I am getting:
Error messsage with out PNMImage:
wglGraphicsPipe
(all display modules loaded.)
:grutil(error): Failed to load heightfield image Main/env/maps/shore.png!
:grutil(error): No valid heightfield image has been set!
[Finished in 4.074s]

Error with PNMImage used:
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:pnmimage(error): Could not read image /env/maps/shore.png
:grutil(error): Failed to load heightfield image env/maps/shore.png!
:grutil(error): No valid heightfield image has been set!
[Finished in 3.701s]

Here is the code I am using as of now

import random
import sys
import os
import math
################################################################################
from direct.showbase.ShowBase import ShowBase
from panda3d.core import GeoMipTerrain
from panda3d.core import Filename, AmbientLight, DirectionalLight
from direct.gui.OnscreenText import OnscreenText
from panda3d.core import Filename
from panda3d.core import PNMImage
################################################################################

class MyApp(ShowBase):
    def __init__(self):

        ShowBase.__init__(self)

        terrain = GeoMipTerrain("terrain")
 #       img = PNMImage('/env/maps/shore.png')
        terrain.setHeightfield("env/maps/shore.png")
        terrain.setColorMap("env/maps/shores_tx.jpg")
        terrain.setBruteforce("True")
        root = terrain.getRoot()

        root.reparentTo(render)
        root.setSz(14)
        terrain.generate()
        self.root = terrain.getRoot()
#        root.writeBamFile("env/maps/lakes.bam")

app = MyApp()
app.run()

Its not a shader issue cause it works on other Maps. As for roaming Ralph, I agree its a bad example and does seem to be a bit limiting, for example if you get too close to a tree or fall into a tiny hole your stuck lol. But it gives you a basic understanding on using an egg file and creating a very simple small level. Be nice if they had a tutorial of loading a height map, texture AND collision WITHOUT converting to something else. But as it stands, the closet Ive found was a bullet example that was super slow until I commented out the debug lines of code lol. Meh I will get better at this. I wil get it figured out :slight_smile:

1 Like

Don’t use setColorMap to set a texture. Use setTexture. setColorMap is only for specifying vertex colors.

Could you attach the png file that failed to load?

Ahh kk, Ill try that instead. But I thought the texture map from L3DT was the same as a colour map. I have loaded maps before and never used the texture only the colour map, think thats where I am getting confused lol. But it still fails to read the height map . Here is the png that has an issue. PS I tried the png in Ursina and did not work, how ever the same shore.jpg worked fine in Ursina but not Panda…which I felt is a wee-bit funny since Ursina was built with Panda. Im starting to think it may be because my system is way to old. One message I got in Ursina and a very simular error was the following created-shader:1(10): error: GLSL 1.50 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, and 3.00 ES. Which sucks cause it is hard to find shaders that work. So Im sure thats not helping either. My system in old, by old I mean Intel Mobile ® 4 series chipset kinda old lolz.

PNG
shore

JPG
shore