(译)Cg Programming/Unity(Cg编程/Unity)
最近在学习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对于Cg(Nvidia开发的着色器语言)和HLSL(Direct3D的着色器语言)不进行区分,由于这两种语言太相似了;因此,这些教程中的大多数也可以适用于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语言被编写在Nvidia的Cg教程和Nvidia的Cg语言说明书中,然而,这些描述是没有针对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)的更多相关文章
- Unity GUI编程
脚本语言:C# 附上一张图说明Unity GUI编程中可用的控件:(可能有遗漏) 下面列出一些例子来说明: 1.Groups : 在固定Layout模式中起到组织可用项的功能,它让你在屏幕的一个区域中 ...
- 【Unity Shader】Unity Chan的卡通材质
写在前面 时隔两个月我终于来更新博客了,之前一直在学东西,做一些项目,感觉没什么可以分享的就一直没写.本来之前打算写云彩渲染或是Compute Shader的,觉得时间比较长所以打算先写个简单的. 今 ...
- Java实战之03Spring-03Spring的核心之AOP(Aspect Oriented Programming 面向切面编程)
三.Spring的核心之AOP(Aspect Oriented Programming 面向切面编程) 1.AOP概念及原理 1.1.什么是AOP OOP:Object Oriented Progra ...
- Unity学习笔记(二)——第一个Unity项目Hello Unity
保留版权,转载请注明出处:http://blog.csdn.net/panjunbiao/article/details/9318811 在这一篇文章里,参照宣雨松的<Unity 3D游戏开发& ...
- Unity cg vertex and fragment shaders(二)
着色器的一般结构: Shader "MyShader/MyShaderName" { Properties { // ... properties here ... } SubSh ...
- Unity cg vertex and fragment shaders(一)
cg片段 Cg程序片段写CGPROGRAM和ENDCG之间 开始时的片段可以作为#pragma语句编译指令 Pass { // ... the usual pass state setup ... C ...
- 解读Unity中的CG编写Shader系列4——unity中的圆角矩形shader
上篇文章中我们掌握了表面剔除和剪裁模式 这篇文章将利用这些知识实现一个简单的,可是又非经常常使用的样例:把一张图片做成圆角矩形 例3:圆角矩形Shader 好吧我承认在做这个样例的时候走了不少弯路,因 ...
- [转]解读Unity中的CG编写Shader系列4——unity中的圆角矩形shader
上篇文章中我们掌握了表面剔除和剪裁模式这篇文章将利用这些知识实现一个简单的,但是又很常用的例子:把一张图片做成圆角矩形 例3:圆角矩形Shader好吧我承认在做这个例子的时候走了不少弯路,由于本人对矩 ...
- [Unity] Cg标准函数库
随机推荐
- Windows C/C++调试
windows兼容dirent.h error c4996: 'fopen': This function or variable may be unsafe This file requires _ ...
- 几种开源SIP协议栈对比
几种开源SIP协议栈对比 随着VoIP和NGN技术的发展,H.323时代即将过渡到SIP时代,在H.323的开源协议栈中,Openh323占统治地位,它把一个复杂而又先进的H.323协议栈展现在普通程 ...
- 关于java基础中,接口里面父类的对象指向子类的引用
父类的引用指向子类的对象,它只能看的到父类的那些方法~ 子类自身的方法看不到-- ······························· 如: interface Singer { //定义了 ...
- C#开发Activex控件(转载别人的只为再看时方便放在自己里边了)
前言 ActiveX控件以前也叫做OLE控件,它是微软IE支持的一种软件组件或对象,可以将其插入到Web页面中,实现在浏览器端执行动态程序功能, 以增强浏览器端的动态处理能力.通常ActiveX控件都 ...
- [bzoj2154]Crash的数字表格(mobius反演)
题意:$\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^m {lcm(i,j)} } $ 解题关键: $\sum\limits_{i = 1}^n {\sum\l ...
- openstack官方指导书
openstack官方网站:https://docs.openstack.org/ 由于openstack的官方文档有点多,所以这里对其进行梳理一下 Release Notes 发布版本 新功能,升级 ...
- Object有哪些公用的方法?
Object是所有类的父类,任何类都默认继承Object. public class Demo { public static void main(String[] args) { Object ob ...
- yzm10与战地信使 yzm10原创系列
yzm10与战地信使 M国与R国正进行着激烈的鏖战,此时的yzm10从R国窃取了最高军事机密,这份情报将是此次战役的转折点,如果M国得到了这份情报,就能够取得这次战争的胜利.yzm10当然是站在M国这 ...
- MySQL数据库基础详解(非原创)
文章大纲 一.数据库简介二.Mysql数据库简介三.Mysql安装与服务启动(Windows版本)四.Mysql图形化工具五.Mysql存储引擎精讲六.Mysql数据类型介绍七.Mysql主要专业名称 ...
- Search index
问题:查找字符串b在a中的起始位置,如果b不为a的子串,则返回-1 示例: 输入:a = "well", b = "el" 输出:1 输入:a=" ...