You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update "neural graphics in an afternoon" blog for post-SGL (#170)
Updated links to example code to reflect move to slangpy-samples repository, and updated the code to use the newest SlangPy (after the removal of SGL.)
Copy file name to clipboardExpand all lines: _posts/2025-04-04-neural-gfx-in-an-afternoon.md
+34-30Lines changed: 34 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,33 +48,34 @@ Slang makes this entire process much easier, because it can automatically calcul
48
48
49
49
## The Code
50
50
51
-
Let’s take a look at what it looks like to do this in the code. I’ll first go through a simplified version of the 2D Gaussian splatting example, so it’s very clear how the mechanism works. You can find this example in the SlangPy repository [here](https://github.com/shader-slang/slangpy/tree/main/examples/simplified-splatting). First, we’ll check out the Python side of things. With SlangPy, this code is pretty succinct.
51
+
Let’s take a look at what it looks like to do this in the code. I’ll first go through a simplified version of the 2D Gaussian splatting example, so it’s very clear how the mechanism works. You can find this example in the SlangPy repository [here](https://github.com/shader-slang/slangpy-samples/tree/main/examples/simplified-splatting). First, we’ll check out the Python side of things. With SlangPy, this code is pretty succinct.
52
52
53
53
```python
54
-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
54
+
# SPDX-License-Identifier: Apache-2.0
55
55
56
56
import slangpy as spy
57
-
import sgl
58
57
import pathlib
59
58
import imageio
60
59
import numpy as np
61
60
62
-
# Create an SGL device, which will handle setup and invocation of the Slang
61
+
# Create a device, which will handle setup and invocation of the Slang
63
62
# compiler for us. We give it both the slangpy PATH and the local include
64
63
# PATH so that it can find Slang shader files
65
-
device = sgl.Device(compiler_options={
66
-
"include_paths": [
67
-
spy.SHADER_PATH,
68
-
pathlib.Path(__file__).parent.absolute(),
69
-
],
70
-
})
64
+
device = spy.Device(
65
+
compiler_options={
66
+
"include_paths": [
67
+
spy.SHADER_PATH,
68
+
pathlib.Path(__file__).parent.absolute(),
69
+
],
70
+
}
71
+
)
71
72
72
73
# Load our Slang module -- we'll take a look at this in just a moment
And then finally, we use one last function in our Slang module to render the results of our blobs out to a texture, instead of just keeping them in memory, so that we can visualize the results of the iterations as we go on. We’re doing 10 thousand iterations, though, so looking at every iteration might be overkill, so we’ll only render out every 50th iteration.
0 commit comments