0
\$\begingroup\$

I have normal skybox via CubeMap, but i noticed that the size of the cube has no effect. I would expect that when i have cube size 20.0, i will see different result than with cube of size 1000.0 (same as if you have texture 20x20 on 20x20 face and on 1000x1000 face).

It is probably because the CubeMap works somehow different, but i don't know where to find how.

\$\endgroup\$
  • \$\begingroup\$ Are you referring to the size in units of the geometry of the cube? \$\endgroup\$ – Felsir Sep 6 '15 at 10:09
  • \$\begingroup\$ @Felsir: yes. Look here antongerdelan.net/opengl/cubemaps.html - "The size of the box is not going to affect how big it looks. Think about it - if it's moving with the camera it will look exactly the same close up as far away. The size only matters if it intersects with the clip planes - in this case you will see a plane cutting off part of your box. " But i still don't understand why the result is same ignoring the cube geometry. \$\endgroup\$ – Krab Sep 6 '15 at 11:13
2
\$\begingroup\$

A skybox is already simulating a sky infinitely far away from you. If you would increase the size, wouldn't you expect to be the same?

Cube mapping works by sampling a special cube texture (consisting of six 2D textures, one for each face) by normalized 3d vector coordinates. If you get 3D coordinates from a cube scaled by 1000, and normalize those, you get the same coordinates as you would from a unit cube.

\$\endgroup\$
  • 1
    \$\begingroup\$ @oh i finally undestand. I am noob i was like why the result is same if i change the size of front face, but i must change size of every face and then again center the cube around 0.0, so the direction vector to any corner of cube is still the same (it would change only if i change size only one face). Thx. \$\endgroup\$ – Krab Sep 6 '15 at 12:20
  • \$\begingroup\$ No problem, welcome to the site! :) \$\endgroup\$ – János Turánszki Sep 6 '15 at 12:34
2
\$\begingroup\$

Imagine you're in the center of a flat square rectangle. If you look North you'll look at an edge. If you look Northeast, you'll see a dot representing the corner connected by two edges- the horizon. Now the distance of that corner is not relevant, you will always see a straight line with a dot representing the corner.

Apply this to a cube: if you're in the center of a cube, the corners are always in the same location, no matter how big that cube is. So the 'look' is not changed by the size of the cube. Since the skybox moves with the camera- you're always in the center of that cube.

The only reason for a bigger cube is the clipping plane. You want the gameworld to be INSIDE the cube to be visible. Thus, the size of the cube is only relevant for the clipping part not the 'looks' part.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.