Working with Color in POPs

Curriculum Navigator:

If you’re viewing this page from the TouchDesigner curriculum explorer, you can use the buttons below to interact with this topic.

Overview:

Color can be calculated (and modified) in POPs in many different ways. One of the most important ways we think about color is through applying materials. 

For example, we might have a Rectangle POP or Grid POP that we want to texture. We can do this by connecting our POP to a Geometry COMP, and then applying a texture with a material (for example, a Constant MAT). This technique will allow us to paint our Grid or Rectangle smoothly with the material regardless of the number of points it’s made up of. 

However, there are also times when we may want to apply a specific color to our points. In this case we typically want to start working with a dedicated attribute for color. In POPs, Color is an attribute called Color that has four components: red, green, blue and alpha. The individual RGBA components are refer red to as Color(0), Color(1), Color(2), and Color(3).

Any of the mechanics for adding attributes can be used for setting the Color attribute in POPs. For example, if we wanted to add the same color to all of our points in a POP, we could use the Attribute POP and add a Color attribute. If we wanted to create a procedural gradient, we might use the Pattern POP to output the result of a pattern into the Color attribute.

In some cases we want to pull color from a texture (image) and associate it with a point. To do this we use the Lookup Texture POP. The Lookup Texture POP will allow us to specify which attribute will be used for our U and V lookup from our texture. In many cases, U and V values are in a range of 0-1, and typically u describe horizontal values, where v describes vertical values. Many POPs come with Texture coordinates, i.e. Tex(0) and Tex(1), and these texture coordinates are commonly used for U and V lookups.

Sometimes color is expressed as the representation of some other attribute – for example, position. In those cases we often want to use a Normalize POP to quickly change the range of values as large as position into a range of only 0-1.


References: