├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Cedric Guillemet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Signed Distance Field (SDF) 2 | 3 | Resources, links, papers, discussions, ShaderToys on SDF and related algorithm. 4 | Please contibute to this resource by sending your PRs! 5 | 6 | ## Tutorials / introductions 7 | 8 | Jamie Wong, Ray Marching and Signed Distance Functions 9 | http://jamie-wong.com/2016/07/15/ray-marching-signed-distance-functions/ 10 | 11 | Alex Benton, Ray Marching and Signed Distance Fields 12 | http://bentonian.com/Lectures/FGraphics1819/1.%20Ray%20Marching%20and%20Signed%20Distance%20Fields.pdf 13 | 14 | Sungiant, Sphere tracing signed distance functions (Scala) 15 | https://github.com/sungiant/sdf 16 | 17 | Rendering Worlds with Two Triangles / with raytracing on the GPU in 4096 bytes 18 | https://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf 19 | 20 | Raymarching Beginners' Thread 21 | https://www.pouet.net/topic.php?which=7920&page=1 22 | 23 | Potatro, RayMarching and DistanceFields : a story of SphereTracing 24 | https://xoofx.com/blog/2009/10/12/potatro-and-raymarching-story-of/ 25 | 26 | Ray Marching for Dummies! 27 | https://www.youtube.com/watch?v=PGtv-dBi2wE 28 | 29 | Electric Square, Raymarching Workshop 30 | https://github.com/electricsquare/raymarching-workshop 31 | 32 | 2D Distance fields with Unity and Unreal 33 | https://joyrok.com/SDFs-Part-Two 34 | 35 | SDF Decomposition 36 | http://zone.dog/braindump/sdf_clustering/ 37 | 38 | The smallest WebGL SDF raymarcher (135 bytes), with detailed source code and useful links 39 | https://xem.github.io/articles/webgl_quest_2.html 40 | 41 | SDF Generator using Compute Shaders in Unity 42 | https://mateigiurgiu.com/unity-sdf-generator-part-1/ 43 | https://mateigiurgiu.com/unity-sdf-generator-part-2/ 44 | 45 | An Introduction to Raymarching 46 | https://typhomnt.github.io/teaching/ray_tracing/raymarching_intro/ 47 | 48 | Ray Marching Soft Shadows in 2D 49 | https://www.rykap.com/2020/09/23/distance-fields/ 50 | 51 | Ray Marching 52 | https://michaelwalczyk.com/blog-ray-marching.html 53 | 54 | Shape Lens Blur Effect with SDFs and WebGL 55 | https://tympanus.net/codrops/2024/06/12/shape-lens-blur-effect-with-sdfs-and-webgl/ 56 | 57 | ## Games and tools 58 | 59 | ### Dreams 60 | 61 | Alex Evans at Umbra Ignite 2015: Learning From Failure 62 | Dreams tech from early prototypes to cloud point rendering 63 | 64 | https://www.youtube.com/watch?v=u9KNtnCZDMI 65 | 66 | PDF: https://www.mediamolecule.com/blog/article/siggraph_2015 67 | 68 | Dreams: Under the Hood with Alex Evans! 69 | https://www.youtube.com/watch?v=1Gce4l5orts 70 | 71 | Alex Evans (NVIDIA), Optimising for Artist Happiness 72 | https://www.youtube.com/watch?v=eGfX1iWzkh0&t=1273s 73 | 74 | ### MagicaCSG 75 | 76 | Distance field editor with the same UI as MagicaVoxel by Epthtracy 77 | https://ephtracy.github.io/index.html?page=magicacsg 78 | 79 | ### https://slimery.art/ 80 | 81 | SDF editor on the web 82 | https://slimery.art/ 83 | GIF here : https://twitter.com/DaniGatunes/status/1413388975713173506 84 | 85 | ### Distance Field Modeler for Unreal Engine 86 | 87 | https://twitter.com/SDFmodelerUE4 88 | 89 | ### Antimony 90 | CSG (CAD) tool 91 | https://www.mattkeeter.com/projects/antimony/3/ 92 | https://github.com/mkeeter/antimony 93 | 94 | ### Clayxels 95 | 96 | Clayxels is the volumetric toolkit for Unity 97 | https://assetstore.unity.com/packages/tools/game-toolkits/clayxels-165312 98 | 99 | ### unbound.io 100 | Collaborative SDF editing 101 | https://www.unbound.io/ 102 | https://twitter.com/unbound_io 103 | https://on-demand.gputechconf.com/gtc/2017/presentation/s7777-florian-hoenig-a-road-to-3d-for-everyone.pdf 104 | 105 | ### Claybook 106 | "Claybook is a unique world made entirely of clay. Shape your character and the world around you to overcome challenging obstacles." 107 | https://store.steampowered.com/app/661920/Claybook/ 108 | 109 | ### Signed 110 | Signed is a Lua based 3D modeling and construction language and will be a unique way to create 3D content, objects as well as whole scenes, in high detail. 111 | https://github.com/markusmoenig/Signed 112 | 113 | ### SDF pathtracer on CPU 114 | Pathtracer written on CPU which is capable of rendering both SDF as functions and as a volume grids. The application is written on top of Yocto/GL library. 115 | https://github.com/edu-rinaldi/Volumetric-Path-Tracer 116 | 117 | ## Demos 118 | 119 | Bounding Volume Hierarchy (BVH) implementation for SDFs to reduce per ray distance measurements 120 | https://youtu.be/2T2FqvtXqLw 121 | 122 | SDF / Ray Marching Prototypes. A collection of SDF related examples using fungi to handle the rendering. 123 | https://sketchpunk.bitbucket.io/ 124 | 125 | ## Algorithms / Papers 126 | 127 | Iq distance functions 128 | https://iquilezles.untergrund.net/www/articles/distfunctions/distfunctions.htm 129 | 130 | Jon Baker, The Distance Estimator Compendium (many distance distance functions with awesome Fractal primitives) 131 | https://jbaker.graphics/writings/DEC.html 132 | 133 | Max Norm ellipsoid (sphere with transforms) 134 | https://www.shadertoy.com/view/Mt2XWG 135 | 136 | Efficient Max-Norm Distance Computation and Reliable Voxelization PDF 137 | http://gamma.cs.unc.edu/RECONS/maxnorm.pdf 138 | 139 | Distance to Quadratic Bezier 140 | https://twitter.com/jbaker_graphics/status/1415767199382396940 141 | 3D: https://www.shadertoy.com/view/7dfGD2 142 | 143 | GPU-Driven Rendering Pipelines / Cluster rendering 144 | https://advances.realtimerendering.com/s2015/aaltonenhaar_siggraph2015_combined_final_footer_220dpi.pdf 145 | 146 | Making Signed Distance Field Textures With Jump Flooding Algorithm (2D) 147 | https://blog.demofox.org/2016/02/29/fast-voronoi-diagrams-and-distance-dield-textures-on-the-gpu-with-the-jump-flooding-algorithm/ 148 | https://blog.demofox.org/2016/03/02/actually-making-signed-distance-field-textures-with-jfa/ 149 | 150 | Enhanced Sphere Tracing 151 | https://erleuchtet.org/~cupe/permanent/enhanced_sphere_tracing.pdf 152 | 153 | Collection of smooth minimums, maximums, ramps, and absolutes. 154 | https://www.shadertoy.com/view/ltf3W2 155 | 156 | Segment Tracing Using Local Lipschitz Bounds (improve the marching step computation and accelerate the overall process.) 157 | https://diglib.eg.org/handle/10.1111/cgf13951 158 | 159 | Improved Alpha-Tested Magnification for Vector Textures and Special Effects (Valve 2007) 160 | https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf 161 | 162 | Massively Parallel Rendering of Complex Closed-Form Implicit Surfaces 163 | https://www.mattkeeter.com/research/mpr/ 164 | 165 | Tom Duff, Interval Arithmetic and Recursive Subdivision for Implicit Functions and Constructive Solid Geometry 166 | http://fab.cba.mit.edu/classes/S62.12/docs/Duff_interval_CSG.pdf 167 | 168 | Raph Levien’s research on 2D blurred shapes 169 | https://raphlinus.github.io/graphics/2020/04/21/blurred-rounded-rects.html 170 | 171 | Interval Raymarching 172 | https://dercuano.github.io/notes/interval-raymarching.html 173 | 174 | GigaVoxels:A Voxel-Based Rendering Pipeline For Efficient Exploration Of Large And Detailed Scenes 175 | http://maverick.inria.fr/Membres/Cyril.Crassin/thesis/CCrassinThesis_EN_Web.pdf 176 | 177 | Adaptively Sampled Distance Fields: A General Representation of Shape for Computer Graphics 178 | _ *Frisken, Perry, Rockwood, and Jones - 2000* 179 | https://www.merl.com/publications/docs/TR2000-15.pdf 180 | 181 | Kizamu: A System for Sculpting Digital Characters - *Frisken and Perry - 2001* 182 | https://dl.acm.org/doi/abs/10.1145/383259.383264 183 | 184 | Hierarchical hp-Adaptive Signed Distance Fields - *Koschier, Deul, and Bender - 2016* 185 | http://interactive-graphics.de/index.php/research/98-hierarchical-hp-adaptive-signed-distance-fields 186 | 187 | GPU-Accelerated Adaptively Sampled Distance Fields - *Bastos and Celes - 2008* 188 | https://www.researchgate.net/profile/Waldemar-Celes/publication/4344580_GPU-accelerated_Adaptively_Sampled_Distance_Fields/links/00b7d522f51ab59cc9000000/GPU-accelerated-Adaptively-Sampled-Distance-Fields.pdf 189 | 190 | Signed Distance Computation using the Angle Weighted Pseudo-normal - *Bærentzen and Aanæs - 2005* 191 | http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.107.9173&rep=rep1&type=pdf 192 | 193 | Fast Winding Numbers for Soups and Clouds - *Barill, Dickson, Schmidt, Levin, and Jacobson - 2018* 194 | https://www.dgp.toronto.edu/projects/fast-winding-numbers/ 195 | 196 | Non-linear Sphere Tracing for Rendering Deformed Signed Distance Fields - *Seyb, Jacobson, Nowrouzezahrai, and Jarosz - 2019* 197 | https://cs.dartmouth.edu/~wjarosz/publications/seyb19nonlinear.html 198 | 199 | Concurrent Binary Trees (with application to longest edge bisection) 200 | https://onrendering.com/data/papers/cbt/ConcurrentBinaryTrees.pdf 201 | 202 | Bounding Interval Hierarchies (BIH) - 2006 203 | (for improved per Ray distance calculations) 204 | https://people.cs.clemson.edu/~dhouse/courses/405/papers/bounding-interval-WK06.pdf 205 | 206 | GPU accelerated BIH Construction - 2014 207 | https://www.uni-weimar.de/fileadmin/user/fak/medien/professuren/Virtual_Reality/documents/publications/2014.bih_construction_using_dynamic_parallelism.pdf 208 | 209 | Synchronized-tracing of implicit surfaces - 2023 210 | https://arxiv.org/pdf/2304.09673.pdf 211 | 212 | ## Talks 213 | 214 | Dynamic Bounding Volume Hierarchies 215 | (BVH methods applicable to BIH) 216 | https://box2d.org/files/ErinCatto_DynamicBVH_GDC2019.pdf 217 | 218 | Advanced-Procedural-Rendering-with-DirectX 219 | https://www.gdcvault.com/play/1015726/Advanced-Procedural-Rendering-with-DirectX 220 | 221 | Advanced Graphics Techniques Tutorial: GPU-Based Clay Simulation and Ray-Tracing Tech in 'Claybook' 222 | https://www.gdcvault.com/play/1025030/Advanced-Graphics-Techniques-Tutorial-GPU 223 | https://www.youtube.com/watch?v=Xpf7Ua3UqOA 224 | 225 | Rendering mandelbox fractals faster with cone marching 226 | https://www.youtube.com/watch?v=4Q5sgNCN2Jw&t=530s 227 | http://www.fulcrum-demo.org/wp-content/uploads/2012/04/Cone_Marching_Mandelbox_by_Seven_Fulcrum_LongVersion.pdf 228 | https://www.pouet.net/prod.php?which=59072 229 | 230 | Conemarching in VR / Developing a Fractal experience at 90 FPS / Johannes Saam / Mariano Merchante / FRAMESTORE 231 | https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2018/presentations/Saam_Johannes_Merchante_Mariano_Conemarching%20in%20VR.pdf 232 | https://www.gdcvault.com/play/1025454/Cone-Marching-in-VR-Developing 233 | 234 | Fluid and Particle Physics in PixelJunk Shooter. 2D fluids collision detection with SDF 235 | https://www.gdcvault.com/play/1012447/Go-With-the-Flow-Fluid 236 | 237 | Realtime sparse Distance Fields for game 238 | https://gpuopen.com/gdc-presentations/2023/GDC-2023-Sparse-Distance-Fields-For-Games.pdf 239 | 240 | ## Twitter/Reddit discussions 241 | 242 | BVH with blending 243 | https://twitter.com/TheKristofLovas/status/1415000116629495808 244 | 245 | fBM style displacement Inigo quilez @iquilezles 246 | https://twitter.com/iquilezles/status/1414738043118899200 247 | https://iquilezles.org/www/articles/fbmsdf/fbmsdf.htm 248 | 249 | How is SDF stored in a octree? 250 | https://www.reddit.com/r/VoxelGameDev/comments/ontjdf/how_is_sdf_stored_in_a_octree/h5vrbea/ 251 | 252 | Using @SebAaltonen's eikonal solver (https://shadertoy.com/view/ltGGRw) to fix interior/exterior of SDF after add/cut. 253 | https://twitter.com/Calneon/status/1422316033071882243 254 | 255 | Casey Muratori's helpful notes for Implicit Surfaces and Interval Arithmetic 256 | https://hastebin.com/raw/orenawiwum 257 | 258 | "my best idea right now is to start in the middle of the ray/bounds intersection, and add new samples at the half way point of every unknown segment of the ray until you find a hit with no unknown space preceding it" 259 | https://twitter.com/ladyaeva/status/1201770482766364672 260 | 261 | "the idea here is that you start at the graph leaves and work your way down to the graph root. leaves emit geometry for basic shapes. operators modify the mesh data, and so on." 262 | https://twitter.com/ladyaeva/status/1410120245621239808 263 | 264 | ## Code 265 | 266 | hg_sdf A glsl library for building signed distance functions by Mercury 267 | https://mercury.sexy/hg_sdf/ 268 | 269 | Rust & Vulkan test projects. "The first test project renders 1 million cubes, each containing a 950 MB (uncompressed) distance field volume. 270 | The second test project is going to be using sparse octree storing a hierarchy of distance field volume bricks." 271 | https://github.com/sebbbi/rust_test 272 | 273 | libfive is a software library and set of tools for solid modeling, especially suited for parametric and procedural design. 274 | https://libfive.com/ 275 | 276 | ## Conversion to Polygonal Mesh 277 | 278 | isosurface: A project testing and comparing various algorithms for creating isosurfaces 279 | https://github.com/Lin20/isosurface 280 | 281 | Manifold Dual Contouring - *Schaefer, Ju, and Warren - 2007* 282 | http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.75.9707&rep=rep1&type=pdf 283 | 284 | Dual Contouring Tutorial 285 | https://www.boristhebrave.com/2018/04/15/dual-contouring-tutorial/ 286 | --------------------------------------------------------------------------------