unity3d shader指南

Unity中的Shader有3种方式:

1.      surface shaders

2.      vertex and fragment shaders

3.      fixed function shaders

在shader tutorial中会指引你使用合适的shader类型。

不管你选择什么类型,shader的代码实际上都在用ShaderLab来组织。如:

Shader "MyShader" {

    Properties {

        _MyTexture ("MyTexture", 2D) = "white" { }

        // other properties likecolors or vectors go here as well

    }

    SubShader {

        // here goes the 'meat' ofyour

        // - surface shader or

        //  - vertex and program shader or

        //  - fixed function shader

    }

    SubShader {

        // here goes a simplerversion of the SubShader above than can run on older graphics cards

    }

}

建议先从ShaderLab的基础概念、语法了解起,然后是Surface Shaders,或是vertext and fragment shaders。由于fixed functionshaders是用ShaderLab来写的,你可以在ShaderLab中找到它们的更多信息。

下面的指南中包括大量的不同类shader的例子。为了获取更多特别的surface shaders,你可以从Resources section中获取Unity内置shaders的源码。Unity的Image Effects包包含很多有趣的vertext and fragment shaders。

同时浏览shader指南,检验shader tutorial。

Writing Surface Shaders

 Surface Shader Examples

 Custom Lighting models in Surface Shaders

 Surface Shader Lighting Examples

 Surface Shaders with DX11 Tessellation

Writing vertex and fragment shaders

 Vertex and Fragment Shader Examples

 Accessing shader properties in Cg

 Providing vertex data to vertex programs

 Built-in shader include files

 Predefined shader preprocessor macros

 Built-in state variables in shader programs

 Making multiple shader program variants

 GLSLShader Programs

ShaderLab syntax:Shader

 ShaderLab syntax:Properties

 ShaderLab syntax:SubShader

  ShaderLab syntax:Pass

   ShaderLab syntax:Color,Material,Lighting

   ShaderLab syntax:Culling&Depth Testing

   ShaderLab syntax:Texture Combiners

   ShaderLab syntax:Fog

 ShaderLab syntax:Alphatesting

   ShaderLab syntax:Blending

   ShaderLab syntax:Pass Tags

   ShaderLab syntax:Name

   ShaderLab syntax:BindChannels

   ShaderLab syntax:Stencil

 ShaderLab syntax:UsePass

 ShaderLab syntax:GrabPass

 ShaderLab syntax:SubShader Tags

ShaderLab syntax:Fallback

ShaderLab syntax:CustomEditor

ShaderLab syntax:other commands

Advanced ShaderLab topics

 Unity’s Rendering Pipeline

 Performance Tips when Writing Shaders

 Rendering with Replaced Shaders

 Custom Material Editors

 Using Depth Textures

 Camera’s Depth Texture

 Platform Specific Rendering Differences

Shader Level of Detail

ShaderLab built-in values

 

原文地址:https://docs.unity3d.com/Documentation/Components/SL-Reference.html,下一步是抽时间逐个研究。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值