Show N Hide, Still will GO!

Return to Scripting Issues

Show N Hide, Still will GO!

Postby markjacksonguy » Mon Apr 16, 2012 6:56 pm

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.
User avatar
markjacksonguy
 
Posts: 550
Joined: Wed Sep 28, 2011 4:06 pm

Postby ynjh_jo » Mon Apr 16, 2012 7:23 pm

Try stash().
http://ynjh.tk
Intel P4Prescott 2.8GHz HT | ATI Radeon HD4670 1GB GDDR3
User avatar
ynjh_jo
 
Posts: 1795
Joined: Tue Apr 18, 2006 12:41 am
Location: Malang, Indonesia

Postby teedee » Mon Apr 16, 2012 8:06 pm

Hiding something should prevent it from rendering.
Do you have an example where that is not the case?
teedee
 
Posts: 861
Joined: Tue May 12, 2009 11:33 pm
Location: Kepler-22b

Postby markjacksonguy » Mon Apr 16, 2012 10:42 pm

teedee wrote: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:
User avatar
markjacksonguy
 
Posts: 550
Joined: Wed Sep 28, 2011 4:06 pm

Postby teedee » Mon Apr 16, 2012 11:02 pm

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?
teedee
 
Posts: 861
Joined: Tue May 12, 2009 11:33 pm
Location: Kepler-22b

Postby markjacksonguy » Tue Apr 17, 2012 12:50 am

teedee wrote: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. :)
User avatar
markjacksonguy
 
Posts: 550
Joined: Wed Sep 28, 2011 4:06 pm

Postby teedee » Tue Apr 17, 2012 3:08 am

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.
teedee
 
Posts: 861
Joined: Tue May 12, 2009 11:33 pm
Location: Kepler-22b

Postby markjacksonguy » Tue Apr 17, 2012 5:34 am

teedee wrote: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. :D

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

PS,

I guess the title of my thread was a little missleading.
User avatar
markjacksonguy
 
Posts: 550
Joined: Wed Sep 28, 2011 4:06 pm

Postby rdb » Wed Apr 18, 2012 1:39 pm

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.
rdb
 
Posts: 9582
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby drwr » Tue Apr 24, 2012 1:52 pm

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.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA


Return to Scripting Issues

Who is online

Users browsing this forum: Google [Bot], nachus and 2 guests