Unity3D Shader 内置函数
Intrinsic Functions (DirectX HLSL)
The following table lists the intrinsic functions available in HLSL. Each function has a brief description, and a link to a reference page that has more detail about the input argument and return type.
| Name | Syntax | Description |
|---|---|---|
| abs | abs(x) | Absolute value (per component). |
| acos | acos(x) | Returns the arccosine of each component of x. |
| all | all(x) | Test if all components of x are nonzero. |
| any | any(x) | Test if any component of x is nonzero. |
| asfloat | asfloat(x) | Convert the input type to a float. |
| asin | asin(x) | Returns the arcsine of each component of x. |
| asint | asint(x) | Convert the input type to an integer. |
| asuint | asuint(x) | Convert the input type to an unsigned integer. |
| atan | atan(x) | Returns the arctangent of x. |
| atan2 | atan2(y, x) | Returns the arctangent of of two values (x,y). |
| ceil | ceil(x) | Returns the smallest integer which is greater than or equal to x. |
| clamp | clamp(x, min, max) | Clamps x to the range [min, max]. |
| clip | clip(x) | Discards the current pixel, if any component of x is less than zero. |
| cos | cos(x) | Returns the cosine of x. |
| cosh | cosh(x) | Returns the hyperbolic cosine of x. |
| cross | cross(x, y) | Returns the cross product of two 3D vectors. |
| D3DCOLORtoUBYTE4 | D3DCOLORtoUBYTE4(x) | Swizzles and scales components of the 4D vector x to compensate for the lack of UBYTE4 support in some hardware. |
| ddx | ddx(x) | Returns the partial derivative of x with respect to the screen-space x-coordinate. |
| ddy | ddy(x) | Returns the partial derivative of x with respect to the screen-space y-coordinate. |
| degrees | degrees(x) | Converts x from radians to degrees. |
| determinant | determinant(m) | Returns the determinant of the square matrix m. |
| distance | distance(x, y) | Returns the distance between two points. |
| dot | dot(x, y) | Returns the dot product of two vectors. |
| exp | exp(x) | Returns the base-e exponent. |
| exp2 | exp2(x) | Base 2 exponent (per component). |
| faceforward | faceforward(n, i, ng) | Returns -n * sign(•(i, ng)). |
| floor | floor(x) | Returns the greatest integer which is less than or equal to x. |
| fmod | fmod(x, y) | Returns the floating point remainder of x/y. |
| frac | frac(x) | Returns the fractional part of x. |
| frexp | frexp(x, exp) | Returns the mantissa and exponent of x. |
| fwidth | fwidth(x) | Returns abs(ddx(x)) + abs(ddy(x)) |
| GetRenderTargetSampleCount | GetRenderTargetSampleCount() | Returns the number of render-target samples. |
| GetRenderTargetSamplePosition | GetRenderTargetSamplePosition(x) | Returns a sample position (x,y) for a given sample index. |
| isfinite | isfinite(x) | Returns true if x is finite, false otherwise. |
| isinf | isinf(x) | Returns true if x is +INF or -INF, false otherwise. |
| isnan | isnan(x) | Returns true if x is NAN or QNAN, false otherwise. |
| ldexp | ldexp(x, exp) | Returns x * 2exp |
| length | length(v) | Returns the length of the vector v. |
| lerp | lerp(x, y, s) | Returns x + s(y - x). |
| lit | lit(n • l, n • h, m) | Returns a lighting vector (ambient, diffuse, specular, 1) |
| log | log(x) | Returns the base-e logarithm of x. |
| log10 | log10(x) | Returns the base-10 logarithm of x. |
| log2 | log2(x) | Returns the base-2 logarithm of x. |
| max | max(x, y) | Selects the greater of x and y. |
| min | min(x, y) | Selects the lesser of x and y. |
| modf | modf(x, out ip) | Splits the value x into fractional and integer parts. |
| mul | mul(x, y) | Performs matrix multiplication using x and y. |
| noise | noise(x) | Generates a random value using the Perlin-noise algorithm. |
| normalize | normalize(x) | Returns a normalized vector. |
| pow | pow(x, y) | Returns xy. |
| radians | radians(x) | Converts x from degrees to radians. |
| reflect | reflect(i, n) | Returns a reflection vector. |
| refract | refract(i, n, R) | Returns the refraction vector. |
| round | round(x) | Rounds x to the nearest integer |
| rsqrt | rsqrt(x) | Returns 1 / sqrt(x) |
| saturate | saturate(x) | Clamps x to the range [0, 1] |
| sign | sign(x) | Computes the sign of x. |
| sin | sin(x) | Returns the sine of x |
| sincos | sincos(x, out s, out c) | Returns the sine and cosine of x. |
| sinh | sinh(x) | Returns the hyperbolic sine of x |
| smoothstep | smoothstep(min, max, x) | Returns a smooth Hermite interpolation between 0 and 1. |
| sqrt | sqrt(x) | Square root (per component) |
| step | step(a, x) | Returns (x >= a) ? 1 : 0 |
| tan | tan(x) | Returns the tangent of x |
| tanh | tanh(x) | Returns the hyperbolic tangent of x |
| tex1D | tex1D(s, t) | 1D texture lookup. |
| tex1Dbias | tex1Dbias(s, t) | 1D texture lookup with bias. |
| tex1Dgrad | tex1Dgrad(s, t, ddx, ddy) | 1D texture lookup with a gradient. |
| tex1Dlod | tex1Dlod(s, t) | 1D texture lookup with LOD. |
| tex1Dproj | tex1Dproj(s, t) | 1D texture lookup with projective divide. |
| tex2D | tex2D(s, t) | 2D texture lookup. |
| tex2Dbias | tex2Dbias(s, t) | 2D texture lookup with bias. |
| tex2Dgrad | tex2Dgrad(s, t, ddx, ddy) | 2D texture lookup with a gradient. |
| tex2Dlod | tex2Dlod(s, t) | 2D texture lookup with LOD. |
| tex2Dproj | tex2Dproj(s, t) | 2D texture lookup with projective divide. |
| tex3D | tex3D(s, t) | 3D texture lookup. |
| tex3Dbias | tex3Dbias(s, t) | 3D texture lookup with bias. |
| tex3Dgrad | tex3Dgrad(s, t, ddx, ddy) | 3D texture lookup with a gradient. |
| tex3Dlod | tex3Dlod(s, t) | 3D texture lookup with LOD. |
| tex3Dproj | tex3Dproj(s, t) | 3D texture lookup with projective divide. |
| texCUBE | texCUBE(s, t) | Cube texture lookup. |
| texCUBEbias | texCUBEbias(s, t) | Cube texture lookup with bias. |
| texCUBEgrad | texCUBEgrad(s, t, ddx, ddy) | Cube texture lookup with a gradient. |
| texCUBElod | tex3Dlod(s, t) | Cube texture lookup with LOD. |
| texCUBEproj | texCUBEproj(s, t) | Cube texture lookup with projective divide. |
| transpose | transpose(m) | Returns the transpose of the matrix m. |
| trunc | trunc(x) | Truncates floating-point value(s) to integer value(s) |
Unity3D Shader 内置函数的更多相关文章
- Unity3d shader内置矩阵
内置矩阵 支持的矩阵(float4x4):UNITY_MATRIX_MVP 当前模型视图投影矩阵UNITY_MATRIX_MV 当前模型视图矩阵UNITY_MATRI ...
- Unity3D -- shader语法内置函数
该篇是Unity Shader中HLSL的内置函数,主要是一些数学方面的计算函数.在写Shader的时候可以直接使用. abs //计算输入值的绝对值. acos //返回输入值反余弦值. all / ...
- [Unity Shader] 坐标变换与法线变换及Unity5新增加的内置函数
学习第六章Unity内置函数时,由于之前使用mul矩阵乘法时的顺序与书中不一致,导致使用内置函数时出现光照效果不一样,因此引出以下两个问题: 1 什么时候使用3x3矩阵,什么时候使用4x4矩阵? 2 ...
- DirectX HLSL 内置函数
Intrinsic Functions (DirectX HLSL) The following table lists the intrinsic functions available in HL ...
- Unity3D -- shader光照常用函数和变量
上一篇记录了shader常用函数和变量,这篇记录一些光照计算时常用函数和变量 1.内置的光照变量 _LightColor0 float4 //该Pass处理的逐像素光源的颜色 _WorldSpaceL ...
- CG 内置函数 和 HLSL 内置函数
CG 内置函数 英伟达官网链接: http://http.developer.nvidia.com/Cg/index_stdlib.html absacosallanyasinatan2atanbi ...
- Entity Framework 6 Recipes 2nd Edition(11-12)译 -> 定义内置函数
11-12. 定义内置函数 问题 想要定义一个在eSQL 和LINQ 查询里使用的内置函数. 解决方案 我们要在数据库中使用IsNull 函数,但是EF没有为eSQL 或LINQ发布这个函数. 假设我 ...
- Oracle内置函数:时间函数,转换函数,字符串函数,数值函数,替换函数
dual单行单列的隐藏表,看不见 但是可以用,经常用来调内置函数.不用新建表 时间函数 sysdate 系统当前时间 add_months 作用:对日期的月份进行加减 写法:add_months(日期 ...
- python内置函数
python内置函数 官方文档:点击 在这里我只列举一些常见的内置函数用法 1.abs()[求数字的绝对值] >>> abs(-13) 13 2.all() 判断所有集合元素都为真的 ...
随机推荐
- windows 2003 iis 360防黑加固后不能使用
最近在使用360的防黑加固加固2003系统,发现IIS居然不能够使用了,报401.1错误,查找解决方案如下: 1.我的电脑-〉属性-〉管理-〉本地用户和组,查看IUSER用户是否开启,如果未开启开启后 ...
- Google Maps瓦片(tile)地图文件下载(1-11层级)
整理硬盘时,发现一份去年下载的谷歌地图瓦片文件,整理并分享给大家. 地图来源:Google Maps(应该是国内谷歌地图) 采集时间:2017年6月 采集范围:0-6层级世界范围:7-11层级中国范围 ...
- 微软BI 之SSIS 系列 - Lookup 组件的使用与它的几种缓存模式 - Full Cache, Partial Cache, NO Cache
开篇介绍 先简单的演示一下使用 Lookup 组件实现一个简单示例 - 从数据源表 A 中导出数据到目标数据表 B,如果 A 数据在 B 中不存在就插入新数据到B,如果存在就更新B 和 A 表数据保持 ...
- 每天一个linux命令(2):cd命令
1.作用 cd(Change Directory 改变目录)命令用来切换工作目录至dirname. 其中dirName表示法可为绝对路径或相对路径.若目录名称省略,则变换至使用者的home direc ...
- ArrayList vs LinkedList 空间占用
空间占用上,ArrayList完胜 看下两者的内存占用图 这三个图,横轴是list长度,纵轴是内存占用值.两条蓝线是LinkedList,两条红线是ArrayList,可以看到,LinkedLis ...
- SoapUI Pro Project Solution Collection –Easy develop Groovy Script to improve SoapUI ability
As you know the groovy script and java script language is the soapui supported .but unfortunately So ...
- MySQL5.7在JSON解析后丢失小数部分的Bug
在MySQL Bugs上提交了 https://bugs.mysql.com/bug.php?id=84935 . 已经在MySQL8.0.1中修复 重现步骤 -- Prepare the table ...
- selenium是如何启动浏览器的
前几天有同学问到selenium是怎么样启动浏览器的(selenium启动浏览器的原理),当时稍微讲解了一下,不过自我感觉不够具体,现在特地把启动原理通过代码和一系列操作给串联起来,希望可以帮助大家更 ...
- 【Android】开源项目UniversalImageLoader及开源框架ImageLoader
UniversalImageLoader 简单来说就是用于加载图片的一个开源项目,在其项目介绍中是这么写的 支持多线程图片加载 提供丰富的细节配置,比如线程池大小,HTPP请求项,内存和磁盘缓存,图片 ...
- rtrim() 函数 从字符串的末端开始删除空白字符!
例子 在本例中,我们将使用 rtrim() 函数从字符串右端删除字符: <?php $str = "Hello World!\n\n"; echo $str; echo rt ...