/r/dualcontouring

Photograph via snooOG

A Dual Contouring subreddit for discussing the creation, usage, rendering and general question about Dual Contouring algorithms.


When submitting content to this subreddit, you should include content flairs so that other users can see which type of content the post has.

/r/dualcontouring

229 Subscribers

10

Naive Surface Nets on GPU in Unity. All in a single draw call using "meshlet" system.

11 Comments
2024/09/18
00:49 UTC

4

Can the results be improved by knowing the SDF of the isosurface?

3 Comments
2022/06/04
12:32 UTC

3

Terrain

It may be a stupid questions to some but I am totally new to the subject

I do know the very basics of HLSL so far, so I have hard time understanding the syntax of nvidia Gem code. like noiseVol.Sample(TrilinearRepeat, ws).x; I have no idea what code like this does and the worst thing, is that i dont know how to debug it in compilers like visual studio to understand it.

I think I might have implemented dual contouring without an octree, except for a density function,

Now I want to do that, so I want to create Terrain like nvidia's or similar, How to influence a noise function to generate 3D terrain to my liking. a terrain with mountain or flat or sea landscape like nvidias

I converted Ken improved Perlin noise from java to C. and it generated a maze

so where to go from Now

0 Comments
2021/06/06
10:09 UTC

4

How edges works in dual contouring

I dont understand the sign change of it, i tried to read boris tutorial

he said Dual Contouring works by placing a single vertex in each cell, and then “joining the dots” to form the full mesh. Dots are joined across every edge that has a sign change, just like in marching cubes.

https://preview.redd.it/chsvxh3a9e271.png?width=360&format=png&auto=webp&s=df5ca5c12866e3420db9520285d11334c4dc95df

this is clear for 2D but I don't understand the 3D

the 2d and 3d cases aren’t really that different. A cell is now a cube, not a square. And we are outputting faces, not edges. But that’s it. The routine for picking a single point per cell is the same. And we still find edges with a sign change, and then connect the points of adjacent cells, but now that is 4 cells, giving us a 4-sided polygon:

I dont understand the bolded lines!

find edges with sign change ?? then connect point to adjacent cells

lets take this example

lets assume we have a singular point in the center and we have + sign at 0, 1 and the rest are negative

edges with sign change are 3,8,1,9 have different signs

The neighbours are faces not edges, does this means, i should look for faces with sign change?

so can I connect the vertex in this cube with neigbours from the following faces 0347,0123,1256,0154 right,left buttom, and front face?

0 and 1 has positive signs the rest are negative

Edit:

in 2D we don't connect the dot through edges with the same signs. but In 3D to my understanding in 3D edges are faces so..

in the previous example the bottom edge has the same sign in 2D but different sign in 3D so

Can we connect the dots like this using the signs from the previous example, is this correct?

On the left connecting dots in 3D on the right 2D

3D image of connecting dots

9 Comments
2021/05/31
05:59 UTC

10

[WIP] Unity Super Fast Uniform Dual Contouring using Burst + Jobs + Mathematics Library (Runs 32x32x32 chunk in under 3 ms)

3 Comments
2019/05/30
09:14 UTC

3

Mesh generation octree traversal

Hi,

Can someone help me understand how the three functions CellProc, FaceProc and EdgeProc from the Dual Contouring with Hermite Data paper fit together and allow us to retrive the four vertices from a set of nodes surrounding a sign change edge.

I've looked at many diagrams and descriptions of what the functions do and I think I understand them in isolation but I can't visualise how everything fits together. Thanks!

0 Comments
2019/02/27
16:01 UTC

7

Unity - Multithreaded Dual Contouring C++ Plugin

2 Comments
2017/08/25
05:38 UTC

2

Dual Contouring Help

I'm trying to figure out how to generate a planet.

I am using http://weber.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf as the test Simplex code. Currently the code i have separate a grid by height, width, and depth(xyz) by iteration in 2x2 chunks. On the final iteration. It's divided by 2x2.

I currently want to use the Simplex code to get edge signs based on a clamp level.

I checked out adaptive dual contouring, enhanced marching cube, marching cube, adaptive marching cube the last week or so but I'm finding it somewhat complicated. I'm not a math major so I'm not super proficient in algebra II, calculus, or trig.

The only thing I can think of is testing each edge selecting a midpoint detecting if a sign change then drawing a edge to a center point of each cell forming a triangle then maybe something it out based on the average of the edges with sign changes. Then for now calculating the normal by the face triangle (generated). Adding each vertex face to a buffer.

Vivienne

1 Comment
2017/03/08
02:18 UTC

4

[Question]Dual Contouring - Sharp features are lost?

So, I've 'implemented' DC, but it seems that it can precisely reconstruct sharp features only if they are aligned to the grid.

When an implicit cube (SDF) is aligned with coordinate axes or rotated by 45 degrees along one axis, it's contoured perfectly.

But when it's rotated by 45 degrees along one axis, then rotated by 45 degrees along the other, the edges becomes kinda wobbly or jagged. Imgur

If I don't clamp cell vertices to cell bounds, the edges again become perfectly sharp, but the resulting mesh contains overlapping triangles and 'wedges' (not seen on the picture - you have to look from the inside of the mesh). Imgur

Is this problem inherent to DC? How can it be solved? What contouring algorithm should I switch to if precise sharp edges cannot be done with DC?

4 Comments
2016/05/26
18:22 UTC

1

[Question] Any papers on voxel terrain with sharp features?

Hi! I need to implement a voxel terrain with sharp features as part of my studies, but I could only find two published papers ("Real-time rendering of stack-based terrains"[2011] and "Generating smooth high-quality isosurfaces for interactive modeling and visualization of complex terrains"[2012]) that deal with isosurface extraction with sharp feature preservation (using Dual Contouring and Dual Marching Cubes[G.Nielson, 2004]).

Could you please refer me to some publications on polygonizing voxel terrains with sharp features (apart from those two)?

Most works are aimed at rendering smooth voxel terrains, e.g.:

Level of Detail for Real-Time Volumetric Terrain Rendering [2013]

Real-Time Isosurface Extraction With View-Dependent Level of Detail and Applications [2015]

Arches: a Framework for Modeling Complex Terrains [2009]

A hybrid representation for modeling, interactive editing, and real-time visualization of terrains with volumetric features [2014].

1 Comment
2016/05/25
11:58 UTC

3

QEF

Hello!

I'm working on a project in Unity (C#) that would require a smooth terrain. First thing i tried was the Marching cubes algorithm. The terrain was smooth as i wanted it too be but it had a problem with preserving hard edges. This is why i looked in DC. I have reconfigured my code to calculate the Hermite data( if i understand this correctly this are the Density function intersections with the edges of a voxel and the normals at those intersections ).

The problem I'm facing is solving the so called QEF for the feature point of the voxel. I have read about the problem online and found several solutions ( singular value decomposition was the most prominent ) but i have trouble understanding/implementing the method as i have yet to leave high school and matrix operations are not in our high school curriculum.

My question is if there are any already written examples in C# you know of that could help me implement the QEF in Unity.

Thank you for reading this post!

Dmajster

[edit] DC is now sort of working, having some problems with moving the particle, but even the not so accurate terrain is looking quite nice.

http://prntscr.com/aom6kv

[/edit]

10 Comments
2016/04/03
13:51 UTC

9

100% Manifold Dual Contouring Implementation

After months of research and working through various algorithms to get to this point, I've finally done it! Fully working Manifold Dual Contouring! It features surface-independent vertex clustering, multi-vertex cells, and the manifold criterion that enforces simplifications produce only manifold surfaces.

Other noteworthy features that the paper originally notates is their "attractive" feature of extremely quick error-threshold switching. Since vertex clustering works without the error threshold (which is used initially to give quicker polygonization), you only have to re-run the polygonization stage. Manifold criterion can be enabled and disabled in a similar fashion.

The code is currently unoptimized and messy, but it's fully functional and, as far as I can tell, bug-free. This is the ONLY public implementation of this algorithm so it feels really good to get this far.

Source Code

Screenshots and Comparisons

With and Without Manifold Criterion

Chinese Dragon Undergoing Simplification

Regular DC vs Manifold DC

Regular DC vs Manifold DC Teapot

10 Comments
2015/12/24
23:53 UTC

5

Neilson's Dual Marching Cubes Implementation

After finding a table on a Stack Overflow post, I whipped up a rather crude (and somewhat messy) implementation of Neilson's Dual Marching Cubes. To my knowledge, this is the only published straight-foward implementation of the raw algorithm. It's pretty much the same as dual contouring but it allows for up to 4 vertices inside a cell. While it doesn't make much of a difference on uniform grids, it's the key to manifold dual contouring, which results in high-quality simplified meshes.

Thanks to /u/ngildea and his open-source Dual Contouring implementation, I was also able to add a QEF solver so the resulting meshes preserve sharp features. The QEM mode was actually my failed attempt at implementing my own QEF solver. The math goes way over my head.

Some other noteworthy things are my implementation specifically disables indexing to allow for flat-shaded faces, although with some tweaks you can use indexed vertices and smooth shading. Culling is also working.

Source on GitHub

Screenshot

Next up is Manifold Dual Contouring, so keep an eye out for that in the near future. :)

0 Comments
2015/11/09
07:37 UTC

2

Updated the flairs. The tags are no longer necessary.

Just make sure to add a suitable tag.

0 Comments
2015/09/29
19:40 UTC

2

[Question] How do you handle mesh corners?

I'm struggling through my first isosurface implementation using DC, learning as I go and having a bit of an issue with how to generate the mesh itself. If it matters this is not for terrain but hollow objects that will be moving independent of each other. I've not implemented an octree yet either.

I've used a simplified version of the Schmitz "particle" method of generating vertices from hermite data and can loop through and replicate objects art those verts and see my data.

When going back to read about the mesh generation techniques it generally says "when the edge has a sign change create a quad using the neighbouring points, but how does this work for corners or jutting edges? Presumably you have to check in all dimensions? Is there anywhere that goes into this in more depth?

Cheers!

24 Comments
2014/10/27
13:55 UTC

Back To Top