lit 함수 쓰기

lit - HLSL


Returns a lighting vector (ambient, diffuse, specular, 1) where:
라이트 벡터를 리턴한다. float4 (엠비언트 벡터, 디퓨즈 벡터, 스페큘러 벡터, 1)

  • ambient = 1.* diffuse = ((n • l) < 0) ? 0 : n • l.* specular = ((n • l) < 0) || ((n • h) < 0) ? 0 : ((n • h) * m)

  • 엠비언트는 벡터가 필요 없으니까 1.

  • 디퓨즈는 normal과 light를 dot 해서 0보다 작으면 0을 리턴하고 0보다 크면 normal과 light를 dot한 연산을 리턴한다

  • 스페큘러는 normal과 light의 dot 연산이 0보다 작거나 (or) normal과 half가 0보다 작다 라는 것이 거짓이면 (둘 다 안맞으면) 0을 리턴하고, 둘 중 하나라도 참이면 normal과 half를 dot 연산한 것에 specular exponent 를 곱해서 return한다.

Parameters

n_dot_l: [in] The dot product of the normalized surface normal and the light vector. n_dot_h: [in] The dot product of the half-angle vector and the surface normal. m: [in] A specular exponent.

N dot L 노말과 라이트 벡터의 dot 연산
N dot H 노말과 하프벡터의 dot 연산
M         스페큘러 상수

Return Value

The lighting coefficient vector.

라이트 계수벡터를 리턴한다.

Syntax

ret lit(n dot l, n dot h, m)

Where:

NameIn/OutTemplate TypeComponent TypeSize
linscalarfloat1
hinscalarfloat1
minscalarfloat1
retoutvectorfloat4

Minimum Shader Model This function is supported in the following shader models.


Hugo로 만듦
JimmyStack 테마 사용 중