It is currently Sun Nov 17, 2019 9:44 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Material Ignoring
PostPosted: Wed Nov 23, 2016 4:38 pm 

Joined: Wed Nov 23, 2016 3:46 pm
Posts: 4
Hi im new to this forum/PolyVox, but I would like to use it with Unreal4(irrelevant in the matter) in a specific scenario, there it would generate nearly all the world by various means, so specially i would use the marching cubes for something like stone and sand, and i would like to use cubic to generate bricks, and marching cubes separately for water, so i would need a function to ignore eg bricks in one generation, and water to generate a separate mesh for that material (this is for generating lake floor from eg stone in first run, and i don't want to use just a plane for water because i would like it to be dynamic fluid so i need to generate the whole body)this cannot be done post processing the output arrays because there is no vertex to duplicate because the algorythm just generate the mesh based on merely the isovalue.
also translucent cubes like glass in minecraft shuold be in another cycle of mesh generation(or other solution) for the same reason as water because they need the surrounding faces to be generated otherwise you can see through the world.

i wouldnt like to use another volume because its a huge overhead in memory and hdd space and i would like to spare that resources most because i intend to make Big worlds.

as an additional question how can i store additional data in volume for a voxel apart from mat density pair eg hitpoint

now i see i can do some tricks defining a custom controller for the marching cubes, don't know how to do it with cubic i see no controler there and just started browsing the code in the moment im completely new to PV,im just leaving the question as is mby you have a better way doing this eg to do it in one generation

thx in adv

Offline Profile  
Reply with quote  
 Post subject: Re: Material Ignoring
PostPosted: Thu Nov 24, 2016 7:24 pm 
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hi, welcome to the forums. Unfortunately the requirements you describe are going to be challenging, even though PolyVox is quite flexible in this regard.

Starting with the Marching Cubes, the decision about whether to generate triangles for a given set of eight voxels is driven entirely by the density as provided by the 'convertToDensity()' function on the MarchingCubesController. Note that you don't actually have to store a density as you can instead make one up based on other information (e.g. a material). So in your scenario you would need a different MarchingCubesController for each surface you wanted to extract. Note that you will find it very difficult to generate *smooth* densities from just material information, resulting in a jagged appearance.

The CubicSurfaceExtractor is probably simpler, in this case control is provided by the IsQuadNeeded parameter. This simply determines whether a surface should be generated between any given pair of voxels (you could make this decision based on the material).

Combining both of the above is going to be difficult. Amoung other things, the CubicSurfaceExtractor generates a cube on a per-voxel basis, but the MarchingCubesExtractor generates triangles on a per-cell (group of eight adjacent voxels) basis just because this is how Marching Cubes works. But do you really want buildings and terrain in the same volume? I can imagine the resolution of buildings would need to be much higher.

Transparency is probably going to be difficult though I haven't really tried it. My gut feeling is that it will be easier in the cubic case but I'm not sure.

Anyway, good luck!

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

All times are UTC

Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created