Skip to main content
GameDev.net gamedev.net
🔒 Locked

2D Preetham sky

Started by Veldrin Jul 16, 2012 at 1:17 PM 0 replies 1.8k views
Original Post
Veldrin
Veldrin
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.

Thanks for any reply!
Veldrin
Veldrin
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.

If somebody need 2D/3D Preetham sky example code - please contact me on PM/

Topic solved.

Topic Locked

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

Sign in to reply to this topic.