Saturday 22 June 2013

Mixed Forests and Basic Animation




Here is a scene that supports 3 distinct tree types, as well as textured and shaded cut blocks.  Here cut blocks are part of the rendered forest, to support smooth transitions in animation, as well as to have some volume in the 3d scene  (There is a lot of dense waste left on cut blocks).



3 Tree Types and cut blocks

Here one forest Map Texture is used, describing patterns and shapes of the 3 different tree types.  Cut blocks as well as roads, are then defined through the cut texture, which maps uniquely to the entire terrain.  Cut Blocks are rendered as a 4th texture, so they are defined in the initial mapping to terrain function.

Though one of the major problems with this process is borders between areas of different type.  many artifacts appear around cut block boundaries due to sampling problems, and transitions between tree types are also problematic.  Though mostly these border issues are solved by creating a line map with a laplacian defining border boundaries between tree types.  This image is then used to blur the final image.









The animations above provide examples of simple ecological based animations which may be implemented through this process.  The forest growing is simply a global value applied to forest height.  (Obviously an entire forest does not just grow like this)  The Cut block animation was created by using a video for the modification texture.  This animation is pretty terrible so that is why there are some ugly artifacts between the roads and cut blocks.







Basic Multitexturing

A large forested scene would likely require many different forest map textures that describe tree placement and type.  For one, if there are distinctive features in the texture, it would be quite noticeable that the texture repeats.  Secondly, forests vary in relation to aspect, terrain type, and elevation.  Thus this system should support basic multi texturing (based off of Riemer's terrain tutorial) that supports dynamic or terrain based forests. 



Scene with many forest types - Helena National Forest, Montana
The young forest, beetle kill, and fields could potentially be described via the modification map, but in this area some forests are more dense, and tree types vary depending on aspect.  There is support for differences accounting for age, roads and cut blocks via the modification texture, as well as in a value in the terrain vertices which defines whether or not the ground is forested.





Deer Lodge National Forest, Montana

Inspired by some of the beautiful forests of the Rocky Mountains, I decided to see if this system could also be used to render similar rock formations and mixed forests.  With not too much effort I was able to implement a similar scene supporting multi texturing and different tree types (in this case, one tree and one type of rock)




Here 4 different textures were used, one describing a mixed forest/rock, dense forest, sparse forest, and only rock formations.





These are the 4 textures used.  The red channel describes feature height, the blue channel defines forest or rock, and the green channel is noise used for dynamic texturing.  As you can imagine, many possible forest types could be created by creating simple noise based textures.



 Here only two feature types are used, the Forest Color and Forest Texture images are split for the trees and rocks.  Potentially many feature types, tree species, kinds of rock etc could be represented through this system.  Though there are some potential problems when merging different Forest Maps for Multi texturing, as well as with transitions between types.  Some solutions to these problems will be explored later.







But even so, this process can successfully implement basic mutlitextured mixed forests


Thursday 30 May 2013

Process Synthesis





So far the per pixel displacement approach to forest rendering works pretty well and looks pretty good.



There are a few inherent problems, mainly that trees are not rendered from a perpendicular view angle, and that there is still some flickering on the horizons. Though all in all this process provides a flexible basis for experimentation.



Some more work can be done to improve individual trees, better texturing, adding stumps and possibly branches.  There are more states I would like to show as well, from growth to death, cut blocks and burned forests.  I also would like to  work on various animations, and real time interaction with systems such as fire.




Though at this point the problems with this process may negate its usability or practicality.  There is definitely a lot of overhead for full integration, and this process obviously has limits.  I see potential at this point to develop some of my personal interests, but the technical side of this process may not be worth continuing. 

I will try to experiment with adapting this process to offset vertices up, then offset pixels down.  This may solve some of the flickering on horizons, but may still have some problems. 

Monday 20 May 2013

Basic Mixed Forests

 So far the forests rendered in this prototype have all been the same type.  Luckily, it is not too hard to allow for multiple types of trees to be represented with this approach.

Canadian Boreal Forest - Deciduous, spruce and pine trees


 So far this model only contains two types of trees, but many more could be added easily.  Different tree types may have different max height,shape, color, and texture.  The following processes provide a rough implementation for mixed forests.


Height Map rendering with mixed forest.

Essentially the type of tree is defined by the shape and color in the forest map.






Forest Height Map, Type defined by blue channel
Here the blue Chanel is used to define smaller deciduous trees.  Where there is blue, the height and offset values are modified in the pixel shader to generate the Forest Map.  The Offset chanel is already used as the x value when sampling the final forest textur, so it is scaled down by the number of tree types, and then offset depending on the value of the tree type.






Here the forest texture is divided into two images, texture and color, each split to represent two different tree types.  The y coordinates of the color texture image represent the decay value so the color of tress can change smoothly. 



Mixed Forest, deciduous trees have higher decay value.







Sunday 19 May 2013

Displacement Rendering - Integration





In the past year, I have worked extensively on a separate rendering project to model industrial processes and systems to represent various types of pollution. A component of the forest Rendering project is to create forest systems that can interact with the systems from the Industrial Abstraction Project


Thursday 9 May 2013

Displacement Map - Modification and Interaction







Height Map Displacement Shading






The textured forest looks pretty bad when it does not have shading-  It is pretty much impossible to distinguish different trees other than on horizons-



Textured Forest, no shading



Luckily implementing dynamic shading is not too difficult, and a variety of shading techniques can be combined to create a convincing effect.

Terrain Shading





Terrain Shading – trees will be shaded in shadow of terrain contours
lighting factor writen to Forest Map – passed through Displacement Filter


Height Shading



Height Shading – Assuming trees are shaded more on the bottom -
                                    Forest Height is determined by texture height * forest Value in terrain Vertices
                                    Forest Value passed through Forest Map –
                        bottomShading = finalHeight/ForestValue  (Relative Max Height)



Emboss Bump Map Shading



Embos Bump Mapping – Technique used to approximate bump mapping – may still show up in terrain shadows-




Combined Shading




Combined Shading – Shading methods multiplied together- some artifacts from embos bump map.. 


 



These shading methods require 2 more channels to be passed through the initial mapping process- Relative height for height shading and a light factor calculated for the emboss and terrain shading


Textured Displaced Height Map

To correctly implement Dynamic Hight Map Displacement, my approach to render tree textures, (not just sampling directly from the ground)  is to render a contour reference map containing x and y coordinates that could then be used to sample from a separate tree texture.









Saving the correct height to a separate render target required a few solutions to different problems.

Near far sampling -

Up close, trees should show a gradient from 0 to the relative maximum value.  This height value is calculated by dividing the current pixel height by the maximum pixel height, giving a height value in the [0,1] range.

This calculation quickly breaks down when trees are viewed from farther away, as the current pixel height range is smaller-

Rather than sampling from the bottom of the tree, we would want to sample from the middle as distance grows -  Thus a solution to this problem is to take the average value between the relative maximum height and the current height value-
(is this really that good of a solution??  ... does not give full range??)


Up/Down sampling-

The maximum amount of displacement occurs when viewing trees from the side, and no displacement occurs when looking down on the trees.   The height calculation is taken care of in the general height formula, but the correct height value is not saved to the forest volume layer. 

When looking from the side, there should be a gradient with height values from 0 to the max height of the tree.  When looking above, only the value of the maximum height should be seen.

This problem is soluved a linear interpolation between the current hight value and the relative maximum hight value based on the ViewUp dot product value-

Height saved to displacement map



Having correct sampling and smearing of tree height / shape is a critical step in implementing this process.  So far this process looks smooth and transitions fluidly with the camera constraints-  




Now with proper height or y values, we need x values to determine how to sample tree color-


A simple but powerful approach to this problem is to include "offset" values in the height map, essentially randomized pixel values in the green channel-



Forest Height Map with Offset values



Rendering the offset value to the displacement map gives x and y coordinates to sample from a displacement texture-

Displacement Map with x and y texture coordinates


Rendering the tree color texture with the coordinates from the displacement map allows for dynamic coloring of the displacement map-


Textured Forest
Forest Color Texture




Tuesday 23 April 2013

Displacement - Basic Process



To render distant forests, it is common to have some kind of bump map to simulate a forest- Though of course this approach would actually render a flat forest, where edges such as mountain ridges or tree lines would be simply cut off.

A simple image of a cut block shows the problem quite nicely:


Cut Block near Hazelton B.C.
Notice the edges around the cut block.  You can see pointed tree tops along the bottom edge and trunks along the top edge.  This image is about the distance that this approach would likely be appropriate for.


Per-Pixel Displacement Volume Rendering


A solution to this problem is to render a forest height map texture to the terrain contours to a separate render target, and then use that image as a key for a 2d displacement filter on the scene image.


Forest Map Layer - Tree Height, dot(ViewVector, UpVector), and Depth rendered to terrain

The Forest Map contains the necessary data from a 3D vertex shader to "smear" a 2D image
  • red channel - tree height (also defines shape of tree)
  • green channel - dot product of view vector and up.  (Pixels to be dilated range between full displacement when viewing from the side and to no displacement when looking down)
  • blue channel - distance from camera.  Pixels to be displaced is dependent on distance.
Basic displacement filter - using terrain color

This displacement filter is a for loop that checks a small number of pixels bellow to determine if the current pixel should be recolored.  The loop starts with the bottom sample first, as it would be closer to the camera, and calculates the approximate height of the sample from the Forest Map:

pixelHeight = depth * height * viewUpDot * maxPixelHeight;

If this value is greater than the current for loop counter, the pixel is recolored with the color of the base image.  Effectively displacing the base color up according to the height in the Forest Map.

Repeated displacement Filter


Running this filter more than once by offsetting by the maximum shader amount produces some ugly artifacts, but already begins to represent a forest.


Though there are a few fundamental problems with this approach:
-For efficiency only a singular direction displacement filter is used, restricting the camera to no roll, and no upside down views
-Any forest bearing ground not seen by the camera (occluded by other terrain etc.. ) will not be rendered.




Though as a start, this process produces some interesting results.  Here is a video showing a bit of the basic process:



What has already been done


From what I have seen most forest rendering in computer graphics is based off of rendering many point sprite trees either in order, or with some kind of alpha cut to eliminate z-buffer artifiacts.



 Simple Point Sprite Forests

 http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series4/Billboarding_renderstates.php


























Cylindrical Point sprites only look good from ground level
 http://vision.mas.ecp.fr/Personnel/teboul/files/pma06_teboul.pdf

"We would like to show that it is feasible to use three cross
billboards to realize a fast and realistic rendering of a big
forest in our software ForestRoam: Forest Rendering and
Simulation with Image models."




Certainly rendering a large forest scene would have to include a point sprite for every tree- for realistic scenes this would require an astronomical number of sprites- many thousands for a single frame...


Project Overview

As a Computer Graphics, Visual Art, and Environmental Studies student, I have been lucky enough to receive an NSERC USRA grant from the Canadian Government to work on a research project to render Virtual Forest Environments.


I am interested in exploring new methods of forest rendering that are fast enough for real time use in games and interactive simulations.  As well as developing aesthetically pleasing scenes, I also want to be able to create animations modeling ecological processes such as growth and succession. 

Helena National Forest, Montana

Beyond natural processes, I also would like to develop systems to model interactions with industrial elements that threaten forest environments, including logging, agriculture, mining, tar sands and fracking operations.

Northern British Columbia Cut Block


The focus of this project is to model forests artistically, not to develop photo realistic environments. 
The intent of these solutions to look good, while being able to support real time interaction and modification animations.  I may explore a variety of approaches, and will try to combine appropriate elements to create dynamic and interactive forests.

Thursday 11 April 2013

Project Background


I have had the privilege to grow up in one of the most fertile and temperate forested areas in Montana, a lot of my child hood was spent absorbing the beauty, nourishment and darkness of the forest.  As I ahve gotten more interested in computer science, my interest in spending time on the land within the forest has only intensified.  Especially within these last few years, I feel that my experiences in nature have inspired me to communicate and relate the severity of the change that threatens the worlds forests. 


In 2007 the rocky mountain pine beetle epidemic swept through Motnana, destroying most of the Ponderosa and Lodge pole pine stands in large areas across the mountains. 

Beetle kill forest - 6 years after initial infestation

 Interested in the epidemic, I learned from various biologists and restoration specialists that this outbreak was about 20 times larger than previous outbreaks, and that it was magnified through various mechanisms by climate change. 







After moving to Canada for University, I gradually became more interested in development issues relating to climate change.  Especially after experiencing the forest industry of Canada through tree planting, I became rapidly convinced that our economic practices were leading to large scale social and environmental degradation, and that severely impacted the worlds climate.


Cut block in Northern British Columbia



Continuing to study climate related issues through Environmental Studies and through political activism, I have how serious of an issue climate change will be over my life time, and for the rest of humanity.  

Throughout this process of informational accumulation, I have become interested in public awareness, sharing information through visual methods with visual art and computer mediums.  Through various independent computer graphics projects, I have built tools for rendering industrial systems and pollution processes through Industrial Abstraction.  Now I wish to augment these virtual environments with a forest system that can handle real time interaction and modification, to show abstract relationships through animation and interactive simulations. 

As large scale development and climate related issues are extremely large scale and abstract, I beleive virtual environments may help relate the consequences humanity faces from our lack of appreciation of the complex forces of nature.