本文版权归 博客园 七星重剑 所有,如有转载,请按如下方式于显示位置标明原创作者及出处,以示尊重!!
作者:七星重剑
原文:每天30分钟看Shader--(1)HLSL固有函数 【Intrinsic Functions (DirectX HLSL)】

放在blog上看起来方便,这个是MSDN上的,DirectX Documentation里也有

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)

表 3-1 HLSL内置函数

函数名            用法

abs                         计算输入值的绝对值。

acos                        返回输入值反余弦值。

all                           测试非0值。

any                         测试输入值中的任何非零值。

asin                         返回输入值的反正弦值。

atan                        返回输入值的反正切值。

atan2                       返回y/x的反正切值。

ceil                         返回大于或等于输入值的最小整数。

clamp                      把输入值限制在[min, max]范围内。

clip                         如果输入向量中的任何元素小于0,则丢弃当前像素。

cos                         返回输入值的余弦。

cosh                       返回输入值的双曲余弦。

cross                      返回两个3D向量的叉积。

ddx                         返回关于屏幕坐标x轴的偏导数。

ddy                         返回关于屏幕坐标y轴的偏导数。

degrees                   弧度到角度的转换

determinant              返回输入矩阵的值。

distance                   返回两个输入点间的距离。

dot                          返回两个向量的点积。

exp                         返回以e为底数,输入值为指数的指数函数值。

exp2                       返回以2为底数,输入值为指数的指数函数值。

faceforward             检测多边形是否位于正面。

floor                       返回小于等于x的最大整数。

fmod                       返回a / b的浮点余数。

frac                        返回输入值的小数部分。

frexp                       返回输入值的尾数和指数

fwidth                     返回 abs ( ddx (x) + abs ( ddy(x))。

isfinite                     如果输入值为有限值则返回true,否则返回false。

isinf                        如何输入值为无限的则返回true。

isnan                       如果输入值为NAN或QNAN则返回true。

ldexp                       frexp的逆运算,返回 x * 2 ^ exp。

len / lenth                返回输入向量的长度。

lerp                         对输入值进行插值计算。

lit                            返回光照向量(环境光,漫反射光,镜面高光,1)。

log                          返回以e为底的对数。

log10                      返回以10为底的对数。

log2                        返回以2为底的对数。

max                        返回两个输入值中较大的一个。

min                         返回两个输入值中较小的一个。

modf                       把输入值分解为整数和小数部分。

mul                         返回输入矩阵相乘的积。

normalize                 返回规范化的向量,定义为 x / length(x)。

pow                        返回输入值的指定次幂。

radians                    角度到弧度的转换。

reflect                     返回入射光线i对表面法线n的反射光线。

refract                     返回在入射光线i,表面法线n,折射率为eta下的折射光线v。

round                      返回最接近于输入值的整数。

rsqrt                       返回输入值平方根的倒数。

saturate                   把输入值限制到[0, 1]之间。

sign                        计算输入值的符号。

sin                          计算输入值的正弦值。

sincos                     返回输入值的正弦和余弦值。

sinh                        返回x的双曲正弦。

smoothstep              返回一个在输入值之间平稳变化的插值。

sqrt                         返回输入值的平方根。

step                        返回(x >= a)? 1 : 0。

tan                          返回输入值的正切值。

fanh                        返回输入值的双曲线切线。

transpose                 返回输入矩阵的转置。

tex1D*                    1D纹理查询。

tex2D*                    2D纹理查询。

tex3D*                    3D纹理查询。

texCUBE*                立方纹理查询。

HLSL内置函数一览相关推荐

  1. HLSL内置函数,及HLSL与GLSL的对应函数

    HLSL函数列表 本表来自网络,我对说明做了些修改. Name Syntax Description abs abs(x) 返回x的绝对值.对x的每个元素都会独立计算一次.Absolute value ...

  2. CG/hlsl 内置函数

    数学函数 abs(x)  返回输入参数的绝对值 acos(x)  反余切函数,输入参数范围为[-1,1], 返回[0,π]区间的角度值 all(x)  如果输入参数均不为0,则返回ture: 否则返回 ...

  3. python 3 常用内置函数

    一.简介 如其他计算机语言一般, python 也有自己的内置函数,本文会一一实现python的所有内置函数,并注明一些需注意的地方 二.内置函数一览 三.实现 目录 (1)dir() (2)help ...

  4. Python 常用内置函数map、zip、filter、reduce、enumerate

    Python 中有许多非常实用的内置函数,通过这些函数我们可以方便的实现某些功能,下面就列举一些常用的内置函数. 1. map() 函数 map() 可以根据提供的函数对指定序列做映射,它接受一个函数 ...

  5. 2021年大数据Hive(五):Hive的内置函数(数学、字符串、日期、条件、转换、行转列)

    全网最详细的Hive文章系列,强烈建议收藏加关注! 后面更新文章都会列出历史文章目录,帮助大家回顾知识重点. 目录 系列历史文章 前言 Hive的内置函数 一.数学函数 1. 取整函数: round ...

  6. python3 内置函数map 返回的迭代器转为列表

    python3 内置函数map 返回的是迭代器,python2 返回的才是列表, 在python3中想要使用需要把迭代器在转换成列表 list_a = [1, 2, 3, 4, 5]def add(n ...

  7. Python Day26:多态、封装、内置函数:__str__、__del__、反射(反省)、动态导入模块...

    ## 多态 ```python OOP中标准解释:多个不同类型对象,可以响应同一个方法,并产生不同结果,即为多态 多态好处:只要知道基类使用方法即可,不需要关心具体哪一个类的对象实现的,以不变应万变, ...

  8. 13装饰器和内置函数

    装饰器 # 1.装饰用的工具# import time #内置函数计算函数运行时间 # print(time.time())# import time # def func(): # start_ti ...

  9. python中execute函数_Python 中的内置函数与模块

    封面图片来源:沙沙野 内容概览 内置函数(二) 模块概念 内置函数(二) ord():输入字符找该字符编码 (Unicode) 的位置 print 2. chr():输入位置数字找出其对应的字符 pr ...

最新文章

  1. 浅尝key-value数据库(三)——MongoDB的分布式
  2. master-slave(主/从)模式
  3. SOAMANAGER配置后无法登录问题
  4. log4j2动态修改日志级别及拓展性使用
  5. Android开发中的多线程编程技术
  6. matlab中rms代表什么_电气施工图纸中BV、ZRBLV和TC、SC符号代表什么?
  7. Python数据分析(一):Pandas、Numpy
  8. MVVM模式下,自定义用户控件不执行COMMAND的原因
  9. Ubuntu22.04 Python 深度学习环境配置记录
  10. 40句常用Linux命令总结(手写板)
  11. 最小-最大搜索和Alpha-beta剪枝搜索
  12. 静态库、动态库及导入库
  13. 计算机excel怎么删除重复项,在Excel中巧妙提示重复输入和删除重复数据
  14. 超有爱的并查集 6666
  15. Linux下载zip
  16. 高通linux平台(mdm9x07,sdx12)连接qact
  17. 图片尺寸压缩和图片质量压缩
  18. python向es写入大量数据_使用Python-elasticsearch-bulk批量快速向elasticsearch插入数据_李谦的博客-CSDN博客...
  19. 计量经济学Stata-自用笔记
  20. 论文 文献引用字体颜色更改为蓝色

热门文章

  1. 指针06:指针和数组
  2. 力扣——合并两个有序链表
  3. Go Module 工程化实践(二):go get 取包原理篇
  4. JVM常见的七种垃圾收集器的简单比较
  5. 小程序(仿微信发布说说功能)
  6. 【376天】每日项目总结系列113(2018.02.16)
  7. oraccle 索引管理
  8. python3爬取中国药学科学数据
  9. 【李宏毅2020 ML/DL】P78 Generative Adversarial Network | fGAN: General Framework of GAN
  10. vivox20 html阅读器,【vivoX20评测】屏幕:全面屏也得看显示素质_vivo X20_手机评测-中关村在线...