最近在学习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)的更多相关文章

  1. Unity GUI编程

    脚本语言:C# 附上一张图说明Unity GUI编程中可用的控件:(可能有遗漏) 下面列出一些例子来说明: 1.Groups : 在固定Layout模式中起到组织可用项的功能,它让你在屏幕的一个区域中 ...

  2. 【Unity Shader】Unity Chan的卡通材质

    写在前面 时隔两个月我终于来更新博客了,之前一直在学东西,做一些项目,感觉没什么可以分享的就一直没写.本来之前打算写云彩渲染或是Compute Shader的,觉得时间比较长所以打算先写个简单的. 今 ...

  3. Java实战之03Spring-03Spring的核心之AOP(Aspect Oriented Programming 面向切面编程)

    三.Spring的核心之AOP(Aspect Oriented Programming 面向切面编程) 1.AOP概念及原理 1.1.什么是AOP OOP:Object Oriented Progra ...

  4. Unity学习笔记(二)——第一个Unity项目Hello Unity

    保留版权,转载请注明出处:http://blog.csdn.net/panjunbiao/article/details/9318811 在这一篇文章里,参照宣雨松的<Unity 3D游戏开发& ...

  5. Unity cg vertex and fragment shaders(二)

    着色器的一般结构: Shader "MyShader/MyShaderName" { Properties { // ... properties here ... } SubSh ...

  6. Unity cg vertex and fragment shaders(一)

    cg片段 Cg程序片段写CGPROGRAM和ENDCG之间 开始时的片段可以作为#pragma语句编译指令 Pass { // ... the usual pass state setup ... C ...

  7. 解读Unity中的CG编写Shader系列4——unity中的圆角矩形shader

    上篇文章中我们掌握了表面剔除和剪裁模式 这篇文章将利用这些知识实现一个简单的,可是又非经常常使用的样例:把一张图片做成圆角矩形 例3:圆角矩形Shader 好吧我承认在做这个样例的时候走了不少弯路,因 ...

  8. [转]解读Unity中的CG编写Shader系列4——unity中的圆角矩形shader

    上篇文章中我们掌握了表面剔除和剪裁模式这篇文章将利用这些知识实现一个简单的,但是又很常用的例子:把一张图片做成圆角矩形 例3:圆角矩形Shader好吧我承认在做这个例子的时候走了不少弯路,由于本人对矩 ...

  9. [Unity] Cg标准函数库

随机推荐

  1. javacpp-FFmpeg系列之2:通用拉流解码器,支持视频拉流解码并转换为YUV、BGR24或RGB24等图像像素数据

    javacpp-ffmpeg系列: javacpp-FFmpeg系列之1:视频拉流解码成YUVJ420P,并保存为jpg图片 javacpp-FFmpeg系列之2:通用拉流解码器,支持视频拉流解码并转 ...

  2. Redis 客户端安装与远程连接图解

    Linux环境:Centos 6.8 Redis服务端版本:3.2.6 Redis客户端下载链接:https://redisdesktop.com/download 省略Linux系统安装Redis教 ...

  3. KCF+Opencv3.0+Cmake+Win10 测试

    配置 需要的文件下载 安装CMake,安装opencv3.0.0 在KCFcpp-master 目录下新建一个文件夹,命名为build 打开CMake-GUI配置如下: 点击Configure,编译器 ...

  4. springboot 1.5.x中的动态切换日志级别

    logback是一套日志框架,由log4j的优化版,由同一个作者开发,在速度和性能上都超过其他日志框架,再结合slf4j,已成为当前最流行的日志框架. 一.springboot中使用logback s ...

  5. cassandra根据用户名密码登录cqlsh

     修改conf目录下cassandra.yaml文件 authenticator: PasswordAuthenticator //将authenticator修改为PasswordAuthentic ...

  6. 基于Qt Gui的Led控制显示程序

    基于arm + linux的嵌入式软件开发,基本上的内容主要是:u-boot的移植,kernel的裁剪和相关驱动程序的设计,root-fs的制作,应用程序的设计,其中,应用程序主要包含两方面的内容:G ...

  7. Arduino 元件

    http://www.rs-online.com/designspark/electronics/

  8. MVN&nbsp;命令行

    Maven依赖查询: http://mvnrepository.com/ Maven常用命令:  1. 创建Maven的普通java项目:     mvn archetype:create     - ...

  9. 《Java多线程编程核心技术》读后感(十)

    一生产一消费:操作栈 本实例是使生产者向堆栈List对象中放入数据,使消费者从List堆栈中取出数据.List最大容量是1 package Third; import java.util.ArrayL ...

  10. 阿里云服务器CentOS7中Tomcat8.x启动慢问题解决记录

    公司服务器刚换CentOS7,在内部的刀片机上一直跑的很溜,迁移到阿里云上后Tomcat启动竟然要6.7分钟!这还了得. 且日志上无任何错误,在日志中查看到如下信息: Log4j:[2015-10-2 ...