Skip to content

OniDaito/SDeeEff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDeeEff - A PyTorch SDF learner

A set of Python PyTorch programs to create a Signed Distance Field (SDF), for use with a raymarching GLSL shader.

A neural network - Siren - is trained on a particular .obj mesh file. This object is repeatedly sampled by the program, using the mesh-to-sdf library. Points in the space are sampled with this library, returning the distance to the object's surface. The network learns the distance from the sampled point, until all we need is the network weights to estimate our SDF.

The weights are then exported as text, which can be pasted into the sdf.glsl file included. Or, if you prefer, one can use ShaderToy or PoshBrolly to view the SDF.

The majority of this work is based on the work of Blackle Mori.

Based on the following:

This repository is mostly just a rehash of the excellent work done by Blackle.

Requirements and setup

I use the virtualenv model to setup all the requirements.

python -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt

The main libraries are PyTorch and mesh-to-sdf.

Running

To train, go with:

python train.py --obj <path to object file> 

The current_fragment.glsl will contain the final network and a shader to visualise it.

There are a number of options you can take a look at, at the bottom of the train.py script. I've found the defaults seem to work best.

About

A SIREN-based neural network representation of a signed, distance field.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors