Using detail texture to get the highest quality of realism (more)

  • Tutorial
I offer readers of "Habrahabr" a translation of the publication " Using detail textures for extra realism close-up " from the blog of Unity.

Additional material for this article is a link to

Detail Textures on a texture pattern that will disappear on the surface when the camera gradually moves away. This can be used to simulate dirt, weather, or other similar detail on the surface without adding extra expense when rendering the camera too far to see the difference.

Getting texture


Detail Textures in a black and white image that are used to lighten or darken another selected texture. Where the pixel has a brightness value from 0 to 127 , the image will be darkened ( 0 means maximum dimming), when the value is between 129 and 255 , the image will be lit ( 255 means maximum illumination). A value of exactly 128 is neutral and will leave part of the image (with brightness pixels 128 ) unchanged.

image

If image detail has an average brightness greater than or less than 128, the whole image will appear lighter or darker, this will give the wrong effect when the camera zooms in. Therefore, it is important to make sure that the brightness level in the image is approximately symmetrically equal to 128 . You can check this out in many image editing software by looking at the image histogram or the Levels adjustment (which usually also shows a histogram). If the histogram shows a symmetrical “bulge”, that is, a little bit to the left or right of the center, you can use the “swell” brackets with min / max arrows to adjust the level so that you get a brightness of 128 .

image

To avoid the visibility of frames when a detailed texture is wrapped (wraps) on top of another texture, you should ideally use an image that can be tiled without leaving the borders of another texture. If the image is created using the noise function in a graphics editor, the result will be that our detailed texture will be without artifacts. In addition, filters such as Difference Clouds often have a setting that will result in a quality wrap of the image. Simple effects that can make quite effective detail maps to simulate dirt, grainy surfaces, or erosion.

Detailed texture import settings in Unity


After you have saved the image to a Unity project , you can select it to see its import settings in the Inspector panel .

image

Set the texture type to the value of the Advanced , and then select the option Generate Mip Maps and setting Fadeout Mip Maps are also included. You should see the range knob in the Fade Range parameter ; numerical values ​​for the range are not specified, but the default settings are suitable for most cases. If you decrease the values ​​in this knob, the detailed texture will be visible from a short distance. If you increase this range, it will be visible from a long distance. in fade range indicates the distance at which the detailed texture will gradually disappear until it becomes invisible.

Material for detailed texture


To use a detailed texture, you must set the material using the Diffuse Detail shader using the menu in the Material Inspector .

image

In addition to the base texture , you will see a second window (Detail) to set the detailed texture that you just imported.

Typically, you want to set your Tiling values more (usually set around 10).

Detail material can now be applied to any suitable object to display the effect of detail.

Also popular now: