It is currently Sat Aug 22, 2020 3:47 pm


All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: why getIndices() always zero? I am using SurfaceExtracto
PostPosted: Fri Jun 24, 2011 7:31 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
It looks like you are setting all of your voxels to have maximum density? It so there will be no surface generated. You need to set some to the maximum density and some to the minimum density. Then the surface will be generated on the boundary.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: why getIndices() always zero? I am using SurfaceExtracto
PostPosted: Sat Jun 25, 2011 3:50 am 

Joined: Fri Sep 10, 2010 5:38 am
Posts: 30
David Williams wrote:
It looks like you are setting all of your voxels to have maximum density? It so there will be no surface generated. You need to set some to the maximum density and some to the minimum density. Then the surface will be generated on the boundary.

Thank you for your in time reply. I recode my lines as you told and I do have indices. But from my point of view, the numbers below is a litte wired:
Attachment:
indices.Png
indices.Png [ 191.01 KiB | Viewed 1909 times ]

And I also didn't get what I want. The result mesh is just have on side.
So I post my code here, and hope you can help me to bug it!
Attachment:
VolumeStone.h [1.35 KiB]
Downloaded 183 times
Attachment:
VolumeStone.cpp [14.35 KiB]
Downloaded 182 times

Sorry for bothering you during these couple of days!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: why getIndices() always zero? I am using SurfaceExtracto
PostPosted: Sun Jun 26, 2011 3:15 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
pumpkin_zch2u wrote:
Thank you for your in time reply. I recode my lines as you told and I do have indices. But from my point of view, the numbers below is a litte wired:


I think the number are probably ok. Though it's hard to be sure without a screenshot.

pumpkin_zch2u wrote:
And I also didn't get what I want. The result mesh is just have on side.
So I post my code here, and hope you can help me to bug it!


Do you man that it generates the correct triangles, but they are only visible from one side? If so then this is a rendering issue, not directly related to PolyVox. By default graphics cards will draw triangles as only having one side, but you can change this behaviour. See http://www.ogre3d.org/docs/manual/manual_16.html#SEC61

Also, you may find it useful to look at the wireframe rendering: http://www.ogre3d.org/docs/manual/manual_16.html#SEC65

These settings requres you to be familier with Ogre's material system.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: why getIndices() always zero? I am using SurfaceExtracto
PostPosted: Sun Jun 26, 2011 11:13 pm 

Joined: Fri Sep 10, 2010 5:38 am
Posts: 30
I check it in vertex mode and wireframe mode inOgre, It seems the invisible parts stil do not have these components. I will double check lately.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: why getIndices() always zero? I am using SurfaceExtracto
PostPosted: Tue Jun 28, 2011 5:09 am 

Joined: Fri Sep 10, 2010 5:38 am
Posts: 30
It seems it is not the problem in mesh Ogre Generated. I try to test in this way:
first I use the getvertices to generate:
Code:
for(uint32_t i = 0; i < vecVertices.size(); i++)
      {
         const PolyVox::PositionMaterialNormal& vertex = vecVertices.at(i);   
         PolyVox::Vector3DFloat vertex_pos = vertex.getPosition() /*+static_cast<PolyVox::Vector3DFloat>(mesh->m_Region.getLowerCorner())*/;            
         const PolyVox::Vector3DFloat v3dFinalVertexPos = vertex_pos + static_cast<PolyVox::Vector3DFloat>(mesh->m_Region.getLowerCorner());
         oMO->position(v3dFinalVertexPos.getX(), v3dFinalVertexPos.getY(), v3dFinalVertexPos.getZ());
         oMO->normal(vertex.getNormal().getX(), vertex.getNormal().getY(), vertex.getNormal().getZ());
         oMO->index((Ogre::uint32)(vecIndices[i])); 
         //oMO->index(i);      
      }

the result is below.
Attachment:
effect1.Png
effect1.Png [ 202.37 KiB | Viewed 1888 times ]

If I use the code below,
Code:
for(uint32_t i = 0; i < vecVertices.size(); i++)
      {
         const PolyVox::PositionMaterialNormal& vertex = vecVertices.at(i);   
         PolyVox::Vector3DFloat vertex_pos = vertex.getPosition() /*+static_cast<PolyVox::Vector3DFloat>(mesh->m_Region.getLowerCorner())*/;            
         const PolyVox::Vector3DFloat v3dFinalVertexPos = vertex_pos + static_cast<PolyVox::Vector3DFloat>(mesh->m_Region.getLowerCorner());
         oMO->position(v3dFinalVertexPos.getX(), v3dFinalVertexPos.getY(), v3dFinalVertexPos.getZ());
         oMO->normal(vertex.getNormal().getX(), vertex.getNormal().getY(), vertex.getNormal().getZ());
         //oMO->index((Ogre::uint32)(vecIndices[i])); 
         oMO->index(i);      
      }

the result is,
Attachment:
effect2.jpg
effect2.jpg [ 141.3 KiB | Viewed 1888 times ]

Does it have a bug?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: why getIndices() always zero? I am using SurfaceExtracto
PostPosted: Tue Jun 28, 2011 6:53 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
pumpkin_zch2u wrote:
Does it have a bug?

It sure does :-)

It seems you are not using the index list correctly. Try something like the code below. Note that I haven't tested it so you may need to adjust it to make it compile:

Code:
for(uint32_t i = 0; i < vecVertices.size(); i++)
{
   const PolyVox::PositionMaterialNormal& vertex = vecVertices.at(i);   
   PolyVox::Vector3DFloat vertex_pos = vertex.getPosition() /*+static_cast<PolyVox::Vector3DFloat>(mesh->m_Region.getLowerCorner())*/;           
   const PolyVox::Vector3DFloat v3dFinalVertexPos = vertex_pos + static_cast<PolyVox::Vector3DFloat>(mesh->m_Region.getLowerCorner());
   oMO->position(v3dFinalVertexPos.getX(), v3dFinalVertexPos.getY(), v3dFinalVertexPos.getZ());
   oMO->normal(vertex.getNormal().getX(), vertex.getNormal().getY(), vertex.getNormal().getZ());     
}

for(uint32_t i = 0; i < vecIndices.size(); i++)
{
   oMO->index((Ogre::uint32)(vecIndices[i]));
}


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

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