码迷,mamicode.com
首页 > 编程语言 > 详细

(译)Cg Programming/Unity(Cg编程/Unity)

时间:2015-06-28 23:00:40      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:

最近在学习Unity3d中的shader编程,能找到的中文资料比较少,于是,尝试翻译一下wiki Books上的资料,以方便其他跟我一样的入门学习者。由于是第一次翻译技术资料,经验不足,难免出错,请路过的大神们批评指正,共同帮助我等新手少走弯路,谢谢。

下面翻译开始:

(原文:https://en.wikibooks.org/wiki/Cg_Programming/Unity)

Cg programming in the game engine Unity is considerably easier than Cg programming for an OpenGL or Direct3D application. Import of meshes and images (i.e. textures) is supported by a graphical user interface; mipmaps and normal maps can be computed automatically; the most common vertex attributes and uniforms are predefined; OpenGL and Direct3D states can be set by very simple commands; etc.

Unity引擎中的Cg编程,要比OpenGL或者Direct3D应用中的Cg编程容易许多。网格和图片的导入是被图形用户界面所支持;mipmaps和法线贴图能被自动计算;最平常的顶点属性和规范也被预定义好了;OpenGL和Direct3D语句能被很简单的指令所设置;等等。

Preliminaries(准备)

A free version of Unity can be downloaded for Windows and MacOS at Unity‘s download page. All of the included tutorials work with the free version. Three points should be noted:

Unity下载页面中,可以下载到针对Windows和Mac平台的免费版本的Unity软件。下面所有的教程都可以用免费版的Unity来运行。请注意一下三点:

  • First, this part assumes that readers are somewhat familiar with Unity. If this is not the case, readers should consult the first three sections of Unity‘s User Guide [1] (Unity Basics, Building Scenes, Asset Import and Creation).

首先,读者们需要对Unity有了一些熟悉,否则,读者应该考虑先去学习一下Unity的用户指导的前三部分(Unity基础、建立场景、资源的导入和创建)。

  • Second, Unity doesn‘t distinguish between Cg (the shading language by Nvidia) and HLSL (the shading language in Direct3D) since the two languages are very similar; thus, most of these tutorials also apply to HLSL.

其次,Unity对于CgNvidia开发的着色器语言)和HLSLDirect3D的着色器语言)不进行区分,由于这两种语言太相似了;因此,这些教程中的大多数也可以适用于HLSL.

  • Furthermore, Cg is documented by Nvidia‘s Cg Tutorial and Nvidia‘s Cg Language Specification. However, these descriptions are missing the details specific to Unity. On the other hand, Unity‘s shader documentation [2] focuses on shaders written in Unity‘s own “surface shader” format, while the documentation of shaders in Cg/HLSL is very limited [3]. Thus, learning Cg programming in Unity without prior knowledge of Cg can be rather difficult. This wikibook tries to close this gap by providing an introduction to Cg programming in Unity without requiring prior knowledge of Cg.

此外,虽然Cg语言被编写在NvidiaCg教程NvidiaCg语言说明书中,然而,这些描述是没有针对Unity平台的特殊细节的。另一方面,Unity自己的着色器文档,主要关注的是Unity自己的表面着色器的写法,其中关于Cg/HLSL的说明是非常有限的。因此,如果没有对于Cg语言的预先学习,就来学习Unity中的Cg编程,是有一定难度的。本套教程试图在没有Cg语言预先学习的情况下,通过对Unity中的Cg编程的介绍,来处理这个困难。

Tutorials(教程)

Note that the tutorials assume that you read them in the order in which they are presented here, i.e. each tutorial will assume that you are familiar with the concepts and techniques introduced by previous tutorials. If you are new to Cg or Unity you should at least read through the tutorials in the “Basics” section. (Now you are warned!)

注意:本套教程建议你按照下面所写的顺序来阅读,每一节课都假设你对之前课程里介绍的概念和技术已经熟悉了。如果你是Cg或者Unity的新手,那么你一定要阅读教程中的“基础”部分。

Basics(基础)

  • Minimal Shader (about shaders, materials, and game objects)

    最小的着色器(关于着色器、材质和游戏物体)

  • RGB Cube (about vertex output parameters)

    红绿蓝盒子(关于顶点输出参数)

  • Debugging of Shaders (about vertex input parameters)

    着色器的debugging(关于顶点输入参数)

  • Shading in World Space (about uniforms)

    世界空间中的着色(关于统一)

Transparent Surfaces(透明表面)

  • Cutaways (about discarding fragments and triangle-face culling)
  • Transparency (about blending)
  • Order-Independent Transparency (about order-independent blending)
  • Silhouette Enhancement (about transforming normal vectors)

(未完待续。。。)

 

(译)Cg Programming/Unity(Cg编程/Unity)

标签:

原文地址:http://www.cnblogs.com/fengrenyuan/p/4590527.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!