Is scale important in OpenGL?

Does scene scale in OpenGL mean? On a scale, I mean, for example, drawing 1 unit cube, but setting the camera position at 1000 pixels versus setting the camera at 100 pixels from 0.1 unit cube? I suppose, first, do I think that this will give the same results visually? And if so, does anyone know how that would affect performance, if at all?

My guess would be that this would have no effect, but a more definitive answer would be nice.

+4
source share
5 answers

This does not matter, except for inaccuracies using floating point arithmetic. Therefore, try not to use super small or large numbers.

+10
source

"Camera setup" actually only changes the transformation matrix by which the vertices are multiplied, so after applying the transformation, the positions of the vertices coincide. There may be slight differences resulting from inaccuracy of floating point values.

If the camera has a constant near and far clipping distance, the resulting values ​​in the depth buffer will vary, and one of the cubes may go beyond the range of clipping planes, which would make it different or not display at all.

+1
source

If you mean 2D, that doesn't matter. An image created in both directions may look the same.

0
source

You should know that floats have two modes: normalized and unnormalized. For values ​​below 0 you will have more bits and more precision. So, it is better if you keep everything between 0 and one.

In addition, looking at how exp / mantissa works, the difference between the numbers when changing one bit is greater when you move away from zero, and everything starts to appear when you move very far from the beginning.

0
source

Yes, it is important. Not because of OpenGL, but because of the nature of floating point operations - floating point accuracy degrades at large values. Try and normalize your values ​​so that the values ​​are closer to zero. That is, do not make the object of the planet 1,000,000 units wide just because you want the planet to have 1000 KM in diameter.

0
source

Source: https://habr.com/ru/post/1479068/


All Articles