Skip to content

probcomp/UnityMeshSampling

Repository files navigation

MeshSampling

A Unity package for point sampling on meshes with both CPU and GPU backends. It's been tested on Unity 6.1 and is currently compatible with the Built-in Rendering Pipeline.

MeshSampling Demo

Features

  • Sample points from static, dynamic, and skinned meshes
  • Update points based on mesh transform and deformation in runtime
  • Multiple sampling strategies:
    • Triangle-based sampling
    • Vertex-based sampling
    • Bone-based sampling (for skinned meshes)
  • CPU and GPU backends with identical API
  • Shader to render billboards points with occlusion support, points size scaling control, points count demultiplier, and points count scaling based on distance to camera
  • WebGPU compatible

Installation

Option 1: Install via Git URL

In your Unity project, open the Package Manager (Window > Package Management > Package Manager), click the "+" button, and select "Add package from git URL...". Enter:

[email protected]:probcomp/UnityMeshSampling.git

Option 2: Add to manifest.json

Add the following line to your manifest.json file in your project's Packages folder:

{
    "dependencies": {
        "com.probcomp.meshsampling": "[email protected]:probcomp/UnityMeshSampling.git"
    }
}

WebGPU Support

This package has been tested with Unity's experimental WebGPU integration on version 6000.1.0b10. It has been verified on a MacBook with an M3 Max and tested with builds targeting WebGPU on Chrome Version 134.0.6998.89 (arm64).

To set up WebGPU in your Unity project, follow the instructions here: https://discussions.unity.com/t/early-access-to-the-new-webgpu-backend/933493

Quick Start

The package includes sample scenes demonstrating:

  • Static and dynamic rigid mesh sampling
  • Skinned mesh sampling
  • Basic CPU sampling
  • GPU sampling with visualization

Import samples through the Package Manager by selecting the package, going to the "Samples" tab, and clicking "Import".

Sample Import

CPU Sample Preview:

CPUSampling Demo

GPU Sample Preview:

GPUSampling Demo

Changelog

For history of changes, see CHANGELOG.md.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published