| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1743 人关注过本帖
标题:有关Adobe Pixel Bender内置函数
只看楼主 加入收藏
zb6306
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-1-26
收藏
 问题点数:0 回复次数:0 
有关Adobe Pixel Bender内置函数
大家好,有关Adoeb Pixel Bender 我在此不用细说了吧,就是我们说的着色器语言,以下是我整理的这个语言的内置函数,希望对大家有所帮助 ,因为本人不懂英文,所以解释的肯定不正确,希望大家拍砖。
Pixel Bender内置函数
如没有特殊注明,所有角度均为弧度:
弧度转换为角度
float radians( float degrees )                     
float2 radians( float2 degrees )
float3 radians( float3 degrees )
float4 radians( float4 degrees )
角度转换为弧度
float degrees( float radians )
float2 degrees ( float2 radians )
float3 degrees ( float3 radians )
float4 degrees ( float4 radians )
正弦值、余弦、正切
float sin( float radians )
float2 sin( float2 radians )
float3 sin( float3 radians )
float4 sin( float4 radians )
float cos( float radians )
float2 cos( float2 radians )
float3 cos( float3 radians )
float4 cos( float4 radians )
以下如果cos(radians)==0,返回值Undefined
float tan( float radians )
float2 tan( float2 radians )
float3 tan( float3 radians )
float4 tan( float4 radians )
反正弦
float asin( float x )
float2 asin( float2 x )
float3 asin( float3 x )
float4 asin( float4 x )
其中x的取值满园为-1到1,返回值为-PI/2到PI/2之间;如果x的取值范围大于1或是小于-1,返回Undefined值
反余弦
float acos( float x )
float2 acos( float2 x )
float3 acos( float3 x )
float4 acos( float4 x )
其中x的取值范围为-1到1,返回值为0到PI;取值范围大于1或是小于-1,返回Undefined值;
反值的正切
float atan( float y_over_x )
float2 atan( float2 y_over_x)
float3 atan( float3 y_over_x)
float4 atan( float4 y_over_x)
其中 返回值为-PI/2到PI/2,这里是返回单一值的正切角度值
返回坐标参数x与y的角度值
float atan( float y, float x )
float2 atan( float2 y, float2 x )
float3 atan( float3 y, float3 x )
float4 atan( float4 y, float4 x )
如果x==0或是y==0 返回Undefined 否则返回值的范围是-PI到PI
冥指运算,返回xy。如果x<0,返回Undefined;
float pow( float x, float y )
float2 pow ( float2 x, float2 y )
float3 pow ( float3 x, float3 y )
float4 pow ( float4 x, float4 y )
e指数运算,返回ex。
float exp( float x )
float2 exp( float2 x )
float3 exp( float3 x )
float4 exp( float4 x )
2的指数运算返回2x。
float exp2( float x )
float2 exp2( float2 x )
float3 exp2( float3 x )
float4 exp2( float4 x )
自然对数运算。如果x<0返回Undefined;
float log( float x )
float2 log( float2 x )
float3 log( float3 x )
float4 log( float4 x )
以2为底的对数运算。如果x<0返回Undefined;
float log2( float x )
float2 log2( float2 x )
float3 log2( float3 x )
float4 log2( float4 x )
平方根运算。如果x<0返回Undefined;
float sqrt( float x )
float2 sqrt( float2 x )
float3 sqrt( float3 x )
float4 sqrt( float4 x )
平方根的倒数运算。如果x<0返回Undefined;
float inverseSqrt( float x )
float2 inverseSqrt( float2 x )
float3 inverseSqrt( float3 x )
float4 inverseSqrt( float4 x )
绝对值运算。如果x>0,返回x,如果x<0返回-x;
float abs( float x )
float2 abs( float2 x )
float3 abs( float3 x )
float4 abs( float4 x )
判断函数,在此我是这样理解的,因为此了函数返回三个数值,-1,0,1,这是我们在函数判断中经常使用的。如果x<0,return 1;x=0,return 0,x>0,return 1;
float sign( float x )
float2 sign( float2 x )
float3 sign( float3 x )
float4 sign( float4 x )
就近取整,返回x最近的整数 返回值<=x;
float floor( float x )
float2 floor( float2 x )
float3 floor( float3 x )
float4 floor( float4 x )
向上取整,返回最接近的上限整数 返回值>=x;
float ceil( float x )
float2 ceil( float2 x )
float3 ceil( float3 x )
float4 ceil( float4 x )
向下取整差,返回x与floor(x)的差值 x-floor(x);
float fract( float x )
float2 fract( float2 x )
float3 fract( float3 x )
float4 fract( float4 x )
返回x-y*floor(y/x);的值;如果y==0,返回Undefined;
float mod( float x, float y )
float2 mod( float2 x, float2 y )
float3 mod( float3 x, float3 y )
float4 mod( float4 x, float4 y )
float2 mod( float2 x, float y )
float3 mod( float3 x, float y )
float4 mod( float4 x, float y )
返回最小值 如果x<y,返回x,反之返回y。
float min( float x, float y )
float2 min( float2 x, float2 y )
float3 min( float3 x, float3 y )
float4 min( float4 x, float4 y )
float2 min( float2 x, float y )
float3 min( float3 x, float y )
float4 min( float4 x, float y )
返回最大值 如果x<y,返回y,否则返回x。
float max( float x, float y )
float2 max( float2 x, float2 y )
float3 max( float3 x, float3 y )
float4 max( float4 x, float4 y )
float2 max( float2 x, float y )
float3 max( float3 x, float y )
float4 max( float4 x, float y )
判断x,y值并返回相应的值的函数,类似与返回一个布尔值的方法,但此函数返回的是一个浮点值0.0与1.0的值
如果y<x return 0.0 反之return 1.0;
float step( float x, float y )
float2 step( float2 x, float2 y )
float3 step( float3 x, float3 y )
float4 step( float4 x, float4 y )
float2 step( float x, float2 y )
float3 step( float x, float3 y )
float4 step( float x, float4 y )
限定值函数 如果x<最小值,返回最小值,反之如果x>最大值,返回最大值,否则返回x值。这个函数可以保证x的取值不会超过限定的最大与最小值的范围。minval(最小值),maxval(最大值)
float clamp(float x, float minval, float maxval)
float2 clamp(float2 x, float2 minval, float2 maxval)
float3 clamp(float3 x, float3 minval, float3 maxval)
float4 clamp(float4 x, float4 minval, float4 maxval)
float2 clamp( float2 x, float minval, float maxval )
float3 clamp( float3 x, float minval, float maxval )
float4 clamp( float4 x, float minval, float maxval )
返回x * (1.0 - a) +y * a,也就是说返回一个线性插值,介与x与y之间
float mix(float x, float y, float a)
float2 mix(float2 x, float2 y, float2 a)
float3 mix(float3 x, float3 y, float3 a)
float4 mix(float4 x, float4 y, float4 a)
float2 mix( float2 x, float2 y, float a )
float3 mix( float3 x, float3 y, float a )
float4 mix( float4 x, float4 y, float a )
如果x<=edge0,return 0,如果x>=edge1,return 1。否则计算插值。在此插值应该是x。
float smoothStep(float edge0, float edge1, float x)
float2 smoothStep(float2 edge0, float2 edge1, float2 x)
float3 smoothStep(float3 edge0, float3 edge1, float3 x)
float4 smoothStep(float4 edge0, float4 edge1, float4 x)
float2 smoothStep( float edge0, float edge1, float2 x )
float3 smoothStep( float edge0, float edge1, float3 x )
float4 smoothStep( float edge0, float edge1, float4 x )
返回向量的长度
float length(float x)
float length(float2 x)
float length(float3 x)
float length(float4 x)
返回向量的距离
float distance(float x, float y)
float distance(float2 x, float2 y)
float distance(float3 x, float3 y)
float distance(float4 x, float4 y)
返回x与y的积(向量乘法)
float dot(float x, float y)
float dot(float2 x, float2 y)
float dot(float3 x, float3 y)
float dot(float4 x, float4 y)
叉积(这个我不确定,原文是Returns the cross product of x and y.
float3 cross(vector3 x, vector3 y);
返回单位向量(此翻译也不确定,有待高手纠正)。
如果length(x)==0,返回Undefined;
(CG编程语言中,对此函数的解释是:返回一个指向与向量x一样,长度为1的向量)
float normalize(float x)
float2 normalize(float2 x)
float3 normalize(float3 x)
float4 normalize(float4 x)
矩阵相乘
(此函数类似于CG中的mul(M,N)函数)
float2x2 matrixCompMult(float2x2 x, float2x2 y)
float3x3 matrixCompMult(float3x3 x, float3x3 y)
float4x4 matrixCompMult(float4x4 x, float4x4 y)
通过比较向量值,返回布尔值
x<y;
bool2 lessThan(int2 x, int2 y)
bool3 lessThan(int3 x, int3 y)
bool4 lessThan(int4 x, int4 y)
bool2 lessThan(float2 x, float2 y)
bool3 lessThan(float3 x, float3 y)
bool4 lessThan(float4 x, float4 y)
x<=y;
bool2 lessThanEqual(int2 x, int2 y)
bool3 lessThanEqual(int3 x, int3 y)
bool4 lessThanEqual(int4 x, int4 y)
bool2 lessThanEqual(float2 x, float2 y)
bool3 lessThanEqual(float3 x, float3 y)
bool4 lessThanEqual(float4 x, float4 y)
x>y;
bool2 greaterThan(int2 x, int2 y)
bool3 greaterThan(int3 x, int3 y)
bool4 greaterThan(int4 x, int4 y)
bool2 greaterThan(float2 x, float2 y)
bool3 greaterThan(float3 x, float3 y)
bool4 greaterThan(float4 x, float4 y)
x>=y;
bool2 greaterThanEqual(int2 x, int2 y)
bool3 greaterThanEqual(int3 x, int3 y)
bool4 greaterThanEqual(int4 x, int4 y)
bool2 greaterThanEqual(float2 x, float2 y)
bool3 greaterThanEqual(float3 x, float3 y)
bool4 greaterThanEqual(float4 x, float4 y)
x==y;
bool2 equal(int2 x, int2 y)
bool3 equal(int3 x, int3 y)
bool4 equal(int4 x, int4 y)
bool2 equal(float2 x, float2 y)
bool3 equal(float3 x, float3 y)
bool4 equal(float4 x, float4 y)
bool2 equal(bool2 x, bool2 y)
bool3 equal(bool3 x, bool3 y)
bool4 equal(bool4 x, bool4 y)
x!=y;
bool2 notEqual(int2 x, int2 y)
bool3 notEqual(int3 x, int3 y)
bool4 notEqual(int4 x, int4 y)
bool2 notEqual(float2 x, float2 y)
bool3 notEqual(float3 x, float3 y)
bool4 notEqual(float4 x, float4 y)
bool2 notEqual(bool2 x, bool2 y)
bool3 notEqual(bool3 x, bool3 y)
bool4 notEqual(bool4 x, bool4 y)
以下是对值的判断返回布尔值;
如果任意x有效(为true),返回true;
bool any(bool2 x)
bool any(bool3 x)
bool any(bool4 x)
如果所有的x为true,返回true;
bool all(bool2 x)
bool all(bool3 x)
bool all(bool4 x)
取反
bool2 not(bool2 x)
bool3 not(bool3 x)
bool4 not(bool4 x)
对象素进行采样
Sample函数采样比较精细,可以生成比较光滑的纹理
pixel1 sample( image1 im, float2 v )
pixel2 sample( image2 im, float2 v )
pixel3 sample( image3 im, float2 v )
pixel4 sample( image4 im, float2 v )
下面函数与上面的效果是一致的
pixel1 sampleLinear( image1 im, float2 v )
pixel2 sampleLinear( image2 im, float2 v )
pixel3 sampleLinear( image3 im, float2 v )
pixel4 sampleLinear( image4 im, float2 v )
下面的函数也是采样函数,只是这个是不精细采样。容易生成马赛克;
pixel1 sampleNearest( image1 im, float2 v )
pixel2 sampleNearest( image2 im, float2 v )
pixel3 sampleNearest( image3 im, float2 v )
pixel4 sampleNearest( image4 im, float2 v )
输出象素坐标
float2 outCoord()
返回数组的元素个数
int arrayVariable.length()
返回象素的坐标值
float2 pixelSize( image1 )
float2 pixelSize( image2 )
float2 pixelSize( image3 )
float2 pixelSize( image4 )
float2 pixelSize( imageRef )

float2 pixelSize( pixel1 )
float2 pixelSize( pixel2 )
float2 pixelSize( pixel3 )
float2 pixelSize( pixel4 )
以下是返回象素的x与y的比
pixelAspectRatio( i ) ==
pixelSize( i ).x / pixelSize( i ).y

float pixelAspectRatio( image1 )
float pixelAspectRatio( image2 )
float pixelAspectRatio( image3 )
float pixelAspectRatio( image4 )
float pixelAspectRatio( pixel1 )
float pixelAspectRatio( pixel2 )
float pixelAspectRatio( pixel3 )
float pixelAspectRatio( pixel4 )
float pixelAspectRatio( imageRef )
因为本人不懂英文,而Pixel Bender语言又没有中语文版本的,
为了方便编写这方面的程序,我自己整理了这些,希望有英文水平好的朋友,帮忙翻译一下全部的 Adobe Pixel Bender  Toolkit  2的帮助文档,在此多多感谢,我的QQ是4252186,希望大家多交流
                    黑市魔旗
2012年1月26日
搜索更多相关主题的帖子: 函数 内置 大家拍 Adobe 
2012-01-26 10:37
快速回复:有关Adobe Pixel Bender内置函数
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016115 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved