GL_REPEAT on Cube Maps??

Hello everyone!

I’ve been working on this game where you walk on planets which is actually giant spheres. To fake a sense of detail to the ground I’ve cube mapped a simple static texture around the planet. Now, the question I ask is as follows; Is there any way to repeat the static pattern on all 6 sides of the cube map? If you catch my drift ;)… in other words the static image is allready 512x512 and gives little or no detail to the ground up close… Further increasing the texture in size, only to repeat a single 32x32 static texture seems like a waste of memory…

Any help appreciated :slight_smile:

Is it used as a skybox or for environmental mapping? It is not really clear how you use your cubemap.

Maybe, instead of repeating a boring 32^2 sized pattern, use the additional resolution of your 512^2 cubemap to actually put a more interesting/detailed texture in there.

Other than that: No there is no GL_REPEAT for cubemaps, as far as i know. With shaders it is certainly possible, but could be difficult.


Well… The planets are really huge, (mesh alone about 200 mB of memory). If I were to use a 512x512 texture cubemap for the ground, it would take about 1 minute to walk across one single pixel of the ground texture. If I where to use one single texture w/o repeat I would have to use textures with resolution of at least 16384^2 to make the ground detailed enough. I suppose OpenGL does not support such large textures…

BTW the cube map texture I am talking about is used for the ground. You know, like grass or pebbels or whatever. The reason I need to use cube map is because the planet is a round sphere you can walk on. Any other way to texture a sphere maybe?

But thanks for the answer anyway :slight_smile:

I must say your explanation what you are doing is really bad. I think i have now understood what you are actually doing, but in the future you should take more time to explain more thoroughly what you are doing. Otherwise people will just not care to answer you.

Cubemaps are definitely not designed to fulfill your current need. But you could do a two-step texturing approach. First sample your cubemap to obtain the overall color (blue for water, brown for earth, etc.). Then combine this with a “detail texture” (google…).

You would need to somehow sample your 2D detail texture with texture coordinates, that repeat over the sphere and minimize distortions. This is certainly possible, but not that easy. In general, texturing a sphere is a big problem.

Hope that helps you out a bit.

Just make the planet mesh with the same topology as a subdivided box. This way you will have 6 grids and you can use normal texturing.
The texture coordinates must match where the grids meet and you should use a texture map that will tile properly across all sides (e.g. even when rotated 90 degrees).

GeLeTo, That is a very good idea! I shall try that. Thanks! :slight_smile: