现在的位置: 首页 > 综合 > 正文

Unity3D Shader官方教程翻译(一)

2013年08月31日 ⁄ 综合 ⁄ 共 2748字 ⁄ 字号 评论关闭

Unity3D Shader官方教程翻译

Shader Reference
着色参考

Shaders in Unity can be written in one of three different ways:

Unity3D着色器,可以写在三种不同的方式之一:

  • assurface shaders,
  • asvertex and fragment shaders and
  • asfixed
    function shaders
    .
  • 表面着色,
  • 顶点和片段着色器和
  • 作为固定功能着色

Theshader tutorial can guide you on choosing the right type for your
needs.
着色教程可以指导您对您的需求选择正确的类型

Regardless of which type you choose, the actual meat of the shader code will always be wrapped in a language called ShaderLab, which is used to organize
the shader structure. It looks like this:

无论您选择哪种类型,实际的shader代码肉总是会被裹在被称为ShaderLab一种语言,这是用来组织结构着色。它看起来像这样:

Shader "MyShader" { 
Properties { _MyTexture ("My Texture", 2D) = "white" { }
 // other properties like colors or vectors go here as well //其他属性如颜色或向量 }
 SubShader {
 // here goes the 'meat' of your
 // - surface shader or 
// - vertex and program shader or
 // - fixed function shader
 / /这里写内容
 / / - 表面着色 或
 / / - 顶点和程序着色 或
 / / - 固定功能着色
 }
 SubShader {
 // here goes a simpler version of the SubShader above than can run on older graphics cards 
/ /可以运行在旧的显卡的着色器
 } 
}

We recommend that you start by reading about some basic concepts of the ShaderLab syntax in the sections listed below and then to move on to read about
surface shaders or vertex and fragment shaders in other sections. Since fixed function shaders are written using ShaderLab only, you will find more information about them in the ShaderLab reference itself.

我们建议您阅读ShaderLab在下面列出,然后转移到其他章节中有关表面着色或顶点和片段着色器读取的部分语法的一些基本概念开始。由于固定功能着色器编写只能使用ShaderLab,你会发现更多的关于他们的信息在ShaderLab引用本身。

The reference below includes plenty of examples for the different types of shaders. For even more examples of surface shaders in particular, you can get
the source of Unity's built-in shaders from the
Resources
section
. Unity'sImage
Effects
 package contains a lot of interesting vertex and fragment shaders.


下面的参考,包括大量的着色不同类型的例子。更多的在粒子系统中使用的表面着色的例子,你可以查阅Unity3D内置的Shader获得更多信息。Unity3D的图像效果包中包含了很多有趣的顶点和片段着色器

Read on for shader reference, and check out theshader tutorial as well!

  

抱歉!评论已关闭.