HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
fogleman
sdf
Python2021–2025
fogleman / sdf

sdf

Simple SDF mesh generation in Python

11Distinct people
16Mentions
0Explicit recommenders
2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Simple SDF mesh generation in Python

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year16 dated mentions

Observed mentions: 2021-02-15 14:06:46 UTC to 2025-12-20 21:45:39 UTC.

02462021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC615
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC413
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC523

What Hacker News says

16 sources
It is kinda neat, but OpenSCAD's limitations are the main thing that motivated me to write this Python library to generate 3D meshes used signed distance functions: https://github.com/fogleman/sdf One big plus to doing it this way is that it's "just" Python and you can use arbitrary logic to help construct your model. You can even load an existing 3D mesh and operate on it as an SDF. Great for hollowing, chopping, eroding/dilating, etc. existing models. I should probably do more with this project. I think there's a lot of interest in this space.
In OpenSCAD is kinda neat
Mostly speed, I'm mostly doing large boolean unions of primitives or chain hulls and OpenSCAD chugs pretty good at large numbers of operations. Don't get me wrong, they're great tools for what they're good at. I need to do more research before I start a port, SDFs seem like the best option but I'm not 100% confident. I am considering using your SDF library though (github.com/fogleman/sdf) but need do do some experimenting/benchmarking first.
In Marble Fountain

Show HN: Constructive Solid Geometry with Python in the browser

This is a little hobby/side project i've been working on . Its tool for constructive solid geometry using python which runs in your browser (best viewed on desktop). The gist of it is it runs in your browser(pyodide) you write high level python which generates the corresponding glsl for your objects signed distance function which is then rendered using webgl (raymarching). The objects can then be converted to an STL (marching cubes) and downloaded while SDF's for csg has been done before , https://github.com/fogleman/sdf , it requires you to generate the mesh and view it in a seperate viewer . Here instead i render the sdf with a fragment shader onto a canvas. Python is neat, a lot of people know it or can pick it up fast and i thought its the perfect language for small time 3d printing hobbyist or designers to quickly conjure something u
Read the rest
p. P.S , i'm also looking for a job.
2 points · Open discussion
At the moment you don't. What I'm suggesting is that you could build up a conventional BREP-based datastructure, and than use SDF to "render" it. This gives you a very clear separation between your data structure and your meshing algorithm, and as I understand it a big chunk of those "100 man years" would be in dealing with the meshing algorithm and edge cases in it. I suspect that having a generic meshing algorithm that will always mesh your datastructure with no edge cases would significantly reduce the time needed to implement a CAD kernel. You just need an algorithm that can tell you if a given point is inside or outside of your BREP. All you really need for that is a surface that points at a given direction, and the ability to tell whether a point is under the surface or not. Define your surfaces as BREP, render them using SDF, only
Read the rest
have to write one meshing algorithm. That being said I disagree with your definition for parametric CAD. Mostly the name, I get that you're talking about BREP based CAD. That is one way to do parametric CAD, but CSG can also work, especially if you can do more advanced operations like a filleted difference or union, or blends between two shapes, or other advanced CSG operations. I don't think that CSG-based CAD is inherently worse as long as you've got the ability to do things like fillet/chamfer CSG operations. You probably don't need to do a fillet along an edge if you can do a fillet where you subtract one object from another, something that SDFs can do easily: https://github.com/fogleman/sdf#smooth_difference
In CAD Sketcher, free and open-source project bringing CAD like tools to Blender3d
>these the the central core that understands BREP and implements the geometric operations. I've seen people quote a good modern CAD kernal as a 100 man year project. It's probably not going to happen, maybe there's some avenue for government funding? Alternatively Signed-Distance-Functions are pretty nice. They're not BREP, but they're a lot easier to implement, and it might be possible to shove them into a BREP-shaped hole. Here's a signed-distance-function based CAD kernal written in a few thousand lines of python+numpy, that seems to be about as fast as openscad. Maybe faster. https://github.com/fogleman/sdf
In CAD Sketcher, free and open-source project bringing CAD like tools to Blender3d
Excellent. You might be interested in a Python library that I wrote for generating 3D meshes (STL files) from SDFs : https://github.com/fogleman/sdf It just uses marching cubes for triangulation but the SDFs are all numpy'd and the SDF is evaluated in batches on multiple threads so it's relatively fast. I wrote it because I was a little frustrated with OpenSCAD. SDFs make it trivial to do things like rounded corners, for example.
In Signed distance functions in 46 lines of Python
Just a quick diff between your list and mine, apologies if I missed them or if there is a reason to exclude these: - https://github.com/nickc92/ViewSCAD - Matt Keeter's stuff (listed here https://www.mattkeeter.com/projects/, including https://github.com/mkeeter/antimony and https://www.mattkeeter.com/projects/ao/, though I see you have libfive) - https://solvespace.com/index.pl - https://mirmik.github.io/zencad/en/ - https://github.com/fogleman/sdf This is from a list entitled "migrate away from OpenSCAD", but somehow I can never manage to do that... Thanks for this site!
In Curated Code CAD (2020)
> Basic things like 'hollow this object out, leaving a 3mm shell' are nearly impossible. Yeah, I think that's a consequence of how they're constructing the objects. But things like signed distance fields make that easier* because it'd just be "expand the SDF by 3mm" - https://github.com/fogleman/sdf has `shell` for this. * if you can wrap your head around the math/geometry, I guess
In Curated Code CAD (2020)
> Which I reckon is me being too used to cli-tools and hardly ever going outside the cli world You might get some mileage out of OpenSCAD if you can define your object parametrically (I used it to make a Switch controller middle-bit.) Or there's stuff like https://github.com/fogleman/sdf which I've used to make resin-printed buttons for my mother. (I also cannot get the hang of Blender despite dipping into it for a couple of weeks every year since about 2013.)
In Guerrilla guide to CNC machining, mold making, and resin casting (2015)

Showing the 15 most recent of 16 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.