• Create Account

Need scary sound effects or creepy audio loops for your next horror-themed game? Check out Highscore Vol.3 - The Horror Edition in our marketplace. 50 sounds and 10 loops for only \$9.99!

# 2D Preetham sky

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1Veldrin  Members   -  Reputation: 103

Like
0Likes
Like

Posted 16 July 2012 - 07:17 AM

I am currently working on procedural skies models, clouds, god rays and other effects for my 3D engine for my master degree on Warsaw University of Technology.

I have implemented few models: perez(per-vertex), preetham, O'Neil, gradients etc. It is working for such geometry like skydome(sphere/hemisphere, best effects) and skybox.

I need to convert it for 2D games, using skyplane for sky background.(baked texture, dynamic changes etc.).

Now I am trying to convert Preetham to 2D space, as full screen quad for 2D games(platformers etc). I would like to use only simple full screen quad and create configurable dynamic sky(sun rise at defined point, moving from left to right, sun set at defined point).

The same shader I use for skydome/skybox works almost good - but I can't get sun in defined points on quad. It is like sunset/sunrise is out of the quad, can't see moving sun also.

Maybe someone know how to scale it for 2D quad? It is possible, or I need to render some view of skydome/skybox to texture and use it later?

I am trying to do something in vertex shader, but still result is ugly.

PS. Is there any simple solution for scale sun size? Maybe something in perez func A,B,C,D,E variables? In all geoemtry represenations sun is too big.

### #2Veldrin  Members   -  Reputation: 103

Like
0Likes
Like

Posted 25 July 2012 - 11:02 AM

I've solve my problem by mixing some techniques in Vertex Shader and CPU sun trace. Now it's fully configurable Preetham sky for 2D game using only quad.