Generation of SDFGeometry online

A number of primitives have been added.

2D SDFs were also extruded ( “bevelbox”, “prism” ).

Currently available types for SDF primitives:
“sphere”, “ellipsoid”, “torus”, " capsule", “box”, “bevelbox”,
“prism” with edges parameter “n”: 3, 4, 5, 6, 8 ,

Currently available operation types: “union”, “subtraction”

The help has been supplemented accordingly,
see 2025-06-08 14.41.42in the application SDFGeometry.

The center of the primitives can be defined (except capsule, since it is positioned with from to).
All primitives can be rotated using Euler rotation or quaternion.

See original post at the top here.

2 Likes

There are significant extensions to the SDF primitives that can be triangulated. The operation intersection has been added. See original post at the top.

1 Like

Have you iterated the square box edge case?

Technically, is it an SDF if you adjust the algorithm to provide a result? The next clause may be to optimize triangulation to a primitive cube.

I don’t really understand the request, although English is not my native language and the translation tools (especially for technical terms) are not always correct.
Unless I’ve got it completely wrong, that’s what’s being asked:

Re: Have you iterated the square box edge case?

“type”: “boxframe”, “type”: “box”
are nothing special, all primitives are generated with the functions ported from GLSL to PHP or JavaScript as SDF. A slightly modified triangulation algorithm (original according to E. Hartmann, see also other uses: GitHub - hofk/THREEi.js: three.js addon for triangulation of implicit surfaces and for forms with holes. The addon generates indexed BufferGeometries.) is then applied to these SDFs.

Re: Technically, is it an SDF if you adjust the algorithm to provide a result?

The result is not called SDF but SDFGeometry, because it is a geometry according to the rules of three.js.

If you press the “export…” button in the application, you have the geometry definition

/*… indexed BufferGeometry … */

const geometry = new BufferGeometry();
geometry.indices = new Uint32Array( [ 0, 1, 2, 0 …
2490, 2489 ] );
geometry.positions = new Float32Array( [ 0, 0, -0.5, 0, 0, -0.5, 0, 0, -0.5, 0, …
-0.4, -0.2, 0.9 ] );
geometry.setIndex( new BufferAttribute( geometry.indices, 1 ) );
geometry.setAttribute( ‘position’, new BufferAttribute( geometry.positions, 3 ) );
geometry.setAttribute( ‘normal’, new BufferAttribute( geometry.normalss, 3 ) );

and you can load them into your project.

Re: The next clause may be to optimize triangulation to a primitive cube.
I’m not sure what you mean? :thinking:

I have added a corresponding reference to the question in the original post. :slightly_smiling_face:

Sharp edges was another post on the same topic… :razor::lemon: From the context (of a peeled lime with a depression), I presume it suggests: un/bevel, un/blur, end-cap, multiple EPSILONs… being passive ways to provide inquiry to elicit your motive.

I have added the operation blending and the primitives hemisphere, octahedron, pyramid. Examples in the help. More in the future.
See original post above.

4 Likes

There are some new SDFs, see original article and in the help
https://hofk.de/SDFGeometry/Generation_of_SDFGeometry_EN.pdf

Some sharp edges are generated almost perfectly by the algorithm itself under special conditions.


4 Likes

The tetrahedron has been added as a new primitive.

More important is the new operation


“section” “op”, “planes”, “s”

“planes”: [ {“normal”: , “d”: }, … ]
(array of section planes - normal, d must be specified)


which can be used to create new entities from the primitives and from SDFs created with operations.

See original post and https://hofk.de/SDFGeometry/Generation_of_SDFGeometry_EN.pdf

UPDATE:


New primitive polyhedron.

At least 4 planes must be specified.

3 Likes

There is a new primitive
“hollowsphere”

and operations

“elongateX”
“elongateY”
“elongateZ”
“scale”
“repeat”

and

“displace” with the functions
“sinX”, “sinY”, “sinZ”, “sinXY”, “sinXZ”, “sinYZ”, “sinXYZ”, “FBM”, “sinFBM”, “sinRND”

There are examples for all new things in the help.

See original post at the very beginning of the posts here.


An example

{
"Settings": { "tsl": 0.06, "startPoint": { "x": 0, "y": -0.8, "z": -100 }},
"HollowSph": { "type": "hollowsphere", "R": 1.0, "r": 0.9, "h": 1.4 },
"ElongX" : { "type": "elongateX", "op": "HollowSph", "d": 0.6 },
"ElongZ" : { "type": "elongateZ", "op": "ElongX", "d": 0.6 }
}

3 Likes

Further operations are available.

“mirrorXY” “op”
“mirrorXZ” “op”
“mirrorYZ” “op”
“mirrorPlane” “op”, “normal”, “d” (distance)

“distort” “op”, “mode”, “dxyz”, “fxyz” (mode, differences, frequencies)
“mode”: “sin”, “noise”, “vnoise”, “twist”, “pinch”

In order to be able to quickly find an example in the now quite extensive number of primitives and operations, I have given a page number in the help overview. However, due to the links between primitives, there are usually further examples of primitives or operations.

See original post here at the top.


mirror

distort noise

distort twist

3 Likes

See original post here at the top. :face_with_monocle:

There are three new parameters
“points” array of points [ {“h”: , “r”: }, … ] (rotate lines)
“a” factor for SDFs defined with boundary functions
“hollow” for SDFs defined with boundary functions

New primitives defined by boundary functions.
It only works with “balanced” parameter constellations.
Tip: Starting with a working example, make small, targeted changes to individual parameters.
Not all other parameters always work correctly in combination, especially “hollow” with the parameters for center, rotation, and bending.

See the help pdf.

zip file with more json examples https://hofk.de/SDFGeometry/examples.zip
(Link in help)

An example


{ "Settings": { "tsl": 0.04 },
 "RotataLines": { "type": "rotate",  "func": "linescos", "r": 0.5, "a": 0.02,  "f":  9.43, "h": 3.0, "hollow": true, "s": 0.12,
  "points": [
       { "h": 0.0, "r": 0.5 },
       { "h": 0.8, "r": 0.8 },
       { "h": 2.0, "r": 0.4 },
       { "h": 2.8, "r": 1.0 }
       ] },
  "Cyl_1": { "type": "cylinder", "c": {"x":0.0 , "y": 2.55, "z": 0.0}, "rb": 0.3, "rt": 0.3, "h": 1.7, "rotz": 90, "s": 0.12 },
  "Cyl_2": { "type": "cylinder", "c": {"x":0.0 , "y": 2.55, "z": 0.0}, "rb": 0.3, "rt": 0.3, "h": 1.7, "rotx": 90, "s": 0.12 },
  "Union": { "type": "union", "op1": "Cyl_1", "op2": "Cyl_2", "s": 0.12 },
  "OP": { "type": "union", "op1": "RotataLines", "op2": "Union", "s": 0.12}
}
3 Likes

Just one thing more.
Curve instead of lines. "type": "rotate", "func": "curve"


{ "Settings": { "tsl": 0.06 },
  "RotataCurve": { "type": "rotate",  "func": "curve", "r": 0.1, "h": 3.1, "hollow": true, "s": 0.12,
  "points": [
       { "h": 0.2, "r": 0.1 },
       { "h": 0.5, "r": 0.33},
       { "h": 1.1, "r": 1.2 }, 
       { "h": 1.9, "r": 1.3 },
       { "h": 2.6, "r": 2.0 }
       ] }
}

3 Likes