Skip to content

Instantly share code, notes, and snippets.

View Wenzy--'s full-sized avatar

Wenzy Wenzy--

  • China
View GitHub Profile
@Wenzy--
Wenzy-- / gist:8520443b107d60ca19b6cfb3e7e2529f
Created February 3, 2020 12:05 — forked from DuncanF/gist:353509dd397ea5f292fa52d1b9b5133d
Unity lockless (no GPU readback) marching cubes via Graphics.DrawProceduralIndirect - some slight faffing because compute shader must append full triangle (3 verts) at a time to render correctly, but this means the appendbuffer count is 3 times smaller than it needs to be, so we have to invoke a very short compute shader (FixupIndirectArgs) just…
MarchingCubesGPU.cs:
...
// DrawProceduralIndirect
ComputeBuffer argsBuffer;
[StructLayout(LayoutKind.Sequential)]
struct DrawCallArgBuffer
{
public const int size =
sizeof(int) +
sizeof(int) +
public class AutoSkin : MonoBehaviour
{
WenzyTailSkin skinEditor;
void Start()
{
}
void Update()