GeoMipTerrain issue

Hi

I am trying to generate terrain from 257x257 png image.
But i get this error:

:grutil(error): Specified image does not have a power-of-two-plus-one size!
:grutil(error): No valid heightfield image has been set!
myImage = PNMImage()
myImage.read(Filename("Data/World.png"))

self.terrain = GeoMipTerrain("World")
self.terrain.setHeightfield(myImage) 
self.terrain.generate()

Panda v1.7.0
Windows

Are you sure that Data/World.png is really 257x257?

Yes

Can you upload it? I’m able to load a 257x257 image fine. I wonder what is different about yours.

Also, can you try this line (before the read() call):

myImage.setReadSize(257, 257)

img19.imageshack.us/img19/6548/worldkq.png

myImage.setReadSize(257, 257) not works :confused:

I can load it correctly, no errors. Are you sure that the right image is loaded? What does it print if you put this after the read() call:

print myImage
image: 0 by 0 pixels, 0 channels, 255 maxval.

That’s Strange. Image is in correct place.

Does the read() call return False? If so, the image failed to load, and that could explain why GeoMipTerrain chokes on it.

assert myImage.read("Data/World.png"), "Failed to read!"

When i try this code:

myTexture = obj.loader.loadTexture("Data/World.png")
print myTexture

output :

2-d, 256 x 256 pixels, each 1 shorts, luminance

Try this:

from panda3d.core import getModelPath

myImage = PNMImage()
myImage.read(getModelPath().findFile("Data/World.png"))
1 Like

Thank you! Now its working fine. :slight_smile: