It is currently Tue Feb 18, 2020 1:42 am


All times are UTC




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: PolyVox and threads
PostPosted: Sat Dec 04, 2010 11:18 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Maybe, though I'm trying to avoid external dependancies for PolyVox where possible. But actually I don't think anything as complex as ZLib is needed - I'm pretty sure a standard RLE algorithm would give good results and I already have some code lying around.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 7:33 pm 

Joined: Wed Dec 08, 2010 5:54 am
Posts: 27
I haven't follow the "volume divided in chunks" path, but instead the -IMO much easier and intuitive- "one volume = one chunk" with a layer on top of all chunks coordinating PutVoxel/GetVoxel/Save/Load/Generate operations into all volumes seamlessly.

Using this, threading was extremely painless and I haven't got a single error yet :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 9:19 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
onimatrix wrote:
I haven't follow the "volume divided in chunks" path, but instead the -IMO much easier and intuitive- "one volume = one chunk" with a layer on top of all chunks coordinating PutVoxel/GetVoxel/Save/Load/Generate operations into all volumes seamlessly.


I'm not saying this is bad, but it is a bit redundant. You are talking about about storing several volumes and then providing a coordinating layer for getVoxel(), etc. But this is what PolyVox already provides, in that a volume is stored as a number of Block objects (each with a getVoxel() function), and then the volume's getVoxel() function calls through to the one in the appropriate block.

The reason that bezyend is using multiple volumes is in order to page them from disk on demand in order to create infinite terrain. There might be other reasons - if for example you had a space scene where each volume was an asteroid and there were large gaps between them. But generally it not how I anticipated PolyVox being used (though sometimes it's good to think outside the box :-) ).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 9:25 pm 

Joined: Wed Dec 08, 2010 5:54 am
Posts: 27
Quote:
The reason that bezyend is using multiple volumes is in order to page them from disk on demand in order to create infinite terrain.


Well, that's another of my reasons too =p


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 9:50 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Well in that case go for it... Eventually I may add built in support for infinite volumes but it won't happen for a while.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 10:26 pm 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
That's how I did it initially, one coordinate system for paging (using Ogre's paging system) and is mapped into a set of PolyVox::Volumes with single data chunk defined for each volume. Then I went and changed this because (OCD issues? lol) I was "trippign" about borders between chunks (okay granted I didn't spend too long thinking how I can resolve this and keep the same system) so that now I have multiple chunks of data per PolyVox::Volume chunk, and another level of mapping from Ogre's coordinate system into the final (local) coordinate system. So it's Ogre's -> Volume's -> Volume chunks. I'm going to stop worrying about this. It's not perfect but it works.

And I'm not doing moving coordinate frame thing where I map all pages into a single PoyVox::Volume; I'm instead dynamically allocating PolyVox::Volume as I go. I know it's not perfect solution but I don't really care anymore.


Last edited by beyzend on Fri Dec 10, 2010 10:49 pm, edited 2 times in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 10:31 pm 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
Also, the first thing I tried before the current solution is I tried generating the needed borders per Volume chunk. THat is, generating one less than "power of two" voxel value, and with the "power of two" voxel value matching the value of the next chunk. But there was some trouble with that and I ended saying screw it and went with my current solution.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox and threads
PostPosted: Fri Dec 10, 2010 10:44 pm 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
I was going to pass in a border cache from my noise generator into the surface extractor so when they need to evaluate an border then can get it from there, but I was lazy and didn't implement this, and went with my current solution.

In the future I may have to go back to a thin layer between PolyVox and my generation method; the reason is that my current method can have memory leak issues due to block mangement with PolyVox::Volume and the way I'm using it with threads. So the thin layer will use an atomic variable, so that the first thread that generates an border value will be responsible for generating that border value. But you say, that makes no sense. Well, the thing is, with memory access pattern currently this rarely happens (i.e. the voxel being set is always going from left to right, so --in most cases-- by the time one gets to the border, that value has been generated--it is the left-most value for a region). I can live with the occasional exposed borders. Mind you though, all this border issue is really a non-issue, it doesn't really affect the performance at all!!! So my advice is to just ignore the borders. (well I comfort myself on the time wasted on this with --hey man , it's for teh physics.)


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net