I have been using geomip terrain and unforutnately I cant seem to get it working very well I have tried
and strong as well and all i get is white terrain with no height and my framerate drops to pretty much nill I beleive there might be something wrong with this call. shouldnt this make my framerate better? my terrain code is listed below.
Ive also tried setting near and far but have not gotten this to work satisfactorily yet either.
I need to load alot more terrain than you see here as this is 1024X1024 and i also want to tile it so if anyone can let me know hoe to fix the above issue or how to make it so i can load alot more terrain without killing my framerate that would be appreciated.
#Load the first environment model
self.terrain = GeoMipTerrain("ground")
self.terrain.setHeightfield(Filename("Terrain/Level 1/terraintest.bmp")) #Terrain/game heightmap.bmp
# Set terrain properties
self.terrain_tex = loader.loadTexture('Terrain/Level 1/ground.jpg')
# Store root NodePath for convenience then set root settings for the terrain
root = self.terrain.getRoot()
#Set the terrain itself to be collide-able.
ts = TextureStage('ts')
#set global variable
#there are currently no global variables
#Updates the taskMgr
#this updates the terrain when needed
def updateTask(self, task):
Anybody got an answer for this? Can someone who works with Panda let me know if this code is doing what it is supposed to as i believe this maybe a bug but im not sure.
I am hoping someone will have an answer.
I played time ago with Geomipterrain and barely remember that performance is influenced by 2 parameters relationship: the heightmap texture size and the blocksize in a way that the bigger the texture the bigger the blocksize. Try to play with those and see how much the performance change.
I provided you code to be more elastic for tests - this setup is for an hf of 1024x1024 and runs @ 240fps on my rig:
# -*- coding: utf-8 -*-
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
win-origin 0 0
self.root = self.getRoot()
def update(self, dummy):
def setMonoTexture(self, texture):
ts = TextureStage('ts')
tex = loader.loadTexture(texture)
def reparentTo(self, target):
Beautiful example astelix!!! Thanks a million
However, the camera position relative to the terrain never shows it completely and actually sees the terrain from below (resulting in the darker regions of the terrain map to look like holes instead of mountains).
Is there any way to position this terrain? the ‘setPos’ function did not work…
My bad. You need to set the position of the root of the terrain therefore:
However, on a relatively unrelated topic (but something I faced with these terrains and I am pretty sure most people have) is that the camera is never at a perfect position so you always have to move it around to get a good look of the whole terrain.
So, is there a way in Panda for the camera to encompass all rendered objects? Something like a ‘fit objects to window’ or a ‘zoom to fit all’ kind of thing?
Thanks in advance,