I’ve started the task of learning how the SRP really works (rather than just modifying the LWRP or HDRP) but there’s remarkably few resources regarding making a RenderPipeline from scratch.
Currently I’m trying to make a very barebones pipeline following Unity Custom SRP Tutorials but this is outdated as of Unity 2019.1.2. I’ve managed to update what I have to a mostly-functional state by trying to cross-reference with the LWRP repository, but documentation is really lacking. There’s actually quite a bit going on in the LWRP.
Currently my actual rendering is going okay but my editor gizmos aren’t showing in the scene view. Is there something I am supposed to call in my pipeline to enable this? The interaction handle dots are rendering, but for instance, my camera’s frustum wireframe doesn’t show, nor do any gizmo icons. These icons DO show correctly when I swap back to the LWRP but I’m having difficulting finding out exactly what part of the LWRP is doing this.
The following are my two main rendering methods in my pipeline:
protected override void Render(ScriptableRenderContext context, Camera[] cameras)
{
GraphicsSettings.lightsUseLinearIntensity = true;
GraphicsSettings.useScriptableRenderPipelineBatching = true;
BeginFrameRendering(context, cameras);
foreach (var cam in cameras)
{
BeginCameraRendering(context, cam);
Render(context, cam);
EndCameraRendering(context, cam);
}
EndFrameRendering(context, cameras);
}
void Render(ScriptableRenderContext context, Camera camera)
{
context.SetupCameraProperties(camera);
ScriptableCullingParameters cullingParams;
if (!camera.TryGetCullingParameters(out cullingParams)) return;
#if UNITY_EDITOR
if (camera.cameraType == CameraType.SceneView)
{
ScriptableRenderContext.EmitWorldGeometryForSceneView(camera);
}
#endif
var cull = context.Cull(ref cullingParams);
var buffer = CommandBufferPool.Get(camera.name);
var clearFlags = camera.clearFlags;
buffer.ClearRenderTarget(
(clearFlags & CameraClearFlags.Depth) != 0,
(clearFlags & CameraClearFlags.Color) != 0,
camera.backgroundColor
);
context.ExecuteCommandBuffer(buffer);
buffer.Clear();
var drawSettings = new DrawingSettings(new ShaderTagId("SRPDefaultUnlit"), new SortingSettings(camera));
drawSettings.enableDynamicBatching = dynamicBatching;
drawSettings.enableInstancing = gpuInstancing;
var filterSettings = new FilteringSettings(null, camera.cullingMask);
filterSettings.renderQueueRange = RenderQueueRange.opaque;
context.DrawRenderers(cull, ref drawSettings, ref filterSettings);
//context.DrawSkybox(camera);
filterSettings.renderQueueRange = RenderQueueRange.transparent;
context.DrawRenderers(cull, ref drawSettings, ref filterSettings);
CommandBufferPool.Release(buffer);
context.Submit();
}
Thanks for any help.