Skip to content

Commit e066404

Browse files
committed
Problem with mask support have been solved, example scene updated with independent corners shader example
1 parent da50b21 commit e066404

5 files changed

Lines changed: 178 additions & 17 deletions

File tree

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Material:
77
m_CorrespondingSourceObject: {fileID: 0}
88
m_PrefabInstance: {fileID: 0}
99
m_PrefabAsset: {fileID: 0}
10-
m_Name: MaskedExampleMaterial
11-
m_Shader: {fileID: 4800000, guid: 0bd2ec5d73751e34a814274a454bec41, type: 3}
12-
m_ShaderKeywords: UNITY_UI_ALPHACLIP
10+
m_Name: MaskedMaterial
11+
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12+
m_ShaderKeywords:
1313
m_LightmapFlags: 4
1414
m_EnableInstancingVariants: 0
1515
m_DoubleSidedGI: 0
@@ -57,7 +57,6 @@ Material:
5757
m_Offset: {x: 0, y: 0}
5858
m_Floats:
5959
- _BumpScale: 1
60-
- _ColorMask: 15
6160
- _Cutoff: 0.5
6261
- _DetailNormalMapScale: 1
6362
- _DstBlend: 0
@@ -71,13 +70,7 @@ Material:
7170
- _SmoothnessTextureChannel: 0
7271
- _SpecularHighlights: 1
7372
- _SrcBlend: 1
74-
- _Stencil: 0
75-
- _StencilComp: 8
76-
- _StencilOp: 0
77-
- _StencilReadMask: 255
78-
- _StencilWriteMask: 255
7973
- _UVSec: 0
80-
- _UseUIAlphaClip: 1
8174
- _ZWrite: 1
8275
m_Colors:
8376
- _Color: {r: 1, g: 1, b: 1, a: 1}
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/example.unity

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ RectTransform:
205205
- {fileID: 1293534749}
206206
- {fileID: 787497678}
207207
- {fileID: 1695272625}
208+
- {fileID: 418354422}
208209
m_Father: {fileID: 0}
209210
m_RootOrder: 0
210211
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -213,6 +214,95 @@ RectTransform:
213214
m_AnchoredPosition: {x: 0, y: 0}
214215
m_SizeDelta: {x: 500, y: 300}
215216
m_Pivot: {x: 0.5, y: 0.5}
217+
--- !u!1 &418354421
218+
GameObject:
219+
m_ObjectHideFlags: 0
220+
m_CorrespondingSourceObject: {fileID: 0}
221+
m_PrefabInstance: {fileID: 0}
222+
m_PrefabAsset: {fileID: 0}
223+
serializedVersion: 6
224+
m_Component:
225+
- component: {fileID: 418354422}
226+
- component: {fileID: 418354425}
227+
- component: {fileID: 418354424}
228+
- component: {fileID: 418354423}
229+
m_Layer: 5
230+
m_Name: Image
231+
m_TagString: Untagged
232+
m_Icon: {fileID: 0}
233+
m_NavMeshLayer: 0
234+
m_StaticEditorFlags: 0
235+
m_IsActive: 1
236+
--- !u!224 &418354422
237+
RectTransform:
238+
m_ObjectHideFlags: 0
239+
m_CorrespondingSourceObject: {fileID: 0}
240+
m_PrefabInstance: {fileID: 0}
241+
m_PrefabAsset: {fileID: 0}
242+
m_GameObject: {fileID: 418354421}
243+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
244+
m_LocalPosition: {x: 0, y: 0, z: 0}
245+
m_LocalScale: {x: 1, y: 1, z: 1}
246+
m_Children:
247+
- {fileID: 1697298825}
248+
m_Father: {fileID: 314398719}
249+
m_RootOrder: 3
250+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
251+
m_AnchorMin: {x: 0.5, y: 0.5}
252+
m_AnchorMax: {x: 0.5, y: 0.5}
253+
m_AnchoredPosition: {x: 88.7, y: 78.5}
254+
m_SizeDelta: {x: 100, y: 100}
255+
m_Pivot: {x: 0.5, y: 0.5}
256+
--- !u!114 &418354423
257+
MonoBehaviour:
258+
m_ObjectHideFlags: 0
259+
m_CorrespondingSourceObject: {fileID: 0}
260+
m_PrefabInstance: {fileID: 0}
261+
m_PrefabAsset: {fileID: 0}
262+
m_GameObject: {fileID: 418354421}
263+
m_Enabled: 1
264+
m_EditorHideFlags: 0
265+
m_Script: {fileID: -1200242548, guid: f70555f144d8491a825f0804e09c671c, type: 3}
266+
m_Name:
267+
m_EditorClassIdentifier:
268+
m_ShowMaskGraphic: 1
269+
--- !u!114 &418354424
270+
MonoBehaviour:
271+
m_ObjectHideFlags: 0
272+
m_CorrespondingSourceObject: {fileID: 0}
273+
m_PrefabInstance: {fileID: 0}
274+
m_PrefabAsset: {fileID: 0}
275+
m_GameObject: {fileID: 418354421}
276+
m_Enabled: 1
277+
m_EditorHideFlags: 0
278+
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
279+
m_Name:
280+
m_EditorClassIdentifier:
281+
m_Material: {fileID: 0}
282+
m_Color: {r: 1, g: 1, b: 1, a: 1}
283+
m_RaycastTarget: 1
284+
m_OnCullStateChanged:
285+
m_PersistentCalls:
286+
m_Calls: []
287+
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
288+
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
289+
m_Sprite: {fileID: 0}
290+
m_Type: 0
291+
m_PreserveAspect: 0
292+
m_FillCenter: 1
293+
m_FillMethod: 4
294+
m_FillAmount: 1
295+
m_FillClockwise: 1
296+
m_FillOrigin: 0
297+
m_UseSpriteMesh: 0
298+
--- !u!222 &418354425
299+
CanvasRenderer:
300+
m_ObjectHideFlags: 0
301+
m_CorrespondingSourceObject: {fileID: 0}
302+
m_PrefabInstance: {fileID: 0}
303+
m_PrefabAsset: {fileID: 0}
304+
m_GameObject: {fileID: 418354421}
305+
m_CullTransparentMesh: 0
216306
--- !u!1 &787497677
217307
GameObject:
218308
m_ObjectHideFlags: 0
@@ -776,6 +866,80 @@ CanvasRenderer:
776866
m_PrefabAsset: {fileID: 0}
777867
m_GameObject: {fileID: 1695272624}
778868
m_CullTransparentMesh: 0
869+
--- !u!1 &1697298824
870+
GameObject:
871+
m_ObjectHideFlags: 0
872+
m_CorrespondingSourceObject: {fileID: 0}
873+
m_PrefabInstance: {fileID: 0}
874+
m_PrefabAsset: {fileID: 0}
875+
serializedVersion: 6
876+
m_Component:
877+
- component: {fileID: 1697298825}
878+
- component: {fileID: 1697298827}
879+
- component: {fileID: 1697298826}
880+
m_Layer: 5
881+
m_Name: Image
882+
m_TagString: Untagged
883+
m_Icon: {fileID: 0}
884+
m_NavMeshLayer: 0
885+
m_StaticEditorFlags: 0
886+
m_IsActive: 1
887+
--- !u!224 &1697298825
888+
RectTransform:
889+
m_ObjectHideFlags: 0
890+
m_CorrespondingSourceObject: {fileID: 0}
891+
m_PrefabInstance: {fileID: 0}
892+
m_PrefabAsset: {fileID: 0}
893+
m_GameObject: {fileID: 1697298824}
894+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
895+
m_LocalPosition: {x: 0, y: 0, z: 0}
896+
m_LocalScale: {x: 1, y: 1, z: 1}
897+
m_Children: []
898+
m_Father: {fileID: 418354422}
899+
m_RootOrder: 0
900+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
901+
m_AnchorMin: {x: 0.5, y: 0.5}
902+
m_AnchorMax: {x: 0.5, y: 0.5}
903+
m_AnchoredPosition: {x: 50.3, y: 23.3}
904+
m_SizeDelta: {x: 100, y: 100}
905+
m_Pivot: {x: 0.5, y: 0.5}
906+
--- !u!114 &1697298826
907+
MonoBehaviour:
908+
m_ObjectHideFlags: 0
909+
m_CorrespondingSourceObject: {fileID: 0}
910+
m_PrefabInstance: {fileID: 0}
911+
m_PrefabAsset: {fileID: 0}
912+
m_GameObject: {fileID: 1697298824}
913+
m_Enabled: 1
914+
m_EditorHideFlags: 0
915+
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
916+
m_Name:
917+
m_EditorClassIdentifier:
918+
m_Material: {fileID: 2100000, guid: 28702f2ea720aca4ea0f2399151d5714, type: 2}
919+
m_Color: {r: 0.7830189, g: 0.16620687, b: 0.16620687, a: 1}
920+
m_RaycastTarget: 1
921+
m_OnCullStateChanged:
922+
m_PersistentCalls:
923+
m_Calls: []
924+
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
925+
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
926+
m_Sprite: {fileID: 0}
927+
m_Type: 0
928+
m_PreserveAspect: 0
929+
m_FillCenter: 1
930+
m_FillMethod: 4
931+
m_FillAmount: 1
932+
m_FillClockwise: 1
933+
m_FillOrigin: 0
934+
m_UseSpriteMesh: 0
935+
--- !u!222 &1697298827
936+
CanvasRenderer:
937+
m_ObjectHideFlags: 0
938+
m_CorrespondingSourceObject: {fileID: 0}
939+
m_PrefabInstance: {fileID: 0}
940+
m_PrefabAsset: {fileID: 0}
941+
m_GameObject: {fileID: 1697298824}
942+
m_CullTransparentMesh: 0
779943
--- !u!1 &1923065472
780944
GameObject:
781945
m_ObjectHideFlags: 0

UiRoundedCorners/IndependentRoundedCorners.shader

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
Shader "UI/RoundedCorners/IndependentRoundedCorners" {
22

3-
Properties{
3+
Properties {
44
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
5-
// Comment for future to debug
6-
// _r ("Radiuses", Vector) = (0,0,0,0)
7-
// _rect2props ("Rect 2 Props", Vector) = (0,0,0,0)
85

96
// --- Mask support ---
107
[HideInInspector] _StencilComp ("Stencil Comparison", Float) = 8
@@ -14,11 +11,14 @@
1411
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
1512
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
1613
[HideInInspector] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
14+
// Definition in Properties section is required to Mask works properly
15+
_r ("r", Vector) = (0,0,0,0)
16+
_halfSize ("halfSize", Vector) = (0,0,0,0)
17+
_rect2props ("rect2props", Vector) = (0,0,0,0)
1718
// ---
1819
}
1920

2021
SubShader {
21-
2222
Tags {
2323
"RenderType"="Transparent"
2424
"Queue"="Transparent"
@@ -41,7 +41,7 @@
4141
Blend SrcAlpha OneMinusSrcAlpha
4242
ZWrite Off
4343

44-
Pass{
44+
Pass {
4545
CGPROGRAM
4646

4747
#include "UnityCG.cginc"

UiRoundedCorners/RoundedCorners.shader

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ Shader "UI/RoundedCorners/RoundedCorners" {
1010
[HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
1111
[HideInInspector] _ColorMask ("Color Mask", Float) = 15
1212
[HideInInspector] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
13+
14+
// Definition in Properties section is required to Mask works properly
15+
_WidthHeightRadius ("WidthHeightRadius", Vector) = (0,0,0,0)
1316
// ---
1417
}
18+
1519
SubShader {
1620
Tags {
1721
"RenderType"="Transparent"

0 commit comments

Comments
 (0)