• Stars
    star
    154
  • Rank 240,988 (Top 5 %)
  • Language ShaderLab
  • License
    BSD 3-Clause "New...
  • Created over 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Unity tool to generate signed distance field volumes (as Texture3D assets) from meshes.

sdf-generator

A Unity tool to generate signed distance field volumes (as Texture3D assets) from meshes.

demo

How To Install

The sdf-generator package uses the scoped registry feature to import dependent packages. Please add the following sections to the package manifest file (Packages/manifest.json).

To the scopedRegistries section:

{
  "name": "DSS",
  "url": "https://registry.npmjs.com",
  "scopes": [ "com.dss" ]
}

To the dependencies section:

"com.dss.sdf-generator": "1.0.2"

After changes, the manifest file should look like below:

{
  "scopedRegistries": [
    {
      "name": "DSS",
      "url": "https://registry.npmjs.com",
      "scopes": [ "com.dss" ]
    }
  ],
  "dependencies": {
    "com.dss.sdf-generator": "1.0.2",
    ...

To Use

In Editor

  1. Select SDF > Generator from the Unity menu bar, the tool window will pop up.
  2. Set the relevant options (described in the next section).
  3. Press Create and a save dialog will pop up.
  4. Choose a location and name to save your SDF to.

Through a Script

// create a new generator instance
DSS.SDF.Generator generator = new DSS.SDF.Generator();

// set the relevant options (described in the next section)
generator.Mesh = someMeshInstance;
generator.Resolution = 32;
// ...etc...

// generate the Texture3D
// note: this can take a long time, so definitely don't do it each frame
// and probably only do it once when the application first starts
Texture3D sdf = generator.Generate();

Options

Mesh: the mesh you want to generate an SDF from.

Resolution: the resulting Texture3D resolution (I recommend that you keep this below 64).

Submesh Index: for multi-part meshes, the index of the sub-mesh you want to use.

Padding: the padding to surround your mesh within the SDF (only set this to be non-zero if you see artifacts).

More Repositories

1

unity-stylized-water

A stylized water shader (and material presets) for Unity.
ShaderLab
771
star
2

unity-stylized-sky

A stylized sky shader (and material presets) for Unity.
C#
95
star
3

unity-stylized-sand

A stylized sand shader (and material presets) for Unity.
ShaderLab
58
star
4

unity-image-effects

A collection of image effects for Unity.
C#
57
star
5

unity-cloth-simulation

A mass-spring-damper based real-time cloth simulation I wrote for a class project.
C#
50
star
6

atmosphere

A tool to precompute atmospheric scattering tables for real-time dynamic atmosphere rendering.
C++
40
star
7

unity-flocking

CPU and GPU implementations of Craig Reynold's boids in Unity.
C#
36
star
8

unity-fluid-simulation

A fluid simulation I made for a class assignment, based on work by Jos Stam.
C#
36
star
9

unity-particle-system

A GPU accelerated particle system I made for a class assignment.
C#
17
star
10

unity-core-utils

A collection of common Unity scripts and extensions I've found myself continually rewriting.
ShaderLab
12
star
11

unity-font-presets

A system to keep TextMeshPro styles consistent throughout a project.
ShaderLab
12
star
12

webxr-ik-avatar

An IK avatar controller for WebXR and BabylonJS.
TypeScript
9
star
13

unity-first-person-controller

A simple and extensible first person controller.
ShaderLab
6
star
14

unity-google-fonts-importer

A Google Fonts importer for Unity.
ShaderLab
6
star
15

unity-caching

An image, text, and audio caching system for Unity.
C#
6
star
16

unity-color-palettes

A system to keep UnityEngine.Graphic colors consistent throughout a project.
ShaderLab
3
star
17

unity-logging

A screen logging system for unity.
ShaderLab
2
star
18

TinyPaint

A lightweight painting and image editing application for Unix, written in C.
C
1
star
19

unity-stylized-materials

1
star
20

TinyChat

A lightweight chat server and client, written in C.
C
1
star