It is currently Sun Nov 17, 2019 10:33 am


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Inverse PolyVox?
PostPosted: Wed Nov 09, 2016 6:04 pm 

Joined: Fri Sep 30, 2016 3:30 am
Posts: 14
PolyVox is working really well for me, for converting an array of voxels into a smooth mesh.

I'd like to manipulate imported an imported mesh. The UE4 engine has a tool called "procedural mesh slicing", but it's very limited.

I have a feature request for David:

Would it be possible to start with an enclosed mesh, and then build a Voxel Volume from that? Essentially importing a shape into the voxel database. This would be really useful for example, turning a tree into a voxel database, manipulating it, then generating a new mesh.

If you don't have the time to implement this feature, do you have an outline of a strategy I could use to implement this import feature?

Maxwell Gumley


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Inverse PolyVox?
PostPosted: Sat Nov 12, 2016 7:21 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hi,

The process you describe is known as 'Voxelization'. Searching on that term (also on this forum) should throw up some interesting leads.

You basically need a way to determine whether a given point is inside your mesh and there are a few ways to do this. One approach is to cast a ray from a voxel to infinity and then test how many of your triangles it intersects. If this is an odd number then the voxel is inside the mesh, while an even number (or zero) means it is outside. I'm sure that some searching will lead you to some better approaches though.

Unfortunately I won't be adding it to PolyVox, partly because it is out of scope, and partly because my focus is now on developing a new version of Cubiquity instead.

Hope that helps get you started!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Inverse PolyVox?
PostPosted: Thu Nov 17, 2016 1:29 am 

Joined: Fri Sep 30, 2016 3:30 am
Posts: 14
It looks like my question has been asked before quite a few times lol. I did some searching around and it looks like that it wouldn't be too hard to convert a cubic mesh into voxels.

I looked at binvox, and poly2vox, but it seems like they are both using cubic approximations. I dont think their voxelization output has any kind of distance field. The voxels are either on or off. Do you know of a way to get the partial voxel values for an input mesh that is not cubic?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Inverse PolyVox?
PostPosted: Sat Nov 19, 2016 9:23 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
mgumley wrote:
Do you know of a way to get the partial voxel values for an input mesh that is not cubic?


I think the easiest approach would be to create a binary (cubic) volume at higher resolution than you need, and then downsample it to a smooth volume of the requred resolution. So if you wanted a smooth volume of 256^3 resolution, you might create a binary volume at 1024^3 resolution and voxelise into that. Then groups of 4^3 = 64 voxels would be summed up to give a value between 0-63, scaled to the range 0-255, and written to you smooth volume. Obviously there are performance and memory implications to this approach, which my or may not matter to you.

Alternatively, a smarter approach would be to test not only whether a voxel is inside a mesh, but also how far inside it is. If a triangle slices a voxel in two then determine what percentage of the voxel is inside. This then tells you what your density value should be. This method is probably faster and more scalable but requires more maths and thought.

In general I would research antialiasingtechniques (e.g. this one), as I think what you are describing is basically the 3D equivalent of those.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Inverse PolyVox?
PostPosted: Mon Nov 21, 2016 4:15 pm 

Joined: Fri Sep 30, 2016 3:30 am
Posts: 14
Thanks for the guidance David. I'll be looking into this.


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

All times are UTC


Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest


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