(译)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标准函数库
随机推荐
- ACM学习历程—Hihocoder编程之美测试赛B题 大神与三位小伙伴(组合数学 )
时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 给你一个m x n (1 <= m, n <= 100)的矩阵A (0<=aij<=10000),要 ...
- ACM学习历程——UVA11111 Generalized Matrioshkas(栈)
Description Problem B - Generalized Matrioshkas Problem B - Generalized Matrioshkas Vladimir wo ...
- 【Python】数组排序
1.numpy库:argsort() argsort函数返回的是数组值从小到大的索引值(升序排列) 一维: In [1]: import numpy as np In [2]: x = np.arra ...
- python爬虫知识点总结(九)Requests+正则表达式爬取猫眼电影
一.爬取流程 二.代码演示 #-*- coding: UTF-8 -*- #_author:AlexCthon #mail:alexcthon@163.com #date:2018/8/3 impor ...
- C# 把datagridview控件上的表格输出到excel文件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Swing 添加Esc快捷键退出程序
JFrame demo = new JFrame(); demo.addKeyListener( new KeyListener(){ public void keyReleased(KeyEvent ...
- MySQL Horizontal Scaling
http://www.tuicool.com/articles/miuq63E http://www.guokr.com/blog/475765/ http://songwie.com/article ...
- 51nod1202【DP-树状数组维护】
思路: DP[i]代表从1 到 i 以 a[i] 为末尾的子序列个数,dp[i]=dp[i]+dp[j](a[i]!=a[j]) +1 利用树状数组维护以值 a[i] 结尾的子序列个数. #inclu ...
- Codeforces86D【莫队算法】
题意: 给一个序列和一些区间,每次询问对区间所有不同的数,求每个不同的出现的个数的平方*其值的总和 2*2*1+1*1*2 思路: 裸的莫队算法. 补: 1.cmp写错. 2.LL运算不会进行转化. ...
- 散列表(Hash table)及其构造
散列表(Hash table) 散列表,是根据关键码值(Key value)而直接进行访问的数据结构.它通过把关键码值映射到表中一个位置来访问记录,以加快查找的速度.这个映射函数叫做散列函数,存放记录 ...