zoukankan      html  css  js  c++  java
  • 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部分。

  • 相关阅读:
    每天一个linux命令(20):linux chmod命令
    每天一个linux命令(19):Linux 目录结构
    每天一个linux命令(18):find 命令概览
    每天一个linux命令(17):locate 命令
    shiro实战系列(一)之入门实战
    nginx反向代理和tomcat集群(适用于ubutnu16.04及其centos7)
    Ubuntu16.04之开发环境构建
    Drools实战系列(三)之eclipse创建工程
    Drool实战系列(二)之eclipse安装drools插件
    谈谈maven多模块
  • 原文地址:https://www.cnblogs.com/nafio/p/9137205.html
Copyright © 2011-2022 走看看