Recent project requirements make a vision part of a scene. Just try to use UE4 's Landscape. But directly in the Editor to brush the terrain is too much work, brush out the terrain is not real, the most important thing is that the Landscape tool is not so useful.
So we decided to use Worldmachine as a tool for terrain generation, to import the height map of the terrain into editor, and then to modify the details in the editor. Worldmachine generated by the height of the figure is relatively artificial to real, the most important thing is fast, use it to find the slope, gully more accurate.
The use of Worldmachine in UE4 also solves several problems. The official wiki will be very clear. Unreal Engine 4-in Depth Guide
Issue 1: Height chart size
The height map of the UE4 has some limitations, which are related to the organization of the UE4 topography system. Each pixel in the height map corresponds to a vertex of the terrain system. UE4 's topography is organized into 3 layers: Components component
, Segments section
, quads quads
. Landscape Technical Guide
The quads are the smallest units of the terrain system, each of which corresponds to 4 vertices.
The segments are composed of quads and are the smallest units of drawcall and LOD. because the LOD is to be done for each segment individually, the height graph needs to be mipmap, so the height of each segment is a power of 2, which can be an 8x8 to 256x256 middle. Each quadrilateral in the segment shares vertices, so the number of quads on each side is x-1.
Components consist of segments, each of which can have only 1x1 or 2x2 segments. components are the basic units of rendering, visibility, and collisions. the number of components per side can be one of 1 to 32, and the length and width can be different. The more components, the greater the CPU consumption.
Understanding the above relationship, the size of the height map can be calculated. However, the recommended method is to adjust the component and segment options in the Editor to get the dimensions of the height map.
Height Chart Size
The height of the dimension is 505x505.
Question 2: World size
The second problem is figuring out the actual world size of the distance in the terrain system. The distance between vertices in the normal terrain system is 1ued, representing the actual 1cm, but you can see that the scale is (100, 100, 100) when created. So the distance between vertices is 1m. The height range of the terrain system is 255 to 257, and the unit is m at scale = 100. If you want to set in the height figure 1 pixels corresponding to 1m, then the Worldmachine setting is, the resolution 505x505, Width is 505m, High is 505m. The setting of the altitude is set to 512m since World machine starts at 0.
Resolution, wide, high
Height
The next operation is to make a diagram in the Worldmachine and import the Editor. Worldmachine By default are km-level, can be magnified 100 times times, easy to operate in the worldmachine.
Issue 3: Terrain material
The terrain material is mainly to understand the meaning of the 22 blending modes of Layerinfo and the 3 kinds of mixing types in the material.
Layerinfo 22 Blending modes: Weight-blend (normal), No weight-blend
Weight-blend (normal), No weight-blend
Weight-blend layer Weights and 1, adding a layer of weight, the weight of the other layers will be reduced. The layers of No weight-blend calculate weights separately and do not affect other layers.
The layer of the No Weight-blend calculates the weights separately
In the figure, the red and blue sections are weight-blend and the green ones are No weight-blend. First, brush red, then blue, green. The blue part covers the area of the red part, and the weight of the red part becomes 0. The green portion of the area covered by the red part of the weight did not change.
Lb_weightblend,lb_alphabland,lb_heightbland
Weightblend and Heightbland are all weights mixed. The weights of the different layers on the same pixel are 1. But Heightbland provides a height map. Produces an effect at the boundary.
Heightbland
Weightblend and Heightbland are unordered, reducing the weight of one layer, the weight of the other layers increases, but the increase is not certain.
The Alphabland is ordered, as if one layer is covered, and the lower layer is exposed. The official documentation is not detailed here. Check the code.
int32 UMaterialExpressionLandscapeLayerBlend::Compile(class FMaterialCompiler* Compiler, int32 OutputIndex, int32 MultiplexIndex)
Their relationship should be the same.
Blend formula
W is the weight, color is the colour of the point, Alphabland is mixed at the end, and each Alpha layer is lerp once, in a variable order.
Original link: http://www.jianshu.com/p/f0feccb546f2
Ue4 Worldmachine Combined Use