HighlightRenderer - the main pass only renders the layer “Highlight” normally and an additional pass renders everything else and replaces all rendered materials with a transparent one to create a “faded out” effect.
So far so good, the different renderers work as expected, but I have no clue how I can switch the default (or current active) ForwardRendererData from a script (e.g. when the user selects/deselects an object).
I can get the active RenderPipeline Asset from QualitySettings.renderPipeline but the API is unclear for me as to how I would access the “Renderer List” as shown in the Editor (Screenshot above).
I could be hacky and use different Quality Levels and manually assign RenderPipeline assets to them which either have the normal or highlight rendering, and then switch the quality level from script… but I dont think that would be the best solution.
The following code is only for testing the toggle of the renderer
var x = GetComponent<UnityEngine.Rendering.Universal.UniversalAdditionalCameraData>();
if (Input.GetKey(KeyCode.LeftShift)) x.SetRenderer(1);
else x.SetRenderer(0);
Thanks for that… I’ve been looking into this as well.
It makes me wonder what the intent is for having a list of renderers. From what I’ve seen, there’s no order/sequence - it seems only the “default” renderer is active at one time.
I had initially hoped that it would allow for additive-like behaviours where you can add multiple renderers and simply toggle the ones you want to active at any given time.
In your example, if I want highlighting turned on, then I would just toggle that renderer to be active.
Instead it seems like this list of renderers is really just a holder for all possible renderers in your game and it’s up to you to switch things around. But the way it’s done that is not the greatest. Somewhere in the code you will need to associate “0” with one renderer and “1” as the other - nasty.