Skip to content

ultrahamlet/cnvSDF2

Repository files navigation

cnvSDF2.py

cnvSDF2.py 'rotation bug fixed 21/05/24'


jitech's "SDF Editor" https://joetech.itch.io/sdf-editor
is a very good tool for modeling SDF primitives.
But there are still few functions.

"cnvSDF2.py" convert SDF Editor's json file to GLSL or Shadertoy code.

"cnvSDF2" handle hierarchical structure of rotation and translation of "SDF Editor".
(Although not confirmed by a complete test.)
Right now, "cnvSDF2" handle only ellipsoid and cube, but soon
there will be a version that can handle other SDF models, or you can extend it by yourelf.

STEPS

step1: Modeling SDF model with "SDF Editor" and output "sample.json"
As you see image below, you just copy and paste "float sdf(vec3 p0){ .... }.

python convSDF2.py this will read "sample.json"

step2: Copy and paste output of above to head of "viewSDF2.frag".

step3: Copy and replace float "sdf(vec3 p0){...} of "vewSDF2.frag".

alt text

alt text

Showing with shadertoy code, "viewSDF2.frag" .

alt text

in terms of "viewSDF2.frag" I uploaded a version that turns the rotor.

https://www.shadertoy.com/view/NtXGRH

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published