Dynamic sky dome gradient

Started by
7 comments, last by Drakex 18 years, 9 months ago
Hey all, What is the general method used to apply a dynamic gradient to a skydome? (ie, red at the horizon, fade to blue as you get to the top -- but can change over time). There are two methods I can think of: 1.) use a dynamic texture and generate a new radial gradient every few frames and map this texture onto the skydome. 2.) update the diffuse component of every vertex based on its position within the dome Which would be fastest and most efficient? For 1), I would need a sizable texture (atleast 128x128 or 256x256?) to get good resolution on the gradient, and filling that every few frames isn't cheap. Then again, updating every vertex might not be cheap either, but a dynamic vertex buffer might be better than a dynamic texture. Are there any other methods that you guys use?
Advertisement
Remember that you're not going to change it every frame, unless you're doing some weird effects. So if you only have to update it every few seconds, it probably isn't much of a big deal either way. To me though, updating the diffuse colours seems to be the most effecient.

tj963
tj963
Yeah, I realize that it will only be every few seconds, but I still want it to be as flexible as possible ( allowing me to "fast foward" time effects if I need to :)

What resolution of mesh do you use for your sky dome? It seems like vertex diffuse would give decent results but only if the mesh is above some threshold of detail (some number of verts). Likewise with a texture -- the texture size has to be of a certain size or above in order to look good. I'm just wondering which is more efficient with these thresholds in mind :)
To be honest, my game doesn't have a sky dome, but consider that for each vertex in your sky dome you can have a different color and it will blend between them. How many different colours do you actually think you'll need? Also, you could arrange the vertices in your sky dome so that there would be more in certain areas, around where the sun is or at the horizon for example, which would reduce the overall number of vertices.

tj963
tj963
Actually, I use a dynamic texture for my skydome. The size? 16x16. It looks quite nice, thanks to texture filtering. Using some UV coordinate trickery, I have the "north pole" of the dome mapped to the top of the texture, the "east" side set to the bottom-left of the texture, and the "west" side set to the bottom-right. I then generate the gradient from three colors - azimuth (straight up), east, and west, and the dome turns beautiful colors.

It's more than fast enough to be generated every frame, and the texture may even be able to be made smaller.
_______________________________________________________________________Hoo-rah.
Here's the obligatory vterrain.org link for skies. If you use a sky model, you'll get very good results. I've implemented the light scattering model presented by Arcot Preetham (The paper's available at ATi's website) before in HLSL, and it looked great. You get a sun too.

Also, Yann L has put some good links on this in the Graphics Programming and Theory Forum FAQ. He also participated in several long threads about skies, and you can find links for them at triplebuffer (Yann's greatest hits link, on the top right).

Drakex: sounds nice. If 16x16 can look good, I think I'll definitely do something like that. How difficult was it to get the u,v coords to map correctly?

edit: Thanks for the links Coder :) Right now, I'm more looking for a "quick hack" rather than something involved like light scattering.. I'm also only using the FFP for my current project :P
Does it have to be a dome? Can it be a box? Then you could just run through, using just colored vertices, and lock and unlock only about 24. It would also be quick because the hardware would interpolate for you.
kosmon_x - I mapped the UV coords in a texture wrapper program by using a sphere UV unwrap and manipulating the results. If you'd like, I could email you the final model in .X format (I have no webspace to post it).
_______________________________________________________________________Hoo-rah.

This topic is closed to new replies.

Advertisement