A dash of post-processing, a cup of decals, a pinch of color grading, and some sparkling water: Our new Universal Render Pipeline (URP) cookbook is coming soon. Here’s a sneak peek at what’s on the menu.
URP is the successor to the Built-In Render Pipeline. It provides Unity creators with flexibility and customization, enhanced performance across a range of platforms, and the ability to iterate more quickly.
Our upcoming guide, The Universal Render Pipeline cookbook: Recipes for shaders and visual effects, helps you harness the many capabilities of URP. You can now preregister to be notified when the guide is available.
This handy cookbook provides 12 recipes for popular visual effects that can be applied to a wide range of games, art styles, and platforms. You can use it alongside the Introduction to the Universal Render Pipeline for advanced Unity creators guide.
In the meantime, here’s a taste of what you’ll find in the cookbook: A recipe for using one of the post-processing filters available in URP for color grading.
If you’ve yet to use the post-processing filters available with URP, you’re in for a treat. This recipe involves using one filter, but the steps employed apply to all of them. Using LUT Textures is an efficient way to create dramatic color grading, and this approach can be useful in many games.
By default, a new URP scene has post-processing disabled, so make sure to enable it via the Camera > Rendering panel.
Additionally, you’ll need to enable post-processing in the Universal Renderer Data asset.
To apply the filter where the camera is located, add a Global Volume. Right-click the Hierarchy window and select Volume > Global Volume.
Select the new GameObject, and create a new Profile by clicking New.
Now you can add an override. Press the Add Override button, select post-processing, then choose Color Lookup.
Click the All button. Now you need a LUT (Lookup Table) image texture. This is a strip image that will be used by the filter to change the default rendered colors. You’ll find the image file in Scenes > LUT > NeutralLUT.png, or you can download it using this link.
A LUT image must have sRGB (Color Texture) disabled, which you do by selecting the image and viewing the Inspector.
Count the blocks in the NeutralLUT image above, and you’ll find there are 32 of them. Alternatively, you can use 16 blocks. Whether you choose 32 or 16 blocks, ensure the settings for your URP Asset match your choice. If you choose 32, make sure the post-processing panel has LUT size set to 32. Feel free to experiment with the Grading Mode option.
If you assign NeutralLUT.png as the Lookup Texture using the Color Lookup settings panel, you’ll see no change to the rendered image. The filter uses the texture to set a new color. The code takes the current pixel color and uses this to find a texel on the LUT image. With a neutral LUT image, the texel color will be the same as the current pixel color. The real magic occurs when you process the image you use as the Lookup Texture using a paint program like Photoshop or Krita. Explore these resources to learn more:
Take a screen grab of your scene and open it in Photoshop. At the bottom of the Layers panel, find the half black/half white circular button. Select it, and in the panel find Gradient Map. A new color adjustment layer is added.
To create a color adjustment layer that results in a high-contrast black-and-white image, click the Gradient Map drop-down and select Basics, black and white.
To boost the contrast click the gradient to open a new window. Use the stops to adjust the contrast.
The screengrab should now look black and white.
Once you have the grading of your choice, you need to apply this layer to the NeutralLUT.png file. Open the file in Photoshop. Back in the screengrab, right-click the adjustment layer, and select Duplicate Layer. In the new panel, select NeutralLUT.png as the Destination > Document.
Now the texture looks like this:
Save it, and drag it to your project’s Assets folder. Make sure to disable sRGB (Color Texture) using the Inspector panel. The last step is to assign the new LUT texture as the Lookup Texture for the Color Lookup filter.
Stay tuned for more helpful recipes from our upcoming URP cookbook. Sign up to be notified as soon as it’s available.