Feature 7 Post Mortem
April 25, 2013 by wisbymn. Filed under
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
cs455, postmortems, spring 2013.
Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/twodee/blog/wp-includes/wp-db.php on line 3030
Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/class.jetpack.php on line 4255
Deprecated: Creation of dynamic property Jetpack_Carousel::$localize_strings is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/modules/carousel/jetpack-carousel.php on line 339
Adding fog to my scene was one of the easier additions to my walkabout scene that I’ve done thus far. I got it to work on more or less my first try, although there was a lot of tweaking to be had after that. After watching the video on fog, I decided that I wanted to create my fog in the second manner, as I thought that would be the most realistic.
Most of the steps for creating fog were taken from the video, although I did make a couple changes. The biggest was that I define my fog in eye space instead of in world space. Originally I wanted to simply draw my fog in the 128 x 128 space over my terrain, but Chris suggested a better idea to me: to define the fog in eye space so that it moves with the camera. This way the fog is always perpendicular to the camera–I had some concerns about the camera looking at the fog from the side so that it wasn’t visible. Defining the fog in eye space coordinates was easy once I realized how to do it (with some help from Chris), and I accomplished it in the following manner. Now I didn’t have to multiply by the camera’s view matrix in the shader, since the coordinates were already defined in relation to the camera.


After this my fog displayed as I expected. The part that took me the longest to get right was how opaque my fog should be and how many planes of fog I should draw. If the fog was too opaque the program was slow and one could tell there were many planes of it, but if it was too see-through it was unnoticeable. I finally decided on the following amount of loops for my drawing and an opacity of .02 times the original alpha value.

Lastly, I defined a variable that defines whether or not the fog should be drawn. My program starts with the fog not drawn, simply because it takes a lot of processing power to draw it. The camera movement is also very slow when it is there. If one wants to see the fog, they simply need to push r, and then it will appear! Pushing r again will toggle it back off.
And of course, here is a video of my fog:
http://www.youtube.com/watch?v=x39bBwl292w&feature=youtu.be