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

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.

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?

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.

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 node somehow not work for your use case?

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.

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

12 Likes

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