Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question VFX Graph & custom SRPs

Discussion in 'Visual Effect Graph' started by Lo-renzo, Aug 11, 2023.

  1. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    I have a fork with minor changes of URP 2021.3 but when trying to use VFX Graph it gives me this warning:

    At first when switching the Graphics > Pipeline to my SRP, it appears to work. But if I Reimport the graph, it'll stop working.

    It refuses to compile the shaders. I can switch back to the default URP Pipeline (specifically here I'm using the 2D Renderer), reimport again, and it'll work again.

    These shaders disappear after Reimport.
    d - Copy - Copy.png
    This makes me suspect it's some check in VFX Graph that I'm not passing or I forgot something in my SRP.

    What am I doing wrong? Is there a way to get VFX Graph to work with custom SRPs?
     
  2. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    134
    Hello,

    The errors you shared is displayed in case of currentSRPBinder returns null, you can inspect in debug what is happening here. If you forked URP, you probably also forked the VFXURPBinder, maybe you renamed the class UniversalRenderPipelineAsset ?

    This is only a blind guess, VFX Graph is supposed to work with a custom SRP if the appropriate binder is reachable.

    I hope this information helps.
     
    Lo-renzo likes this.
  3. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    I think I need to have access to VFXSRPBinder so I can derive my own type.

    I didn't quite fork it, I wanted it to be parallel for a host of reasons, so it's basically a copy/paste of just the 2D Renderer, which I then renamed - but this means I don't have access to internal classes.

    I have MyCustomPipelineAsset inheriting from it.

    I didn't touch this. Only touched 2D Renderer.

    Could VFXSRPBinder be public so that VFX Graph can work in this situation?
     
  4. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    134
    Indeed, the VFXSRPBinder should be public to ease implementation of custom SRP.

    Meanwhile, there are two workarounds:
    - Fork the VFX package and add an InternalVisibleTo in PackageInfos.cs to your assembly definition
    - Use asmref to reach internal definition of the visual effect graph, see this message

    About the SRPBinder which isn't fallbacking to the default VFXURPBinder when your custom definition actually inherits from UniversalRenderPipelineAsset, we will explore the expected behavior.
     
    Lo-renzo likes this.
  5. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    Wonderful, thank you so much for the help!
     
    PaulDemeulenaere likes this.