Pixel shader for skydome

Started by
6 comments, last by redcliffe 20 years, 11 months ago
I''m not asking how to do it, but would it be possible to use a pixel shader program to colour a skydome based on the position of the sun? Has anyone done it with good results? Thanks, David
Advertisement
I don''t think you really need a pixel shader for such a simple thing...

Height Map Editor | Eternal Lands | Fast User Directory
quote:Original post by Raduprv
I don''t think you really need a pixel shader for such a simple thing...

Height Map Editor | Eternal Lands | Fast User Directory


Well probably I don''t, but if it will make it run faster, and make it easier to build the whole sky and clouds stuff it should be useful. Thanks,

Davdi
I doubt the skydome, of all things, is going to be taxing enough on the machine to matter. There are a lot of better things to get the GPU doing. Like mesh skinning.
"There is only one everything"
http://www.vterrain.org/Atmosphere/

They have some interesting stuff. ATI has a paper on atmshperic light scattering and shaders. Indeed, you can get some wonderful effects, but you don''t have to use shaders.
Look at page 6 of the sky thread:

http://www.gamedev.net/community/forums/topic.asp?whichpage=6&pagesize=20&topic_id=86024

You''ll see some screenshots of my implementation of ATI''s paper. No pixel shaders stuff there

Y.
I think you guys are missing the point. You''re asking if there''s a quicker way to modify your vertices every frame instead of having to lock them (which effectively stalls the graphics pipeline), right?

I''ve wondered this myself and I think it''s completely possible. I color my skydome based on time of day which would base it on the suns position but I have to update all the verts when the time of day changes. Haven''t attempted an implementation but I have found two ways to do it. One way works with what I have now which is a text file with the colors of the sky, vertically and horizontally. You would just pass those values as constants to a vertex shader (so I guess you wouldn''t want a pshader anyways since you just want to update your vert colors).

The second way (which I want to convert to) would use each a texture as a lookup into the vertical and horizontal sky colors which could reflect the time of the day. You then could use this texture in a pshader I suppose to set the correct colors based on their texel pos. If you did do this in a pshader though, you''d definetly have to lerp your colors. Hmm, if you did just load that entire texture into another stage and apply it to the dome you would not even need to modify the verts).

i.e. if you wanted 4 colors to represent the vertical sections of the dome and 32 for horizontal, you would make a 32x4 texture.

I have a tut on the first method on my site, btw (non-accelerated).

"Love all, trust a few. Do wrong to none." - Shakespeare

www.CodeFortress.com
"Artificial Intelligence: the art of making computers that behave like the ones in movies."www.CodeFortress.com
if you want a physicly correct skycolor, using your pixelshader in the riht way would be the best method i know of. especially if you also want to be able to fly out of your athmosphere, and still have everything look realistic.

a gradient texture would be a nice enough fake for most uses i think though. it would also be faster i think, but if you can find no other use for your pixelshader anyway, why not?

This topic is closed to new replies.

Advertisement