Octree selector memory use

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Octree selector memory use

Post by robmar »

I´ve noticed that on large meshes when the Octree triangle selector is created, a massive list of nodes is created, and up to 4 times more memory than needed for the nesh (vertices, indices etc), is used just for the triangle selector.

Is there any way to reduce that, or to make a hit selection system that is more memory efficient?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Octree selector memory use

Post by hendu »

Many apps use color picking.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Octree selector memory use

Post by robmar »

Yes but how does that determine which sub-mesh has been touched?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Octree selector memory use

Post by hendu »

Google for color picking. You assign different colors for each part you want to recognize.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Octree selector memory use

Post by robmar »

Not possible as the colors could be anything, and are related to the colors of the fish models, which I cannot reassign.

I´m looking for a more efficient way to detect hits... there must be a better way to do this.
CuteAlien
Admin
Posts: 9633
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Octree selector memory use

Post by CuteAlien »

Just wondering - is this really a problem? Generally the texture memory blows away the amount of mesh-memory you need by far.

You can try tuning the octree parameters somewhat. But triangle-selectors will always be larger than the mesh as it keeps real triangles (so vertices are no longer shared like with vertex-arrays). The alternative would be to write a triangleselector which creates the triangles constantly at runtime when trying to select something (would use less memory, but I suppose it would be a lot slower).

I have used an own grid-selector in the past as alternative, but while that is better/worse in some situation it also works with triangles.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Octree selector memory use

Post by robmar »

The weak point of the system is the cpu, so trying to not have it process 10s thousands of triangles to find a hit match would be good.

This is from a paper on computing mesh collisions on the GPU : http://www8.cs.umu.se/education/examina ... eckman.pdf
"Implementing and evaluating triangle mesh collision detection on GPUs using OpenCL was another important aspect. As GPUs nowadays are getting more and more advanced, with better and better capabilities for performing general programming, evaluating whether the massively parallel architecture of GPUs could lead to speedups versus a CPU implementation was an important aspect."

Having the GPU to handle hits in scenes with bigger models would be ideal of course...
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Octree selector memory use

Post by hendu »

You really should do your research. Color picking does not mean you change your normal mesh colors. You always ask for hand-holding...
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Octree selector memory use

Post by robmar »

True hendu, :)

Well, I still don´t think color picking will work where the textures can be any color due to reflections and lighting, unless this is some form of color picking that I´ve not heard of...

This paper I referenced upload the triangle data to the GPU, and I guess that´s the best way to crack this nut head on, or is there a better solution?
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Octree selector memory use

Post by Granyte »

Multiple render target + color picking problem solved
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Octree selector memory use

Post by robmar »

MRTs are not efficient in complex scenes though... or am I not understanding?
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Octree selector memory use

Post by Granyte »

why wouldn't they? it really depends how you use them
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Octree selector memory use

Post by Mel »

Other than high rasterizing consumers, the MRT just serve for anything. the only drawback is to read the pixels, as that implies retrieving the rendertarget data, and reading it, whether directly by locking the texture or implicitly through a driver call.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply