Your code looks like the example in the manual. I wonder if the h.png is corrupted or is actually a .png file. I use L3DT 2.9 too with no problems, but code with C++.
Can you display t.png in a image viewer and does it look like a black and white version of what you made in L3DT ?
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:grutil(error): Failed to load heightfield image test.png!
:grutil(error): No valid heightfield image has been set!
Well it’s just a flat image, but looks like for some reason you can’t read files or the paths to find the file aren’t right. It didn’t work when you tried to write the simple image and then read it back in …
Huh… I agree with tah. I can’t possibly explain why you’re having this issue though. I also have win7x64 and I’ve never seen this issue before. Perhaps it might help to reinstall Panda3d or upgrade to 1.7.1.
It seems like pnm images can write to files still, maybe it can also read files. If that’s the case the problem can easily be worked around. See if the following works for you.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import GeoMipTerrain
from panda3d.core import *
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
terrain = GeoMipTerrain("worldTerrain")
image = PNMImage(513,513)
image.write(Filename("test.png"))
image.read("test.png")
terrain.setHeightfield(image)
terrain.setColorMap("t.jpg")
terrain.setBruteforce(True)
root = terrain.getRoot()
root.reparentTo(render)
root.setSz(60)
terrain.generate()
app = MyApp()
app.run()
Thank you guys for helping me! I’ve upgraded to 1.7.1, and tried to reinstall Panda serval times, and still nothing.
now console says:
:grutil(error): Specified image does not have a power-of-two-plus-one size!
:grutil(error): No valid heightfield image has been set
I’ve installed Debian, and everything works like a charm. There is still a problem with loading heightmap on Windows, but now i can continue with learning Panda.
If someone have idea how to make Panda load heightmap on Win, please let me know.
Also i remmber having a problem where L3DT gave me a gray scale png files. Panda3d cant read grayscale png files so i had to convert it to color and then it all worked.
First I’ve heard of this. I’ve never had any trouble reading grayscale png files in Panda. It just uses libpng, which supports all png file types, including grayscale.
I when and checked schaik.com/pngsuite/#basic and drwr, you right it does load all the images i tried. Maybe what i was seen was that it would load a 16bit grayscale truncating that that to 8bit not making the things work?
Noticed that this thread was a little old but this worked for me.
use this for 1.7.2 (I’m sure panda3d.core will work for 1.7.1, still in the learning/experiment process):
from pandac.PandaModules import GeoMipterrain
and instead of using this:
terrain = GeoMipTerrain(“worldTerrain”)
you should try using the whole filepath:
/c/(file_location)/worldTerrain.png