It is currently Sat Aug 22, 2020 4:28 am


All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: PolyVox::LargeVolume
PostPosted: Sun Sep 15, 2013 9:19 pm 
User avatar

Joined: Thu Sep 05, 2013 3:38 am
Posts: 51
Location: USA - Arizona
Are there any other benefits from using LargeVolume aside from you have the ability to work with a larger volume? Are they 'tuned' better for larger volumes?

Also, with VS2012 I'm getting this error when I try to compile with a LargeVolume

Code:
Error   5   error C2064: term does not evaluate to a function taking 2 arguments   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap   431   1   Day-X


It then brings me to this line of xrefwrap
Code:
_VARIADIC_EXPAND_0X(_APPLYX_CALLOBJ, , , , )


I'm trying to define a PolyVox::LargeVolume as follows:
Code:
volData = new PolyVox::LargeVolume<PolyVox::MaterialDensityPair44>(PolyVox::Region(PolyVox::Vector3DInt32(0,0,0), PolyVox::Vector3DInt32(1024,32,1024)), 64);


Are there any examples of how to correctly define a LargeVolume? :)

EDIT:
I just found this topic :/ viewtopic.php?f=14&t=506
I'm sad now its broken for VS2012.. Any news on a V3 release :)

_________________
Dream Big Or Go Home.
ENet - http://enet.bespin.org
Recast - https://github.com/memononen/recastnavigation
Irrlicht - http://irrlicht.sourceforge.net/forum
PolyVox - http://www.volumesoffun.com/phpBB3/
Help Me Help You.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Tue Sep 17, 2013 8:42 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
The main benefits of the LargeVolume are that it does not have to store all the data in memory at once, and that data which is stored is often compressed. Overall this allows you to have much bigger volumes, though access to the voxels might be slower in cases where the data has to be loaded into memory or decompressed.

I would definitely recommend using the 'develop' branch of PolyVox if you are working with the large volume, because we've done a lot of work on it (particularly adding unit tests and fixing ones that didn't pass). It also compiles with VS2012 (I believe) though the AStarPathfinder still doesn't compile.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Tue Sep 24, 2013 9:06 am 
User avatar

Joined: Thu Sep 05, 2013 3:38 am
Posts: 51
Location: USA - Arizona
I'm getting "Unable to open file to write out block data."
Referring to this line:
Code:
pFilePager = new PolyVox::FilePager<PolyVox::MaterialDensityPair44>("./");

I've tried setting a specific file and creating the file at the correct path, I've tried leaving it as is, and I've tried doing both of those while running the program as an administrator, I also checked file and folder permissions, I'm not sure why I'm getting this..

_________________
Dream Big Or Go Home.
ENet - http://enet.bespin.org
Recast - https://github.com/memononen/recastnavigation
Irrlicht - http://irrlicht.sourceforge.net/forum
PolyVox - http://www.volumesoffun.com/phpBB3/
Help Me Help You.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Fri Sep 27, 2013 12:25 pm 

Joined: Fri Sep 20, 2013 10:16 am
Posts: 15
Hello everybody,

I am currently working with a LargeVolume and a few questions about the SurfaceExtraction came to my mind. I read through most of the related topics and got a little bit confused by some stuff:

I understand the reason of having one huge LargeVolume instead of a lot smaller ones. And if I have a Volume of e.g. 10000 width, 5000 height, 10000 depth it would be better to create more small meshes and load them the time i need them instead of creating one single mesh.
As far as I understood the CubicSurfaceExtractor or MarchingCubeExtractor needs my Volume, a Region and a SurfaceMesh.

Does the Region have to be related to the region i created my LargeVolume or is any other Region fine?
If it is related, is there any way I can extract small parts of my Region which are still related to the LargeVolume region?

Thanks for any help :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Fri Sep 27, 2013 1:13 pm 
User avatar

Joined: Thu Sep 05, 2013 3:38 am
Posts: 51
Location: USA - Arizona
I believe the Region specifies a specific portion within your volume.

_________________
Dream Big Or Go Home.
ENet - http://enet.bespin.org
Recast - https://github.com/memononen/recastnavigation
Irrlicht - http://irrlicht.sourceforge.net/forum
PolyVox - http://www.volumesoffun.com/phpBB3/
Help Me Help You.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Fri Sep 27, 2013 2:01 pm 

Joined: Fri Sep 20, 2013 10:16 am
Posts: 15
Sounds logic to me. But I get an error trieing to do so.
For example we take the code from the Tutorial with a few changes:
Code:
PolyVox::Region region(Vector3DInt32(0,0,0), Vector3DInt32(200,200,200));
SimpleVolume<uint8_t> volData(region);
SurfaceMesh<PositionMaterialNormal> mesh;


We define our global Volume because i just need one and so I dont have to pass it as parameter. Inside of createSphere I create a new region where I want to set Voxels and where I want to create a mesh.

Code:
SimpleMesh createSphereInVolume()
{
        PolyVox::Region mRegion(Vector3DInt32(10,10,10), Vector3DInt32(20,20,20));
        Vector3DFloat v3dVolCenter(15, 15, 15);
        float fRadius = 3.0f;
        for (int z = 10; z < 20; z++)
        {
                for (int y = 10; y < 20; y++)
                {
                        for (int x = 10; x < 20; x++)
                        {
                                Vector3DFloat v3dCurrentPos(x,y,z);
                                float fDistToCenter = (v3dCurrentPos - v3dVolCenter).length();
                                uint8_t uVoxelValue = 0;

                                if(fDistToCenter <= fRadius)
                                {
                                        uVoxelValue = 255;
                                }
                                volData.setVoxelAt(x, y, z, uVoxelValue);
                        }
                }
        }
        CubicSurfaceExtractorWithNormals< SimpleVolume<uint8_t> > surfaceExtractor(&volData, mRegion, &mesh);
        surfaceExtractor.execute();
       return mesh; 
}

(Sorry if I miss some pointers or things I normally program in C# with PolyVox. So but I think the idea behind this is clear :) )

The Problem is after execute(), there are no datas stored in mesh (no vertices, no indices)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Fri Sep 27, 2013 8:02 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
This is actually expected (though you are not the first person to get caught out by this). The Marching Cubes algorithm works by processing group of eight voxels (a cell) at a time, and it only generates triangles if some of the voxels in a cell are above a threshold and some are below it. That is, it extracts the surface which passes through the cells (Google for some diagrams of Marching Cubes if this isn't clear).

In your case you are setting the whole region to be high density, so there is no isosurface inside the region. The transition from high to low density occurs just outside the region you have set. If you extract a slightly larger region you should see your mesh

Code:
mRegion.grow(1); // This makes the region slightly larger
CubicSurfaceExtractorWithNormals< SimpleVolume<uint8_t> > surfaceExtractor(&volData, mRegion, &mesh);
surfaceExtractor.execute();


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Mon Sep 30, 2013 7:29 am 

Joined: Fri Sep 20, 2013 10:16 am
Posts: 15
Thanks a lot, it is getting clearer now.
So if I have a huge sphere, I could split it up and create smaller pieces and attach them together later on.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Mon Sep 30, 2013 8:48 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Exactly, you can split it into a number of small adjacent regions and generate a mesh for each. Then you only need to render the parts of the volume which are visible, and you only need to rebuild a few small meshes when the volume data changes.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: PolyVox::LargeVolume
PostPosted: Fri Oct 18, 2013 1:58 am 
User avatar

Joined: Thu Sep 05, 2013 3:38 am
Posts: 51
Location: USA - Arizona
Image

Why does this error occur?

I can't seem to pin down exactly why, here is the code that spawns this beast:
Code:
//Receive Lower Chunk Voxel Pos
               int LowerX = mn::GetInt( recvPacket );
               int LowerY = mn::GetInt( recvPacket );
               int LowerZ = mn::GetInt( recvPacket );
               //Receive Upper Chunk Voxel Pos
               int UpperX = mn::GetInt( recvPacket );
               int UpperY = mn::GetInt( recvPacket );
               int UpperZ = mn::GetInt( recvPacket );
               //std::cout << LowerX << " " << LowerY << " " << LowerZ << " -- " << UpperX << " " << UpperY << " " << UpperZ << std::endl;
               for ( int blkX = LowerX; blkX <= UpperX; ++blkX )
               {
                  for ( int blkZ = LowerZ; blkZ <= UpperZ; ++blkZ )
                  {
                     for ( int blkY = LowerY; blkY <= UpperY; ++blkY )
                     {
                        PolyVox::MaterialDensityPair44 Voxel = volData->getVoxelAt( blkX, blkY, blkZ );
                        Voxel.setDensity( mn::GetUnsignedByte( recvPacket ) * 255 );
                        volData->setVoxelAt( blkX, blkY, blkZ, Voxel );
                     }
                  }
               }


blkX blkZ & blkY are 0, which is the first block that's being accessed.


Also for whatever reason if I fill the density of a voxel to 255, I cout the density before it goes in, then I get the density of the same voxel it's magically 15.

I can upload all the code involved in these two processes if it helps you but it spans across a couple classes.

EDIT:
I did some other things for a few hours, came back & ran my program, worked fine the first time, the second time, and the third time, but the fourth time the error is back -_-* I'm super confused now..

_________________
Dream Big Or Go Home.
ENet - http://enet.bespin.org
Recast - https://github.com/memononen/recastnavigation
Irrlicht - http://irrlicht.sourceforge.net/forum
PolyVox - http://www.volumesoffun.com/phpBB3/
Help Me Help You.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 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