Archived

This topic is now archived and is closed to further replies.

redcliffe

Pixel shader for skydome

Recommended Posts

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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites