Volumes Of Fun http://www.volumesoffun.com/phpBB3/ |
|
Relationship between voxels,rays,density and mesh materials http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=326 |
Page 1 of 1 |
Author: | charlieb [ Thu Feb 02, 2012 1:34 am ] |
Post subject: | Relationship between voxels,rays,density and mesh materials |
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 |
Author: | David Williams [ Thu Feb 02, 2012 9:25 am ] |
Post subject: | Re: Relationship between voxels,rays,density and mesh materi |
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. |
Author: | charlieb [ Thu Feb 02, 2012 1:22 pm ] |
Post subject: | Re: Relationship between voxels,rays,density and mesh materi |
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 |
Author: | charlieb [ Fri Feb 03, 2012 2:47 am ] |
Post subject: | Re: Relationship between voxels,rays,density and mesh materi |
Worked perfectly. I even got the shader to change the colour based on the material so I'm happy! |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |