ShaderLab的Properties面板
Shader "ABigDeal/COS_PropertiesShow"
{
Properties
{
[Header(PropertiesShow)]
[Space(20)] [Header(Texture)]//贴图
_Texture2D("2D", 2D) = "white" {}
_Texture3D("3D", 3D) = "white" {}
//法线
[Normal] _Normal("Normal", 2D) = "white" {}
_CubeMap("Cube", Cube) = "white" {}
//没有向量的贴图
[NoScaleOffset] _NoScaleOffset("NoScaleOffset", 2D) = "white" {}
//定义长方形贴图 非二次幂
_Rect("Rect",Rect) = "white" {}
[Space(20)] [Header(Color And Vector)]//颜色和向量
_Color("Color",Color)=(1,1,1,1)
//HDR颜色
[HDR] _HDR("HDR",Color) = (1,1,1,1)
//伽马颜色
[Gamma] _Gamma("Gamma",Color) = (1,1,1,1)
_Vector("Vector",Vector) = (0.7,0.7,0.7,0.7)
[Space(20)] [Header(Numbers and Sliders)]//数字和滑块
_Range("Range",Range(0,1))=0.7
_Float("Float",Float)=0.7
_Int("Int", Int) = 7
[Space(20)] [Header(Toggle)]//开关
// Will set "_INVERT_ON" shader keyword when set
[Toggle] _Toggle("Toggle",Float) = 0
// Will set "ENABLE_FANCY" shader keyword when set.
[Toggle(ENABLE_FANCY)] _Fancy("Fancy", Float) = 0
[MaterialToggle] _MaterialToggle("MaterialToggle",Float)=0
[Space(20)] [Header(Enum)]//枚举
// Blend mode values 混合模式值
[Enum(UnityEngine.Rendering.BlendMode)] _Blend("Blend mode", Float) = 1
// 混合模式的子集,只有 "One" (value 1) and "SrcAlpha" (value 5).
[Enum( One,1,SrcAlpha,5)] _Blend2("Blend mode subset", Float) = 1
/*显示浮动属性的弹出菜单,并启用相应的着色器关键字。
这与着色器中的“#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
...*/
[Space(20)] [Header(Range)]//滑块
//显示具有范围着色属性的非线性响应的滑块。
// A slider with 3.0 response curve
[PowerSlider(3.0)] _PowerSlider("PowerSlider", Range(0.01, 1)) = 0.08
//显示范围着色器属性的整数滑块。
// An integer slider for specified range (0 to 255)
[IntRange] _IntRange("IntRange", Range(0, 255)) = 100
[Space(20)]
//隐藏
[HideInInspector] _Hide("Hide",Float) = 0.7
//表示纹理属性将以MaterialPropertyBlock的形式从每个渲染器数据中来。材质监视面板的纹理框UI样式会因为这类属性改变
//[PerRendererData] _Tex2D("2D", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma multi_compile _OVERLAY_NONE _OVERLAY_ADD _OVERLAY_MULTIPLY
#pragma vertex vert
#pragma fragment frag
struct appdata{};
struct v2f{};
sampler2D _MainTex;
v2f vert (appdata v){v2f o;return o;}
fixed4 frag (v2f i) : SV_Target{
fixed4 col = float4 (0,0,0,0);
return col;
}
ENDCG
}
}
}
unitypackage:
链接:https://pan.baidu.com/s/1exQNS0FBiazMcACUNUxdzA
提取码:clgl