Search Unity

Question What's to be done about upgrading textures on my custom shaders?

Discussion in 'Shader Graph' started by omatase, May 10, 2019.

  1. omatase

    omatase

    Joined:
    Jul 31, 2014
    Posts:
    159
    I really want to make use of the new GPU particle support Unity has and so I've updated my project to use the Lightweight Render Pipeline and ran the "Update Project Materials to LightweightRP Materials". I've been left with a few materials that are displaying pink and am trying to manually update them but I'm really lost on what I'm supposed to do even after reading the documentation here: https://github.com/Unity-Technologi...eline/wiki/Upgrading-to-HDRP#ManualConversion.

    My question is, I've got several shaders that my VFX artist created that have custom options built into them that I have to preserve and am hoping there's a way to do that without rewriting the shaders. Is there a way to make it so the shader is compatible with the LRP easily? Here's an example of one of my failing shaders.

    upload_2019-5-9_22-29-24.png

    This shader handles the leaves in my scene and has options to control their movement.

    I appreciate any help anyone can give.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    No shader made with Shader Forge will work in the SRPs.

    The “auto upgrade” only takes built in Unity shaders and replaces them with close equivalents. It won’t do anything to custom shaders, it will leave them as is, which means they’ll be non-functional and thus render pink.

    Any shader that shows pink after swapping to an SRP will need to be rewritten from scratch using Unity’s Shader Graph or as a compatible vertex fragment shader.

    But...
    The new VFX Graph doesn’t support shaders made with Shader Graph, or even any of the shaders included with the SRP, or really any custom shader as you know them. The VFX Graph uses it’s own special shader setup and as far as I can tell does not support any shaders but those that the system comes with. If you want to use a custom shader, you need to use a regular mesh, or the older “Shuriken” particle system that you were already using.
     
    Last edited: May 10, 2019
  3. omatase

    omatase

    Joined:
    Jul 31, 2014
    Posts:
    159
    I'm not an artist, I'm just hiring artists to work on my project for me so my terminology may be a bit off. Here's what I was under the impression I could do with the LWRP:

    1. Use any of my old shaders / materials that were able to be automatically upgraded using Unity's upgrade process tool.
    2. Build new shaders using the Visual Effects Graph to replace any of my outdated, custom shaders.
    3. Build new shaders that use the new render pipeline to build VFX that make use of GPU particles so that I can have VFX with more particles and thus more depth.

    Is there anything amiss with my understanding of the technology?
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    1. Old materials using built-in shaders, yes.

    The VFX (Visual Effects) Graph is used to build out the how the particles move and interact. While technically this is being used to generate a "shader", it's probably best to not think about it as a shader tool at all. The actual control over the final look of the particle rendering is essentially limited to a handful of settings like opaque, alpha blended, cutout, lit, unlit, etc. with texture inputs than the control you get with a fully custom shader. You essentially get a subset of the options you'd get using a built-in Lit shader, or the Standard Particle shaders if you ever used those.

    The Shader Graph is what you use to make custom shaders, and is what you'd need to use if you want to recreate anything more complicated than what a basic "unlit or lit and textured" shader can do.

    So the answer to both 2 & 3 is: build completely new effects using the VFX Graph to make use of the GPU particle system, otherwise rebuild your shaders using Shader Graph and continue using the older particle system.

    Technically the new VFX Graph can also use custom shaders when you're using a Static Mesh context, but I believe this requires use of shaders with support for instancing, which Shader Graph shaders do not, so it likely requires hand written vertex fragment shaders. I've not found any documentation on what is required to use custom written shaders with the VFX Graph, so I have no idea what is actually involved with that.