Terrain Issue

I understand the lower the LOD is the quality looks worse, but when I increase it any little bit, then when running around the update “skips” and pauses for a second because it’s so jerky.

How do I do the wire frame? I searched under GeoMipTerrain under Reference and didn’t see that, and also searched in the manual.

Also, BruteForce doesn’t work in 1.5.2(which is what I have). I even enable it(though it says not to) and it just crashes.

Anyways, here is my height field specs:

Width: 512 pixels
Height: 512 pixels
Horizontal Resolution: 96 dpi
Vertical Resolution: 96 dpi
Bit Depth: 32
Frame Count: 1

Here is the specs for the texture image:

Width: 512 pixels
Height: 512 pixels
Horizontal Resolution: 96 dpi
Vertical Resolution: 96 dpi
Bit Depth: 24
Frame Count: 1

Here is a screen shot of ralph and my map:

As you can see, the FPS isn’t very good for just standing still and not moving.

Here is my current settings:

        self.terrain.setBlockSize(32)
        self.terrain.setMinLevel(0)
        self.terrain.setFactor(5)

        # More code in between

        self.terrainRoot.setSz(50)

Just a note: With these settings my body still passes through some of the terrain if the update() is not set fast enough.

hm. your terrain has a overall resolution of 512. . given ablocksize of 32 this makes 16 blocks in each dimension. resulting in 16*16 = 256 blocks… resulting in as many nodes. too many nodes are inefficient due to hardware limitations. a few larger nodes are ways wayyys faster handled by the hardware. so keeping nodecount below ~50 or 70 is recommended
try increasing your blocksize to 64 should bring a big performance bonus.
you should also be able to increase the setFactor value after that.
so you should get better quality and performance at the same time.
you can even try to set the blocksize to 128. but it’s propably already too high so popping would be totaly awfull.

the wireframe mode is a nodepath method. see

https://www.panda3d.org/apiref.php?page=NodePath#setRenderModeWireframe very usefull to study how the the single values affect your terrain and its quality.

It seems to have helped on the fps as long as I keep my Factor down to 5 but any more than that, and it’s low FPS all over again. Plus, even with the Factor down, LOD set to 64, the FPS high, etc the game is still “choppy” looking. Think of how lag looks, that’s how this is behaving. And sometimes my player goes partially into the ground and then when the terrain updates, “pops out”. When I change the terrain update speed, it just ends up making it always run along the ground and not in the walls, but the movement is so “sharp laggy”, that it’s very bad. =/

Heheh, I do that sometimes, it seems. :stuck_out_tongue:

Excellent! I’m very glad to hear it. :slight_smile:

And now, I’ll leave you with ThomasEgi, who seems to know rather more than I about GeoMipTerrains. :slight_smile:

Thanks for all your help Thaumaturge! :slight_smile:

Tweaking these settings really is like a science, like ThomasEgi said. =P

Just hopefully I can get it right one day. @_@

given the fact that you run this thing on a geforce 9600 gt … the terrain should render at >100fps even when bruteforcing. means. quality level to 100 and blocksize set to 512.
graficcard should have NO problem with that. so i assume its something else.
you should run pstats to see what’s wrong. my guess would be the collision ray.
its casted on an geometry which was not optimized for collision and this can be very slow. especially on geometry with lots of triangles (which would explain the performancedrop with higher quality since your graficcard can handle rendering it without trouble)
so run pstats to see whats eating up your performance.
btw. you can use the “get elevation” for the camera height aswell as for the character.

Here is some stats that I took, any clue as to what that lets me know?

I thought I should be getting better fps. >_<

likei guessed. rendering itself is not your problem
can you show the graphs from “graphs->framecompnents->app” aswell as “cull” in the same location. those 2 seems to need most of your calculation power.
from what it looks to me. about 25% of the time goes into collision detection.

the frametime and its components are the most intresting parts for performance tuning. track down the components which needs most time to get calculated.

also… you rnumber of geom and nodes is quite high. which lets me assume you’r still using a blocksize of 32. increase it to 64 after or while you fix the other issues.
even if it might look ugly and makes performance worse at the moment.

Here ya go:

as i thought. collisions are takeing quite some time.
can you disable the collision traverse() call and check on performance again(with better quality settings for terrain)?

That’s what I’m getting now. I turned off all my collisions and used getElevation() for my character and then just set my camera’s Z always to the character’s Z + 2.0

I set the BlockSize to 64 and the LOD to 20. The whole application seems a lot more stable in speed/fps, but the problem that I notice is when your updateTask that I’m using runs, every 2 seconds my guy “jerks” as the map re-renders around it. In between those two seconds, it seems to work fine though. =x

Hmm, have you tried to increase the setMinLevel value just a little bit?
Also, verify that you are calling update() instead of generate() at the frames… and can you tell me your focal point settings?

EDIT: I’m just thinking of another potential problem, its a feature I recently added, the dirty flag. Can you try to print terrain.isDirty() every frame to see whether the terrain is marked dirty? Because if it is somehow (either through a bug or something in your code) the entire terrain will be regenerated every time (which is quite slow.)

you can set the LOD quality to 100. should be no problem. drawing things seems to be very fast on your machine.
those peaks however are strange. i’ll look into it and ask pro-rsoft about it who wrote it. might be an issue/bug which already is fixed in the development version.
who knows. lets wait for his response

[edit] -> gomipterrain master was faster :smiley: pro’s here to save the day

:open_mouth: Yay, a pro’s is here. :smiley:

I currently have the setMinLevel to 0, what should I try setting it to?

    def updateTask(self,task):
        self.terrain.update()
        return task.again 

At first it’s this:

self.terrain.setFocalPoint(base.camera)

but then when I initialize my ralph character, I do this:

self.terrain.setFocalPoint(self.ralph)

I added a function for the taskMgr to run to print out if it is “dirty”, here is the function:

    def checkDirty(self,task):
        print self.terrain.isDirty()
        return task.again

It always prints out: 0
Nothing but zero’s =x

  • You can try setting your minlevel to 1. Then to 2, or maybe even 3, until you see a quality loss. When you see quality loss, stop increasing the value. Beware that this value is exponential, every time you increase it 1 unit the quality will be divided by two, but the performance boost will be big.

  • Hmm, where do you have ralph reparented to?
    Btw. setting the focal point to the camera makes more sense than setting the focal point to the avatar.

  • If isDirty is always 0, thats good, that means nothing is wrong with the dirty flag.

I tried even 6 for minlevel and even though it just keeps my FPS more stable, I’m still getting some type of shakyness of my character when running around. Like a jitter of some sort. >_<

I have ralph reparented to “render”, but I switched the focal point back to the camera.

Hmm, this is interesting. Can you try both increasing and decreasing your block size and see what effects this has on the jitter?

For me, it’s not really even affecting it, I just notice that the FPS starts going lower at 32(BlockSize). Also, I don’t think this is it, but the ralph character moves slow so his speed for me has always been altered. I’ve had it like this:

self.actor.setPos(self.actor.getPos() - backward*(elapsed*15))

That isn’t very fast, is it? @_@

I doesn’t seem to be, to me.

It must not be the speed of my character at all, like I thought. I just redownloaded the samples and altered just the speed of ralph and everything runs smoothly.

I’m getting 74-75 fps, I’m guessing that it’s low because of refresh rate, or should it be even higher then that?

Anyways, I know it’s not the terrain now for sure. I went and commented out my terrain code, and uncommented the old terrain code(the original ralph code) and it’s still got the jitteryness. It’s the character that is jittery.

So, at least I’m getting somewhere…it’s nothing to do with the terrain, but it also seems it’s not the collisions. So guess I’ll just keep testing stuff. @_@;

74-75 fps indeed sounds like the monitor refresh rate. You’ll be able to see the ‘real’ framerate by putting this variable in your Config.prc:

sync-video #f