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

Mesh created by Paged Volume is bugged
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=15&t=679
Page 1 of 1

Author:  BitteWenden [ Sun Sep 25, 2016 6:17 pm ]
Post subject:  Mesh created by Paged Volume is bugged

Hey, so this time the problem is probably not caused by me since I encounter a similar problem in the PagingExample. In my UE4 project, I get weird extra planes when my region bigger than a certain amount. In the example I get weird artifacts for every size (I've only changed extractCubicSurface to extractMarchingCubesSurface, but it happens for both methods apparently).


Image
Image

Author:  BitteWenden [ Tue Sep 27, 2016 7:05 pm ]
Post subject:  Re: Mesh created by Paged Volume is bugged

Looks like it's some uint8 causing the problem since it only happens once you go over 256 in the region size.

Author:  David Williams [ Tue Sep 27, 2016 9:32 pm ]
Post subject:  Re: Mesh created by Paged Volume is bugged

BitteWenden wrote:
Looks like it's some uint8 causing the problem since it only happens once you go over 256 in the region size.


Yes, indeed, the CubicVertex is defined as follows:

Code:
/// A specialised vertex format which encodes the data from the Marching Cubes algorithm in a very
/// compact way. You will probably want to use the decodeVertex() function to turn it into a regular
/// Vertex for rendering, but advanced users can also decode it on the GPU (see PolyVox examples).
template<typename _DataType>
struct  MarchingCubesVertex
{      
   typedef _DataType DataType;

   /// Each component of the position is stored using 8.8 fixed-point encoding.
   Vector3DUint16 encodedPosition;

   /// The normal is encoded as a 16-bit unsigned integer using the 'oct16'
   /// encoding described here: http://jcgt.org/published/0003/02/01/
   uint16_t encodedNormal;

   /// The interpolated voxel data from the neighbouring voxels which generated this
   /// vertex (every vertex is placed between two voxels by the MArching Cubes algorithm)
   DataType data;
};


The '8.8 fixed-point encoding' limits the extracted size to 256. In practice users are expected to extract regions with a side length of 16, 32, or 64 (depending on your application) and extract multiple adjacent regions per volume which are rendered as separate meshes. This keeps each extraction fast, and means that you can quickly update the mesh for parts of the volume which change.

Edit: I though you were talking about cubic voxels to start with - with Marching Cubes you have to take a bit more care to line the meshes up. You might want sides lengths of 17/33/65 so that they actually touch.

Author:  BitteWenden [ Wed Sep 28, 2016 4:10 pm ]
Post subject:  Re: Mesh created by Paged Volume is bugged

Ah, alright. Thanks!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/