Terrain Painting (Layers and Shader)

Hi to all !

I finally realize that I need help regarding Terrain Painting. I read Lumberyard and CryEngine documentations, but no clarity has been gained.

I. As I understand there are at least three different entities that affect terrain color:

a) “Layer Texture” that is set to terrain layer in Terrain Texture Layer Editor.

b) Color from texture that is set as Diffuse map in material (assigned to the terrain layer)

c) Layer “Color” from Layer Painting Tool

And the questions are:

  1. The main question is how does Terrain Layer Shader mixes this colors, what is the formula?

  2. As it is described in documentation, “Layer Texture” is used for distance view of terrain, but as I tested its max resolution is only 512x512 and its one tile is stretched at whole terrain, so actually this layer absolutely useless as in fact it provides extremely low resolution.

Moreover in all documentation it is recommended to use grey 2х2 px. texture, so what is the purpose of this layer? As i see it only distorts the final color. Why dont to use just white?

  1. As example for “Layer Texture” i use black-white texture like this:

i use default grass1 and in material shader params “DetailTextureStrenght” is equal to 1 (or even 2). But black areas remains black and I can’t understand how does DetailTextureStrenght works, what is a math of blending?

  1. At shader documentation page “http://docs.aws.amazon.com/lumberyard/latest/userguide/shader-ref-terrain-layer.html” it is said at the beginning:

“The Detail normals texture is not an external texture, but rather a texture generated by Lumberyard through code.”

What normal texture it is meaned? Am i right that “normal map” from material “texture maps” section is still usable?

  1. What are effects from “Blend factor” and “Blend Faloff” params from material “Shader params” section? I tried different values, but didn’t notice any effect. Can anyone show an example?

  2. Abit stupid question: are Terrain Painting lessons from CryEngine 3 documentation still actual?

For example I tried to reproduce this documentaion:

http://docs.cryengine.com/display/SDKDOC2/Creating+Terrain+Textures+and+Materials

If I use exactly the same params as in lesson then i gain different effect, but changing Layer Color very close result could be acquired. I mean that it seems that Shader math was changed and the the question is how much?

Thank you for answering if someone decide to read all this :). I will be grateful for any links to documentation or lessons that will help me in understanding.

Hi @geotype, thanks for taking the time to make such a detailed post. I’ve filed a ticket with the tech and art team to see if they can hop in here and help you out.

@geotype

  1. The Terrain.Layer Shader is required for all materials that will be on the terrain.

  2. Use the Blend Factor and Blend Falloff to control how the material blends with materials below it. You need to also use a Height Map to get this to work correctly.

  3. Also, your terrain diffuse texture should be a high-pass texture as noted in the documentation.

  4. The texture you see at distance should be the Megaterrain Texture. This texture can be very large. I have used up to an 8k texture here, but it will take a long time to import. If you want to experiment with this, I suggest using a smaller 2k or 4k texture until you have a result that you are happy with then go larger.

  5. Game / Terrain / Export/Import Megaterrain Texture
    1. Select the sector and then click Change tile resolution. Set this to the resolution of your Megaterrain texture.
    5043-import-megaterrain-001.png

  6. The Terrain Texture Layers are the textures that you will see up close. For example, when your character is walking on the terrain. In the distance, you will see the Megaterrain Texture.

  7. This texture is generated by code.

  8. See my explanation for Step 1. This will only work if you have a Height Map.

  9. There are no stupid questions! While some things from older documentation might work, I would not expect them to work the same anymore. Lumberyard has changed a lot.
    I hope this is a big help to you, share your results with us!

@BigMonet, thank you for your answer!

But I’m still have misunderstanding about math of color mixing between “layer texture”, layer mateial diffuse color and “layer color”.

I have noticed that both “layer texture” and “layer color” form texture that is shown from far distance (in accorance with “detail texture view distance” parameter) by color mixing through simple muliplication. For example if layer texture has color RGB(0.5,0.5,0.5) and layer color is RGB (1,1,0.5) then final color will be RGB(0.5,0.5,0.25). And this is ok.

But in close range both this layers also mixing with material diffuse texture color based on material/shader params/ “DetailTextureStrength” parameter (ranged between 0 to 2).

And I can’t understand formula of that mixing and so to predict final color. Could you please clarify that mixing formulas?

Hi @geotype, I’ve updated the ticket with this information to help get you some clarification.