본문 바로가기
Shader

유니티 쉐이더 인터페이스 조작 : Unity Shader Properties Contriol

by 대마왕J 2015. 7. 16.

http://chulin28ho.tistory.com/trackback/230

 

고급 기능 추가

 

Toggle

 displays a float as a toggle. The property value will be 0 or 1, depending on the toggle state. When it is on, a shader keyword with the uppercase property name +"_ON" will be set, or an explicitly specified shader keyword.

// Will set "_INVERT_ON" shader keyword when set
[Toggle] _Invert ("Invert?", Float) = 0

// Will set "ENABLE_FANCY" shader keyword when set [Toggle(ENABLE_FANCY)] _Fancy ("Fancy?", Float) = 0

 

 

Enum displays a popup menu for a float property. You can supply either an enum type name (preferably fully qualified with namespaces, in case there are multiple types), or explicit name/value pairs to display. Up to 7 name/value pairs can be specified.
// Blend mode values
[Enum(UnityEngine.Rendering.BlendMode)] _Blend ("Blend mode", Float) = 1

// 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 displays a popup menu for a float property, and enables corresponding shader keyword. This is used with "#pragma multi_compile" in shaders, to enable or disable parts of shader code. Each name will enable "property name" + underscore + "enum name", uppercased, shader keyword. Up to 9 names can be provided.

// 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

When a property drawer class name ends with "Decorator", that is a property decorator, similar to DecoratorDrawer. They are used to create headings and dividers between properties that don't affect the property itself. A single property can have multiple decorators on it. The built-in decorator drawers are: SpaceDecorator, HeaderDecorator.

 

 

 

 

Space creates vertical space before the shader property.

빈 공간을 만든다. 숫자를 넣으면 더 크게도 된다

// Default small amount of space
[
Space] _Prop1 ("Prop1", Float) = 0

// Large amount of space
[
Space(50)] _Prop2 ("Prop2", Float) = 0

 

Header creates a header text before the shader property.

제목을 만든다

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

 

 

 

아래는 메뉴얼에 있던거 .

 

[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.
  • [Normal] - indicates that a texture property expects a normal-map.
  • [HDR] - indicates that a texture property expects a high-dynamic range (HDR) texture.
  •  

    반응형

    댓글