2
$\begingroup$

Using the material node compositor, I need to translate the x and y of the uvs of a mesh (assuming they are ranged from 0 to 1), to the red and green color value of a material.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

In principle, just plugging the "UV" outlet of the "Texture Coordinate" node into the "Color" property of your shader should work. This is because, by chance, your choice of colors (red, green) matches the R, G, B order.


A more elegant and controllable way is in the node setup below. The three nodes in the middle are MixRGB nodes, using the "Mix" and "Add" blend modes. Note: the Fac: value for "Add" must be 1.0.

You may want to swap red ↔ black and green ↔ black, as currently higher X/Y values give lower red/green intensities.

suggested setup and result

$\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.