SDF Mesh Library
by
Facepunch
| Summary | Marching cubes & squares mesh generation |
|---|---|
| Description |
About SDF Mesh Library Allows you to define a 2D / 3D field of signed distances to a virtual surface, perform operations with primitive shapes, and then generate a 3D mesh of the surface in real-time. Create a world using Sandbox.Sdf; // ... var sdfWorld = new Sdf2DWorld { // Rotate so that Y is up LocalRotation = Rotation.FromRoll( 90f ) }; In this example we've rotated it by 90 degrees, so that the Y axis when doing 2D operations becomes the Z (up) axis in world space. Draw some shapes Still in server-side code, you can modify the SDF world like this: // Shape that we want to add var circle = new CircleSdf( new Vector2( localPos.x, localPos.y ), radius ); // Load the material to use var material = ResourceLibrary.Get( "layers/sdf2d/checkerboard.sdflayer" ); // Draw the circle! sdfWorld.Add( circle, material ); // Move the circle to the right, then subtract it! sdfWorld.Subtract( circle.Translate( new Vector2( 32f, 0f ) ), baseMat );About SDF Mesh Library
Allows you to define a 2D / 3D field of signed distances to a virtual surface, perform operations with primitive shapes, and then generate a 3D mesh of the surface in real-time.
Create a world
using Sandbox.Sdf;
// ...
var sdfWorld = new Sdf2DWorld
{
// Rotate so that Y is up
LocalRotation = Rotation.FromRoll( 90f )
};
In this example we've rotated it by 90 degrees, so that the Y axis when doing 2D operations becomes the Z (up) axis in world space.
Draw some shapes
Still in server-side code, you can modify the SDF world like this:
// Shape that we want to add
var circle = new CircleSdf( new Vector2( localPos.x, localPos.y ), radius );
// Load the material to use
var material = ResourceLibrary.Get( "layers/sdf2d/checkerboard.sdflayer" );
// Draw the circle!
sdfWorld.Add( circle, material );
// Move the circle to the right, then subtract it!
sdfWorld.Subtract( circle.Translate( new Vector2( 32f, 0f ) ), baseMat );
|
| Votes | 👍25 👎0 ❤️29 |
| Error Rate | 0% |
| Reviews |
3 reviews
66.7% Recommended (2)
33.3% Promise (1)
0% Needs Work (0)
|
| Usage |
6,523 players
16,980 sessions
4,208 hours playtime
15 minutes avg session
Totals captured
|
| Data | {} |
| Version | Created | Size (modified) | Files | Changes |
|---|---|---|---|---|
| 121787 | 503.7 KB (167.3 KB) | 57 ~9 | Changes on 2025-09-30 | |
| 114518 | 499.8 KB (148.9 KB) | 57 +1 ~7 -2 | Changes on 2025-08-18 | |
| 77682 | 814.6 KB (392.5 KB) | 58 ~5 | Changes on 2024-11-19 | |
| 77637 | 814.5 KB (482.4 KB) | 58 ~9 -9 | Changes on 2024-11-19 | |
| 71520 | 1.2 MB (825.6 KB) | 67 ~15 | Changes on 2024-08-31 | |
| 70881 | 1.2 MB (947.5 KB) | 67 +6 ~12 | Changes on 2024-08-28 | |
| 70398 | 1.2 MB (866.5 KB) | 61 +8 ~3 -2 | Changes on 2024-08-27 | |
| 62649 | 704 KB (16.3 KB) | 55 ~1 | Changes on 2024-08-01 | |
| 62647 | 703.9 KB (48.6 KB) | 55 ~3 | Changes on 2024-08-01 | |
| 62629 | 704 KB (55 KB) | 55 ~5 -1 | Changes on 2024-08-01 | |
| 62579 | 703.8 KB (21.9 KB) | 56 ~2 | Changes on 2024-08-01 | |
| 62471 | 703.5 KB (53.8 KB) | 56 ~5 | Changes on 2024-07-31 | |
| 61855 | 700.6 KB (49.6 KB) | 56 ~4 | Changes on 2024-07-29 | |
| 60424 | 698.2 KB (381.1 KB) | 56 +2 ~5 | Changes on 2024-07-16 | |
| 57803 | 356.6 KB (25.9 KB) | 54 ~2 | Changes on 2024-06-03 | |
| 56951 | 356.5 KB (15.3 KB) | 54 ~3 -2 | Changes on 2024-05-15 | |
| 56856 | 697.5 KB (19.6 KB) | 56 ~1 | Changes on 2024-05-13 | |
| 56618 | 697.4 KB (19.5 KB) | 56 ~1 | Changes on 2024-05-10 | |
| 56168 | 697.4 KB (362 KB) | 56 +5 ~6 -1 | Changes on 2024-05-03 | |
| 55862 | 352.6 KB (54.9 KB) | 52 +9 ~1 | Changes on 2024-04-29 | |
| 55833 | 298.5 KB (293.5 KB) | 43 +41 -44 | Changes on 2024-04-29 | |
| 55572 | 300.5 KB | 46 -14 | Changes on 2024-04-24 | |
| 55535 | 357.9 KB (357.9 KB) | 60 +60 -22 | Changes on 2024-04-23 | |
| 43142 | 15.4 MB (943.8 KB) | 22 ~7 | Changes on 2023-11-09 | |
| 42686 | 15.4 MB (283.6 KB) | 22 ~4 | Changes on 2023-10-25 | |
| 38424 | 15.4 MB (949.2 KB) | 22 ~6 | Changes on 2023-09-14 | |
| 35958 | 15.4 MB (235.8 KB) | 22 ~2 | Changes on 2023-08-25 | |
| 35956 | 15.4 MB (1005.4 KB) | 22 ~7 | Changes on 2023-08-25 | |
| 33950 | 15.4 MB (10.5 MB) | 22 +1 ~9 | Changes on 2023-08-17 | |
| 33233 | 15.4 MB (10 MB) | 21 ~7 -1 | Changes on 2023-08-15 | |
| 32907 | 15.4 MB (196 KB) | 22 ~1 | Changes on 2023-08-14 | |
| 32827 | 15.4 MB (948.5 KB) | 22 ~6 | Changes on 2023-08-14 | |
| 30173 | 15.4 MB (198.6 KB) | 22 ~2 | Changes on 2023-08-02 | |
| 30055 | 15.4 MB (198.1 KB) | 22 ~2 | Changes on 2023-08-02 | |
| 29221 | 15.4 MB (323.4 KB) | 22 +1 ~5 | Changes on 2023-07-31 | |
| 23216 | 15.4 MB (10.4 MB) | 21 ~9 | Changes on 2023-07-05 | |
| 21307 | 15.4 MB (189.5 KB) | 21 ~1 | Changes on 2023-07-03 | |
| 20405 | 15.4 MB (189.5 KB) | 21 ~1 | Changes on 2023-06-30 | |
| 20403 | 15.4 MB (9.8 MB) | 21 ~7 -1 | Changes on 2023-06-30 | |
| 20363 | 15.4 MB (9.8 MB) | 22 +1 ~7 | Changes on 2023-06-30 | |
| 20007 | 15.4 MB | 21 ⏳ | Changes on 2023-06-28 | |
| 19994 | 15.4 MB | 21 ⏳ | Changes on 2023-06-28 | |
| 19734 | 15.4 MB | 21 ⏳ | Changes on 2023-06-26 | |
| 19731 | 15.4 MB | 21 ⏳ | Changes on 2023-06-26 | |
| 19165 | 1021.8 KB | 15 ⏳ | Changes on 2023-06-21 | |
| 19164 | 1 MB | 16 ⏳ | Changes on 2023-06-21 | |
| 17951 | 15.4 MB | 18 ⏳ | Changes on 6/3/2023 | |
| 17942 | 15.4 MB | 18 ⏳ | Changes on 6/2/2023 | |
| 17940 | 15.4 MB | 18 ⏳ | Changes on 6/2/2023 | |
| 17581 | 15.1 MB | 17 ⏳ | Changes on 5/19/2023 | |
| 17580 | 15.1 MB | 17 ⏳ | Changes on 5/19/2023 | |
| 17577 | 15.1 MB | 17 ⏳ | Changes on 5/19/2023 | |
| 17542 | 15.1 MB | 17 ⏳ | Changes on 5/17/2023 | |
| 17449 | 15.6 MB | 19 ⏳ | Changes on 5/13/2023 | |
| 17441 | 15.6 MB | 19 ⏳ | Changes on 5/13/2023 | |
| 17425 | 15.6 MB | 19 ⏳ | Changes on 5/12/2023 | |
| 17414 | 15.6 MB | 19 ⏳ | Changes on 5/12/2023 | |
| 17413 | 15.6 MB | 19 ⏳ | Changes on 5/12/2023 | |
| 17412 | 15.6 MB | 19 ⏳ | Changes on 5/12/2023 | |
| 17411 | 15.6 MB | 19 ⏳ | Changes on 5/12/2023 | |
| 17410 | 15.6 MB | 19 ⏳ | Changes on 5/12/2023 | |
| 17381 | 15.6 MB | 19 ⏳ | Changes on 5/11/2023 | |
| 17019 | 2.3 MB | 9 ⏳ | Changes on 4/28/2023 | |
| 16985 | 9.6 KB | 2 ⏳ | Changes on 4/27/2023 | |
| Earlier versions of this package are not tracked. | ||||
Loading history…