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, 04:36:34 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Performance..
Pages: [1]
Print
Author Topic: Performance..  (Read 1142 times)
rox
Enjoying the stay
*
Offline Offline

Posts: 29


View Profile
« on: 16. February 2007, 08:57:27 am »


Hello!

I'm porting my Java3D software to use Xith3D. Everything seems to be working pretty well. However, I've got some serious performace issues. I checked out the version from SVN and noticed thaht it seems to be under constant evolution. That's nice, and I'm hoping these issues to be resolved soon Smiley

Anyway, browsing through the code and profiling it, I noticed that if the tranform of a group is changed, the bounding sphere is updated by scanning through all the vertices in the children. While it always produces correct results and "tight" bounding volumes, it also effectively kills the performance. The better solution would be just to transform also the bounding volumes and trust that the volumes are as "tight" as possible. So as I understand, there doesn't seem to be a mechanism to make a difference between the dirty bounds and transformed bounds case. In the end, they are different things, right?

Any plans on making improvements on this soon, or should I make a "quick" fix for myself?

- rox

Logged
rox
Enjoying the stay
*
Offline Offline

Posts: 29


View Profile
« Reply #1 on: 16. February 2007, 11:26:02 am »


Ok, seems like a simple fix works at least in my case. In Shape3D.java (SVN Feb 16.2007) in method updateBounds(boolean onlyDirty) I replaced:

Code:
bsph.compute( geom );

with:
Code:
if (getTransformGroup() == null)
    bsph.compute( geom );
else
    bsph.transform(getTransformGroup().getTransform());

Got immediately LOTS more of FPS Smiley I don't know if this is a generally valid fix... Maybe someone with more insight to the engine knows.

- rox
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #2 on: 16. February 2007, 11:47:32 am »

I don't know that much about the internals of the picking library; however, that change feels dangerous to me for general use.  When you created your shapes, did you try making them Shape3D.Types.STATIC?  The default is Shape3D.Types.DYNAMIC which has the least optimizations.  There are a couple levels in between but your code change clearly implies the STATIC choice.
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
rox
Enjoying the stay
*
Offline Offline

Posts: 29


View Profile
« Reply #3 on: 16. February 2007, 01:11:56 pm »

I don't know that much about the internals of the picking library; however, that change feels dangerous to me for general use.  When you created your shapes, did you try making them Shape3D.Types.STATIC?  The default is Shape3D.Types.DYNAMIC which has the least optimizations.  There are a couple levels in between but your code change clearly implies the STATIC choice.

Thanks for the reply. I did try that but it makes no difference. But you are correct, the STATIC should be my choice (which it wasn't previously). I actually figured out the fix to be dangerous as it fails, for example, if the geometry is modified. For my case it is good enough at the moment though..

- rox
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 16. February 2007, 02:06:17 pm »

Ok, seems like a simple fix works at least in my case. In Shape3D.java (SVN Feb 16.2007) in method updateBounds(boolean onlyDirty) I replaced:

Code:
bsph.compute( geom );

with:
Code:
if (getTransformGroup() == null)
    bsph.compute( geom );
else
    bsph.transform(getTransformGroup().getTransform());

Got immediately LOTS more of FPS Smiley I don't know if this is a generally valid fix... Maybe someone with more insight to the engine knows.

I will definitely implement a fix inspired by your code. But your code can't work for general case. Consider, you're modifying the TransformGroup's Transform3D twice. Then you would first compute the BoundingSphere, then transform it after the TG has changed and then after the other change, it is again transformed.

The "untransformed" BoundingSphere has to be cached and the "real" BoundingSphere has to be built from it.

I don't know that much about the internals of the picking library; however, that change feels dangerous to me for general use.  When you created your shapes, did you try making them Shape3D.Types.STATIC?  The default is Shape3D.Types.DYNAMIC which has the least optimizations.  There are a couple levels in between but your code change clearly implies the STATIC choice.

This won't make a difference.

Thanks for the reply. I did try that but it makes no difference. But you are correct, the STATIC should be my choice (which it wasn't previously).

Oh, I just forgot again to write some lines about Shape3D.Types in XIN. I will do it these days. If I don't, please remind me.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #5 on: 16. February 2007, 02:18:36 pm »

Really looking forward for this fix. I think it'll increase performances a lot..
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 19. February 2007, 03:14:05 am »

The new bounds fix also includes a tweak like above.

Marvin
Logged
rox
Enjoying the stay
*
Offline Offline

Posts: 29


View Profile
« Reply #7 on: 19. February 2007, 08:49:31 am »


Thanks for the quick fixes. My application works now much better Wink

- rox
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #8 on: 19. February 2007, 03:05:51 pm »

Thanks for the quick fixes. My application works now much better Wink

Cool, you're welcome Smiley.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic