Sign in to follow this  
dawberj3

Texturing the sky

Recommended Posts

dawberj3    122
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
Enselic    829
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
dawberj3    122
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.

Share this post


Link to post
Share on other sites
Bob Janova    769
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
Adam Hamilton    271
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...

Share this post


Link to post
Share on other sites
haegarr    7372
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
zedzeek    528
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

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