6
\$\begingroup\$

Based on my results from this question I decided to build myself a 3D noise map containing float values in place of my existing boolean point values. The effect I'm trying to produce is something like this, rather than typical rolling hills; which should explain the "missing cubes" in the image below.

If I render my density map in normal "minecraft mode" (1 block per point in the density map) varying the size of the cube based on the value in my density map (floats in the range 0 to 1) I get something like this:

voxel point cloud data

I'm now happy that I can produce a density map for the marching cubes algorithm (which will need a little tweaking) but for some reason when I run it through my implementation it's not producing what I expect.

My problem is that I'm getting something like the first image in this answer to my previous question, when I want to achieve the effect in the second image.

Upon further investigation I can't see how marching cubes does the "move vertex along the edge" type logic (i.e. the difference between the two images on my previous link). I see that it does do some interpolation, but I'm not convinced I have the correct understanding of what I think it should do, because the code in question appears to give the same result regardless of whether I use boolean or float values.

I took the code from here which is a C# implementation of marching cubes, but instead of using the MarchingCubesPrimitive I modified it to accept an object of type IDrawable, containing lists for the various collections (vertices, normals, UVs, indices), the logic was otherwise untouched.

My understanding is that given a very low isovalue the accuracy level of the surface being rendered should increase, so in short "less 45 degree slows more rolling hills" type mesh output. However this isn't what I'm seeing.

Have I missed something or is the implementation flawed and need to be fixed?

EDIT:

A little more detail on what I am seeing when I "marching cube" the data.

enter image description here

Ok so firstly, ignore the fact that the meshes created by the chunks don't "connect" (i'll probably raise another question about this later).

Then look at the shaping of the island, it's too ... square, from the voxels rendered as boxes you get the impression there's a clean soft gradual hill and yet from the image there are sharp falling edges even in the most central areas where the gradient in the first image looks the most smooth.

The data is "regenerated" each time I run this so no 2 islands come out the same, and it's purely random so not based on noise, but still, how can it look so smooth in 1 image and so not smooth in the other?

\$\endgroup\$
9
  • \$\begingroup\$ Interpolation starts at line 430. What results are you getting with marching cubes? Your screenshot just looks like you make a cube scaled to the density value at that location. \$\endgroup\$
    – House
    Apr 12, 2013 at 14:04
  • \$\begingroup\$ ok ive added a bit more detail on what I am seeing based on running the same generation algorithm output through marching cubes. Does that help you see what i'm trying to say? small side note: i don't expect the very edges to be smooth as there clearly is a sharp fall off but in the middle it should be a lot smoother. Having said that, part of the problem could be that the meshes aren't linked. \$\endgroup\$
    – War
    Apr 12, 2013 at 17:11
  • 4
    \$\begingroup\$ Maybe clamp down on the randomness factor (specific seed) until you get a solution. Hard to diagnose a sick patient if he's never the same guy. \$\endgroup\$
    – Dialock
    Apr 12, 2013 at 17:16
  • \$\begingroup\$ Actually looks pretty reasonable to me. Other than your missing seams, I think it's good. If you're wanting finer detail you would need to use smaller voxels. \$\endgroup\$
    – House
    Apr 12, 2013 at 17:35
  • \$\begingroup\$ yeh not a bad idea ... the problem is the logic is based on the height map generation by robot frog stuffwithstuff.com/robot-frog/3d/hills/island.html the logic is specifically designed to be completely random (which don't help). i'll seewhat happens when i fix seeds on the random number gens. \$\endgroup\$
    – War
    Apr 12, 2013 at 17:37

1 Answer 1

0
\$\begingroup\$

You're not interpolating the vertices correctly, depending on the density value of two points that should have a vertex placed between them, you should have the vertex placed in such a way that the density value for that point is 0.

I'm doing a piss-poor job of explaining, but here is an really good article:

Nvidia GPU Gems 3 - Chapter 1

\$\endgroup\$
1
  • \$\begingroup\$ Would you care to elaborate? \$\endgroup\$
    – War
    Sep 10, 2013 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .