Skip to content

Commit 7401164

Browse files
committed
N44: rust-gpu-sdf
1 parent a41b24e commit 7401164

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

content/news/044/index.md

+41
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,47 @@ If needed, a section can be split into subsections with a "------" delimiter.
7676

7777
## Library Updates
7878

79+
### [rust-gpu-sdf]
80+
81+
![3d-distance-field](rust-gpu-sdf.gif)
82+
_An implicit surface defined compositionally, raymarched, and shaded entirely in Rust_
83+
84+
Announcing [rust-gpu-sdf], by [@Shfty]; a `no-std` signed distance field library designed for use across both CPU and GPU.
85+
86+
At time of writing, this library is the primary consumer of [bevy-rust-gpu], and is in a heavy-development pre-release state.
87+
Its main goal is to enumerate the distance field domain to the fullest extent allowed by Rust's type system;
88+
this covers a great many applications, such as collision detection, rendering, mesh generation,
89+
and volume modeling. And, contrary to its working title, is [rust-gpu]-agnostic, so can be used anywhere Rust can!
90+
91+
But what is a distance field? In short, it's a function that defines a shape in terms of its distance from a point.
92+
This can be used as an alternative to traditional meshing approaches in order to achieve perfectly smooth surfaces,
93+
the dynamic morphing depicted above, and many other effects that would traditionally require a powerful modeling package.
94+
95+
On paper, this also makes SDFs a great fit for accelerated rendering via GPU;
96+
a given distance function can be encoded directly in a shading language,
97+
and rendered by evaluating it on a per-fragment basis.
98+
In practice however, this presents a pipeline problem;
99+
distance fields (such as the ones found in [Inigo Quilez' excellent reference](inigo-quilez))
100+
are generally defined in mathematical form, i.e. as a single monolithic function.
101+
102+
Thus, in order to effectively leverage SDFs for CGI, an artist must also be both a competent mathematician
103+
and shader programmer. Even then, organization via abstraction eventually becomes necessary,
104+
which is often limited in shading languages. This is often solved by introducing a preprocessor,
105+
but forks away from the base language, introducing more machinery, specification,
106+
and points of failure to the process.
107+
108+
[rust-gpu] allows us to sidestep this problem, using Rust's language features
109+
to model powerful abstractions that can be compiled directly into SPIR-V.
110+
This is ideal for SDFs, since the algorithms involved can often be decomposed into reusable,
111+
generalizable operators that lend themselves well to functional composition.
112+
[rust-gpu-sdf] aims to do this, and provide a go-to library able to compose complex SDFs for any use-case. Watch this space!
113+
114+
[@Shfty]: https://github.com/Shfty
115+
[rust-gpu-sdf]: https://github.com/bevy-rust-gpu/rust-gpu-sdf
116+
[bevy-rust-gpu]: https://github.com/bevy-rust-gpu
117+
[rust-gpu]: https://github.com/EmbarkStudios/rust-gpu
118+
[inigo-quilez]: https://iquilezles.org/articles/distfunctions/
119+
79120
## Popular Workgroup Issues in Github
80121

81122
<!-- Up to 10 links to interesting issues -->

content/news/044/rust-gpu-sdf.gif

17.7 MB
Loading

0 commit comments

Comments
 (0)