Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3507 Members - Latest Member: Edgebteme

26. May 2012, 07:34:24 am
Xith3D CommunityXith3D InternalsDeveloper discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)merging many shapes into 1 shape...
Pages: [1]
Print
Author Topic: merging many shapes into 1 shape...  (Read 1042 times)
jmoliere
Enjoying the stay
*
Offline Offline

Posts: 29


Molamini
View Profile WWW
« on: 08. July 2008, 09:42:18 pm »

Hello,
I'm trying to eke out some performance in Xith and have a few thousand objects in my scene.  The problem is that all these objects can really feel heavy when the viewer gets close to them.

Is there a way to put a lot of shapes into an object and have it return 1 shape that's tuned for rendering?  Is there a book that describes this behavior and would fit in well with Xith's architecture?

Thanks!
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 08. July 2008, 11:01:55 pm »

Merging multiple shapes into one shape is pretty simple and straight forward. But they need to have equal Appearances.

You should also be aware of the fact, that merging too many shapes can cause a performance loss, since the FrustumCuller cannot to anything the sort out invisible shapes. As a rule of thumb you should not exceed 4096 vertices per shape, since this is the maximum number of vertices for optimum VBO performance.

In AC3DLoaderTest there is a method, that merges multiple TriangleArrays into one. I will write a utility method to do that and will report here when it's ready.

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

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 09. July 2008, 01:09:12 am »

I have added four new utility methods. In GeometryUtils there are mergeGeometriesTA() and mergeGeometriesITA(), which merge a set of geometries to a single TriangleArray resp. IndexedTriangleArray. In ShapeUtils there are mergeShapesTA() and mergeShapesITA(), which merge whole groups of Shapes. The latter methods first check, which Shapes have equal Appearances and groups them together and them merges the Shapes' geometries and uses the one of the Appearances for the new merged Shape.

Enjoy Smiley.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic