VR Project

I am working on a virtual reality world in Panda3d. It uses Bullet for physics.

I don’t know if I will release anything, but here are some screen shots:


very interesting :slight_smile: terrain made with geomip or just a model? i would like to lay hands on your code :slight_smile:

The terrain looks L3DT-ish, but that’s not a bad thing.

Its geomip. I will post the code once I get a little more work done on it, and clean it up abit.

The height map was made with L3DT, which is the best terrain creator/editor I know of.

Some screen shots of my water and bloom:


Rendering 10,000 trees:

Cool, how did you do the trees?
(though the pic shows 3 fps)

They trees are very low-poly models which get placed over the terrain randomly. I use a ray to set them to the correct height.

Yeah, there was only 3 fps. You just can’t render that many trees in real time. (Well, you can, but you have to use that method thats on the blog.)

Looks like every tree is two planes in a + configuration.

You can use many trees at the same time when you’re using flattening, and using it properly, too.
Clear the model nodes on the trees, then flatten them together. I’m sure that the FPS will become normal again.

very nice (Y) waiting for release :slight_smile:

@rdb, Its actually 4 planes.

I am using flattening, though I don’t know if I am doing it the correct way.

Here is the code:

class Grass():

    def __init__(self,x,y,z):

        #Load the model:
        self.model = main.loader.loadModel("models/grass.egg")
        self.model.setPos(x,y,z+.4)
        self.model.setH(random.uniform(0,360))
        self.model.setScale(.5)


class Tree():

    def __init__(self,x,y,z):

        #Load the model:
        self.model = main.loader.loadModel("models/tree.egg")
        self.model.setPos(x,y,z-.2)
        self.model.setH(random.uniform(0,360))
        self.model.setScale(4)


class VegetationController():

    def __init__(self):

        #Set some var's:
        self.grassAmount = 500
        self.currentGrass = 0
        self.treeAmount = 100
        self.currentTree = 0

        self.vegetationNode = NodePath("Vegetation")
        self.vegetationNode.reparentTo(render)

        while self.currentGrass < self.grassAmount:

            self.x = random.uniform(-512,512)
            self.y = random.uniform(-512,512)
            self.z = physics.world.rayTestClosest((self.x,self.y,500),(self.x,self.y,-100)).getHitPoint()[2]

            if self.z < 200 and self.z > world.waterHeight:

                self.grass = Grass(self.x,self.y,self.z)
                self.grass.model.reparentTo(self.vegetationNode)
                self.currentGrass += 1

        while self.currentTree < self.treeAmount:

            self.x = random.uniform(-512,512)
            self.y = random.uniform(-512,512)
            self.z = physics.world.rayTestClosest((self.x,self.y,500),(self.x,self.y,-100)).getHitPoint()[2]

            if self.z < 200 and self.z > world.waterHeight:

                self.tree = Tree(self.x,self.y,self.z)
                self.tree.model.reparentTo(self.vegetationNode)
                self.currentTree += 1

        self.vegetationNode.flattenStrong()

I didn’t go through the entire code, but I don’t see you call clearModelNodes() to allow trees to be merged together. Add something like this after loading:

self.model.clearModelNodes()

Thank you so much!

I called this:

self.vegetationNode.clearModelNodes()

Right before I flattened the node, and now I get normal fps rendering thousands of trees and grass, as before if I rendered a few hundred trees my fps went down.

Here is a screen shot of the new trees:

(I will fix the white border around them, it was a problem with the .png files.)

haven’t tried lod on trees??

Well, the trees are made up of only two planes, so adding LOD would be way more pain then its worth.

Sorry, did you mean if I made the trees 3d it would be great?

I would love to do so, but I am having a very hard time modeling trees and the like.

Although its far from perfect and what you can make with it looks actually much like bushes or palms to me but maybe you could use my tree-maker for that.
see [Procedural Trees)

If you know some Blender’s basics, you can also try ngplant