Search Unity

Question URP double-sided shader with different textures on each side?

Discussion in 'Shader Graph' started by edub101, Sep 15, 2020.

  1. edub101

    edub101

    Joined:
    Jul 16, 2015
    Posts:
    43
    Could anyone recommend a URP shader that allows each side of a double sided shader to display a different set of textures? For example, a black leather cloak with a purple silk under-lining? Perhaps there is one in the asset store? If not, does anyone know a (gulp) tutorial to make one that would be appropriate for someone that thinks a "shader" is someone who holds an umbrella over a person's head on a sunny day? I'm a shader-idiot, and shader talk is like getting smacked in the head with a book written in ancient Sumerian.
     
  2. florianBrn

    florianBrn

    Joined:
    Jul 31, 2019
    Posts:
    53
    Code shader can feel overwhelming, but you really should take some time to learn Shader Graph. It's easy and really powerful!

    Here's how you can make what you asked for with it:



    It's pretty self-explanatory, but here's a simple explanation just in case: the Branch node kinda works like an If statement: Predicate is your condition, and True and False are simply what's happening based on what the condition returns.
    The IsFrontFace node does exactly what its name implies: returning true if it is the front face, and false if it is the backface.
    I plugged simple colors here, but you can of course plug anything you want in the two bottom outputs (textures, procedural stuff...).
     
    TomTrottel, tasticad and Ksanone like this.
  3. Resetxform

    Resetxform

    Joined:
    Oct 17, 2014
    Posts:
    2
    Or just have a check box that says doublesided, no?
     
  4. Alpha-16

    Alpha-16

    Joined:
    Dec 3, 2017
    Posts:
    1
    Yes! In settings (icon top right corner) you have a check box with double sided..
     
  5. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437

    I have serval double sided shader in my asset
    DE Environment
    http://deenvironment.com/documentation/desf-core-shaders/#Two-Sided