GeoMipTerrain is flat white using PNMImage

The terrain generates flat white, but I know the image has noise, because I saved it off and looked.

from direct.showbase.ShowBase import ShowBase
from panda3d.core import PNMImage, GeoMipTerrain


class App(ShowBase):
    def __init__(self):
        super().__init__()

        img_size = 2048 + 1
        img = PNMImage(img_size, img_size, num_channels=1, maxval=65535)
        img.perlin_noise_fill(0.2, 0.2, 256, 1)

        terrain = GeoMipTerrain("terrain")
        terrain.setHeightfield(img)
        # terrain.setBruteforce(True)
        terrain.getRoot().reparentTo(render)
        terrain.generate()

app = App()
app.run()
1 Like

You need to scale the terrain along the Z axis.

terrain.getRoot().setSz(100)

1 Like

Thanks again! That was the problem