Jump to content
  • Advertisement
Sign in to follow this  
Veldrin

2D Preetham sky

This topic is 2329 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!