Mittwoch, 22. Oktober 2014

Illumination


Previously, the generated clouds were simply illuminated according to their turbulent surface. Hence, the color mostly depended on the distance to a cloud's origin. To incorporate the sunlight, the Phong illumination model was used and adapted. This model consists of three separately illuminated components of which the final colors are composed. Phong therefore used an ambient, diffuse and specular component to obtain realistically represented 3D objects. 

Ambient component

The ambient component represents the illumination that only depends on the constant illumination of the environment. Thus, it is independent of the location of the camera and the position of light sources. To obtain the ambient illumination IA at a given point on the distorted sphere, the color was mainly derived from the noise.
IA(x) = sunColor * (1.1 – noise(x))
The noise factor as calculated by the vertex shader is from the range [0,1] and therefore the ambient illumination is always positive. The constant value 1.1 spawned the best results in a series of tests. Figure 1 displays a cloud with ambient illumination.


Figure 1 ambient illumination

Diffuse component

The diffuse component depends on the angle of entry of the light. The diffuse illumination ID at a given point x on the distorted sphere is defined as
ID(x) = sunColor * (L . N)
where L is the unit vector of an incoming light ray, N is the normal vector from the point on the surface and L . N is the angle between L and N.
Figure 2 shows the diffuse component of a cloud where the light source is above the object.


Figure 2 diffuse illumination

Specular component

The specular component treats the reflection of the light from the surface of the cloud. Therefore, it depends on the light direction, the material of the reflecting object and the viewpoint of the observer. To calculate the specular illumination, the vector of the reflected light, the normal of the point on the surface and the observer's position are needed.
Figure 3 displays the result of the specular illumination where the light source is placed above the cloud.


Figure 3 specular illumination

Composed component

In the Phong illumination model, all three components are combined to obtain the final illumination. However, the specular component did not look real on a cloud because a highlight depending on the observer's position is not realistic and was thus removed increasing the performance of the fragment shader as it is time-consuming to calculate the exponentiation and the reflectance vector. The result that incorporates the diffuse and the ambient illumination can be seen in Figure 4.


Figure 4 illumination combining the ambient and the diffuse component

References

Dienstag, 21. Oktober 2014

Project Specification


Procedural Generation of Clouds

Project aim

The aim of this project is to procedurally generate clouds and sunlight from actual weather data of Stockholm. The modeled clouds should be animated to drift along the sky according to the wind properties. The sun cycle ought to include daytime and nighttime.

Limitations

The scope of this project is constrained by the time. Therefore, only cumulus clouds will be modeled and no further weather conditions apart from one-directional wind will be incorporated. Depending on the rendering approach the overall scene might not run in real-time.

 

Technological approach

The weather data can be fetched from a web service such as OpenWeatherMap. This data should be used as input to the procedural cloud generator which will create volumetric cloud models. A rendering routine will then calculate the illumination of the scene from the intensity of the sun with respect to single forward scattering in the clouds. Also wave length dependent calculations to simulate sunrise and sunset should be executed. The generated models will be placed on a skydome in the scene and float with minor animations using Perlin noise or updating the cloud’s internal particles along the sky.

 

Perceptional research

To research the perceptional notion of a scene depending on the weather condition a survey will be conducted. It ought to examine the perception of the same underlying scene for different setups of the procedural weather generator. Also some research will investigate whether the generated sky contributes to making a scene more realistic.

Outline

The project is structured into several stages and the source code is available on GitHub.
  1. Single Cloud - First, a single cloud is generated from geometric primitives.
  2. Illumination - The cloud is illuminated according to the Phong illumination model.
  3. Multiple Clouds - Several clouds are instanced and the model is elevated to a more realisitc and dynamic scene
  4. Skydome - The sky component is developped and the illumination is discussed.
  5. Procedural Sky - All components are combined into a single scene.

References

  • http://openweathermap.org/
  • A Real-Time Cloud Modeling, Rendering, and Animation System, J. Schpok, J. Simons, D. Ebert and C Hansen (2003)
  • A New Application for Real-Time Shadow and Sun's Position in Virtual Environment, H. Kolivand and M. Sunar (2011)
  • Cloud Modeling for Computer Graphics, G. Taxén (1999)
  • Texturing & Modeling - A Procedural Approach, 3rd edition, D. Ebert, F. Musgrave, D. Peachey, K. Perlin and S. Worley (2001)
  • Real-Time Cloud Rendering, M. Harris and A. Lastra (2003)