Tom
1
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
rdb
2
Are you sure that Data/World.png is really 257x257?
rdb
4
Ꙭ
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)
Tom
5
rdb
6
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
Tom
7
image: 0 by 0 pixels, 0 channels, 255 maxval.
That’s Strange. Image is in correct place.
rdb
8
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!"
Tom
9
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
rdb
10
Try this:
from panda3d.core import getModelPath
myImage = PNMImage()
myImage.read(getModelPath().findFile("Data/World.png"))
1 Like
Tom
11
Thank you! Now its working fine.