Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 07:37:21 pm
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)Improving Bounds and Picking for Models
Pages: [1]
Print
Author Topic: Improving Bounds and Picking for Models  (Read 2497 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« on: 26. February 2007, 08:42:35 pm »

hi

I've just had an idea, how to improve performance for Models. We could (by setting a flag) ignore the "inner" bounds of the model. So no bounds of inner groups or shapes are computed, updated or even existing. Then the shapes would get unpickable of course. But a Group could get an additional flag called setPickUnit(boolean)/isPickUnit(). Then it would be considered to be "one" atomic node by the FrustumCuller and the PickingLibrary. This would even improve picking performance, since the PL would not need to dig into the Model's internals. And the Model itself would be returned as the picked Node.

What do you think? Any problems expected? I don't think so.

Marvin
Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #1 on: 26. February 2007, 10:47:56 pm »

Sounds like a good idea. What if you have a model that has multiple distinct packable sections, but each section is composed of multiple shapes that you don't care about?
Logged

"I like my method, what was my method again?" - Jon
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #2 on: 27. February 2007, 09:00:38 am »

+1
To be tested.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 27. February 2007, 09:46:13 am »

Sounds like a good idea. What if you have a model that has multiple distinct packable sections, but each section is composed of multiple shapes that you don't care about?

What exactly do you mean by "packable sections"? Something like that?:

Code:
--------------------
|****              |
|****              |
|******************|
|    **************|
|           *******|
|           *****  |
|           *****  |
|     ********     |
|     ****         |
|     ****         |
--------------------

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #4 on: 27. February 2007, 12:46:03 pm »

What exactly do you mean by "packable sections"? Something like that?:


--------------------
|****              |
|****              |
|******************|
|    **************|
|           *******|
|           *****  |
|           *****  |
|     ********     |
|     ****         |
|     ****         |
--------------------


I don't want to put words in his mouth, but I think he meant to say "pickable sections".   Since we are loading from a model, imagine a spaceship with arms holding objects of interest.  We don't want to allow the player to pick the arms, just the interesting bits.  So the visible scene might look like:

--------------------
|****          ****|
|****          ****|
|******************|
|    **************|
|           *******|
|           *****  |
|           *****  |
|     ********     |
|     ****         |
|     ****         |
--------------------

but the pickable scene would only be

--------------------
|****          ****|
|****          ****|
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
--------------------
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #5 on: 27. February 2007, 03:52:40 pm »


What exactly do you mean by "packable sections"? Something like that?:


Wow, lots of talk about one word. It was meant to be be general. But if you want a more specific example think of a model with the following shapes in it: A B C D E F G H I J

And you want A C J to be one pickable unit, B D G I to be another, and E F H to be not pickable.
Logged

"I like my method, what was my method again?" - Jon
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #6 on: 27. February 2007, 06:03:49 pm »

Easey Smiley

Code:
Model myModel = Loader.load();
Group acj = new Group();
acj.addChild(myModel.getNode("A"));
acj.addChild(myModel.getNode("C"));
acj.addChild(myModel.getNode("J"));
acj.setPacked(true);
Group bdgi = new Group();
bdgi.addChild(myModel.getNode("B"));
bdgi.addChild(myModel.getNode("D"));
bdgi.addChild(myModel.getNode("G"));
bdgi.addChild(myModel.getNode("I"));
acj.setPacked(true);
Group efh = new Group();
efh.addChild(myModel.getNode("E"));
efh.addChild(myModel.getNode("F"));
efh.addChild(myModel.getNode("H"));
efh.setPacked(true);
efh.setPickable(false);
scene.addChild(acj);
scene.addChild(bdgi);
scene.addChild(efh);

The setPacked() method is missing Smiley
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 27. February 2007, 06:35:42 pm »

Wouldn't this hurt the unique structure of the scenegraph?

But the above request could be solved by not setting the Model itself as a pickunit, but certain subgroups of it. And remember, the pickunit feature will always be optional.

Marvin
Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #8 on: 27. February 2007, 07:16:48 pm »

In Amos' code I would assume that the actual Model is never added to the scenegraph.

I was really just thinking about different possibilities. I'm not sure if theres is an actual use for it. 

Logged

"I like my method, what was my method again?" - Jon
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #9 on: 27. February 2007, 07:22:43 pm »

Now, I understand what you're going for.  In this instance, I think you need to:

  • load the model NOT pickable
  • calculate the bounding sphere that encompasses A C J
  • calculate the bounding sphere that encompasses B D G I
  • set the model pickable without recursion; i.e., setPickable( true, false )
  • add 2 invisible objects, make them pickable, and set their bounding spheres to the values calculated above

Marvin, do you have any ideas for optimizing this?
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #10 on: 27. February 2007, 07:28:28 pm »

Marvin, do you have any ideas for optimizing this?

In principle it is exactly, what I intended to say with the pickunit idea Smiley. So this will be one of my next tasks.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic