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


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Relationship between voxels,rays,density and mesh materials
PostPosted: Thu Feb 02, 2012 1:34 am 

Joined: Wed Jan 25, 2012 12:29 am
Posts: 18
Sorry if this is too obvious a question but I have looked through the docs and examples and I'm still confused (it's easily done).

I am trying to implement a simple voxel selection and marking system where the basic functions are:

Draw the mesh (using the voxel sphere example)
Use the camera and mouse position to cast a ray into the scene (works now)
Use a couple of mouse clicks to mark a region (very crude but it's not the problem. yet)
Change the density of the voxels in the region to a lesser density.
Re-draw the mesh

If I set the density of the selected region to to maxDensity / 2 or below, the ray casting and mesh generation agree but if I set it to maxDensity / 2 + 1 then those voxels are not removed from the mesh but rays will pass right through them.

If there is a way to change the thresholds of these functions then I have missed it.

Another possibly related issue I'm having is that when I assemble the mesh for ogre I use the PositionMaterialNormal but I never seem to getMaterial() != 0.

The code is here: http://charlieb.hopto.org/gitweb/index.cgi?p=ogre_vox.git;a=tree

cheers,
Charlie


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Relationship between voxels,rays,density and mesh materi
PostPosted: Thu Feb 02, 2012 9:25 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Yeah... you are encountering some of the rough edges which I'm trying to improve at the moment. Basically, I see you are working with the CubicSurfaceExtractor, and in this case it's doesn't make much sense to have density values (a voxel is either solid or it isn't). I know the example uses MaterialDensityPair44 but that should probably be changed.

Try switching to Material8 instead, and never call setDensity() or getDensity(). Instead call set/getMaterial(). A material of 0 is empty space and any other material is solid.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Relationship between voxels,rays,density and mesh materi
PostPosted: Thu Feb 02, 2012 1:22 pm 

Joined: Wed Jan 25, 2012 12:29 am
Posts: 18
Ah ah ok well good.

So if I switch to Material8 and use get and set material then when I use getMaterial on the mesh vertex will the value returned be the value that I set in the volume or is there still some mapping?

Thanks,
Charlie


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Relationship between voxels,rays,density and mesh materi
PostPosted: Fri Feb 03, 2012 2:47 am 

Joined: Wed Jan 25, 2012 12:29 am
Posts: 18
Worked perfectly. I even got the shader to change the colour based on the material so I'm happy!


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 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