Volumes Of Fun http://www.volumesoffun.com/phpBB3/ 

Noncubic shapes http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=641 
Page 1 of 2 
Author:  kariem2k [ Sun Jun 07, 2015 6:53 pm ] 
Post subject:  Noncubic shapes 
Hi Is there a way to implement noncubic shapes. Like vertical/horizontal half cubes, pyramids. I want to smooth out the environment but still have the bulky style and more importantly I need to be able to control the shape so I don't think marching cubes will be suitable for that(?). Thanks 
Author:  petersvp [ Mon Jun 08, 2015 8:33 am ] 
Post subject:  Re: Noncubic shapes 
You have to write your own Surface Extractor. And your own voxel type. I am already doing something similar for Crafterria, but the task is not so trivial. Welcome to the world of Meshing, Math and voxels. 
Author:  David Williams [ Mon Jun 08, 2015 11:00 am ] 
Post subject:  Re: Noncubic shapes 
I am inclined to agree with petersvp, but I'd be curious if you have any screenshots or images of games with a similar style to what you are trying to create. Creating your own voxel type is pretty easy as PolyVox is templatised, while creating you own surface extractor is as difficult as your requirements :) 
Author:  petersvp [ Mon Jun 08, 2015 11:59 am ] 
Post subject:  Re: Noncubic shapes 
Okay, more helpful now. My approach that is under development, is based on shape extrusion and hidden face removal. I have basic shapes, like rect, triangle and so on, that I extrude, and then remove unneeded faces. For perfect culled geometry a step that calculates unions and intersections in nessesary. Boost::geometry helps here but is 2D only, so this is complication on itself. also, in order to generate volume geometry like this, cashing intersrection geometry is a must, and the amount of memory may also become bottleneck. You must also consider shape rotations, but this can be trivial  you just generate primitives for each needed rotated state. Anyways, the topic is complicated and requires research. Probbly, there is not readymade solution made public or at least i am unaware of such if it exists. 
Author:  kariem2k [ Mon Jun 08, 2015 12:20 pm ] 
Post subject:  Re: Noncubic shapes 
Something like this https://www.planetscube.com/gallery/screenshots/ I was thinking of something like setting the type of the shape (halfcube right, halfcube left, pyramid, etc...) as voxel data, and since the cubes are axis aligned, in the vertex shader I would move the vertices at x+0.5, y+0.5,z+0.5 according to the type or if I want to use the mesh in physics I would do that on the CPU. But that will cause issues in visibility of the hidden cubes since the cubic mesh extractor already thinks that the cube is a full cube and already hidden the cube behind it. Also I think that Polyvox joins contiguous polygons(?). 
Author:  kariem2k [ Mon Jun 08, 2015 12:24 pm ] 
Post subject:  Re: Noncubic shapes 
Thanks petersvp 
Author:  petersvp [ Mon Jun 08, 2015 1:16 pm ] 
Post subject:  Re: Noncubic shapes 
My voxel data have a color, material type and a geometry ID or a density value. First pass uses marching cubes on voxels marked as earth terrain, and the second pass uses the shapes data mapped to the Geometry ID. You basically have a int that corresponds to a lookup table with shapes. The data structure is: Insquare polygons that are always rendered, and the 6 faces only polygons, that can either be rendered or not rendered, bsed on surrounding blocks. And a map of two neighbouring geometry IDs and their intersection geometries. I only process blocks if at least one of its 6 neighbour blocks is air. For blocks that are sorrounded by other blocks,I don't render anything. When this algorithm is ready, I may post portions of its source code that may be of use of everyone. 
Author:  David Williams [ Mon Jun 08, 2015 9:14 pm ] 
Post subject:  Re: Noncubic shapes 
kariem2k wrote: Something like this https://www.planetscube.com/gallery/screenshots/ To be honest it's not that different from what the Marching Cubes algorithm will give you if you apply flat shading and clamp the voxel values to always be the min/max. Marching cubes doesn't have to be smooth. Here's the BasicExample from PolyVoc, adjusted to run Marching Cubes instead of the cubic surface extractor: kariem2k wrote: Also I think that PolyVox joins contiguous polygons(?). That's really a property of the surface extractor. The Marching Cubes implementation does indeed share vertices between triangles which makes flat shading slightly more tricky, but you can still do it by computing normals in the fragment shader. 
Author:  kariem2k [ Mon Jun 08, 2015 9:38 pm ] 
Post subject:  Re: Noncubic shapes 
David Williams wrote: kariem2k wrote: Something like this https://www.planetscube.com/gallery/screenshots/ To be honest it's not that different from what the Marching Cubes algorithm will give you if you apply flat shading and clamp the voxel values to always be the min/max. Marching cubes doesn't have to be smooth. Here's the BasicExample from PolyVoc, adjusted to run Marching Cubes instead of the cubic surface extractor: kariem2k wrote: Also I think that PolyVox joins contiguous polygons(?). That's really a property of the surface extractor. The Marching Cubes implementation does indeed share vertices between triangles which makes flat shading slightly more tricky, but you can still do it by computing normals in the fragment shader. Great idea I did not think of flat shading. 
Author:  petersvp [ Tue Jun 09, 2015 10:59 am ] 
Post subject:  Re: Noncubic shapes 
However, Marching Cubes alone cannot give the exact geometry Planets3 uses, but still you can do interesting nonsmooth stuff with it. 
Page 1 of 2  All times are UTC 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ 