8-bitButterfly
8-bitButterfly

Reputation: 203

Translation is inaccurate n orthogonal view

enter image description here

Attached to this posting is an image displayed by OpenGl. The image is displaying (in orthogonal view) some white cubes made from polygons (each cube is made by two triangles).

The alike cubes are instanced and thus share an original copy of the mesh, individual positioning (xy axes) is applied to each instance, giving me the cubes as in the image. In addition, the positioning data is of type float and rounded at two decimal places to stop rounding error during cumulative math additions. After manually verifying the x-axis position values with those used by the cubes, they are exactly at 0.11 away from each other like so: 0.06, 0.17, 0.28, 0.39, 0.50, 0.61, 0.72, 0.83, 0.94, 1.05 (x-axis data used by top row).

After screen capturing the image from OpenGl and zooming to pixel level, confires the noticeable differences in spacing between the columns, which are 1 to 3 pixels. The more scaled down the arrangement of the white cubes is in OpenGl, more pronounced the differences are noticeable, which dose not look so great visually.

Now my question is, why is the spacing between the cubes changing, even though the spacing between the cubes is exactly 0.11 units apart, for the same instance of the mesh? I need the spacing to be equally the same between each column of cubes, is there a way to fix this or an alternative solution?

Note: It appears to me, from studying the image, that the translations for spacing are correct, however the cubes do not appear to be drawing correctly, otherwise the alignment would not be lining up at consecutive sequence of columns...

Upvotes: 0

Views: 50

Answers (1)

Jon Anderson
Jon Anderson

Reputation: 696

This is probably just an aliasing issue. Ultimately, your floating point object coordinates are projected into integer pixel coordinates. If they are in between, they are rounded one way or another, leading the issues like you are seeing here.

Upvotes: 2

Related Questions