👾 Dynamic Pixelation 3D

In my game VIBE_WEAVERS, I implemented a dynamic pixelation visual style: the closer you are, the larger the pixels, while the background pixels always remain size 2.
I created a “depth ladder” where each band corresponds to a fixed pixel size.

if (closestDepth < 0.05) {
                                dynamicPixelSize = 6.0;
                            } else if (closestDepth < 0.1) {
                                dynamicPixelSize = 5.0;
                            } else if (closestDepth < 0.15) {
                                dynamicPixelSize = 4.0;
                            } else if (closestDepth < 0.2) {
                                dynamicPixelSize = 3.0;
                            } else {
                                dynamicPixelSize = 2.0;
                            }

The effect is quite fun, and the artifacts in the transitions are almost imperceptible.
Here’s the encapsulated code for the effect.

Live Demo:

Code:

:robot: Made with AI vibecoding assistance.

4 Likes