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

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

This project is a work-in-progress editor for designing 3D models using Signed Distance Fields (SDFs). Built with Python, GLSL, ImGui, GLFW, and PyOpenGL, it allows real-time rendering and interaction with SDF primitives.

While the current version is a demo with limited functionality, it serves as a foundation for a more powerful tool. The goal? To simplify 3D modeling by combining primitives into stylized characters or objects – no sculpting required!

I’m happy with the result, but there’s so much more to build!


📌 Screenshots

Screenshot 1 Screenshot 2 Screenshot 2
Screenshot 3 Screenshot 4 Screenshot 2

⚠️ Current Status

This is a late-stage prototype. I'm on the cusp of a major transition: the MVP is progressing well, and Roadmap is nearing completion. Next, I'll move on to building the full product. Once the MVP is complete, I'll immediately focus on promoting the project on social media—and your support can make this launch truly meaningful!

Your feedback and contributions are welcome! Open an issue or submit a PR.


🚀 Features

Real-time SDF rendering (GLSL shaders)

Cycles Additional rendering mode – Realistic Ray Tracing algorithm

Smooth logic operations (substract, intersect, union, etc.)

Multi-primitive composition (spheres, boxes, cones, etc.)

ImGui-based UI for intuitive controls

Save & Load functions (using tkinter)

Export to 3d using scikit-image

Built-in real-time scene code editor in GLSL using Tkinter


🎯 Roadmap

Current Progress

  • 📝 Customization
  • 🧷 UX improvements
  • 🐛 Fix bugs
  • 🔨 Making an GLSL code editor
  • 🌐 Localization - Preparation

Core Functionality (MVP Goals)

  • Free movement of the camera in 3d space
  • Translation operations for primitives – rotation, scale, and position – can be changed in real time in the inspector.
  • Save/Load using JSON
  • Undo/Redo support
  • Export to 3D formats (OBJ)
  • Gizmo-based manipulation (drag, rotate, scale primitives)
  • Write Docs!

User Experience (Future Improvements)

  • Themes
  • Customization
  • Localization (i18n)
  • Performance optimizations

💞 Contributing

Contributions are highly encouraged! Here’s how you can help:

  1. Report bugs → Open an issue.
  2. Suggest features → Share your ideas in Discussions.
  3. Submit code → Fork the repo and create a Pull Request.

Note: This project is a learning experience – expect refactoring and experimentation!


💡 The Story Behind This Project

Inspiration

It all started with this article on SDF-based modeling. The idea of creating stylized 3D characters with just 10-20 primitives was too exciting to ignore!

The Journey

  • Phase 1: Built an MVP using AI tools (ChatGPT, Copilot, Cursor).
  • Phase 2: Hit limitations – free chat limits, code complexity, and bugs.
  • Phase 3: Spent 2 months refactoring, learning, and improving.

AI isn’t a magic solution – it’s a tool. The real work is in understanding and refining the code.

Lessons Learned

AI accelerates prototyping but requires deep debugging.

Refactoring is part of the process – embrace it!

Small steps lead to big results – this is just the beginning.


🔗 Resources


📜 License

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


🙌 Acknowledgments

  • Inigo Quilez for SDF research.
  • AI tools (ChatGPT, Copilot, Cursor) for assistance.
  • Open-source community for inspiration and libraries.

🚀 Ready to Try It?

Download compiled

Compiled executables for windows can be found in releases

NOTE: I don't have the ability to compile a linux app yet.

Clone and run main.py

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

NOTE: To install the imgui package you will need a c++ compiler. My advice is to use mingw – if you only need a compiler for this task. Build Tools will do for this task too, but it weighs more.

Compilation

You have several options for compilation: automatic and manual. Automatic compilation is highly recommended as it will save a lot of time.

Automatic

The automated process is as simple as possible:

  1. Make sure you are in the directory where the project is located.
  2. Run the PowerShell script: ➤ .\build.ps1
  3. Wait for the compilation to complete (the console should display BUILD COMPLETED SUCCESSFULLY!). You now have an executable file in the ReleaseBuild folder.

This method has been tested on Windows.

Manually

  1. First, install pyinstaller.
pip install pyinstaller
  1. Compile into one file
pyinstaller --onefile --name sdfeditor --windowed --add-binary ".venv\Lib\site-packages\glfw\glfw3.dll;." main.py

NOTE: You should make sure that you have a virtual environment named .venv created and glfw installed (it is added to requirements). If there is none or the path is incorrect, specify the correct path to the glfw3.dll file located in the virtual environment in the \Lib\site-packages\glfw folder!

  1. Move the compiled file to a separate folder and drag the shaders folder to this directory. You should get it like this:

root directory
├── gui/fonts
│    └── *.ttf files
│
├── shaders
│    ├── fragment
│    │    ├── cycles.glsl
│    │    └── template.glsl
│    │
│    ├── sdf_library.glsl
│    └── vertex_shader.glsl
│
├── glfw3.dll
└── sdfeditor.exe


Final Thoughts

This project is a testament to experimentation – imperfect, evolving, but full of potential. Whether you’re here to learn, contribute, or build, I’m excited to see where it goes next!

Let’s create something amazing together. 🚀


Support

Your support helps development! Help by leaving a review, reporting an error, suggesting an idea in Discussions, creating a Pull Request, or just star ⭐ the repository!.

Follow me

Dev.toBlue SkyGitHub