Modern Sky Rendering

Started by btwasilow, July 21, 2014, 08:54:31

Previous topic - Next topic

btwasilow

Obviously this is probably a rather complex topic, not that I will not try and elicit an answer anyways, but I was curious if any of you guys knew how modern atmosphere rendering is done. I look at the cry engine and ue4 and the sky looks absolutely amazing; completely realistic. Any help would be appreciated. I am merely looking for ideas and not code, I am completely capable of figuring it out myself however I would prefer not to spend the next several months trying to figure it out (if it really is that complex that is).

abcdef

Hi

There are basically 2 options

1) Sky box

This is a cube that is rendered with the depth testing turned off so that you are effectively in it. You then have 6 textures (normally rendered as a cube map) that are rendered on the inside. There are texture packs on the web that are built for this setup and they take care of the perspective in the corners

Pros : very little to draw on the screen (12 triangles)
Cons : Its very difficult to add sky artifacts afterwards , like moving clouds

One thing to be aware of is that if you use a different coordinate system (Like z up for instance)  the cube map coordinate system will still be in the standard opengl coordinate system.

2) Sky Dome

This is like the sky box but you render half a sphere (same trick with the depth buffering to make sure you are always in side), you need to build the sphere yourself (This is fairly simple, you take two angles and iterate over both so you get multiple slices of the dome). The texture is rendered around the dome. Like the above you need special textures on the web

Pros : You have a lot more data points and can render sky artifacts much easier. Clouds moving over the sky can be done rendering multiple textures and moving the cloud texture over time. The thing to be aware of is that most texture are for a specific time of day so there may be a limit to what you can do.

Cons : More expensive to render


There are probably tools on the web to take a 360 panoramic from a normal camera and covert to something you can use. For both there is example code you can use (might need to convert to java but the principal is the same)

I ended up implementing both as I was curious to see the impact if using one over the other.

basil

another option is to render the sky completely in a fragment shader.

from basic gradients based on the direction vector to realistic scattering. check out http://vterrain.org/Atmosphere/ or http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html. keywords are rayleigh and mie scattering.

these can be difficult to implement.