D
D
Dmitry Korolev2016-11-17 10:55:03
Shaders
Dmitry Korolev, 2016-11-17 10:55:03

How to merge shaders?

I don't know how to combine three shaders.
Here in this pastebin.com/sULvrjkA
you need to put these two
pastebin.com/4EfnVaUc
pastebin.com/YePdaq38
when I try to do this, they start arguing and swearing everything ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2016-11-17
@adressmoeistranici

First of all, open the manual and read:
https://docs.unity3d.com/Manual/SL-SurfaceShaders.html
https://docs.unity3d.com/Manual/SL-SurfaceShaderEx...
After reading it turns out that "My Shader3" is a diffuse shader with a normal map, "My Shader2" is a PBR shader with out-of-balance metallicity and smoothness, and "My Shader" is a diffuse shader that only textures surfaces with normals facing up.
Now, if we want to combine these shaders, it turns out that we need to make a PBR shader, add a normal map and smoothness and metallicity sliders to it, and then insert a normal check condition.

void surf (Input IN, inout SurfaceOutput o)
{
    o.Albedo = _Color;
    // Металличность и гладкость указываем либо здесь, либо внутри условия
    if(abs(IN.worldNormal.z)>0.5)
    {
        o.Albedo *= tex2D (_MainTex, IN.uv_MainTex).rgb;
        // Применяем диффузную текстуру, карту нормалей и тому подобное
        ...
    }
}

Additionally, you can also download an archive with built-in shaders from the unity website and see how they work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question