纳金网

标题: 内置着色器包含文件 [打印本页]

作者: star-小虎    时间: 2013-10-16 16:12
标题: 内置着色器包含文件

Unity contains several files that can be used by your shader programs to bring in predefined variables and helper functions. This is done by the standard #include directive, e.g.:

Unity包含几个可被你的 着色器程序 使用的文件,它们带有预定义的变量和辅助函数。这通过标准 #include命令来使用,例如:

    CGPROGRAM    // ...    #include "UnityCG.cginc"    // ...    ENDCG

Shader include files in Unity are with .cginc extension, and the built-in ones are:

在Unity中Shader include文件的扩展名是.cginc,内置的文件如下:

These files are found inside Unity application ({unity install path}/Data/CGIncludes/UnityCG.cginc on Windows,/Applications/Unity/Unity.app/Contents/CGIncludes/UnityCG.cginc on Mac), if you want to take a look at what exactly is done in any of the helper code.

这些文件存放在Unity程序中,在电脑上的具体位置是: Windows系统在{unity install path}/Data/CGIncludes/UnityCG.cginc Mac系统在 /Applications/Unity/Unity.app/Contents/CGIncludes/UnityCG.cginc 如果你想看一看里面的辅助代码究竟是什么,可以在这些位置找到具体文件。

HLSLSupport.cginc

This file is automatically included when compiling shaders. It mostly declares various preprocessor macros to aid in multi-platform shader development.

当编译着色器时这个文件会自动包括。它主要声明各种预处理宏来帮助多平台着色器开发。

UnityCG.cginc

This file is often included in Unity shaders to bring in many helper functions and definitions.

此文件经常包含在Unity着色器中,带来很多辅助函数和定义。

Data structures in UnityCG.cginc 在UnityCG.cginc中的数据结构Generic helper functions in UnityCG.cginc 在UnityCG.cginc中的通用辅助函数Forward rendering helper functions in UnityCG.cginc
UnityCG.cginc正向渲染辅助函数

These functions are only useful when using forward rendering (ForwardBase or ForwardAdd pass types).

这些函数只有当使用forward rendering(ForwardBase 或 ForwardAdd通道类型)时才有效。

Vertex-lit helper functions in UnityCG.cginc
UnityCG.cginc中的顶点光照辅助函数

These functions are only useful when using per-vertex lit shaders ("Vertex" pass type).

这些函数只在当使用逐顶点光照着色器(“顶点”通道类型)时才有效。


作者: 大爷是某人小号    时间: 2013-10-16 16:13
你这是从文档中copy来的吧,你可以转外国论坛的,不用非得中文
作者: nts    时间: 2013-10-17 09:38
好像是文档啊
作者: 幸福小猪    时间: 2013-10-28 10:42
感谢楼主分享
作者: run0006    时间: 2014-5-7 04:08
感謝分享!




欢迎光临 纳金网 (http://course.narkii.com/club/) Powered by Discuz! X2.5