Triplanar or Worldposition Shader with PBR?

Is there a way to add PBR things like Metallic and Smoothness to vertex/fragment shaders like this one:

The last shader code works well, but I don’t know where to add the lines.

What I’d like to achieve is a PBR material based on worldposition, which I can apply on meshes without UV maps. For example stone or brass statues.

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.

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.

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.

Thanks for the answer. I guess I should delve deeper into real shader programming. Very interesting, very powerful.