Show N Hide, Still will GO!

I always felt setting hide() to an object did not stop it from going to the GPU. I did a test to confirm this.

The only way is to detachNode().

I was wondering why I had a higher than should be geom count.

It is much lower now; since I got rid of the show/hide and replaced with detach/reparent.

Posted this just incase someone as new to P3D as I am, was making the same mistake.

Try stash().

Hiding something should prevent it from rendering.
Do you have an example where that is not the case?

You can easily create a test yourself. I checked my geom count while using show/hide. Then I check it using detach/reparent.

The latter was much lower in geom count. I think hide just tells the GPU an object should not be rendered, but the object still goes down the graphics pipeline.

When you use detach, you are in fact taking an object out of the scene graph (which is taking it out of the game world). Only objects inside the scene graph get sent to the GPU.

Looking at it that way…it does make sense.

Not to mention, my test was accurate because I knew I had a certain number of items that were attached to render, but were hidden. When I detached those items, the geom count dropped based on the number of items.

I’m now looking for more ways to shrink the geom count if possible. This is harder to do for me since I’m developing an RTS style game.

But hey, I’ll take 200+ geoms over 700+ any day.

Yeah, that’s how big of a drop I had when I started using detach. :wink:

Yes it is easy for me to create a test where hiding a node results in it not being sent to the GPU. I am asking to see an example where something is sent to the GPU even though it is hidden.
What method are you using to measure the number of geoms sent to the GPU?

Try using scene analyze; that’s usually enough. My current project is a bit more than an example, so I would sugguest creating an empty world, insert (reparent to render) some objects with hide() and analyze the scene. Then detach the same objects and re-analyze the scene.

The difference in geom count should stun you. :slight_smile:

Scene analyze does not tell you what is sent to the GPU or not, just what is in your scene.
You need to use PStats and look at the Geom window for that.

No it doesn’t, but it’s not about that. It’s about seeing the difference in geom count (Pstats is not needed for that). Given the fact the geom count is where it should be when objects are in the graph but hidden, and the geom count is reduced correctly when objects are detached from render,

speaks for itself.

If hidden objects were not being sent to the GPU, then the geom count would reflect that. Otherwise, if hidden objects are not being sent to the GPU and the geom count says otherwise, then something is wrong somewhere within the engine.

Ok…the benefit of the doubt…

Even if hidden objects are not going to the GPU, detaching them when they are not needed still reduce geom count, and that is better…which is what my thread was about.

I can see your point of view; Panda reports geom count of hidden objects, but does not send those objects down the graphics pipeline… That could be the way P3D does it.

That could be true… but why did I get a performance increase?

The point is, detaching is better for reducing geom count in the scene.

Understanding this has greatly reduced my geom count. I’ve gone from 700+ geoms to 200+. That’s strong evidence. I’m loving the extra performance I’m getting from the change. :smiley:

Keep an eye out for some new screenshots of my project; it’s amazing what little changes can do for a P3D app.


I guess the title of my thread was a little missleading.

I think the geom count is about the geoms which are traversed, not actually sent to the GPU. You should look at the batch count. The batch count will go down when you use hide().

The performance increase is due to the fact that there are less nodes to traverse, but this is entirely on the CPU and not on the GPU side.

The Geom count reported by NodePath.analyze() reports only what is in the scene graph; it has nothing to do with what is sent to the GPU. You need to view the Geom count in PStats to see what is sent to the GPU.

NodePath.hide() does indeed prevent objects from being sent to the GPU.