Search Unity

Resolved Different material on a backface of a trenchcoat

Discussion in 'Universal Render Pipeline' started by Yoshinori_Date, Jan 9, 2021.

  1. Yoshinori_Date

    Yoshinori_Date

    Joined:
    Dec 6, 2018
    Posts:
    18
    i have a flat trench coat and i want to make the inside of it use different material (like the coat from Cappaldi version of doctor who) i know i can extrude the mesh but i also want to use cloth simulation and that was the original mesh but cloth simulation just brakes on it everytime so i have to simplify it and now cloth works
     
  2. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    give the coat two materials with different shaders.
    in shader A write "Cull Back", this will make it so that only the front sides of polygons will be rendered.
    in shader B write "Cull Front", this will make it so that only the back sides of polygons will be rendered.
    if you have both materials with these shaders applied to an object at the same time, one material will only be visible on the fronts, and the other only on the backs.
    more info here: https://docs.unity3d.com/Manual/SL-CullAndDepth.html
    also, nice avi
     
  3. Yoshinori_Date

    Yoshinori_Date

    Joined:
    Dec 6, 2018
    Posts:
    18
    i tried that but the secon shader was not visible no matter wich faces i enable it to render, could it be due to this mesh having 2 materials already? 1 for coat and the other for buttons, mb unity uses the button uvs instead of the uv of the coat?
     
  4. Yoshinori_Date

    Yoshinori_Date

    Joined:
    Dec 6, 2018
    Posts:
    18
    yep, that was the reason
     
  5. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    oh, yeah, any material over the number of materials in the model applies to everything that the last expected material applied to. sorry i forgot to mention that. there must be some way to overcome that but since URP doesn't support multipass within shaders i don't really know how. only thing i can think of is squeezing both the buttons and the coat onto a single material in blender, or whatever you're using, and then adding the backface stuff onto a second unexpected material, but that limits you to using the same shader for both the coat and the buttons which is probably not ideal. if possible, you could separate the buttons onto a different mesh, which would give the buttons separate material slots. again, there's probably a much better way of doing this, for example using scriptable renderer features, hopefully someone else can drop by and offer something along these lines. good luck!
     
  6. Yoshinori_Date

    Yoshinori_Date

    Joined:
    Dec 6, 2018
    Posts:
    18
    i just separeted the button meshes and it all good now, now just the artistic part is left
     
  7. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    glad to hear and good luck!