Displaying a Voxel-Based World Pixel-Perfectly, but Experiencing Jitter

Godot Version

4.3

Question

I’m trying to render a voxel-based 3D world in Godot with pixel-perfect accuracy.

I’ve set the camera to a 45° downward angle and switched to an orthographic projection. To maintain a consistent ratio for the surfaces on the screen, I applied a Y-scale of sqrt(2.0) to the screen.

However, the result isn’t perfect—some lines appear misaligned.

How can I fix this issue?

Video: https://cdn.discordapp.com/attachments/137811595609899010/1334068045420826647/Pixel3D_DEBUG_2025-01-29_16-41-23.mp4?ex=679b2f2f&is=6799ddaf&hm=ab0a349da954d31d9962eb1a03860cb22a9fb50f03e35ea5b7ade8a0b3e8dd01&
Sample Project: https://cdn.discordapp.com/attachments/137811595609899010/1334068455850250281/pixel3d.zip?ex=679b2f91&is=6799de11&hm=1ddcbe51896305c2c11894f14fa78a8724dd601a5d280f1b25595d16e430ee82&

I bet your z motion is not quantized to the pixel step. Maybe your y scaling is effecting the movement requirments.

Why pick an irrational number for the scale when computers have finite resolution in floating point numbers?

It already has rounded camera position.

Why pick an irrational number?
Because this one need it.

And get rid of your scale


It doesn’t help.
And I cannot use stretch option for other some reason.

to make it sable you need to move the z axis by sqrt of 2

I played around some more. The most important thing is the camera z movement. To get better pixels from the scene, just move the mesh around around so it sits better with the quantized camera.

Almost solved.
The key was using TextureRect instead of SubViewportContainer.
And I made the size of the SubViewport 8 times larger than the canvas. (2560x1018 in this case)
And I could achieve almost pixel-perfect by scaling down with TextureRect at nearest.