Skip to content

TomaszLloyd/NaiveSurfaceNets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Naive Surface Nets in C#

This is an implementation of Naive Surface nets adapted from S.F. Gibson, "Constrained Elastic Surface Nets". (1998) MERL Tech Report.

I relied on Gibsons paper, the incredibly well documented Mikola Lysenkos implementation and his explanation, as well as considerable help from my friend and colleague Andrew Gotow who also wrote the shader for this visualization.

Please note: This code was written with modularity in mind, separating each task into it's own function. There are a LOT of performance improvements that can be made by not having multiple for loops, however, I wrote this for clarity so that you can better understand the concepts involved.

In this code, I add several child game objects and create a mesh that maintains a certain distance from all of these objects. These objects can have either a box, sphere, or capsule collider. You can also use lines (capsule collider with zero radius) and points (sphere with zero radius). This is just an example but I'm sure you can add your own implementation

We'll start by creating a sample space, then take samples at each voxel in that space based on the sample space size and our resolution,

You can take this a step further and create a different distance for each object. This can be very useful in visualizing electric fields, radiation visualization, etc.

In these screens you can see the mesh after it's rendered. Also, I have Shaded Wireframe turned on so that you can better see the triangulation alt text alt text

Here's a closeup of the triangle mesh. Nice and smooth tessellation. alt text

About

Unity C# Naive Surface Net implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages