Skip to main content
gamedev.net
🔒 Locked

skymaps? basic theory?

Started by DemOSh 11 replies 1k views
Original Post
DemOSh
DemOSh
Would anyone care to explain the theory behind drawing a sky? I dont need code examples or anything, just a basic idea of how its done. My idea is to, after everything is drawn, do a loadidentity, disaable lights and draw a cube that reaches the the extremes of the viewport... am i right with this one, or is there a better way? thnx ~DemOSh
a2k
a2k
most of us just disable lights(your right) and then render this HUGE sphere, invert the faces, and map a sky with spherical mapping. i use glu quadrics for this. this also requires that the edges of your bitmap blend nicely into eachother.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Strylinys
Strylinys
You might not want to reach to the exact extremes of your viewport because some may be accidentally clipped...

S.
DemOSh
DemOSh
Wouldnt a sphere be slow though?
a2k
a2k
oh yeah, Strylinys is right. be sure make the sphere smaller than your camera clipping distance.

"wouldn''t a sphere be slow though?"

have you tried it yet?

but if you want the answer, it''s slow if you have too many segments that define the sphere. you can pull off a good sphere with around 16 segments. you really wouldn''t be able to tell because the map should cover it up real good, and if you disable lighting, you won''t see the faceted faces. so, really, as you increase the number of points, the only thing you''d affect is the way the texture is painted onto the sphere. if you can tell that it''s not smooth, increase the number of segments. if it''s too slow, decrease.

if you could think of anything better, i''d like to know.

well,... you could always do a HEMIsphere, but my game requires a full sphere.

a2k

------------------General Equation, this is Private Function reporting for duty, sir!a2k
a2k
a2k
also, strylinys, supposing i created a sphere in 3dsmax, exported it with 3d explorer, it spits out the display list as triangles. would this be slow?

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
BlackScar
BlackScar
Also disable depth testing, therefore you won''t have to draw a sphere to reach the outermost limits. (It''d be too slow anyhow)
~-=-=-=-=-=-=~~Justin Eslinger~~.."BlackScar"..~~-=-=-=-=-=-=~
richardve
richardve
What I''m going to try today is making a hemisphere (or just a full sphere) with triangle fans and put them in a display list.

Rendering with Z disabled, lights disabled and tiled textures (64x64 or 128x128).

I think this should be fast enough...
Darkfrog
Darkfrog
Well..
the easiest thing to do is as you said.. draw a skybox. This is a box drawn centered on the player''s view position. You can add a little bit of parallaxing when moving but it isn''t necessary (I believe Shogo did this). All of the Quake and Unreal engine games use skyboxes, and you can find a number of free textures for skyboxes at:

http://halflife.lowlife.com/wadfather

Spherically mapped skys look cool especially when you have clouds scrolling up and over the horizon, but you can''t beat the simplicity of drawing a box

One thing to note.. the resolution of your sky textures will have an impact on how "close" the sky seems to be to the player. It''s an optical illusion I guess

For stuff like starfields and nebulae effects.. it''s best to use a low res texture for the nebula, and then tile or multitexture a higher res star texture over top of it for a detail texture.

good luck
Strylinys
Strylinys
Hmm, haven''t had too much experience using 3dsmax, but I''d expect that it would be slow (since the work I''ve done in max appeared to have lots of triangles in the sphere, not too sure if i was able to change the amount, never tried)... If you are talking about a comparison between triangles and other polygons, triangles would develop the fastest display list even though it may give you more glVertex() calls. This is because all video cards are optimized for triangles since it is almost the most basic unit you can get when drawing in 3d space... and it always lies in one plane.

S.
richardve
richardve
"video cards are optimized for triangles"

They are more optimized for trianglestrips/fans
Ingenu
Ingenu
richardve : so true

Although Quad strips/fans are very fast too...

-* So many things to do, so little time to spend. *-
-* So many things to do, so little time to spend. *-
Strylinys
Strylinys
By "optimized for triangles" I meant all types of triangle generation, that includes triangle strips. Even putting down a bunch of triangles, without a strip, would be faster than strip quads on most cards...

S.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.