1
$\begingroup$

I have a cube (A simple example) I have used a displacement texture (which creates an uneven surface on my cube).

I want to make the lower parts of the displacement use a different texture to the higher parts. (Imagine scratching away the surface to reveal a different material below).

I have set up a material node system with two images textures and a mix shader, but not sure how to drive this so that I can define what parts of the displacement are linked to each image texture.

Thanks for anyone who can help

$\endgroup$
0
2
$\begingroup$

Sorry if I misunderstand the question, but you should be able to just use the Displacement texture itself as a mix factor - the black areas of the texture (< 0.5 grey) will represent one texture, and the white areas (> 0.5 grey) will represent the other. You can add a ColorRamp to give better control over where, and how suddenly, the "transition" happens, and if you set it to constant , you can make the cutoff more clearly defined (though there will be no interpolation). The image below mixes a moon-rock texture with a (very zoomed in) red carpet texture (because, why not?), using a simple Perlin Noise texture as both the mask and the displacement factor:

DisplaceTex

Noise texture used for displacement: Noise

If you need, you can also mix full PBR sets as well - just use a Mix Shader for your Principled BSDF's instead of a MixRGB for the images. Note that in the image below, I changed the interpolation of the ColorRamp to Linear to give a more smooth transition between the two materials. Pick whichever one works best for you:

DisplaceMaterials

$\endgroup$
1
$\begingroup$

To do literally what you ask, use an RGB mix node. Plug the image you want on top into the top input and the image you want on the bottom input. Feed the Object coordinate of a Texture Coordinate node to a Separate XYZ node. Feed the Z output of that node to a math mode set to Less than. Set the threshold to 0.

The math node will return 0 for the lower half of the cube and 1 for the upper half, so the Color 1 input will select the top image for that half of the node. Here's a picture of a similar material. Just substitute your Image textures for my Wave and Noise textures.

material using different methods for displacing the top and bottom half of a cube

Cube that matches the example

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.