Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved Unity Gem shader and LWRP

Discussion in 'Shader Graph' started by Alejandro1912, Oct 10, 2019.

  1. Alejandro1912

    Alejandro1912

    Joined:
    Jun 6, 2016
    Posts:
    6
    Hello everyone, does anyone know how to make old Unity gem shader (https://assetstore.unity.com/packages/vfx/shaders/gem-shader-3) work with LWRP? As i know GEM shader is a multipass shader while LWRP works with only single pass forward rendering, so the back faces of the gems are the first pass and they will be shown up, while the front faces are a second pass which will be skipped. Does anyone know how to make similar shader via shader graph that will be support LWRP? Thanks in advance
     
  2. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    30
    If you follow these steps you can get the gem shader to work properly with Universal RP or LWRP:

    1. Add
    Tags{"LightMode" = "PassTwoPostTransparent"}

    to the beginning of the second pass of the shader.
    upload_2019-10-21_15-29-33.png
    2. Replace the shadowcaster usepass near the end of the shader with
    UsePass "Universal Render Pipeline/Lit/ShadowCaster"

    in order to make shadow casting work properly. If you're still using lightweight (2019.2) use this:
    UsePass "Lightweight Render Pipeline/Lit/ShadowCaster"

    3. Select the forward renderer for your Universal Pipeline Asset and create a Renderer Feature, add the shader pass with the same name and make sure "Layer Mask" is set to whatever layer your gems are on, Event is set to "After Rendering Transparents," and that a Shader Pass filter is added with the name of the pass.
    Note: the renderer feature name can be whatever you want, but the Shader Pass name must match the lightmode tag that you put in the pass.
    upload_2019-10-21_15-27-49.png
    If you're using LWRP (2019.2) make sure to create a custom LWRP forward renderer (Create -> Rendering -> Lightweight Render Pipeline -> Forward Renderer) and set your Lightweight Render Pipeline Asset's Renderer Type to "Custom" and make it use your custom forward renderer.
    upload_2019-10-21_15-45-48.png
    I hope that helps!
     
    j-stash, NOP_W and konsic like this.
  3. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
  4. Alejandro1912

    Alejandro1912

    Joined:
    Jun 6, 2016
    Posts:
    6
    Thank You, it works :)
     
unityunity