В очках люди кажутся умнее! (superka_01) wrote,
В очках люди кажутся умнее!

  • Location:
  • Music:

Snow-covered trees in 3D computer graphics (tutorial)

Snow for CG is often quet a challengeing task. The variety of its forms leads to absence of a universal way of its creation.
Working over one project I was puzzled over creation of snow-covered trees. I want to share my solving of this task..

This snow will suite for a wide spectrum of weather conditions and objects.
Here is the perfect example for what this method is:

Here is an example for what this method is not:

It is not for coniferous trees, too.

Let's allocate those features of snow lying on trees which we will simulate:
1. Snow is lying on those side of branches and trunks from which actually snow is falling. In windless weather snow sticks to branches from above, and some places on a trunk - where the bark bumps.
 Wind changes a direction of snow falling and accordingly a sticking picture. Lot of snow appears on a trunk on leeward side.
2. Border between a snow-covered and not snow-covered site is usually continuous and rough. But this border can be sharp enough - for example when the Sun warm a little.

First of all we must create a tree. A good tree - the keystone to success. The trees generated in Onyx will do the majority of tasks .
It is possible to do trees and in other programs, including 3ds Max. Tree model must satisfy are following requirements:
 1. The model necessarily should contain a loft mapping.
 2. Trunks and bough cross-sections must have no less then 8 segments. In onyx this parameter is called "Transversal"
 3. Incorrect normals will strongly change the appearance of snow. The model from Onyx has many open edges along branches and trunks - the normals are  incorrect there. They shouldn't be - weld those points necessarily.

Let's admit a tree is ready. My model have 230К faces.

Now the most important - creation of a snow mask. Though this mask  is simple enough I managed to get it far not at once.
Assign a standard material on a tree and put Self-illumination on 100 - so we can see better the created mask. We will create the mask, consisting of two procedural maps:
First of all the "Gradient Ramp" with Gradient type "Mapped",
and in "Map" slot - "Falloff" with noted parameters:

Falloff map with these setup - returns the color depending on an orientation of a normal relatively to upward direction . Pay attention that I changed a dependence curve a little. The curve rules the width of snow border and general snow amount. Gradient Map - is used for creation of noise in this border (Noise parameter). This noise will allow to imitate snow border in different weather conditions. Mapping affects this noise appearance and at its this stage it is better to edit this mapping (you may use another map channel), but we will skip it.
 Don't spend a lot of time for geting an ideal mask. Later I will explain why.

Let's create a new material for a tree and we will use this snow mask ( it is Map #48 in an example) for mixing in various channels.
In diffuse channel I used Mix map, in  Bump channel - a composit map. I used snow mask in Self-Illumination channel - fake SSS.
I used fractal noise as snow texture:

(there is only default light source in scene)
Note: I used the same composite map in diffuse and bump channels initialy, but composite map in diffuse caused overbrights in huge scene with lots of trees, when rendering with Vray. So I changed it to Mix-map, but left Composite in bump.
You can create a material by your taste, using such snow mask.

 Turning bump on/off considerably changes snow appearance. A Bump map artificially changes normals at render, and thus influence Falloff map! That is why I asked you not to spend a lot of time for a separate mask of snow. You need to setup this mask in detail when the material is assembled.

In Falloff map  if you put in top slot a procedural Noise (instead of white color), and use World XYZ  as texture coordinates - all you trees will have unique snow covering:

And if you use an object to point the direction in Falloff - it became possible to imitate snowfall in windy weather:

 I did this when creating this picture. Everything, including a dog, has the snow mask, similar to the discribed:

I hope this lesson would be useful to you.
Tags: 3d
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded