Piston Developers 🍿🥤🐸
pistondeveloper.bsky.social
Piston Developers 🍿🥤🐸
@pistondeveloper.bsky.social
A modular game engine written in Rust https://piston.rs
Research branch: https://advancedresearch.github.io

Discord (Piston): https://discord.gg/TkDnS9x
Discord (AdvancedResearch): https://discord.gg/JkrhJJRBR2
I've figured out a way to improve run-length compression on masks in Turbine-Process3D over 10x faster using pre-masks:

Compression: 21.360625982284546 sec (79.224%)
Avg per tile: 0.008900260825951894 sec

Compression: 1.4767029285430908 sec (21.383%)
Avg per tile: 0.0006152928868929545 sec
November 25, 2025 at 1:26 PM
Today I made a new goblet Dyon script, and I added support for snow in my planet generator (in voxels).
November 24, 2025 at 9:51 PM
Here's the Dyon code:
November 24, 2025 at 4:25 PM
This is a pyramid with semi-transparent voxels in chess pattern, 200x200 (40 000 voxels):

It took just a few seconds to run the Dyon script and render.

File size? 469 KB (95 KB compressed).

Memory usage? 56.4 MB.

Turbine-Process3D is amazing. ON THE CPU!
November 24, 2025 at 4:15 PM
Yup, shrinking the Aabb on voxels removes the artifacts:
November 24, 2025 at 11:15 AM
You can now work with volumetric fog for voxels (or closed volumes in general). If two surfaces overlap and share the same color, then you can use an Accumulator that takes a union of the two volumes.

However,be aware that fog-to-fog (two different semi-transparent colors) produces some noise:
November 24, 2025 at 2:04 AM
Finally, the code for TileRgbaSemiFogAcc:
November 23, 2025 at 2:32 PM
Two basic functions to calculate the volumetric fog effect:
November 23, 2025 at 2:27 PM
This a new Acc trait that will be added to Turbine-Process3D for Accumulators, together with FogState, plus a simple tile color accumulator using volumetric fog:
November 23, 2025 at 2:25 PM
Despite this seemingly simple effect, it has a lot of edge cases.

This is the FogState code:
November 23, 2025 at 2:20 PM
Finally, I got an Accumulator working that does seamless transition from opaque to semi-transparent voxels, using a variant of volumetric fog, that retreats to opaque for high alpha values:
November 23, 2025 at 1:55 PM
I've added a new `RayHitAll` to Turbine-Process3D.

I figured out that `RayHit` is too limited when you want to render semi-transparent objects. `RayHitAll` uses a new `IndexFlag` structure that wraps `usize` and `bool` into `i64`.
November 22, 2025 at 8:05 PM
It kind of works:
November 22, 2025 at 6:07 AM
Got semi-transparent objects working:

I use an finite accumulator that sorts colors by depth and calculates the final color. Here, it can only render 64 layers.
November 22, 2025 at 4:07 AM
I'm tempted to add a new method to the `Produce` trait that translates addresses from produced memory to internal memory:
November 21, 2025 at 7:51 PM
I've made it work with Aabb and it reduce memory usage down to 150 MB. Point is next.

I use a simple trait `IntoCubes` to reuse code. Taking advantage of 1-to-1 correspondence between Aabb and Cube.

Finally, I added a `TransformProducer` to transform Aabbs properly.
November 21, 2025 at 6:30 PM
It works! Now, instead of 1 GB memory, it uses 655 MB.
November 21, 2025 at 4:05 PM
Next step: Make a list of Quads produce virtual triangles.

The code is a bit complex, because there is an even and odd case.
November 21, 2025 at 3:26 PM
Finally, I fix `masks`:

Notice that I need to add a `Sync` requirement, because it uses Rayon for multi-threading.
November 21, 2025 at 3:05 PM
I fix `tile_mask` to work with any Producer:
November 21, 2025 at 3:03 PM
Now, since the offset is also in virtual address space, I need to add a parameter and fix the downstream code:
November 21, 2025 at 2:58 PM
When I use `list: Vec<Triangle>`, the Rust compiler isn't able to reduce `&list` to `&[Triangle]`. I can fix this by using `&*list`, however, it's not very ergonomic.

So, I add the following impl:
November 21, 2025 at 2:51 PM
A small change makes it more generic: Implement for [T] instead of &[T].

Next, make triangle_chunk work with any Producer:
November 21, 2025 at 2:46 PM
I can now replace `triangle_chunk` with a one-liner:
November 21, 2025 at 2:26 PM
This trait has a simpler return type for `produce` than `triangle_chunk`, which has both a chunk and an initial mask.

So, I'll add a function to calculate initial mask and implement the trait for `&[T]`:
November 21, 2025 at 2:22 PM