Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RendererListParams

A low-level struct holding the arguments needed to create a RendererList.
Read time 2 minutesLast updated 5 days ago

Definition

public struct RendererListParams : IEquatable<RendererListParams>

Remarks

To create a RendererList object, fill this struct and pass it to ScriptableRenderContext.CreateRendererList.
Alternatively, if you use the render graph system, pass this struct to RenderGraph.CreateRendererList. For more information about RenderGraph, refer to The render graph system .
In terms of usage, this struct is similar to RendererListDesc, only lower level and more closely tied to engine internals. Use this struct instead of RendererListDesc if you need access to advanced properties such as FilteringSettings.sortingLayerRange.
The example illustrates how
RendererListParams
can be used. Follow these steps:
  1. Save the example code in your project as
    SimpleRenderPipelineAsset.cs
    .
  2. Use the
    RenderPipeline/Create SimpleRenderPipelineAsset
    menu item to create the render pipeline asset.
  3. Go to Project Settings > Graphics, and assign the created asset as the Default Render Pipeline Asset.
using System.Collections.Generic;using UnityEngine;using UnityEngine.Rendering;public class SimpleRenderPipelineAsset : RenderPipelineAsset<SimpleRenderPipeline>{#if UNITY_EDITOR [UnityEditor.MenuItem("RenderPipeline/Create SimpleRenderPipelineAsset")] static void CreateSimpleRenderLoop() { var instance = CreateInstance<SimpleRenderPipelineAsset>(); UnityEditor.AssetDatabase.CreateAsset(instance, "Assets/SimpleRenderPipeline.asset"); }#endif protected override RenderPipeline CreatePipeline() => new SimpleRenderPipeline();}public class SimpleRenderPipeline : RenderPipeline{ protected override void Render(ScriptableRenderContext context, List<Camera> cameras) { foreach (var camera in cameras) { if (!camera.TryGetCullingParameters(out var cullingParams)) continue; CullingResults cullingResults = context.Cull(ref cullingParams); context.SetupCameraProperties(camera); var cmd = new CommandBuffer(); cmd.ClearRenderTarget(true, true, Color.red); // Draws visible MeshRenderers that use the built-in Default-Material/Default-Diffuse material. DrawingSettings drawingSettings = new DrawingSettings(new ShaderTagId("ForwardBase"), new SortingSettings(camera)); FilteringSettings filteringSettings = new FilteringSettings(RenderQueueRange.opaque); var rendererListParams = new RendererListParams(cullingResults, drawingSettings, filteringSettings); var rendererList = context.CreateRendererList(ref rendererListParams); cmd.DrawRendererList(rendererList); context.ExecuteCommandBuffer(cmd); cmd.Release(); context.Submit(); } }}

Fields

Value

Description

cullingResultsThe set of visible objects to draw. You typically obtain this from ScriptableRenderContext.Cull.
drawSettingsA struct that describes how to draw the objects.
filteringSettingsA struct that describes how to filter the set of visible objects, so that Unity only draws a subset.
isPassTagNameIf set to true,
tagName
specifies a Pass Tag. Otherwise,
tagName
specifies a SubShader Tag.
stateBlocksAn array of structs that describe which parts of the GPU's render state to override.
tagNameThe name of a SubShader Tag or Pass Tag.
tagValuesAn array of ShaderTagId structs, where the name is the value of a given SubShader Tag or Pass Tag.

Static Fields

Value

Description

InvalidReturns an empty RendererListParams.

Constructors