본문으로 바로가기
반응형

Shader Property창에서 사용할수 있는 속성명령들


[Togle] _Invert("Invert Color?", Float) = 0

해당 값을 켜고 끄는데 사용(해당 값은 토글에서 꺼져도 shader에서 무조건 계산하게 된다)



[Enum] float 속성에 대한 팝업 메뉴를 표시. enum 유형 이름 (여러 유형이있는 경우 네임 스페이스로 규약이 정해짐) 혹은 표시할 이름 / 값 중 하나를 선택 할 수 있다. 최대 7 개


// Blend mode values
[Enum(UnityEngine.Rendering.BlendMode)] _Blend ("Blend mode", Float) = 1


유니티 API에 있는 정보를 불러와 토글로 사용이 가능하다.


// A subset of blend mode values, just "One" (value 1) and "SrcAlpha" (value 5).
[Enum(One,1,SrcAlpha,5)] _Blend2 ("Blend mode subset", Float) = 1



[KeywordEnum] KeywordEnum은 float 속성에 대한 팝업 메뉴를 표시하고 해당하는 셰이더 키워드를 활성화. 셰이더의 "#pragma multi_compile"과 함께 사용되어 셰이더 코드의 일부를 활성화 또는 비활성화. 각 이름은 "속성 이름"+ 밑줄 + "열거 이름", 대문자, 쉐이더 키워드를 활성화. 최대 9 개


// Display a popup with None, Add, Multiply choices.
// Each option will set _OVERLAY_NONE, _OVERLAY_ADD, _OVERLAY_MULTIPLY shader keywords.
[KeywordEnum(None, Add, Multiply)] _Overlay ("Overlay mode", Float) = 0

// ...later on in CGPROGRAM code:
#pragma multi_compile _OVERLAY_NONE, _OVERLAY_ADD, _OVERLAY_MULTIPLY
// ...




[PowerSlider
] displays a slider with a non-linear response for a Range shader property.

// A slider with 3.0 response curve
[PowerSlider(3.0)] _Shininess ("Shininess", Range (0.01, 1)) = 0.08



[HideInInspector] - does not show the property value in the material inspector.

셰이더에서 해당 속성을 감춘다.


[NoScaleOffset] - material inspector will not show texture tiling/offset fields for texture properties with this attribute.

매터리얼에서 offset, Tiling 입력창을 감춘다. 강제로 셰이더에서 값을 사용하지 않거나 Tri-planar처럼 UV offset을 사용하지 않을때 사용한다.



[Normal] - indicates that a texture property expects a normal-map.

노멀 텍스쳐 입력값을 받는걸 가리킨다. Normal Texture가 아닐경우에 fix now 경고가 뜬다.

 



[HDR] - indicates that a texture property expects a high-dynamic range (HDR) texture.

HDR 텍스쳐 입력값을 받는걸 가리킨다.

 

 

 

 

[Gamma] - indicates that a float/vector property is specified as sRGB value in the UI (just like colors are), and possibly needs conversion according to color space used. See Properties in Shader Programs.


sRGB값(Gamma)이 지정되어 받는걸 가리킨다.(연산을 위한 texture들, Metallic, roughness 이외에 계산을 위한 각종 마스킹 텍스쳐들이 해당)


[PerRendererData] - UI처럼 텍스쳐를 미리 받아서 계산하는 셰이더에 사용한다. 이경우 텍스쳐 입력창이 매터리얼창에 표시되지 않는다.






[IntRange] 정수 입력을 받게 처리한다. 소수점 이하로 입력되는 것이 싫을때 사용하면 좋다


// An integer slider for specified range (0 to 255)
[IntRange] _Alpha ("Alpha", Range (0, 255)) = 100





[Space] 윗 속성 명령창을 한줄 띄워준다.(이거 진짜 필요했는데 이제 생겼음~!!)






[Header] 셰이더 속성창 위에 텍스트 입력이 가능해진다.(덕분에 CustomEditor " " 쓸 필요가 없어졌다)


[Header(A group of things)] _Prop1 ("Prop1", Float) = 0













반응형