Trunk Detail Material

Overview

This page describes the general workflow in using the trunk detail material for Atlas. The material will create a mask based on the U dimension so we can isolate the trunks of a particular tree. This isolated section will then use a series of tiled textures blended together using a mask texture that is unique for each tree.

Reference

MaterialInstanceConstant’/Game/Atlas/CoreMaterials/MasterMaterials/MIC/MM_Foliage_Leaves_DetailBlend_MIC.MM_Foliage_Leaves_DetailBlend_MIC’

MIC Parameters

Global Detail

Detail Weight: Controls the amount the CNR textures influence the unique texture. This affects the normal map as well. Generally this should be left at 3 and should not be changed. DetailMask: The grayscale texture that will be used for blending the three CNR textures. Black will be layer-0, grey will be layer-1, and white will be layer-2. DetailMask Debug: Enables a visualizer with RGB colors that shows you how the CNR textures are being used. Useful to also see when the original composite texture lerps in. LightVectorMask Debug: Another debug visualizer that shows a mask based on sun vector. This is used for reducing the CNR normal intensity on areas facing the sun. Sunside Detail Normal Intensity: This will reduce the CNR normal intensity on parts of the trunk that are facing the direction of the sun light. Creates a more pleasing result. In general you should not have to change the default float of 0.5. Trunk Distance Factor-Far: Controls when the CNR texture contribution fades out and the material just uses the composited texture from SpeedTree. Makes sure that it blends well with the billboards. Trunk Distance Factor-Near: Controls when the CNR texture contribution fades out and the material just uses the composited texture from SpeedTree. Makes sure that it blends well with the billboards. Trunk U Max: This controls the lower U value for the trunk UVs. It’s also used for masking the trunk off so that the CNR textures are only applied to the tunk. Trunk U Min: This controls the lower U value for the trunk UVs. It’s also used for masking the trunk off so that the CNR textures are only applied to the tunk. Use Custom Trunk Mask: If you need to extend the CNR texture contribution to branches, etc set this to True. It will then allow you to specify a custom mask. Do not change Trunk U Max and Trunk U Min. Those will still be used to handle seamless texture tiling along the trunk, UV Tiling Override: When set to False the CNR texturing will all be done in the material. Probably Will be best to leave it as True for now.

Detail-[0-2]

Detail-[0-2]: CNR texture for detail. Info on creating them can be found here. Detail-[0-2] UV Tiling: Controls the UV tiling of the CNR textures. Defaults to 5 for both U and V. U always rounds up to the nearest integer to preserve texture tiling across the trunk. Detail-[0-2] Tile Y Ratio: Added in case needed for non square textures. Detail-[0-2] Angel: Allows you to rotate the CNR texture. Detail-[0-2] Normal Intensity: Controls the intensity of the CNR texture. Detail-[0-2] Roughness - Max: Max roughness for CNR texture. Defaults to 0.5. This blends with the composite texture from SpeedTree. Usually you will want to leave the default value. Detail-[0-2] Roughness - Min: Min roughness for CNR texture. Defaults to 0. This blends with the composite texture from SpeedTree. Usually you will want to leave the default value.

Asset Requirements

There are essentially three things that will be needed for an asset that uses this material. You will need a texture mask which controls where each CNR texture is blended, appropriate CNR textures (These can be shared so as time goes on we should need less of these), and the precise U coordinates for the extreme edges of the trunk UVs. These are the parameters Trunk U Max and Trunk U Min under Global Detail.

DetailMask

../_images/Mask.png

Texture mask Texture mask built off of the composite texture from SpeedTree. Depending on the Trunk U Max and Trunk U Min settings not all of the mask might be used. You will also want to make sure it tiles across the trunk.

CNR Textures

Shared CNR textures should be imported here in engine: Game/Atlas/Environment/Shared/TilingTextures/Detail/ Info on creating CNR textures can be found here. They usually work best when the red channel (Color ) has a lot of contrast.

Trunk U Min/Max

You will need to export a tree out of Unreal and import in Maya. Once in Maya open the UV editor, select one of the far left vertices for the trunk and enter the following mel command: polyEditUV -q. This will output the UV coordinates for that vert to the log window. You only need the U coordinate. Enter this float as Trunk U Min. Select one of the far right verts of the trunk and run the command again. Enter this U value for Trunk U Max. Make sure to enter the full number. You will want the precision!

Result

../_images/Before.png

Before

../_images/After.png

After