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