Sign in to follow this  

Texturing the sky

This topic is 4282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this