LWRP Custom Effect - black screen when built

Hello,

I am kinda new within the Unity community and with Unity in general.

I am currently trying to implement a custom post processing effect, and I’ve been following this guide step by step to do so :

This grayscale custom effect is working great in editor mode. I can add it to my post processing volume and everything works fine. However, whenever I try to build my scene, I get a full grey screen, as if nothing was happening. When I remove the effect from the pile of my post processing volume, everything works as intended, even when building. However adding the effect to the volume causses the built game to not render.

I’ve been trying stuff for hours now, but I come to an end.
Am I doing something wrong ?
What are the steps required for an effect to work also on the built game ?

Is the guide I have been following outdated ? If so, where can I find a more recent one ?

Thank you for your time, have a great day;
Ciphered :slight_smile:

Hi!
What platform are you building to? Is there any error in the player log?

1 Like

Hello,

Thanks for your answer.

There is indeed some logs within the player log, I had no idea such a thing existed, thanks for pointing it out. It seems there is a problem with the vertex shader :


Mono path[0] = ‘D:/work/unity/visualizers/Muvi2/Build3/Muvi2_Data/Managed’
Mono config path = ‘D:/work/unity/visualizers/Muvi2/Build3/MonoBleedingEdge/etc’
Initialize engine version: 2019.3.0a5 (9aff892fb75b)
[XR] Discovering subsystems at path D:/work/unity/visualizers/Muvi2/Build3/Muvi2_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1050 Ti (ID=0x1c8c)
Vendor:
VRAM: 4029 MB
Driver: 23.21.13.8816
Begin MonoManager ReloadAssembly

  • Completed reload, in 0.797 seconds
    Initializing input.

Input initialized.

Initialized touch support.

WARNING: Shader Unsupported: ‘Hidden/PostProcessing/FinalPass’ - Pass ‘’ has no vertex shader
WARNING: Shader Unsupported: ‘Hidden/PostProcessing/FinalPass’ - Pass ‘’ has no vertex shader
WARNING: Shader Unsupported: ‘Hidden/PostProcessing/Uber’ - Pass ‘’ has no vertex shader
WARNING: Shader Unsupported: ‘Hidden/PostProcessing/Uber’ - Pass ‘’ has no vertex shader
UnloadTime: 2.439296 ms
Setting up 4 worker threads for Enlighten.
Thread → id: 6084 → priority: 1
Thread → id: 63c8 → priority: 1
Thread → id: 3a68 → priority: 1
Thread → id: 2088 → priority: 1
ArgumentException: Invalid shader ()
at UnityEngine.Rendering.PostProcessing.PropertySheetFactory.Get (UnityEngine.Shader shader) [0x00014] in <5219f50adb754be5a6b446b97a34ec97>:0
at PPtestRenderer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x00010] in :0
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderList (System.Collections.Generic.List`1[T] list, UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.String marker) [0x0008f] in <5219f50adb754be5a6b446b97a34ec97>:0
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderInjectionPoint (UnityEngine.Rendering.PostProcessing.PostProcessEvent evt, UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.String marker, System.Int32 releaseTargetAfterUse) [0x00046] in <5219f50adb754be5a6b446b97a34ec97>:0
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x002f6] in <5219f50adb754be5a6b446b97a34ec97>:0
at UnityEngine.Rendering.LWRP.RenderingUtils.RenderPostProcessing (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.LWRP.CameraData& cameraData, UnityEngine.RenderTextureDescriptor sourceDescriptor, UnityEngine.Rendering.RenderTargetIdentifier source, UnityEngine.Rendering.RenderTargetIdentifier destination, System.Boolean opaqueOnly, System.Boolean flip) [0x00110] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.ScriptableRenderPass.RenderPostProcessing (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.LWRP.CameraData& cameraData, UnityEngine.RenderTextureDescriptor sourceDescriptor, UnityEngine.Rendering.RenderTargetIdentifier source, UnityEngine.Rendering.RenderTargetIdentifier destination, System.Boolean opaqueOnly, System.Boolean flip) [0x0000d] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.PostProcessPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.RenderingData& renderingData) [0x0005d] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.ScriptableRenderer.ExecuteRenderPass (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.ScriptableRenderPass renderPass, UnityEngine.Rendering.LWRP.RenderingData& renderingData) [0x00109] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.ScriptableRenderer.ExecuteBlock (UnityEngine.Rendering.LWRP.RenderPassEvent startEvent, UnityEngine.Rendering.LWRP.RenderPassEvent endEvent, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.RenderingData& renderingData, System.Boolean submit) [0x0003e] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.RenderingData& renderingData) [0x00055] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.LightweightRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) [0x000da] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.LWRP.LightweightRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Camera[ ] cameras) [0x00046] in <090d1e4ec97149dc83d818274fe8ae8e>:0
at UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera[ ] cameras) [0x0001d] in <08d7d13a3eda4b5f9489a2ef715f815e>:0
at UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, UnityEngine.Camera[ ] cameras, System.IntPtr loopPtr) [0x00023] in <08d7d13a3eda4b5f9489a2ef715f815e>:0

(Filename: <5219f50adb754be5a6b446b97a34ec97> Line: 0)


However, how such a thing could happen ? I have followed the guideline and wrote a very basic custom shader, but it seems a step is missing for it to be compliant with the final compilation.

I don’t want to waste too much of your time, but I have no idea on how to proceed to get this working.

Do you have any clues ?

Thanks,
Ciphered

This looks like your actual problem :slight_smile:
I suppose PPtestRenderer is your custom post effect. You have some kind of error inside the Render function.

1 Like

Maybe there is… however my render function is exactly the same as the one given within the guide :

using System;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

[Serializable]
[PostProcess(typeof(PPtestRenderer), PostProcessEvent.AfterStack, "Custom/PPtest")]
public sealed class PPtest : PostProcessEffectSettings {
    [Range(0f, 1f), Tooltip("Grayscale effect intensity.")]
    public FloatParameter blend = new FloatParameter { value = 0.5f };
}

public sealed class PPtestRenderer : PostProcessEffectRenderer<PPtest> {
    public override void Render(PostProcessRenderContext context) {
        var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/PPtest"));
        sheet.properties.SetFloat("_Blend", settings.blend);
        context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
    }
}

Ans since the “hello world” of post processing custom effects is not working but only in build mode, I guess either an extra step not mentioned in the guide is required either there is a bug.

I have found another solution, by rendering my scene to a TargetTexture and applying my effect to the texture, however I’d like to figure out what could cause the issue. I’ll try to build a small project to see if the problem persists :slight_smile:

Thanks for your time,

Shader.Find("Hidden/Custom/PPtest")

It looks like it doesn’t find this shader…

1 Like

it doesn’t find this shader.

You have to add this shader in player setting → grahpics.

4755515--451574--未命名.png

2 Likes

This was the solution to my problem. Thanks for your answer.