본문 바로가기
Shader

SSE (Strumpy Shader Editor) 정리 . 시간날때마다 계속 업데이트

by 대마왕J 2013. 2. 10.

SSE 연구 시작. 일단 노드가 알고 있는 그게 맞나 확인해 볼 필요가 있어서 시작..
일이 바빠서 조금씩 업데이트 하네요.

 

SSE[각주:1]가 뭔가요?

 

SSE (Strumpy Shader Editor)  란 언리얼의 메터리얼 에디터나 shaderFX 처럼 노드구조로 셰이더를 짤 수 있게 해주는 툴입니다. 문제는 이게 유니티의 독창적인 셰이더 구조에 맞춰서 되어 있기 때문에 다른 셰이더 에디터랑은 조금 다른 개념이 들어 있다는 거. (라이팅 노드가 독립되어 있습니다)

또 하나는, 아티스트를 너무 무시했는지 -_-
float 이나 float2 구조까지 전부 억지로 float4로 강제로 맞춰놨습니다.
그래서 0 이 float4(0,0,0,0) 으로 되어 있다는 괴이한 구조.

즉 학습용이나, 셰이더 최적화따윈 거의 중요하지 않은 프로젝트에서는 쓸만하지만
실무용이 되면 최적화 때문에 좀 투덜대면서 다시 만져줘야 한다는게 단점입니다.

그런의미에서 공부할때만 쓸모있다는 얘기일지도.

 

Constant 노드

1 over PI (1/PI) : float4( 0.3183098862, 0.3183098862, 0.3183098862, 0.3183098862 );

Comment : 코멘트를 적을 수 있다. (한글도 된다) 코멘트의 크기를 따로 정하거나 할 수는 없다.
만들면 없앨 수가 없다??????!??? 이거 확인해 보자.
: 지워진다. 전에는 왜 안지워졌지?

Float Const (float) : float 한 자리의 상수를 만들 수 있다. 기본값은 물론 0 . 그렇지만 float4( 2,2,2,2 ); 로 복사되어 들어간다. Homogenous Float4. For when you need a vector (or single float) which has all of the same component. (Effectively a scalar)

Float4 Const( float4) : float4를 만들 수 있다. 역시 float4( 0,0,0,0); 이 기본값. 그치만 여기선 4자리를 따로 만들 수 있다는 특징이 있다. Four Component Constant. Same as float, but you can assign a different value to each component.

LuminanceConst (LumConst) : float4(0.2125,.7154,0.072,0.0);
흑백 변환용 상수 . (그레이스케일 컨버젼 ) http://operationpixel.free.fr/traitementcouleur_grayscale_ENG.php ->
I give you two example. For the encoding analog color television signals wr=0,299 wg=0,587 et wb=0,114. For the digital color encoding: wr=0,2125 wg=0,7154 et wb=0,072.

One : 1을 의미한다. float4( 0.0, 0.0, 0.0, 0.0 ); Same as float4(1,1,1,1). All values set to one, use with Subtraction for a one – value (Invert)

PI : float4( 3.1415926535, 3.1415926535, 3.1415926535, 3.1415926535 );

Zero : 0을 의미한다 float4( 1.0, 1.0, 1.0, 1.0 ); Same as float4(0,0,0,0). Serves no common purpose, provides
shorthand for sampling the corner texel of a sampler2D

 

Operation 노드

1-v (Invert): 반전용 . float4(1.0, 1.0, 1.0, 1.0) - Invert0_0_NoInput;

Add : 두 개 더하는 거다. Add0_0_NoInput + Add0_1_NoInput;

All : all(All0_0_NoInput); 모두 0이 아니면 1을 리턴한다.  If x, y, z AND w are not equal to zero, returns One . Good for splatmaps, to assign holes where there is no texture.

ceil : (Ceil0_0_NoInput); 소숫점을 올림한다.  For each component, round up to the nearest whole number. See also Floor.

Cross : float4( cross( Cross0_0_NoInput.xyz, Cross0_1_NoInput.xyz ), 1.0 ); 외적  Cross Product. Returns a vector perpendicular to Arg1 and Arg2. If the inputs were not normalized, you will need to normalize this.

Degrees :degrees(Degrees0_0_NoInput); 라디안을 디그리로 변환한다. Convert radians to degrees. Shorthand for multiplying by a constant, see also Radians. This should probably never be used in an optimized shader.

Divide (Division) :Divide0_0_NoInput / Divide0_1_NoInput; 나누기 . Divide two inputs, performed per component.
Most of the time you can optimize with a reciprocal function and Multiply instead. Because most values are in the [0,1] range, division as a general rule will make values larger, you should often use this with saturate.

Dot (Dot Product): dot( Dot0_0_NoInput.xyz, Dot0_1_NoInput.xyz ).xxxx; Dot 연산.Primarily used as a normalized dot product, in which it returns 1 for matching vectors, 0 for perpendicular vectors, and -1 for opposite vectors, with a sinusoidal falloff.

Floor ( Floor function ) : floor(Floor0_0_NoInput); 소숫점을 내림한다. For each component, round down to the nearest whole number

Frac(Fractional component) : frac(Frac0_0_NoInput) 소숫점 영역, 즉 두 정수 사이의 중간을 0과 1 영역으로 리턴한다. For each component, returns x – floor(x)- that is, repeats the value in the [0,1] range

Max ( Return the highest values ) : max(Max0_0_NoInput,Max0_1_NoInput); 두 값중 큰 값을 내놓는다. For each component of the inputs, return the highest value for each.

Min ( Return the lowest values ) : min(Min0_0_NoInput,Min0_1_NoInput); 두 값중 작은 값을 내놓는다. For each component of the inputs, return the lowest value for each

Multiply ( Multiplication ) : Multiply0_0_NoInput * Multiply0_1_NoInput; 두 값을 곱한다. Again, performed per component. See Dot for the sum of components.

MxM : mul( MxM0_0_NoInput, MxM0_1_NoInput ); 메트릭스 곱하기 연산 . 이거 어디다 쓰는줄은 알겠는데 어떻게 쓰는거야? 좌표계 변환할때 쓰는건 당연하겠는데 좌표계 받는게 안보여..

MxV : mul( MxM0, MxV0_1_NoInput ); 메트릭스 * 벡터 연산

Matrix Functions : Matrixes have not yet been implemented, you can manually rotate textures using a SinCos setup if you need, I've been promised these for a later update.

... 아직 메트릭스 함수는 완성이 덜 된 거냐.

pow (Raise to a specified exponent) : pow(Pow0_0_NoInput,Pow0_1_NoInput); 제곱연산. Because colors data is generally in the [0,1] range, you can use pow to sharpen any curve function, for example, often specularity isapproximated with pow(cos(fresnel),64)

Radians (Degrees to Radians) : radians(Radians0_0_NoInput); 디그리를 라디안으로 바꾼다. Opposite of Degrees

Rsqrt (1/Sqrt of each component) : rsqrt(RSqrt0_0_NoInput);1/제곱근. 1/ 루트를 의미  Reciprocal square root, useful as an optimization over Sqrt where applicable, implemented on hardware as a fast inverse square-root (as opposed to exponential bitshifting, as regular square-root)

Sign ( Returns representation of sign ) : sign(Sign0_0_NoInput); 싸인 값으로 내보냄 For positive values, returns 1, for negative, -1, for zero, it will return 0, as always, this is a per component operation

Sqrt (Squareroot function ) : sqrt(Sqrt0_0_NoInput); 루트 . Often used for distance calculation or ramping, Implemented internally as an exponential bitshift, making it cheaper then Pow

Substract ( Subtraction) : Subtract0_0_NoInput - Subtract0_1_NoInput; 빼기.  Performed per component, use Saturate to trim for negative values if so desired.

Negative : -Negative0_0_NoInput; 마이너스

V*M : 벡터 * 메트릭스 연산

 

Function 노드

Abs : abs(Abs0_0_NoInput);

Acos : acos(Acos0_0_NoInput);

Asin : asin(ASin0_0_NoInput);

Assemble : float4(Assemble0_0_NoInput.x, Assemble0_1_NoInput.y, Assemble0_2_NoInput.z, Assemble0_3_NoInput.w); 부분으로 된 요소를 합쳐서 노드로 만들어줌.

ATan : atan(ATan0_0_NoInput);

ATan2 : atan2(ATan20_0_NoInput,ATan20_1_NoInput);

Clamp : clamp(Clamp0_0_NoInput,Clamp0_1_NoInput,Clamp0_2_NoInput);

Cos : cos(Cos0_0_NoInput);

Distance : distance(Distance0_0_NoInput,Distance0_1_NoInput);

Frasnel : (1.0 - dot( normalize( Fresnel0_0_NoInput.xyz), normalize( Fresnel0_1_NoInput.xyz ) )).xxxx;

Length : length(Length0_0_NoInput);

Lerp : lerp(Lerp0_0_NoInput,Lerp0_1_NoInput,Lerp0_2_NoInput);

Luminance : Luminance( Luminance0_0_NoInput.xyz ).xxxx;

Mask : float4(0.0,0.0,0.0,0.0);

Normalize : normalize(Normalize0_0_NoInput);

Tex2D : tex2D(_jp,(IN.uv_jp.xyxy).xy);

ParallaxOffset : ParallaxOffset( ParallaxOffset0_1_NoInput.x, ParallaxOffset0_2_NoInput.x, ParallaxOffset0_0_NoInput.xyz).xyxy;

Reflect : reflect(Reflect0_0_NoInput,Reflect0_1_NoInput);

Saturate : saturate(Saturate0_0_NoInput);

Sin : sin(Sin0_0_NoInput);

Smoothstep : smoothstep(SmoothStep0_0_NoInput,SmoothStep0_1_NoInput,SmoothStep0_2_NoInput);

Splat (Copy component across vector) :Splat0=float4( 1,2,3,4).x; 벡터의 한 숫자로 나머지를 모두 깔아줌. Isolate a single component across the vector, maps to the .xxxx, .yyyy, .zzzz, and .wwww swizzles. Used for splatmapping (hence name),channel isolation, and, in combination with Mask, custom swizzling.

Step : step(Step0_0_NoInput,Step0_1_NoInput);

Swizzle : float4(Swizzle0_1_NoInput.x, Swizzle0_1_NoInput.y, Swizzle0_1_NoInput.z, Swizzle0_1_NoInput.w);

Tan : tan(tan0_0_NoInput);

Tex2DNormal : float4(UnpackNormal( tex2D(_jp,(IN.uv_jp.xyxy).xy)).xyz, 1.0 );

TexCUBE : texCUBE(_dsfg,float4( IN.sWorldNormal.x, IN.sWorldNormal.y,IN.sWorldNormal.z,1.0 ));

UnpackNormal : float4(UnpackNormal(UnpackNormal0_0_NoInput).xyz, 1.0);

UV_Pan : float4((IN.uv_jp.xyxy).x,(IN.uv_jp.xyxy).y,(IN.uv_jp.xyxy).z,(IN.uv_jp.xyxy).w); ...?

 

 

 

 

 

 

 

 

 

 

  1. Strumpy Shader Editor [본문으로]
반응형

댓글