Sign VEX node

이 함수는 vop과 shop... 그러니까 후디니 내에서만 존재한다.
vex에서는 없다. 

sign 함수 설명:

인자로 양수가 전달 될 경우, 1 을 반환한다.
인자로 음수가 전달 될 경우, -1 을 반환한다.
인자로 0 이 전달 될 경우, 0을 반환한다.

즉, 이렇게 되어있다는 뜻이다.

if(arg > 0)
return 1;

else if(arg < 0)
return -1;

else
return 0;

정리하면, sign 함수는 인자로 들어오는 값의 sign이 무엇인지만을 전달해주는 함수이다. 




smooth VEX function

float smooth(float value1, float value2, float amount)
float smooth(float value1, float value2, float amount, float rolloff)

smoothstep(min,max,x) : x가 [min, max] 사이의 값인 경우에 대해서 [0, 1] 사이에서 부드럽게 변하는 
    Hermite 보간법을 리턴한다. x가 min보다 작다면 0을 리턴하고, max보다 크다면 1을 리턴한다.

step(x,y) : x≤y 이면 1을 리턴하고, 그렇지 않으면 0을 리턴한다.



lerp VEX function

float lerp(float value1, float value2, float amount)
vector lerp(vector value1, vector value2, float amount)
vector4 lerp(vector4 value1, vector4 value2, float amont)

value1, value2 사이의 값을 interpolation 한다. 만약 amount가 0, 1의 범위를 벗어난 경우, 결과는 선형으로 나온다.

vopsop의 mix 노드랑 똑같음.

lerp(x,y,s) : 선형보간인 x + s(y - x) 를 리턴한다. x, y, s는 모두 동일한 타입으로 지정.



diffuse VEX function

Returns the diffuse (Lambertian) illumination given the normalized surface normal.

    1.     vector diffuse(vector nml)

    1.     vector diffuse(vector nml, vector V, float roughness)

    1.     bsdf diffuse()

    1.     bsdf diffuse(vector nml)

See writing a PBR shader for information on BSDFs.

Returns the diffuse (Lambertian) illumination given the normalized surface normal.

The diffuse(vector nml, V; float roughness, ...) form uses the Oren-Nayar lighting model to compute the diffuse illumination for the surface. The Oren-Nayar lighting model is a more sophisticated lighting model than Lambertian lighting. The V vector represents a vector from the surface to the eye (i.e. -normalize(I)). With a roughness of 0, the Oren-Nayar lighting model is equivalent to the Lambertian model. As roughness increases toward 1, the illumination changes to mimic rougher materials (like clay). The Oren-Nayar form of diffuse() is more expensive than Lambertian diffuse lighting. 




ambient VEX function

Returns the color of ambient light in the scene.

    1. vector ambient()

Returns the color of ambient light in the scene.

You can optionally specify a light mask




specular VEX function

phong, blinn, and specular return the illumination for specular highlights using different lighting models.

    1. vector specular(vector nml, vector V, float roughness)

    1. bsdf specular(vector dir)

See phong for information on the basic lighting models. See writing a PBR shader for information on BSDFs.

You can optionally specify a light mask



Returns the vector representing the reflection of the direction against the normal.

    1. vector reflect(vector direction, vector normal)

Returns the vector representing the reflection of the direction against the normal.



Returns the refraction ray given an incoming direction, the normalized normal and an index of refraction.

    1. vector refract(vector direction, vector normal, float index)

Returns the refraction ray given an incoming direction, the normalized normal and an index of refraction.

The index is a relative index of refraction, the ratio between the interior and exterior index of refraction, where the exterior is defined by the direction of the normals (normals point away from the interior).

In the case of total internal reflection, this function returns the reflection vector.

For example:

refract(normalize(I), normalize(N), outside_to_inside_ior)






frontface VEX function

If dot(I, Nref) is less than zero, N will be negated.

    1. vector frontface(vector N, vector I)

      This form (which doesn’t take a reference vector) is only available in the shading contexts, where the Ng variable is used.

    1. vector frontface(vector N, vector I, vector Nref)


'Houdini > VEX functions' 카테고리의 다른 글

VEX Functions Definition  (0) 2013.01.18
VEX functions  (0) 2012.11.18
Posted by scii
: