Skip to content

This is a project in which I created rendering and full interaction with sdf primitives. Using Python, GLSL, Imgui, glfw, pyopengl.

License

Notifications You must be signed in to change notification settings

EmberNoGlow/SDF-Model-Editor-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

185 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SDF Model Editor (Demo)

A lightweight editor for creating and manipulating Signed Distance Field (SDF) primitives using Python, GLSL, and OpenGL.

Python 3.11 GLSL 330 Imgui 2.0.0 GLFW 2.1.0 MIT License GitHub Issues GitHub Stars



🌟 Overview

SDF Model Editor is an experimental, real‑time tool for designing 3D models using Signed Distance Fields (SDFs). Built with Python, GLSL, ImGui, GLFW, and PyOpenGL, it provides an accessible environment for exploring procedural modeling techniques without the complexity of traditional sculpting workflows.

The current version is a functional demo and a foundation for a more complete editor. The long‑term vision is to make SDF‑based modeling intuitive, playful, and powerful β€” enabling users to build stylized characters and objects from simple primitives.


πŸ“Œ Screenshots

Screenshot 1 Screenshot 2 Screenshot 3
Screenshot 4 Screenshot 5 Screenshot 6

πŸš€ Features

  • Real‑time SDF rendering using GLSL shaders
  • Cycles Additional rendering mode (realistic ray‑tracing algorithm)
  • Smooth boolean operations (union, subtract, intersect, etc.)
  • Multiple primitive types (sphere, box, cone, and more)
  • ImGui‑based UI for intuitive interaction
  • Save & Load scenes (JSON)
  • Export to 3D formats (OBJ via scikit‑image)
  • Built‑in GLSL code editor (Tkinter)
  • Undo/Redo support

🧭 Project Status

This project is in late‑stage prototype development. The MVP is nearing completion, and the next phase will focus on expanding functionality, improving UX, and preparing for a broader public release.

Your feedback, ideas, and contributions can meaningfully shape the direction of the full editor.


🎯 Roadmap

Current Work

  • πŸ“ Customization
  • 🧷 UX improvements
  • πŸ› Bug fixes
  • πŸ”¨ GLSL code editor
  • 🌐 Localization groundwork

MVP Goals

  • Free camera movement
  • Real‑time transform controls (position, rotation, scale)
  • Save/Load (JSON)
  • Undo/Redo
  • OBJ export
  • Gizmo‑based manipulation
  • Documentation

Future Improvements

  • Themes
  • Full customization
  • Localization (i18n)
  • Performance optimizations

πŸ’ž Contributing

Contributions are warmly welcomed β€” whether you're fixing bugs, proposing features, or exploring SDFs for the first time.

You can help by:

  1. Reporting issues β†’ Issues
  2. Suggesting features β†’ Discussions
  3. Submitting code β†’ Pull Requests
  4. Reaching out directly β†’ DM on Bluesky

πŸ›  Installation

Download (Windows)

Pre‑built executables are available in Releases

Linux builds are not yet supported.


Run from Source

git clone https://github.com/EmberNoGlow/SDF-Model-Editor-Demo.git
cd SDF-Model-Editor-Demo
python -m venv .venv
.venv/Scripts/Activate.ps1
pip install -r requirements.txt
python main.py

Installing imgui requires a C++ compiler.
Recommended: mingw or Visual Studio Build Tools.


πŸ— Compilation

Automatic (Recommended)

  1. Navigate to the project directory
  2. Run:
    .\build.ps1
    
  3. After message "BUILD COMPLETED SUCCESSFULLY!", the executable will appear in ReleaseBuild folder.

Manual

  1. Install PyInstaller
    pip install pyinstaller
  2. Build
    pyinstaller --onedir --name sdfeditor --windowed main.py
  3. Move the executable and required folders (shaders, fonts, glfw3.dll) into a single directory:

root directory
β”œβ”€β”€ assets/fonts
β”‚    └── *.ttf files
β”‚
β”œβ”€β”€ shaders
β”‚    β”œβ”€β”€ fragment
β”‚    β”‚    β”œβ”€β”€ cycles.glsl
β”‚    β”‚    └── template.glsl
β”‚    β”‚
β”‚    β”œβ”€β”€ sdf_library.glsl
β”‚    └── vertex_shader.glsl
β”‚
β”œβ”€β”€ glfw3.dll
└── sdfeditor.exe


πŸ’‘ Inspiration & Background

This project began after exploring Inigo Quilez’s work on SDFs, especially the article on smooth minimum functions. The idea of building expressive 3D characters from just 10–20 primitives was too compelling to ignore.

Development Journey

  • Phase 1: Rapid prototyping with AI tools.
  • Phase 2: Hitting limitations β€” complexity, bugs, and tool constraints.
  • Phase 3: Two months of refactoring, learning, and rebuilding.

Lessons Learned

  • AI accelerates prototyping, but understanding the code matters.
  • Refactoring is not a setback β€” it’s part of the craft.
  • Small, consistent progress leads to real breakthroughs.

πŸ”— Resources


πŸ“œ License

This project is licensed under the MIT License – see LICENSE for details.


πŸ™Œ Acknowledgments

  • Inigo Quilez for best articles about math, sdf, computer graphics, etc.
  • AI tools (ChatGPT, Copilot, Cursor) for assistance.
  • Open-source community for inspiration and libraries.

πŸš€ Final Thoughts

This project is an evolving experiment β€” imperfect, ambitious, and full of potential. Whether you're here to learn, contribute, or build something new, I’m excited to see where this journey leads.

Let’s create something amazing.


⭐ Support the Project

You can help by:

  • Starring the repo
  • Reporting bugs
  • Suggesting ideas
  • Sharing the project

Every bit of support helps the editor grow.

Follow me

Dev.toBlue SkyGitHub