Transform $3D$ grid to dimetric projection

49 Views Asked by At

I'm rendering rhombus textures in a $3D$ world: Rhombus textures

Here are the rhombus textures rendered in a grid in perspective projection with $FOV = 45^\circ$: Rhombus textures rendered as a grid in perspective projection

Here is the same grid scene, but in dimetric orthographic projection, with yaw $= 30^\circ$ and pitch $= 45^\circ$: Square textures rendered as a grid in dimetric orthographic projection

I would like to remove this spacing between the rhombuses in orthographic projection:

Spacing between rhombuses in dimetric projection

And render it like this:

Rhombuses in dimetric projection without spacing

I have tried multiplying both the $X$ and $Z$ coordinates of the grid by $0.695$, which produced this result:

Rhombuses in dimetric projection with grid multiplied by 0.695

It's closer but not correct. How can I transform the $3D$ grid coordinates so that the rhombuses appear contiguous when rendered in dimetric projection?

1

There are 1 best solutions below

0
On

The correct multiplier for dimetric projection is sqrt(2) which is around 1.4142.

The 0.695 multiplier was close (1 / 0.695 = 1.4388) but it doesn't work for a different reason.

The rhombs are facing the camera using cylindrical billboarding, in which the object is facing the camera but cannot rotate upwards:

Cylindrical billboarding showcase

This means that at a narrow angle, objects height will be distorted:

Cylindrical billboarding perspective

Compared to spherical billboarding (object always rotates to face camera plane):

Spherical billboarding perspective

Due to this distortion, the multiplier did not work even though the projection was orthographic. Here's orthographic projection with sqrt(2) multiplier with cylindrical billboarding:

Spherical billboarding orthographic

The same sqrt(2) multiplier with spherical billboarding produces the desired result:

Cylindrical billboarding orthographic