Grayscale the world terrain tileset?

Hello All,

In Unreal there is a technique to Styling my texture by Dot Node, It will turn the color texture become Grayscale, and this technique won’t work for the terrain tileset. I Just wonder is there a way to Styling my world terrain tileset to be Grayscale instead of Color?

Thanks in Advance.
-Atritt

Hi @Atritt,

You can do this with a material. If you haven’t yet, I’d recommend checking out the Material Editing tutorial.

I tested this out and came up with two options for a greyscale material.

  1. For a simple (but not necessarily accurate) material, you can just mask out two of the channels of the base color, which results in a greyscale terrain.


    I made the modification in the material layer blend - you just have to add one node.

    This is slightly inaccurate since it discards the color information for the red and blue channels, but it may not matter for your application.

  2. A slightly more accurate option is to take the average of all the channels. This uses all of the channels so it should be somewhat more accurate. It’s a pretty small difference but it might improve the look in certain areas.


    Here’s the node graph for this one:

Let me know if you have any questions!
-Alex

Yeah, this time It work. the simple one just fine. and there is a little question.

I have checked out the tutorial you referenced, actually i read it before, it said that I can set the material to blend 50% Red on the Tile in Material Layer like this.

So my simple thought was maybe I can get the material base color and break it to single channnel which is Grayscale, then put it into the base color, but it result to a black terrain when opacity is 1, and below 1 it will no effect at all regardless the value.

There is a little bit comfuse, and in order to do this i have to modify it in the Blend Asset instead of Layer Asset ? maybe there is something I do not understand yet.

Thanks for you reply!
-Atritt

and hey by the way, I saw the little cake after you id, realizing that is your anniversary day you joined this community, congratulation! Best wish for you, you guys All are amzing!

1 Like

Hi @Atritt,

That’s a good question - it took me a while to wrap my head around when to use a material layer blend vs a material layer. I realize I never wrote that down in the tutorial, so I took some time to write it out here. Apologies if this is more than you were asking for!

Think of the material layer in your first picture (that blends in red) as a whole new layer on your tileset. As a metaphor, adding that material layer above the first Raster Overlay layer (Overlay0) is like putting a piece of red paper over a picture of a map. The layer itself can not access information that is not directly specified in its node graph, so accessing the base color in the material layer like you did results in black because there is no information in that channel. (Note that there IS a way to do it in the Material Layer, but it’s generally not a good practice - see my third point below)

The Blend Asset can get around this limitation because it can access the information of the layer it is applied with, and the information of the layer below it.

So there are actually three ways that you could modify a tileset’s imagery. None of them are really right or wrong, which makes it confusing.

  1. You can modify the imagery through the Material Layer Blend as I showed above. In this case, you’re modifying the Top Layer of the MLB, which means you’re modifying the Material Layer used with this Material Layer Blend. You would put this MLB in the Blend Asset slot of Overlay0, since Overlay0 is where the default imagery is.

    This is what I recommended just because it’s the simplest option. If all you want is a grey terrain, you can delete all the layers above Overlay0.
    This is also what we recommend when using Polygon Raster Overlays/Cartographic Polygons.
  2. Option 2 is modifying the Material Layer Blend, but doing it additively from the layer above. In this option, since you’re trying to modify the layers BELOW, the node graph would look slightly different:

    Notice in this node graph that the work is being done from the Input Bottom Layer, rather than the Input Top Layer as in my original example.

    This one must be applied on Overlay1. You probably shouldn’t do this if you’re just looking for a general grayscale effect, since it adds an extra layer that you otherwise wouldn’t be using. But it might be helpful in certain circumstances, like if you wanted to combine the red effect on a layer with greyscale, for example.
  3. You can also do it by modifying ML_CesiumRasterOverlay. This is how you can do it in a Material Layer like you tried. If you wanted to do this, you would need to duplicate ML_CesiumRasterOverlay, then insert the greyscale node into your duplicated overlay.

    This is not recommended because it involves duplicating all of the Raster Overlay sampling code, which introduces unnecessary overhead. There’s also a higher risk of accidentally modifying the core plugin materials, which could cause all sorts of problems.

So, to summarize -
You can modify a material in the Material Layer OR Material Layer Blend, but doing it a certain way may be better for performance and a smoother workflow. In general, we suggest:

  • If your custom material requires sampling a Raster Overlay(for example, to use a Cartographic Polygon, or modifying the look of satellite imagery to make it appear grayscale), modify the Material Layer Blend.
  • If your custom material does not need to sample a Raster Overlay, modify the Material Layer.

I hope that this made sense - writing it out helped me to understand it better. Let me know if you have any further questions.

Also, thank you for your kind words! I’m really glad to hear you appreciate our work, the plugin has come so far since I joined a year ago. :slight_smile:

-Alex

1 Like

Wow! thanks for these note, that’s exactly what I am trying to figure out!

  1. As the result of becoming black, I AM considerate that probably is the layer node has no Information in it, so natually i have to dive into the background layer(ML_CesiumGltf) and trying to find something useful. But I found that is not a traditional Imagery texture in the base color, it is some receiver that streaming data from Cesium server, so I had no idea how to get those informations of channel.

  2. I did the Cartographic polygon tutorial before, but I’m just roughly passed it not get any further, and didn’t realize that i can get the information I want from THIS node. my mistake, apologies for that.

  3. Reading your expernation of mertial layer and these techniques that you were mentioned above, now I’m understand the affect between Layer and Blend Asset for now, it is really useful!! And I have thought about what if I wnat to combine some color effect on a layer with Grayscale(haha). well, your are further than me.

now I just have to do some experiment or tewak those graphic little bit and see what will happend, if I have any questions I will post it. Well done for these addition, thanks again!

-Atritt

No problem! Good luck with your material editing. If you create something cool that you’re able to share, I’d love to see it!

-Alex