ZModeler2 Lesson #3: Vertices color, painting, prelit.

Vertices color.

ZModeler supports vertex-based color painting. This color acts on vertices exaclly the same way as material's basic color affects polygons, moreover, when enabled, vertices color surpresses material's color. There could be two color channels in vertices: Diffuse color and Specular color, but the second one is quite rarely used. Vertex color can only be set on object level in mesh format properties. Create any sample object (e.g. a sphere), right-click on it and pick Properties... then expand Mesh\Vertices\Format branch. Image on the right shows "Diffuse color" set on the object.

Switch object to vertices level and select any group of vertices with Select\Quadr tool. Then expand Surface\Paint\Color advanced settings box and hit "Fill Selection" button. Vertices will be painted like on the image below:

Vertices painting tools.

Surface...
Paint...

All vertices painting tools are located under Surface\Paint tool which contains some common options for painting operations. The main option you should pay attention to is Pressure. This is how strength color painting will be (in percents). So, if you set it to 10, then painting to red color will add 10% red color to vertices and leave 90% of previouse color. 100% pressure will obviousely replace old vertices color with the one you are painting to.

Another option is Soft shape. When Paint branch expanded, cursor shape will turn to a small circle with a dot in the middle. This is a painting shape - it's always the same and you can't change it's size. However, when Soft Shape option is set on, this shape has maximum pressure in the middle dot and zero pressure on boundary. So, color can be applied like "airburshed". Finally, Alpha only option toggles affection to alpha channel of vertices colors only. When this option set on, you can change alpha "color" of vertices and control transparencity on vertices level. Rarely used indeed, but can produce quite interesting results like on the right image.

But Paint tool does not paint anything itself. Tools under it's branch do.

Surface...
Paint...
Color

Is the main painting tool. It paints vertices with selected color (you can expand it's advanced settings box and change color). "Fill Selection" button can be used to quickly paint selected vertices. This tool respects Pressure and other "Paint..." settings. This is an interactive tool and can only be applied on vertices level.

Note, this tool does not ignores backfacing vertices, so to avoid painting of unneccessary vertices, hide or disable them.

When Alpha Only option is set on, color brightness used for alpha channel. So, painting "alpha only" to white color makes vertices more opaque, and painting to dark or black color will make vertices more transparent.

Surface...
Paint...
Lightness

This tool changes current vertices color's lightness. It's advanced settings Percentage value specify how lightness will be changed. When set to positive value, color will become brighter. When set to negative value, color will become daker. This tool respects all options in "Paint..." box, so to set maximum affection for this tool, "Pressure" should be set to 100, and "Percentage" to 100 (maximum brightness) or -100 (maximum darkness).

Surface\Paint\Saturation tool is exactly the same as Lightness tool, but it changes color saturation. When it's Percentage set to negative value this tool desaturates color.

Surface...
Paint...
Swap Colors

All painting tools affect Diffuse vertices color channel only. If your mesh vertices contain Specular vertices color you have to swap it with Diffuse color, paint it and swap it back. So, Swap color tool can be used on objects to swap diffuse and specular color channels.


Prelit vertices color.

In most of cases, vertices color is used on mesh to add some color variations across the mesh. For example, it's widely used on terrain meshes to add different colors for grass or other landscape surfaces. Then, common texture can be applied over painted surface to achieve different hue across surface. But in certain cases, vertices color can add some darkness to surface so it looks like in shadow. This vertices-based color shadows are widely used, since they do not involve any additional computations in compare to other meshes. Image on the right shows a prelit green terrain mesh and a gray object cast shadow onto this surface. Evenmore, you can disable normals on such a meshes and their rendering will be performed way faster (since no lighting comuptation required). This approach was used in Grand Thieft Auto series games where lots of outdoor rendering was performed.

Surface...
Paint...
Prelit Color

This tool performs vertices prelit, basing on current scene lights settings. If no lights available in scene, viewport directional light is used. The first options you should pay attention to are Force color (Light and Shadow colors). These options can set light and shadows colors when no lights available (so, viewport viewing - is a light direction and these options are colors for light and shadows). Thus, you can set light to a pretty dark blue and shadow to black color: with these colors lighting will look like a soft night moonlight. Image on the right is the same example computed with two lights in scene. Dark blue directional light (moonlight) and a point yellow light (e.g. a streetlamp).

Brightness only option will disable vertex color change and color's brightness will only be affected. So, if certain vertiex is in shadow, it's color brightness reduced. This option can be used when you have painted surface with color (e.g. landscape) and want to add some shading to it (with respect to current mesh color and without regard to light color).

Detect Shadows and Strength option allows prelit tool to detect shadows (either self-casted, or casted by other objects). By default, only polygon's direction to light is used for prelighting, but this can usually produce unrealistic shading. Shadows is what gives realistic look to a rendered image, so consider using "detect shadows" option when preliting landscape or outdoor shapes. Image on the left is the same outdoor mesh object computed with and without shadows detection. It's obviouse that the left image looks more realistic then the right one. One more thing to note is that detected shadows are vertex-based and can be (usually are) very inaccurate. So, consider setting their strength in range 50-80 so that their inaccuracy is not way too obviouse. Also, in order to generate more accurate shadows you can increase detalization of meshes in areas where shadows required and reduce detalization where no shadows will be.