GPU 3D signed distance field generator, written with DirectX 11 compute shader
git clone --recursive https://github.com/AirGuanZ/SDFGenerator.git
cd SDFGenerator
mkdir build
cd build
cmake ..
OPTION(D3D11SDF_BUILD_SAMPLE "build SDF sample" ON)
OPTION(D3D11SDF_BUILD_CLI "build SDF cli tool" ON)
./SDF-CLI.exe -i "./mesh.obj" -o "./output.txt" -r 128,128,128 -q 16 -s -50,-50,-50 -l 50,50,50 -g true
-i
Input mesh filename (.obj, .stl, .ply)-o
Output text filename-s
Min point in SDF bounding box. format:x,y,z
, or a single floating point value specifying all of them-l
Max point in SDF bounding box. format:x,y,z
, or a single floating point value specifying all of them-g
(Optional) Use gpu or not. default value istrue
-r
(Optional) SDF resolution. format:width,height,depth
, or a single integer specifying all of them. default value is64
-q
(Optional) Quality. number of rays for determining value sign. default value is12
SDF-CLI writes generated values into a text file, using the following pseudocode:
file.write(width) file.write(" ")
file.write(height) file.write(" ")
file.write(depth) file.write(" ")
for z in [0, depth):
for y in [0, height):
for x in [0, width):
file.write(SDF[x][y][z])
file.write(" ")
A demo program using ray marching to visualize generated SDF.