• U3D shaderlab 相关指令开关




    Subshader { [Tags] [CommonState] Passdef [Passdef ...] }
    Tags分为SubShader Tags和Pass Tags,Tags放在SubShader顶层或者其内部的单个Pass中,这个时候只在Pass中生效。
    Tags:表面着色器可以被若干的标签(tags)所修饰,而硬件将通过判定这些标签来决定什么时候调用该着色器。比如Tags { "RenderType"="Opaque" }告诉了系统应该在渲染非透明物体时调用我们。

    CommonState:设定开关硬件的各种状态。根据渲染管线,可以设置硬件状态,对渲染的各阶段进行控制。
    CommonState属于SubShader的语法规则。

    Color, Material, Lighting:
    Color color
    Material {Material Block}
    Lighting On | Off
    SeparateSpecular On | Off
    ColorMaterial AmbientAndDiffuse | Emission

    Culling & Depth Testing:
    Cull Back | Front | Off
    ZWrite On | Off
    ZTest Less | Greater | LEqual | GEqual | Equal | NotEqual | Always
    Offset Factor, Units

    Texture Combiners:
    SetTexture [TextureName] {Texture Block}
    SetTexture [_MainTex] { combine previous * texture, previous + texture } 

    Fog:
    Fog {Fog Commands}
    Mode Off | Global | Linear | Exp | Exp2
    Color ColorValue
    Density FloatValue
    Range FloatValue, FloatValue

    Alpha testing:
    AlphaTest Off
    AlphaTest comparison AlphaValue

    Blending:
    Blend SrcAlpha OneMinusSrcAlpha // Alpha blending
    Blend One One // Additive
    Blend OneMinusDstColor One // Soft Additive
    Blend DstColor Zero // Multiplicative
    Blend DstColor SrcColor // 2x Multiplicative


    Unity3D渲染管线

    (据此控制各阶段可控部件的状态或者编写顶点/片段着色器)

    Passdef:包括regular Pass,Use Pass(引用,复用Pass)和Grab Pass(抓屏)

    regular Pass包括

    Name、


    Tags(RenderType,Queue等)


    Render Setup(

    Lighting、Cull、ZTest、ZWrite、Fog、AlphaTest、Blend、Stencil,ColorMask、Offset、Color,Material,SeparateSpecular、ColorMaterial

    等)


    详细描述参考Unity3D用户手册ShaderLab syntax: SubShader部分。

  • 相关阅读:
    net中System.Security.Cryptography 命名空间 下的加密算法
    关于如何生成代码的帮助文档的链接
    Application.EnableVisualStyles();
    VS2010里属性窗口中的生成操作
    把普通的git库变成bare库
    MultiTouch camera controls source code
    android onTouch()与onTouchEvent()的区别
    iOS开发中常见的语句@synthesize obj = _obj 的意义详解
    java nio 快速read大文件
    使用ndk standalone工具链来编译某个平台下的库
  • 原文地址:https://www.cnblogs.com/nafio/p/9137205.html
Copyright © 2020-2023  润新知