Search Unity

Triplanar or Worldposition Shader with PBR?

Discussion in 'Shaders' started by Ravery, Jun 15, 2017.

  1. Ravery

    Ravery

    Joined:
    Mar 5, 2016
    Posts:
    49
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    To convert that basic triplanar shader into one that does the full PBR is a bit more work than just adding a "few" lines. There's quite a few inexpensive assets in the store that do triplanar mapping using Unity 5's PBR shading, I would suggest getting one of those.
     
  3. Ravery

    Ravery

    Joined:
    Mar 5, 2016
    Posts:
    49
    But why? Shouldn't it be something like "just call the surface shader after the vertex shader"?

    If I were using a surface shader, adding metallic and smoothness would be trivial.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    You should read that thread you linked to, it includes an example triplanar surface shader, as well as an explanation as to why you shouldn't use it.

    A surface shader is a vertex fragment shader generator; you can have a surface shader that expands into several vertex fragment shader passes, or you can have a vertex fragment shader, you can't mix and match individual parts as a surface shader is always going to generate both the vertex shader and fragment shader parts of a vertex fragment shader pass.
     
  5. Ravery

    Ravery

    Joined:
    Mar 5, 2016
    Posts:
    49
    Thanks for the answer. I guess I should delve deeper into real shader programming. Very interesting, very powerful.