It is currently Sat Aug 22, 2020 1:44 pm


All times are UTC




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Mon Jun 18, 2012 12:45 am 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
That's what I'm saying. I'm only updating necessary regions and neighboring regions along with checking for duplicate region updates but I have yet to come up with the code for actually checking if the affected voxels are on the edge of a region liked you suggested. It's seems to take quite a bit of cpu time to draw a significant amount of regions all at once. For example - 7 x 6 x 3 regions = 126 regions = 4128768 voxels. if 1 region is 32 x 32 x 32 voxels, it takes just under a minute a half to draw all the regions


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Mon Jun 18, 2012 2:44 am 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
I found an interesting bug that may be causing some problems.

Code:
Math::Floor(raycastResult.intersectionVoxel.getX() / divisor),Math::Floor(raycastResult.intersectionVoxel.getY() / divisor),Math::Floor(raycastResult.intersectionVoxel.getZ() / divisor)


gives a different result than my ogre raycast point ( no voxels hit / freespace )

Code:
myPoint = Vector3(Math::Floor(myPoint.x),Math::Floor(myPoint.y),Math::Floor(myPoint.z));
Math::Floor(myPoint.x / divisor),Math::Floor(myPoint.y / divisor),Math::Floor(myPoint.z / divisor)



For example. a Y value below 0 should be in the -1 region, but when hitting a voxel and using the intersection, a voxel Y value below 0 is also 0, when it should also be -1


Last edited by drwbns on Tue Jun 19, 2012 3:51 pm, edited 1 time in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Tue Jun 19, 2012 8:34 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
drwbns wrote:
For example - 7 x 6 x 3 regions = 126 regions = 4128768 voxels. if 1 region is 32 x 32 x 32 voxels, it takes just under a minute a half to draw all the regions


So it takes about 200ms to extract each 32x32x32 region? This does sound a little slow but it can depend on you hardware of course. Have a read of this thread (viewtopic.php?f=14&t=401) where I state that I can extract a 64x64x64 region in about 52ms. You should ue the timing tricks discused in that thread to determine whether the time is being used by the call to execute() or by something else, such as uploading the data to the GPU.

drwbns wrote:
I found an interesting bug that may be causing some problems.


The PolyVox raycast returns an integer position (the centre of the voxel), where as the Ogre code returns a float position on the mesh. The mesh doesn't pass through the centre of the voxel, it surrounds it. Actually, the Ogre raycast is probably using the bounding box for it detection rather than going to polygon level, so this will make it even more different.

Also, in your sample code it's not clear what 'divisor' is. Is it an integer? If so you're doing integer division and then taking the floor of the result which doesn't make much sense.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Tue Jun 19, 2012 8:59 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
it will take longer to extract a region if the sidelength is lower than the region size.
Then there will be 8 or more internal chunks per region that you extract, causing a huge number of region swaps per extracted region.
make sure you set the sidelength to 32 in your case (i remember the default being 16 at some time in the past)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Tue Jun 19, 2012 3:53 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
I forgot to post that I'm actually flooring the float numbers from my Ogre raycast. I edited my post above. Divisor is an int, should I make it unsigned? I'm not sure what ker is talking about as far as the sidelength. Divisor is a set 32. I'll post back some results of using the Ogre::Timer class, thanks!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Wed Jun 20, 2012 10:38 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
i meant the last parameter of the largevolume constructor. it defaults to 32 in the current git, so that should not be your problem.

how do you compute the lowerCorner and upperCorner of your regions?
maybe they don't match up with the internal regions?
internal regions go from 0,0,0 to 31,31,31 and 32, 0, 0 to 63,31,31 and so on...
if you go any further than that in your extraction, you will cause internal region swaps which will definitely slow down extraction.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Wed Jun 20, 2012 12:27 pm 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
I'm just taking the Ogre raycast hitPoint and dividing it by 32 which gives me what region it is. Then I just multiply the region by the divsor again to give me the lowerCorner, then add 32 to the lowerCorner to give me the upperCorner. So a hitPoint of 31,31,31 would be in region 0,0,0 and 32,32,32 would be in region 1,1,1


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Wed Jun 20, 2012 1:15 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
It's definitely worth determining whether extraction is actually the problem, by putting timing calls around the call to 'execute()' when generating the mesh.

If the individual calls are indeed slow then this may because of the kind of issues that ker is suggesting. You can try swapping LargeVolume for Simple/RawVolume to determine if this is indeed the case.

If the individual calls are not slow then you need to look elsewhere for you problem (perhaps GPU upload issues).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Thu Jun 21, 2012 7:12 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
drwbns wrote:
I'm just taking the Ogre raycast hitPoint and dividing it by 32 which gives me what region it is. Then I just multiply the region by the divsor again to give me the lowerCorner, then add 32 to the lowerCorner to give me the upperCorner. So a hitPoint of 31,31,31 would be in region 0,0,0 and 32,32,32 would be in region 1,1,1


this will not work for negative positions, if you use integer division!

-10,-10,-10 -> 0, 0, 0 while position 10, 10, 10 would also be in zone 0, 0, 0... maybe something is computed badly there...

but yes, first test as david suggested... check which part of the extraction takes up how much time.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Polyvox to Ogre Mesh
PostPosted: Sat Jun 23, 2012 1:57 am 

Joined: Wed Jan 11, 2012 7:33 pm
Posts: 109
Hi ker, yes I figured that out a couple of days ago so I ended up adding -32 to coordinates that are negative to seperate the regions. I still have to run the execute timer tests so I'll post back when I've got them. Thanks


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

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