Patch Editor
Render Pass Patches
Shader Render Pass Patch

Shader Render Pass Patch

Render one or more visual shaders or textures, creating complex textures formed of multiple images.

This patch is particularly useful for:

  • Doing complex visual shader computations at a lower resolution to improve efficiency.
  • Storing data in a buffer (an intermediate stage of shader processing), ready be used at the Size specified in the patch.

Inputs

NameDescription

Size

Set this to edit the size of the texture output. For fixed sizing mode this is in pixels. For relative sizing mode this value is a factor relative to the screen, camera or background.

Sizing Mode

Set whether the size of the output texture is fixed or relative to the screen, camera or background.

Color Channel

The selected combination of color channels. Choose from RGBA, RGB, RG or A.

Shader

Connect a visual shader or texture here.

Output

NameDescription

Image

The output is an image. It can be connected to another Shader Render Pass patch, a Scene Render Pass patch, visual shader network or the Screen Output patch.

Previewing the output

You can see a preview of the output at the bottom of the patch. In the example below, changing the color value in the Mix patch adjusts the output of the Shader Render Pass patch it’s connected to. A preview is shown at the bottom of the Shader Render Pass patch:

Click the arrow in the bottom-right corner of the patch to see the preview area.

Example

This example uses the Shader Render Pass patch to add blur the camera texture and add a color filter:

A simple visual shader graph creates the colorful filter. It’s connected to the Shader input in the Shader Render Pass patch. The Shader Render Pass patch is then connected to a patch representing the Screen Output property of the Device scene object. In the Shader Render Pass the Size values are set to 0.1 and 0.05, rendering the camera texture at lower resolution to create the blurred effect.

Optimization

For efficiency it’s important to add Scene Render Pass patches intermittently in your patch graph. Usually it’s a good idea to add them after a particular stage in the graph. Too many will also impact the performance of your effect.

Use Spark AR Player to check the frame rate on different devices to get the balance right. You can also check the effect size in Spark AR Studio.

Was this article helpful?