---
title: "Texture Randomization"
canonical: "https://rmanwiki-27.pixar.com/space/RU/637272149/Texture%20Randomization"
format: markdown
---
![RenderMan_SprayCans_Header.jpg](media://6ad29e3e-7942-4218-af32-e7062340792f)

![DownloadButton2.png](media://b3f05aad-63c2-4e96-b40f-a5adb5c6e68b)

RenderMan features several nodes that can provide random texture colouring, file selection, and random orientation/placement.

The two nodes we’re going to take a look at are the [PxrVary ](https://rmanwiki-27.pixar.com/space/REN27/542225490/PxrVary)node and the [PxrRandomTileManifold ](https://rmanwiki-27.pixar.com/space/REN27/542224582/PxrRandomTextureManifold)node.


![RenderMan_SprayCans_Dull.jpg](media://6effe6c1-d474-41e1-8336-e3b1273c756e)

In this example, we have seven spray cans, and at the moment, they look pretty dull.  

Our goal in this lesson is to create lids for each can in random colors.

We also have seven different labels we’ve designed and want to apply them to the cans’ labels randomly.


> ℹ️ <span style="color: #ffffff">**Spray Can Colored Lids**</span>

Let’s tackle the lids first, using an incredibly useful randomization node called PxrVary.  

This node takes a base color (or colored input) and allows for hue, saturation, gamma, and many other parameters per instance to have random values.

Let’s start by connecting a PxrVary into the Diffuse color of our PxrSurface and set the Input Color to a bright orange.  

![SprayCans_AllOrange.jpg](media://b67b3629-4f12-4481-933a-0ce5a89de110)

This will turn all the lids to the same orange color, which is not what we want.  

We want each lid to have a random color.

Adjusting the following values yields the image below.  


![SprayCansCans_PxrVary_one.jpg](media://95d8f214-c62e-4702-977f-19e8860bdabf)

This looks ‘ok’, but we don’t really want to let RenderMan decide on which random colors to choose.  We want to choose them ourselves.  

We wish to art-direct the color palette from which the PxrVary will randomly select colors.

The way to achieve this is to use a PxrRamp node, from where we set our ramp colors.  We also need to set the Ramp Type to Random Object Color.

![PxrRamp_Palette.jpg](media://67b349d9-f225-4a3b-81e6-5586a454ff42)

![SprayCans_Network.jpg](media://d7cf03d0-6eff-4e35-971b-d800cce1d661)

> ⚠️ Gotcha! This technique will only work if you set the **Ramp Type** to** Random Object Color.**


![SprayCansCans_PxrVary_Ramp.jpg](media://560e7a53-8aa3-490c-8641-d73f69923fab)

It’s helpful to understand that this is a random node, so at times it can be tricky to art-direct which lid gets which random color.  Sometimes, as you can see, the PxrVary will randomly assign two lids the same color.

Also, the width of the colors in the ramp determines random assignment and probability, so it can be a little tricky to dial in the exact random look you’re going for.  

The keyword here is Random!

If you had 100 cans and didn’t really care which lid had which color, then the PxrVary is the solution for you, but if you needed particular cans to feature specific colored lids, then defining a PrimVar value to each can (and then specifying the PrimVar name in the PrimVar attribute on the PxrVary) is the way, but that’s for another lesson.

We asked for random-colored lids … and we got random-colored lids.

Let’s move on to working on the labels next.


> ℹ️ <span style="color: #ffffff">**Spray Can Labels**</span>


Here we have several textures we want to assign to each label, again randomly — we don’t really mind which goes with which label.  We want it random!

![SprayCans_Labels.jpg](media://8a1b6cd3-958c-486b-a995-6dc393246559)

There are two nodes we need to achieve this.

The first is the PxrMultiTexture node, which we’ll load in all the maps into each filename parameter.

![SprayCans_Label_MultiTexture.jpg](media://b4264359-bc76-4a2e-9d56-64a91dead031)

Then, we need a PxrRandomTextureManifold node to control the randomness of the PxrMultiTexture files by assigning them to our cans.

![SprayCans_Label_RandomManifold.jpg](media://7d29ba4a-2478-4438-abac-01f90599d666)

![SprayCans_Network_Label.jpg](media://7955613b-53dc-4890-97aa-7fd841a967b2)

Connecting them up like the network above will give you a result like this!

![RenderMan_SprayCans_Header.jpg](media://6ad29e3e-7942-4218-af32-e7062340792f)


> ℹ️ Note: You need to set the** Number of Textures** parameter to the number of textures in the file list you want to use.


The PxrRandomTextureManifold has a variety of other parameters that can be tweaked to add more randomization, such as random texture orientation, flipping, offset, and many more, so the amount of texture randomization is … endless!


> ℹ️ <span style="color: #ffffff">**Further uses**</span>

Both of these nodes aren’t just for randomly choosing colors or diffuse textures.

For instance, the PxrRandomTextureManifold can also be used to randomly assign and transform roughness/bump maps, layer random textures, transform random edge breakup masks, etc.

The PxrVary can be used to add random color/saturation variation to roughness maps, so each instance has different roughness values.  The same technique can be used to set random bump and specular values, as well as to control random thickness on a clear coat.  

The possibilities of both these nodes are endless.

![Rfb_Instancing.png](media://08dc763d-dfbd-4cc3-9785-42ea9046142f)

![Weave.png](media://809a082a-72b3-46ad-b659-323df0bb4246)


If you want complete shading randomization across all your instances, these two nodes are a good place to start!