# Is there a way to 'extract' just the black and white info in material editor?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849>\
**Category:** Rendering\
**Tags:** unreal-engine, displacement, question\
**Created:** [January 22, 2019, 5:59pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849 "2019-01-22T17:59:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![popculturereference](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@popculturereference](https://forums.unrealengine.com/u/popculturereference)\
**Post date:** [January 22, 2019, 5:59pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/1 "2019-01-22T17:59:51Z")

</div>

I really don’t know how to word this well, so excuse the fact that the title is more or less word salad.

**Here is the situation:** I have two displacement maps, both which have been messed around with in the texture\_bombing node, then they’ve been lerped with a mask.

I was wondering if I could take the finalized texture, and essentially ‘flatten’ it, as in: extract only the black/white values from the texture and ignore any of the preceding math. I ask because of the displacement map issues that pop up when trying to use the texture\_bombing nodes, and am trying to get the displacement map blend result I want, while circumventing the DDX/DDY issues.

I’ve tried going into the texture\_bombing material functions (both the main one, and the one it references) and manually altering the mipValueMode so that I can plug the results directly into the Displacement node on my main material. Unfortunately, this ends up breaking the material functions and leaving me back at square one. I am so happy with the results I’m getting from the texture\_bombing node regarding my other maps (Albedo/Roughness/Normals) and it’s a huge bummer that I can’t seem to get the displacement map working.

Any insight would be super helpful. I’m not overly concerned about performance in this instance, just results.

---

<div class="post-metadata">

**Author:** ![SavvyIndoorsman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SavvyIndoorsman](https://forums.unrealengine.com/u/SavvyIndoorsman)\
**Post date:** [January 22, 2019, 7:26pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/2 "2019-01-22T19:26:39Z")

</div>

Just to clarify, which are you trying to get?

1. a grayscale value for your color input, e.g. colors become gray? or…
2. a masked version of your input, where only values are passed through if the masking color is exactly black or exactly white at the corresponding texture coordinate?

---

<div class="post-metadata">

**Author:** ![popculturereference](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@popculturereference](https://forums.unrealengine.com/u/popculturereference)\
**Post date:** [January 22, 2019, 7:58pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/3 "2019-01-22T19:58:53Z")

</div>

The first one. I’m ultimately trying to circumvent the issues with using texture\_bombing on the world displacement attribute by trying to use texture\_bombing to essentially ‘calculate’ what the greyscale values of the heightmap should be.

---

<div class="post-metadata">

**Author:** ![SavvyIndoorsman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SavvyIndoorsman](https://forums.unrealengine.com/u/SavvyIndoorsman)\
**Post date:** [January 22, 2019, 8:28pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/4 "2019-01-22T20:28:43Z")

</div>

It’s quite possible that I’m not smart enough to help you with this one, because I haven’t spent a lot of time playing around with displacement mapping in materials, but at the risk of sounding stupid, I wonder…

Does the [Desaturation](https://docs.unrealengine.com/en-us/Engine/Rendering/Materials/ExpressionReference/Color) node somehow not work for your use case?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [January 24, 2019, 12:23am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/5 "2019-01-24T00:23:13Z")

</div>

You can not extract white and black (aka grayscale) information because there so such data, color operate in GPU as 4-axis vector creating Red, Green, Blue and Alpha information, and this is only information you can accurtly extract without any math calculations, it is easy to extract that information if image is already in grayscale as all you need to do is just extract single color channel.

Problem with calculation grayscale from color is that it can have different interpretation of brightness, the easiest way is just use Desaturation node which do grayscale balancing, other would be converting color to HSV (Hue, Saturation, Value) format using RGB to HSV and use value.

---

<div class="post-metadata">

**Author:** ![Roadified](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roadified/32/566435_2.png) [@Roadified](https://forums.unrealengine.com/u/Roadified)\
**Post date:** [April 1, 2022, 11:41am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/6 "2022-04-01T11:41:27Z")

</div>

For anyone in the future. If you are looking how to grayscale image math is simple: (r+g+b) / 3.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 28, 2024, 8:21pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-extract-just-the-black-and-white-info-in-material-editor/441849/7 "2024-02-28T20:21:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
