Texturing the sky

Started by
8 comments, last by zedzeek 18 years ago
Whats the best way to texture the sky? I have a hemisphere texture but I dont know how to apply this. I want my program so the sky looks like its in the distance when I move towards it. Basically how to I make the sky ? Thx OpenGL btw
Advertisement
One simple way is to translate the hemisphere so it's center is always where the player is. I.e. translate player to (5,3,4) => translate hemisphere center to (5,3,4). This way the skybox will appear as non-moving (i.e. it will appear as if it is far away).
[s]--------------------------------------------------------[/s]chromecode.com - software with source code
Yeh I understand that but how to I texture the image onto the sphere?

I can put textures on planes but not sure how to do with curved shapes.
What do you mean by a 'hemisphere texture'? Textures are, by definition (in both OpenGL and DirectX, anyway), rectangular.

A simple skybox is a cube which moves with the user, so it seems to be at infinite distance. You can texture the 'walls' and the 'roof' of this cube with textures that join together to give the impression of a seamless sky.
I think the OP meant that he has a texture designed for a hemispherical surface.

I don't really know how to do it but I think there is a way to do this in the D3DX interface...
Google for how to texture a skydome, the first link to the flipcode tutorial explains exactly what you're asking.

Personally, I'd look into the ideas on TGLTLSBFSASP.

Now actually implementing any of this kind of stuff takes a good deal of finesse, so I wish you luck
The cube way looks easier.

Where can I get textures for this?
I'm using a sphere segment (is it called a segment? I mean a sphere cut by the planar world a little below the upper pole). The texture mapping is done by projecting the texture planar top down but on a sphere, simply by dropping the height co-ordinate of the vertex positions (and doing a uniform overall scaling). So the texture appears more or less 1:1 straight above the player's avatar, but it gets less shrinked the more the view goes to the horizon as would be expected by a pure planar mapping (e.g. a sky box). This method is IMHO suitable for "infinite" worlds.

[Edited by - haegarr on March 28, 2006 4:12:07 AM]
:sigh: [google]
for "skybox texture"
the simplist method is to load the skt texture as a skybox + use the following (in glsl but u can alter to anyting even fixed pipeline)

gl_FragColor.xyz = textureCube( environmentMap, normalize( vertex - camera_pos ) ).xyz;

this will texture everything correctly be it a cube, dome, sphere, person whatevr + a bonus u dont have to worry about texture coords etc

This topic is closed to new replies.

Advertisement