Some Questions

Hi all

Currently I am trying to do my first game using Panda 3D, since I found Panda 3D I come studying the manual, samples programs, searching on the forum trying to understand how Panda really works. Today I have a basic knowledge on using Panda.

To my game I need a medium terrain well texturized, I tried to use GeoMipTerrain to do the job, but it generates a ugly terrain and the textures seems to be scaled in a strange way, besides this the frame rate falls at a half, for example normal frame rates here in my computer is 60 FPS, but using GeoMipTerrain it runs in 25 FPS, it is slow in comparison to blitz, wichs generates a very good terrain with high frame rates.

I was look at the screenshots of the pirates of the caribbean online, and it seems very good with beautiful scenarios, good and weel texturized terrains. My question is how to do something similar to these screens with Panda? Did Disney do everything in this game using only Panda or it used another lib, modules etc? And about performance why it’s very slow in comparisson to Blitz 3D. I am asking these questions, because I am interesting in using Panda for commercial purposes. Currently we are using Blitz 3D, is it worth to change to Panda?

Thx.[/u]

GeoMipTerrain, its some sort of config issue, post how you configured the code.

Have not used Blitz 3D i cant say. But panda3d is pretty fast so i think you might have issue either with GeoMipTerrain or some thing else you are doing every frame.

This is my code, am I doing something wrong?


# Projeto UFO - Invaders, Por Marcos Vinicius
# Versao 0.1
# 25 de Fevereiro de 2008
#-----------------------------------------------------------------------------
import direct.directbase.DirectStart
from direct.actor.Actor import Actor
from direct.task.Task import Task
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import GeoMipTerrain


class Terrain():
    """Set the terrain and its properties"""
    def __init__(self):
        self.createTerrain()
        # Set the task manager to update the terrain every frame
        taskMgr.add(self.updateTerrain,'UpdateTerrain')
    def createTerrain(self):
        # Set up the GeoMipTerrain
        self.terrain = GeoMipTerrain('DynamicTerrain')
        self.terrain.setHeightfield(Filename('Data/Texturas/heightmap.png'))
        self.terrain.setColorMap(Filename('Data/Texturas/sand_texture.png'))
        
        
        # Set terrain properties
        self.terrain.setBlockSize(32)
        self.terrain.setFactor(100)
        self.terrain.setFocalPoint(base.camera)
        
        # Store the terrain's root NodePath
        self.root = self.terrain.getRoot()
        self.root.reparentTo(render)
        self.root.setSz(100)
        
        # Generate terrain
        self.terrain.generate()
        
       
        
    def updateTerrain(self, task):
        # Task to keep updating the terrain
        self.terrain.update()
        return task.cont
# Main
terrainObject = Terrain()

#-----------Teste----------------------
"""terreno = loader.loadModel('Data/eggs/terrain02')
terreno.reparentTo(render)
terreno.setScale(1)
terreno.setPos(0,0,0)
terreno.setHpr(0,0,0)"""


            

run()

This is the result:

Having played around with both Blitz3D and Panda3D I can say that they are both nice engines. Of the engines I’ve tried they are my two favorites by far. Their performance is about the same on my laptop, at least when it comes to rendering regular geometry. I can’t speak for GeoMipTerrain’s performance, however, as I’ve never used it.

Yes, those are kind of the worst settings you can have for your terrain. No wonder it’s ugly and you don’t have good framerates.
You need to tweak the terrain settings until you have a good terrain. And trust me, if you do it right, you’ll get a smooth terrain and a framerate of 60 fps or even higher.

There’s nothing magical about the texturing. The textures are by default scaled that one texture covers the entire terrain. You need to call root.setTexScale (see the manual about texture transforms) to make the textures repeat across the terrain.

Oh, you’re using the color map. It’s not a texture: it contains the values that get copied to the vertex colors. You only need it in very advanced cases. Stick to setTexture instead.

pro-rsoft, thank you for the information,

I did what you said, I changed setColorMap to setTexture but I got an error saying that my nodepath does not have the setTexture attribute. What is the best way to configure a good terrain with good graphic quality and good framerates?

Actually, you must have accidentally called it on the GeoMipTerrain instance instead of the terrain root NodePath (which you can get using terrain.getRoot(). Basically, in your case, you need to call it on self.root which is the actual NodePath instance.)

After some trials I got this, the framerates was improved and the look of the terrain, now I have a factor of 50, earlier it was 100, but the terrain still has a low resolution

The screen:

My code:

# Projeto UFO - Invaders, Por Marcos Vinicius
# Versao 0.1
# 25 de Fevereiro de 2008
#-----------------------------------------------------------------------------
import direct.directbase.DirectStart
from direct.actor.Actor import Actor
from direct.task.Task import Task
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import GeoMipTerrain


class Terrain():
    """Set the terrain and its properties"""
    def __init__(self):
        self.createTerrain()
        # Set the task manager to update the terrain every frame
        taskMgr.add(self.updateTerrain,'UpdateTerrain')
        # Load the skydome model
        self.loadSkyDome()
    def createTerrain(self):
        # Set up the GeoMipTerrain
        self.terrain = GeoMipTerrain('DynamicTerrain')
        self.terrain.setHeightfield(Filename('Data/Texturas/heightmap.png'))
        
        # Set terrain properties
        self.terrain.setBlockSize(512)
        self.terrain.setFactor(50)
        self.terrain.setFocalPoint(base.camera)
        self.terrain_tex = loader.loadTexture('Data/Texturas/sand_texture.png')
        
        # Store the terrain's root NodePath
        self.root = self.terrain.getRoot()
        self.root.reparentTo(render)
        
        self.ts = TextureStage('ts')
        self.root.setTexScale(self.ts.getDefault(),10,10)
        self.root.setTexture(self.terrain_tex,1)
        self.root.setSz(100)
        #self.root.setPos(-150,-5,100)
        #self.root.setHpr(0,0,0)
        #self.root.setScale(1)
        
        # Generate terrain
        self.terrain.generate()
        
       
        
    def updateTerrain(self, task):
        # Task to keep updating the terrain
        self.terrain.update()
        return task.cont
    
    def loadSkyDome(self):
        # Load the skydome for the terrain
        self.sky = loader.loadModel('Data/eggs/sky')
        self.sky.reparentTo(render)
        self.sky.setScale(5)
        self.sky.setPos(0,0,0)
# Main
terrainObject = Terrain()

#-----------Teste----------------------
"""terreno = loader.loadModel('Data/eggs/terrain02')
terreno.reparentTo(render)
terreno.setScale(1)
terreno.setPos(0,0,0)
terreno.setHpr(0,0,0)"""


            

run()

[/code]

Hello again, searching a little on yahoo games I found this game: Aladdin Magic Carpet Racing, looking at the screens I thought: wow! this look very good, then a question arose on my mind, Was this game made with panda3D? And other doubt: besides Disney do you know other company using Panda3D to make their games titles? Sorry for the questiom, but I am curious about that. Thx!

GeoMipTerrain requires a lot of tweaking with the settings to find the perfect resolution<>performance ratio, so I suggest try altering its settings.

Thank you pro-rsoft.

Another question…I am curious about that:

I don’t know anything about Aladdin Magic Carpet Racing, but I don’t think it was developed in-house by Disney; it was probably contracted by an outside company. I don’t think it was developed using Panda3D.

There are a few other companies than Disney making professional titles with Panda3D, but most of them are generally small companies.

David

Thank you David, but I am sure Panda is able to do the same job, a game with a good graphical quality and speed.