Merge branch 'Alexei' into Prod
This commit is contained in:
commit
f8640c9ab2
@ -83,7 +83,7 @@ public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPoint
|
||||
FormatInput();
|
||||
HandleInput(input.magnitude, input.normalized, radius, cam);
|
||||
handle.anchoredPosition = input * radius * handleRange;
|
||||
OnDrug.Invoke(Direction);
|
||||
OnDrug?.Invoke(Direction);
|
||||
}
|
||||
|
||||
protected virtual void HandleInput(float magnitude, Vector2 normalised, Vector2 radius, Camera cam)
|
||||
|
@ -1,6 +1,6 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &855721721
|
||||
--- !u!1 &1971885220552812170
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -8,155 +8,53 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 855721725}
|
||||
- component: {fileID: 855721724}
|
||||
- component: {fileID: 855721723}
|
||||
- component: {fileID: 855721722}
|
||||
- component: {fileID: 3975719838618124896}
|
||||
- component: {fileID: 8375927724544650520}
|
||||
- component: {fileID: 2191591739830093116}
|
||||
- component: {fileID: 8632423750406408422}
|
||||
m_Layer: 5
|
||||
m_Name: ExtralifeCanvas
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &855721725
|
||||
--- !u!224 &3975719838618124896
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 855721721}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 9010224305754668558}
|
||||
- {fileID: 1368758085}
|
||||
m_Father: {fileID: 7017227080055577098}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!223 &855721724
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 855721721}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &855721723
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 855721721}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &855721722
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 855721721}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!1 &1368758084
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1368758085}
|
||||
- component: {fileID: 1368758088}
|
||||
- component: {fileID: 1368758087}
|
||||
- component: {fileID: 1368758086}
|
||||
m_Layer: 5
|
||||
m_Name: ExtralifeButton
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1368758085
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1368758084}
|
||||
m_GameObject: {fileID: 1971885220552812170}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1900174883}
|
||||
- {fileID: 6546462637559422819}
|
||||
m_Father: {fileID: 855721725}
|
||||
m_RootOrder: 1
|
||||
- {fileID: 3104897430720789503}
|
||||
m_Father: {fileID: 5695591491590183961}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: -516.68}
|
||||
m_SizeDelta: {x: 364.9279, y: 96.9068}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 541.731}
|
||||
m_SizeDelta: {x: 400, y: 150}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1368758088
|
||||
--- !u!222 &8375927724544650520
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1368758084}
|
||||
m_GameObject: {fileID: 1971885220552812170}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1368758087
|
||||
--- !u!114 &2191591739830093116
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1368758084}
|
||||
m_Enabled: 0
|
||||
m_GameObject: {fileID: 1971885220552812170}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
@ -169,8 +67,8 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_Sprite: {fileID: 21300000, guid: d60ccf0feab112a4baa66853572c90ad, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
@ -179,13 +77,13 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1368758086
|
||||
--- !u!114 &8632423750406408422
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1368758084}
|
||||
m_GameObject: {fileID: 1971885220552812170}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
@ -219,11 +117,11 @@ MonoBehaviour:
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1368758087}
|
||||
m_TargetGraphic: {fileID: 2191591739830093116}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &1900174882
|
||||
--- !u!1 &4314761925928617334
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -231,241 +129,31 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1900174883}
|
||||
- component: {fileID: 1900174885}
|
||||
- component: {fileID: 1900174884}
|
||||
- component: {fileID: 5695591491590183961}
|
||||
- component: {fileID: 3287032526730687245}
|
||||
- component: {fileID: 1608152011222876715}
|
||||
- component: {fileID: 8705588810450687165}
|
||||
- component: {fileID: 3306115827101638291}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_Name: Ads
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1900174883
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5695591491590183961
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1900174882}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1368758085}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1900174885
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1900174882}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1900174884
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1900174882}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 62
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 84
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: EXTRALIFE
|
||||
--- !u!1 &840994902530579766
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6374203161451546813}
|
||||
- component: {fileID: 648636861675192753}
|
||||
- component: {fileID: 8439688539017693756}
|
||||
- component: {fileID: 5602960826927261039}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &6374203161451546813
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840994902530579766}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1228572368403975580}
|
||||
m_Father: {fileID: 7017227080055577098}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 540, y: 960}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &648636861675192753
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840994902530579766}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &8439688539017693756
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840994902530579766}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &5602960826927261039
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840994902530579766}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 0
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 8439688539017693756}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 7017227080055577099}
|
||||
m_TargetAssemblyTypeName: AdsMob, Assembly-CSharp
|
||||
m_MethodName: ShowAd
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!1 &959541702021905399
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 462934624606052230}
|
||||
- component: {fileID: 1717549448275548369}
|
||||
- component: {fileID: 8019465967749733583}
|
||||
- component: {fileID: 3518427172387084100}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &462934624606052230
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 959541702021905399}
|
||||
m_GameObject: {fileID: 4314761925928617334}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7017227080055577098}
|
||||
m_Children:
|
||||
- {fileID: 3975719838618124896}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@ -473,13 +161,13 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!223 &1717549448275548369
|
||||
--- !u!223 &3287032526730687245
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 959541702021905399}
|
||||
m_GameObject: {fileID: 4314761925928617334}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
@ -490,40 +178,40 @@ Canvas:
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &8019465967749733583
|
||||
--- !u!114 &1608152011222876715
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 959541702021905399}
|
||||
m_GameObject: {fileID: 4314761925928617334}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ReferenceResolution: {x: 1080, y: 1920}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_MatchWidthOrHeight: 1
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &3518427172387084100
|
||||
--- !u!114 &8705588810450687165
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 959541702021905399}
|
||||
m_GameObject: {fileID: 4314761925928617334}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
@ -534,82 +222,21 @@ MonoBehaviour:
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!1 &1999367400106432257
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9010224305754668558}
|
||||
- component: {fileID: 8157564002663662341}
|
||||
- component: {fileID: 5408929494246104917}
|
||||
m_Layer: 5
|
||||
m_Name: Back
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &9010224305754668558
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1999367400106432257}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 855721725}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -518}
|
||||
m_SizeDelta: {x: -680, y: -1809.5325}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8157564002663662341
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1999367400106432257}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5408929494246104917
|
||||
--- !u!114 &3306115827101638291
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1999367400106432257}
|
||||
m_GameObject: {fileID: 4314761925928617334}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: a7c276b4af35fbc4a80539b97e444f32, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: d60ccf0feab112a4baa66853572c90ad, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4042280681130453449
|
||||
button: {fileID: 8632423750406408422}
|
||||
canvas: {fileID: 1971885220552812170}
|
||||
--- !u!1 &6301283852488076976
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -617,28 +244,28 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1228572368403975580}
|
||||
- component: {fileID: 4574297410292119365}
|
||||
- component: {fileID: 4226890313483791420}
|
||||
- component: {fileID: 3104897430720789503}
|
||||
- component: {fileID: 346799076098862248}
|
||||
- component: {fileID: 449182202535964334}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1228572368403975580
|
||||
--- !u!224 &3104897430720789503
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4042280681130453449}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_GameObject: {fileID: 6301283852488076976}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6374203161451546813}
|
||||
m_Father: {fileID: 3975719838618124896}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@ -646,100 +273,21 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4574297410292119365
|
||||
--- !u!222 &346799076098862248
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4042280681130453449}
|
||||
m_GameObject: {fileID: 6301283852488076976}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4226890313483791420
|
||||
--- !u!114 &449182202535964334
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4042280681130453449}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Button
|
||||
--- !u!1 &4988408123839147871
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6546462637559422819}
|
||||
- component: {fileID: 1811238904848561244}
|
||||
- component: {fileID: 1241824234629738060}
|
||||
m_Layer: 5
|
||||
m_Name: ExtraLifeText
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6546462637559422819
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4988408123839147871}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1368758085}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 3.02}
|
||||
m_SizeDelta: {x: 356.4681, y: 136.8}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1811238904848561244
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4988408123839147871}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1241824234629738060
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4988408123839147871}
|
||||
m_GameObject: {fileID: 6301283852488076976}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
@ -756,8 +304,7 @@ MonoBehaviour:
|
||||
m_text: EXTRALIFE
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587,
|
||||
type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
@ -782,7 +329,7 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 72
|
||||
m_fontSizeBase: 62.45
|
||||
m_fontSizeBase: 24
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 18
|
||||
@ -823,56 +370,3 @@ MonoBehaviour:
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &7017227080055577093
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7017227080055577098}
|
||||
- component: {fileID: 7017227080055577099}
|
||||
m_Layer: 5
|
||||
m_Name: ADs
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7017227080055577098
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7017227080055577093}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 462934624606052230}
|
||||
- {fileID: 6374203161451546813}
|
||||
- {fileID: 855721725}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7017227080055577099
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7017227080055577093}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a7c276b4af35fbc4a80539b97e444f32, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
button: {fileID: 1368758086}
|
||||
canvas: {fileID: 855721721}
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1328a0e1e252d60408278772275bf560
|
||||
guid: 829cf0211d46b58489f4cb061c784378
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
@ -65,8 +65,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: -4039628871920856409, guid: bcfec907e0672ed45b69575096b4a1c2,
|
||||
type: 3}
|
||||
m_Sprite: {fileID: -4039628871920856409, guid: bcfec907e0672ed45b69575096b4a1c2, type: 3}
|
||||
m_Type: 3
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@ -138,7 +137,7 @@ MonoBehaviour:
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 5
|
||||
m_ChildAlignment: 4
|
||||
m_StartCorner: 0
|
||||
m_StartAxis: 0
|
||||
m_CellSize: {x: 0.5, y: 0.2}
|
||||
@ -211,8 +210,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: -8254845973784877126, guid: bcfec907e0672ed45b69575096b4a1c2,
|
||||
type: 3}
|
||||
m_Sprite: {fileID: -8254845973784877126, guid: bcfec907e0672ed45b69575096b4a1c2, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@ -288,8 +286,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: -5455261514569519910, guid: bcfec907e0672ed45b69575096b4a1c2,
|
||||
type: 3}
|
||||
m_Sprite: {fileID: -5455261514569519910, guid: bcfec907e0672ed45b69575096b4a1c2, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@ -313,7 +310,7 @@ GameObject:
|
||||
- component: {fileID: 1271697267505620599}
|
||||
- component: {fileID: 482855193181693567}
|
||||
m_Layer: 5
|
||||
m_Name: BarCAnvas
|
||||
m_Name: BarCanvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -385,7 +382,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
m_PresetInfoIsWorld: 1
|
||||
--- !u!114 &1271697267505620599
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -417,8 +414,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
healthBar: {fileID: 7888535169076749686}
|
||||
manaBar: {fileID: 9185818537322146330}
|
||||
shotPrefab: {fileID: 9204531176590517796, guid: 74ba0f2e00eb74a4882dcf82bb66bb3f,
|
||||
type: 3}
|
||||
shotPrefab: {fileID: 9204531176590517796, guid: 74ba0f2e00eb74a4882dcf82bb66bb3f, type: 3}
|
||||
grid: {fileID: 3185331048183402439}
|
||||
captureBar: {fileID: 3113562572513926796}
|
||||
captureBack: {fileID: 3936950508401920806}
|
||||
@ -488,8 +484,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: -8254845973784877126, guid: bcfec907e0672ed45b69575096b4a1c2,
|
||||
type: 3}
|
||||
m_Sprite: {fileID: -8254845973784877126, guid: bcfec907e0672ed45b69575096b4a1c2, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@ -564,8 +559,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: -7745828531039951331, guid: bcfec907e0672ed45b69575096b4a1c2,
|
||||
type: 3}
|
||||
m_Sprite: {fileID: -7745828531039951331, guid: bcfec907e0672ed45b69575096b4a1c2, type: 3}
|
||||
m_Type: 3
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@ -640,8 +634,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: -4039628871920856409, guid: bcfec907e0672ed45b69575096b4a1c2,
|
||||
type: 3}
|
||||
m_Sprite: {fileID: -4039628871920856409, guid: bcfec907e0672ed45b69575096b4a1c2, type: 3}
|
||||
m_Type: 3
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
@ -80,4 +80,4 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 10
|
||||
m_PresetInfoIsWorld: 0
|
||||
m_PresetInfoIsWorld: 1
|
||||
|
@ -266,8 +266,7 @@ MonoBehaviour:
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587,
|
||||
type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
@ -412,7 +411,7 @@ MonoBehaviour:
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 1080, y: 1920}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_MatchWidthOrHeight: 1
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
@ -882,8 +881,7 @@ MonoBehaviour:
|
||||
m_text: Settings
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587,
|
||||
type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
@ -1019,8 +1017,7 @@ MonoBehaviour:
|
||||
'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587,
|
||||
type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
@ -1234,8 +1231,7 @@ MonoBehaviour:
|
||||
m_text: Continue
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587,
|
||||
type: 2}
|
||||
m_sharedMaterial: {fileID: -6360588970910393389, guid: 9a2157e1f9c4c4d38841fbb92558f587, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d9a547e8a3df9a3bf32dd0baede1ba4884e2a6ffea5a57ba1860eda8ec4fb78f
|
||||
size 2190819
|
||||
oid sha256:f41e6134daef2d77e52bf440ee35e2a71d3808b404fdc8a1ac578efd65565fcf
|
||||
size 7307994
|
||||
|
@ -429,55 +429,55 @@ AnimatorController:
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: BackToIdle
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: Build
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: TreeAttack
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: Move
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: SuperJump
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: Frozen
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: isMoving
|
||||
m_Type: 4
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: Death
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
@ -763,7 +763,7 @@ AnimatorState:
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 097363ae0f4e1f447b1b623e24b9cd2e, type: 2}
|
||||
m_Motion: {fileID: 7400000, guid: 46c2b6df43404d447aace3726bf397e3, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
|
8
Assets/Resources/1/MK/MKToon/Shader/Lib.meta
Normal file
8
Assets/Resources/1/MK/MKToon/Shader/Lib.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 521f7a978705f5541a78542d8ac78b5b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
364
Assets/Resources/1/MK/MKToon/Shader/Lib/Common.hlsl
Normal file
364
Assets/Resources/1/MK/MKToon/Shader/Lib/Common.hlsl
Normal file
@ -0,0 +1,364 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Common //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_COMMON
|
||||
#define MK_TOON_COMMON
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
#include "Config.hlsl"
|
||||
#include "Pipeline.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// COMMON
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline float Stutter(float t, float f)
|
||||
{
|
||||
return frac(SafeDivide(round(t * f), f));
|
||||
}
|
||||
inline float2 Stutter(float t, float2 f)
|
||||
{
|
||||
return frac(SafeDivide(round(t * f), f));
|
||||
}
|
||||
inline float3 Stutter(float t, float3 f)
|
||||
{
|
||||
return frac(SafeDivide(round(t * f), f));
|
||||
}
|
||||
|
||||
inline half SoftFade(float near, float far, float4 ndc)
|
||||
{
|
||||
//near OR far has to be > 0.0
|
||||
float sceneDepth = ComputeLinearDepth(SampleDepth(SafeDivide(ndc.xy,ndc.w)));
|
||||
float depth = ComputeLinearDepth(SafeDivide(ndc.z, ndc.w));
|
||||
|
||||
//Remap to 0 - 1
|
||||
far = Rcp(far - near);
|
||||
return saturate(far * ((sceneDepth - near) - depth));
|
||||
}
|
||||
|
||||
inline half CameraFade(float near, float far, float4 ndc)
|
||||
{
|
||||
float depth = ComputeLinearDepth(SafeDivide(ndc.z, ndc.w));
|
||||
|
||||
//Remap to 0 - 1
|
||||
far = Rcp(far - near);
|
||||
return saturate((depth - near) * far);
|
||||
}
|
||||
|
||||
inline void MixAlbedoDetail(inout half3 albedo, DECLARE_TEXTURE_2D_ARGS(tex, samplerTex), float2 uv, float3 blendUV)
|
||||
{
|
||||
half4 detail = SAMPLE_TEX2D_FLIPBOOK(tex, samplerTex, uv, blendUV);
|
||||
detail.rgb *= _DetailColor.rgb;
|
||||
#if defined(MK_DETAIL_BLEND_MIX)
|
||||
albedo = lerp(albedo, detail.rgb, _DetailMix * detail.a);
|
||||
#elif defined(MK_DETAIL_BLEND_ADD)
|
||||
albedo += lerp(0.0h, detail.rgb, _DetailMix * detail.a);
|
||||
#else //MK_DETAIL_BLEND_MULTIPLY
|
||||
albedo *= lerp(1.0h, detail.rgb, _DetailMix * detail.a);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half2 Parallax(half3 viewTangent, half height, half parallax, half bias)
|
||||
{
|
||||
return SafeDivide(viewTangent.xy, viewTangent.z + bias) * (height * parallax - parallax * 0.5);
|
||||
}
|
||||
|
||||
inline half3 UnpackRawNormal(half4 rawNormal, half bumpiness)
|
||||
{
|
||||
half3 unpackedNormal;
|
||||
#if defined(UNITY_NO_DXT5nm)
|
||||
unpackedNormal = rawNormal.rgb * 2.0 - 1.0;
|
||||
#else
|
||||
rawNormal.r *= rawNormal.a;
|
||||
unpackedNormal = half3(2.0 * rawNormal.a - 1.0, 2.0 * rawNormal.g - 1.0, 0.0);
|
||||
#endif
|
||||
unpackedNormal.xy *= bumpiness;
|
||||
#if !defined(UNITY_NO_DXT5nm)
|
||||
//unpackedNormal.z = sqrt(1.0 - dot(unpackedNormal.xy, unpackedNormal.xy));
|
||||
unpackedNormal.z = 1.0 - 0.5 * dot(unpackedNormal.xy, unpackedNormal.xy); //approximation
|
||||
#endif
|
||||
return unpackedNormal;
|
||||
}
|
||||
|
||||
inline half2 UnpackDudv(DECLARE_TEXTURE_2D_ARGS(dudvMap, samplerTex), float2 uv, float3 blendUV)
|
||||
{
|
||||
//somehow a range of [-1, 1] is not possible unless the texture is packed as a normal map
|
||||
//therefore its encoded as a normal map and should also be imported as a normal map
|
||||
//Normal map or Dudv map can be used
|
||||
return UnpackRawNormal(SAMPLE_TEX2D_FLIPBOOK(dudvMap, samplerTex, uv, blendUV), 1).rg;
|
||||
}
|
||||
|
||||
inline half3 UnpackNormalMap(DECLARE_TEXTURE_2D_ARGS(normalMap, samplerTex), float2 uv, float3 blendUV, half bumpiness)
|
||||
{
|
||||
half4 rawNormal = SAMPLE_TEX2D_FLIPBOOK(normalMap, samplerTex, uv, blendUV);
|
||||
return UnpackRawNormal(rawNormal, bumpiness);
|
||||
}
|
||||
|
||||
inline half3 UnpackNormalMap(DECLARE_TEXTURE_2D_ARGS(normalMap, samplerTex), float2 uv, half bumpiness)
|
||||
{
|
||||
half4 rawNormal = SampleTex2D(PASS_TEXTURE_2D(normalMap, samplerTex), uv);
|
||||
return UnpackRawNormal(rawNormal, bumpiness);
|
||||
}
|
||||
|
||||
inline half3 NormalMappingWorld(DECLARE_TEXTURE_2D_ARGS(normalMap, samplerTex), float2 uv, float3 blendUV, half bumpiness, half3x3 tbn)
|
||||
{
|
||||
return SafeNormalize(mul(UnpackNormalMap(PASS_TEXTURE_2D(normalMap, samplerTex), uv, blendUV, bumpiness), tbn));
|
||||
}
|
||||
|
||||
inline half3 NormalMappingWorld(DECLARE_TEXTURE_2D_ARGS(normalMap, samplerTex), float2 uvMain, float3 blendUV, half bumpiness, DECLARE_TEXTURE_2D_ARGS(detailNormalMap, samplerTex2), float2 uvDetail, half bumpinessDetail, half3x3 tbn)
|
||||
{
|
||||
half3 normalTangent = UnpackNormalMap(PASS_TEXTURE_2D(normalMap, samplerTex), uvMain, blendUV, bumpiness);
|
||||
half3 normalDetailTangent = UnpackNormalMap(PASS_TEXTURE_2D(detailNormalMap, samplerTex2), uvDetail, blendUV, bumpinessDetail);
|
||||
return SafeNormalize(mul(SafeNormalize(half3(normalTangent.xy + normalDetailTangent.xy, lerp(normalTangent.z, normalDetailTangent.z, 0.5))), tbn));
|
||||
}
|
||||
|
||||
//threshold based lighting type
|
||||
inline half Cel(half threshold, half smoothnessMin, half smoothnessMax, half value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
half ddxy = fwidth(value);
|
||||
return smoothstep(threshold - smoothnessMin - ddxy, threshold + smoothnessMax + ddxy, value);
|
||||
#else
|
||||
return smoothstep(threshold - smoothnessMin, threshold + smoothnessMax, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
inline half SmoothFloor(half v, half smoothness, half threshold)
|
||||
{
|
||||
threshold = 1.0 - threshold;
|
||||
return ((cos(max((frac(v + threshold) - (1 - smoothness)) / smoothness, 0.5) * PI_TWO) + 1) * 0.5) + floor(v + threshold);
|
||||
}
|
||||
*/
|
||||
|
||||
//level based lighting type
|
||||
inline half Banding(half v, half levels, half smoothnessMin, half smoothnessMax, half threshold, half fade)
|
||||
{
|
||||
/*
|
||||
levels--;
|
||||
half banding = v * lerp(1, 3, fade);
|
||||
return saturate(SafeDivide(SmoothFloor(banding * levels, smoothnessMin + smoothnessMax, threshold), levels));
|
||||
*/
|
||||
|
||||
levels--;
|
||||
threshold = lerp(threshold, threshold * levels, fade);
|
||||
half vl = v * lerp(1, levels, fade);
|
||||
half levelStep = Rcp(levels);
|
||||
|
||||
half bands = Cel(threshold, smoothnessMin, smoothnessMax, vl);
|
||||
bands += Cel(levelStep + threshold, smoothnessMin, smoothnessMax, vl);
|
||||
bands += Cel(levelStep * 2 + threshold, smoothnessMin, smoothnessMax, vl) * step(3, levels);
|
||||
bands += Cel(levelStep * 3 + threshold, smoothnessMin, smoothnessMax, vl) * step(4, levels);
|
||||
bands += Cel(levelStep * 4 + threshold, smoothnessMin, smoothnessMax, vl) * step(5, levels);
|
||||
bands += Cel(levelStep * 5 + threshold, smoothnessMin, smoothnessMax, vl) * step(6, levels);
|
||||
|
||||
return bands * levelStep;
|
||||
//return lerp(bands, Cel(threshold, smoothnessMin, smoothnessMax, v), smoothnessMin + smoothnessMax); // * step(threshold, 0)
|
||||
//return ceil(v * levels) / levels;
|
||||
}
|
||||
|
||||
//Rampcolor when dissolving
|
||||
inline half3 DissolveRamp(half dissolveValue, DECLARE_TEXTURE_2D_ARGS(dissolveBorderRampTex, samplerTex), half4 dissolveBorderColor, half dissolveBorderSize, half dissolveAmount, half2 uv, half3 baseCol)
|
||||
{
|
||||
half sv = dissolveBorderSize * dissolveAmount;
|
||||
return lerp(baseCol, dissolveBorderColor.rgb * SampleTex2D(PASS_TEXTURE_2D(dissolveBorderRampTex, samplerTex), half2(dissolveValue * Rcp(sv), T_V)).rgb, dissolveBorderColor.a * step(dissolveValue, sv));
|
||||
}
|
||||
//Color when dissolving
|
||||
inline half3 DissolveColor(half dissolveValue, half4 dissolveBorderColor, half dissolveBorderSize, half dissolveAmount, half3 baseCol)
|
||||
{
|
||||
return lerp(baseCol, dissolveBorderColor.rgb, dissolveBorderColor.a * step(dissolveValue, dissolveBorderSize * dissolveAmount));
|
||||
}
|
||||
|
||||
//Contrast - Saturation - Brightness
|
||||
inline half3 ColorGrading(half3 color, half brightness, half saturation, half contrast)
|
||||
{
|
||||
half3 bc = color * brightness;
|
||||
half i = dot(bc, REL_LUMA);
|
||||
#ifdef MK_FORWARD_ADD_PASS
|
||||
color = lerp(half3(0.0, 0.0, 0.0), lerp(half3(i, i, i), bc, saturation), contrast);
|
||||
#else
|
||||
color = lerp(half3(0.5, 0.5, 0.5), lerp(half3(i, i, i), bc, saturation), contrast);
|
||||
#endif
|
||||
return color;
|
||||
}
|
||||
|
||||
inline float NoiseSimple(float3 v)
|
||||
{
|
||||
return frac(sin( dot(v, REL_LUMA * 123456.54321)) * 987654.56789);
|
||||
}
|
||||
|
||||
inline half Drawn(half value, half artistic, half artisticClampMin, half artisticClampMax)
|
||||
{
|
||||
//currently implemented as soft pattern, see repo for hard pattern prototype
|
||||
#if SHADER_TARGET >= 35
|
||||
half ddxy = fwidth(value);
|
||||
return lerp(artisticClampMin, 1, value) * smoothstep(artistic - HALF_MIN - ddxy, artistic + ddxy, clamp(value, artisticClampMin, artisticClampMax));
|
||||
//return lerp(artisticClampMin, 1, value) * smoothstep(artistic - T_H - ddxy, artistic, clamp(value, artisticClampMin, artisticClampMax));
|
||||
#else
|
||||
return lerp(artisticClampMin, 1, value) * smoothstep(artistic - HALF_MIN, artistic, clamp(value, artisticClampMin, artisticClampMax));
|
||||
#endif
|
||||
}
|
||||
inline half Drawn(half value, half artistic, half artisticClampMax)
|
||||
{
|
||||
return Drawn(value, artistic, 0, artisticClampMax);
|
||||
}
|
||||
|
||||
inline half Hatching(half3 dark, half3 bright, half value, half threshold)
|
||||
{
|
||||
//value of 0 = black, no strokes visible
|
||||
half stepMax = clamp(value, threshold, 1.0h) * 6.0h;
|
||||
half3 darkCoeff, brightCoeff;
|
||||
#if SHADER_TARGET >= 35
|
||||
half ddxy = fwidth(value);
|
||||
darkCoeff = saturate(stepMax - half3(0, 1, 2) - ddxy); //half3(0, 1, 2)); 7 step
|
||||
brightCoeff = saturate(stepMax - half3(3, 4, 5) - ddxy);
|
||||
#else
|
||||
darkCoeff = saturate(stepMax - half3(0, 1, 2)); //half3(0, 1, 2)); 7 step
|
||||
brightCoeff = saturate(stepMax - half3(3, 4, 5));
|
||||
#endif
|
||||
|
||||
//step wise coeff
|
||||
darkCoeff.xy -= darkCoeff.yz;
|
||||
darkCoeff.z -= brightCoeff.x;
|
||||
brightCoeff.xy -= brightCoeff.yz;
|
||||
//last step = 0 (7max)
|
||||
|
||||
//lerped coeff
|
||||
//darkCoeff = lerp(darkCoeff, half3(darkCoeff.yz, brightCoeff.x), 0.5);
|
||||
//brightCoeff = lerp(brightCoeff, half3(brightCoeff.yz, 0), 0.5);
|
||||
|
||||
half3 d = dark * darkCoeff;
|
||||
half3 b = bright * brightCoeff;
|
||||
|
||||
return d.b + d.g + d.r + b.b + b.g + b.r + bright.r * max(0, value - 1.0);
|
||||
}
|
||||
|
||||
inline half Sketch(half vMin, half vMax, half value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
half ddxy = fwidth(value);
|
||||
return max(lerp(vMin - T_V - ddxy, vMax, value), 0);
|
||||
#else
|
||||
return max(lerp(vMin - T_V, vMax, value), 0);
|
||||
#endif
|
||||
}
|
||||
inline half Sketch(half vMax, half value)
|
||||
{
|
||||
return lerp(0, vMax, value);
|
||||
}
|
||||
|
||||
//Half Lambert - Valve
|
||||
inline half HalfWrap(half value, half wrap)
|
||||
{
|
||||
return FastPow2(value * wrap + (1.0 - wrap));
|
||||
}
|
||||
|
||||
inline half HalfWrap(half value)
|
||||
{
|
||||
return FastPow2(value * 0.5 + 0.5);
|
||||
}
|
||||
|
||||
//Unity based HSV - RGB
|
||||
inline half3 RGBToHSV(half3 c)
|
||||
{
|
||||
const half4 K = half4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
half4 p = lerp(half4(c.bg, K.wz), half4(c.gb, K.xy), step(c.b, c.g));
|
||||
half4 q = lerp(half4(p.xyw, c.r), half4(c.r, p.yzx), step(p.x, c.r));
|
||||
half d = q.x - min(q.w, q.y);
|
||||
const half e = 1.0e-4;
|
||||
return half3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
inline half3 HSVToRGB(half3 c)
|
||||
{
|
||||
const half4 K = half4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
half3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
|
||||
}
|
||||
|
||||
inline float3 VertexAnimationSine(float3 positionObject, half intensity, half3 frequency)
|
||||
{
|
||||
#ifdef MK_VERTEX_ANIMATION_STUTTER
|
||||
positionObject += sin((positionObject.zxx + Stutter(_Time.y, frequency.zyx)) * frequency.zyx) * intensity;
|
||||
#else
|
||||
positionObject += sin((positionObject.zxx + _Time.y) * frequency.zyx) * intensity;
|
||||
#endif
|
||||
return positionObject;
|
||||
}
|
||||
|
||||
inline float3 VertexAnimationPulse(float3 positionObject, half3 normalObject, half intensity, half3 frequency)
|
||||
{
|
||||
#ifdef MK_VERTEX_ANIMATION_STUTTER
|
||||
//positionObject += SafeNormalizenormalObject * sin(Stutter(_Time.y, frequency.xyz) * frequency.xyz) * intensity;
|
||||
float3 scaleAnimation = 1.0 + sin(Stutter(_Time.y, frequency.xyz) * frequency.xyz) * intensity;
|
||||
float3x3 scale = float3x3
|
||||
(
|
||||
scaleAnimation.x, 0, 0,
|
||||
0, scaleAnimation.y, 0,
|
||||
0, 0, scaleAnimation.z
|
||||
);
|
||||
positionObject = mul(scale, positionObject.xyz);
|
||||
#else
|
||||
//positionObject += normalObject * sin((_Time.y) * frequency.xyz) * intensity;
|
||||
float3 scaleAnimation = 1.0 + sin((_Time.y) * frequency.xyz) * intensity;
|
||||
float3x3 scale = float3x3
|
||||
(
|
||||
scaleAnimation.x, 0, 0,
|
||||
0, scaleAnimation.y, 0,
|
||||
0, 0, scaleAnimation.z
|
||||
);
|
||||
positionObject = mul(scale, positionObject.xyz);
|
||||
#endif
|
||||
return positionObject;
|
||||
}
|
||||
|
||||
inline float3 VertexAnimationNoise(float3 positionObject, half3 normalObject, half intensity, half3 frequency)
|
||||
{
|
||||
#ifdef MK_VERTEX_ANIMATION_STUTTER
|
||||
positionObject += normalObject * sin(Stutter(NoiseSimple(positionObject) * _Time.y, frequency.xyz) * frequency.xyz) * intensity;
|
||||
#else
|
||||
positionObject += normalObject * sin((NoiseSimple(positionObject) * _Time.y) * frequency.xyz) * intensity;
|
||||
#endif
|
||||
return positionObject;
|
||||
}
|
||||
|
||||
#if !defined(MK_VERTEX_ANIMATION_SINE)
|
||||
#define PASS_VERTEX_ANIMATION_ARG(vertexAnimationMap, uv, intensity, frequency, positionObject, normalObject) vertexAnimationMap, uv, intensity, frequency, positionObject, normalObject
|
||||
#else
|
||||
#define PASS_VERTEX_ANIMATION_ARG(vertexAnimationMap, uv, intensity, frequency, positionObject, normalObject) vertexAnimationMap, uv, intensity, frequency, positionObject
|
||||
#endif
|
||||
|
||||
inline float3 VertexAnimation
|
||||
(
|
||||
sampler2D vertexAnimationMap
|
||||
, float2 uv
|
||||
, half intensity
|
||||
, float3 frequency
|
||||
, float3 positionObject
|
||||
#ifndef MK_VERTEX_ANIMATION_SINE
|
||||
, half3 normalObject
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef MK_VERTEX_ANIMATION_MAP
|
||||
intensity *= tex2Dlod(vertexAnimationMap, float4(uv, 0, 0)).r;
|
||||
#endif
|
||||
#if defined(MK_VERTEX_ANIMATION_PULSE)
|
||||
return VertexAnimationPulse(positionObject, normalObject, intensity, frequency);
|
||||
#elif defined(MK_VERTEX_ANIMATION_NOISE)
|
||||
return VertexAnimationNoise(positionObject, normalObject, intensity, frequency);
|
||||
#else
|
||||
return VertexAnimationSine(positionObject, intensity, frequency);
|
||||
#endif
|
||||
}
|
||||
#endif
|
9
Assets/Resources/1/MK/MKToon/Shader/Lib/Common.hlsl.meta
Normal file
9
Assets/Resources/1/MK/MKToon/Shader/Lib/Common.hlsl.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48845d263b823dd41ac5fb631d808cac
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
97
Assets/Resources/1/MK/MKToon/Shader/Lib/Composite.hlsl
Normal file
97
Assets/Resources/1/MK/MKToon/Shader/Lib/Composite.hlsl
Normal file
@ -0,0 +1,97 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Composite //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_COMPOSITE
|
||||
#define MK_TOON_COMPOSITE
|
||||
|
||||
#include "Core.hlsl"
|
||||
#include "Surface.hlsl"
|
||||
#include "Lighting.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Composite Final Output
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline void Composite(inout Surface surface, in MKSurfaceData surfaceData, in MKPBSData pbsData)
|
||||
{
|
||||
#ifdef MK_LIT
|
||||
#ifdef MK_VERTEX_LIGHTING
|
||||
surface.direct.rgb += surfaceData.vertexLighting * pbsData.diffuseRadiance;
|
||||
#endif
|
||||
|
||||
#ifdef MK_OCCLUSION_MAP
|
||||
surface.direct.rgb *= surface.occlusion.g;
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS) && defined(MK_INDIRECT)
|
||||
surface.final.rgb = surface.indirect + surface.direct.rgb;
|
||||
#elif defined(MK_FORWARD_BASE_PASS) && !defined(MK_INDIRECT)
|
||||
surface.final.rgb = surface.direct.rgb;
|
||||
#elif defined(MK_FORWARD_ADD_PASS)
|
||||
surface.final.rgb = surface.direct.rgb;
|
||||
#else
|
||||
surface.final.rgb = surface.albedo;
|
||||
#endif
|
||||
|
||||
#ifdef MK_IRIDESCENCE_DEFAULT
|
||||
surface.iridescence = Iridescence(_IridescenceSize, surfaceData.OneMinusVoN, _IridescenceSmoothness * 0.5, surface);
|
||||
surface.final.rgb = lerp(surface.final.rgb, surface.iridescence.rgb, surface.iridescence.a * _IridescenceColor.a);
|
||||
#endif
|
||||
|
||||
#if defined(MK_RIM_DEFAULT)
|
||||
surface.rim = RimRawEverything(_RimSize, surfaceData.OneMinusVoN, _RimSmoothness * 0.5, surface);
|
||||
surface.final.rgb = lerp(surface.final.rgb, _RimColor.rgb, surface.rim.rgb * _RimColor.a);
|
||||
#elif defined(MK_RIM_SPLIT)
|
||||
surface.rim = saturate(surface.rim);
|
||||
#if defined(MK_FORWARD_BASE_PASS)
|
||||
half4 rimDark = RimRawEverything(_RimSize, surfaceData.OneMinusVoN, _RimSmoothness * 0.5, surface);
|
||||
rimDark -= surface.rim;
|
||||
surface.final.rgb = lerp(surface.final.rgb, _RimDarkColor.rgb, rimDark.rgb * _RimDarkColor.a);
|
||||
#endif
|
||||
|
||||
surface.final.rgb = lerp(surface.final.rgb, _RimBrightColor.rgb, surface.rim.rgb * _RimBrightColor.a);
|
||||
|
||||
//surface.final.rgb = lerp(surface.final.rgb, _RimBrightColor.rgb, surface.rimBright.rgb * _RimBrightColor.a);
|
||||
//surface.final.rgb = lerp(surface.final.rgb, _RimDarkColor.rgb, surface.rimDark.rgb * _RimDarkColor.a);
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if defined(MK_ALPHA_LOOKUP)
|
||||
surface.direct.a = saturate(surface.direct.a);
|
||||
#endif
|
||||
|
||||
surface.final.a = lerp(surface.goochDark.a, surface.goochBright.a, surface.direct.a);
|
||||
|
||||
#if defined(MK_ALPHA_CLIPPING)
|
||||
Clip0(surface.final.a - _AlphaCutoff);
|
||||
#endif
|
||||
*/
|
||||
surface.final.a = surface.alpha;
|
||||
#else
|
||||
//non lit color output
|
||||
surface.final.rgb = surface.albedo;
|
||||
surface.final.a = surface.alpha;
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS) || defined(MK_UNIVERSAL2D_PASS)
|
||||
#if defined(MK_DISSOLVE_BORDER_RAMP)
|
||||
//apply color for dissolving
|
||||
surface.final.rgb = DissolveRamp(surfaceData.dissolveClip, PASS_TEXTURE_2D(_DissolveBorderRamp, SAMPLER_REPEAT_MAIN), _DissolveBorderColor, _DissolveBorderSize, _DissolveAmount, surfaceData.baseUV.xy, surface.final.rgb);
|
||||
#elif defined(MK_DISSOLVE_BORDER_COLOR)
|
||||
surface.final.rgb = DissolveColor(surfaceData.dissolveClip, _DissolveBorderColor, _DissolveBorderSize, _DissolveAmount, surface.final.rgb);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_COLOR_GRADING_FINAL_OUTPUT
|
||||
surface.final.rgb = ColorGrading(surface.final.rgb, _Brightness, _Saturation, _Contrast);
|
||||
#endif
|
||||
|
||||
#ifdef MK_FOG
|
||||
ApplyFog(surface.final.rgb, surfaceData.fogFactor);
|
||||
#endif
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd7a4347fed421845aeeddecc8e1adb9
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
949
Assets/Resources/1/MK/MKToon/Shader/Lib/Config.hlsl
Normal file
949
Assets/Resources/1/MK/MKToon/Shader/Lib/Config.hlsl
Normal file
@ -0,0 +1,949 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Config //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_DEFINES
|
||||
#define MK_TOON_DEFINES
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Custom User Config
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
//Enable vertex colors be combined with the albedo map
|
||||
#ifndef MK_COMBINE_VERTEX_COLOR_WITH_ALBEDO_MAP
|
||||
#define MK_COMBINE_VERTEX_COLOR_WITH_ALBEDO_MAP
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
//Enable outline distance based fading
|
||||
//Also set compile directive on project window: MK_TOON_OUTLINE_FADE
|
||||
#ifndef MK_OUTLINE_FADE
|
||||
#define MK_OUTLINE_FADE
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
//Enable Point Filtering instead of Bilinear
|
||||
//This can't be customized by the user in any other way, since sampler objects has to be are hardcoded
|
||||
#ifndef MK_POINT_FILTERING
|
||||
#define MK_POINT_FILTERING
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
//Enable screen spaced dissolve instead of tangent spaced
|
||||
/*
|
||||
#ifndef MK_DISSOLVE_PROJECTION_SCREEN_SPACE
|
||||
#define MK_DISSOLVE_PROJECTION_SCREEN_SPACE
|
||||
#endif
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Note: Every define should have a "MK" prefix to avoid compile issues when using external funtions
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
// because of maximum of interpolators / graphics API operations some features are dependent of Shader Models
|
||||
// Aniso Spec, Normal Mapping, Heightmapping, Vertex Animation Map are foreced to required SM30+
|
||||
// Flipbook requires SM35+
|
||||
// the following maps are skipped on < SM35: Depth => SoftFade, Occlusion, DetailNormal, Normal, DissolveBorder, Height, PBS1, Gooch Bright and Dark, Thickness
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Basic setup
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//SRP's dont accept fixed variables, switched to half instead while defining pipeline
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
#ifndef autoLP
|
||||
#define autoLP half
|
||||
#endif
|
||||
#ifndef autoLP2
|
||||
#define autoLP2 half2
|
||||
#endif
|
||||
#ifndef autoLP3
|
||||
#define autoLP3 half3
|
||||
#endif
|
||||
#ifndef autoLP4
|
||||
#define autoLP4 half4
|
||||
#endif
|
||||
#else
|
||||
#ifndef autoLP
|
||||
#define autoLP fixed
|
||||
#endif
|
||||
#ifndef autoLP2
|
||||
#define autoLP2 fixed2
|
||||
#endif
|
||||
#ifndef autoLP3
|
||||
#define autoLP3 fixed3
|
||||
#endif
|
||||
#ifndef autoLP4
|
||||
#define autoLP4 fixed4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Just a safety thing, not supported on every device
|
||||
#if defined(UNITY_COMPILER_HLSL) || defined(SHADER_API_PSSL) || defined(UNITY_COMPILER_HLSLCC)
|
||||
#define INITIALIZE_STRUCT(type, name) name = (type)0;
|
||||
#else
|
||||
#define INITIALIZE_STRUCT(type, name)
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARTICLES)
|
||||
#else //Standard
|
||||
#ifndef MK_STANDARD
|
||||
#define MK_STANDARD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_LEGACY_RP
|
||||
#ifndef MK_PARTICLES
|
||||
//handle particles instancing on legacy rp
|
||||
#include "UnityStandardParticleInstancing.cginc"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(MK_PBS) && !defined(MK_SIMPLE) && !defined(MK_UNLIT)
|
||||
#ifndef MK_UNLIT
|
||||
#define MK_UNLIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_PBS) || defined(MK_SIMPLE)
|
||||
#ifndef MK_LIT
|
||||
#define MK_LIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_PBS
|
||||
#if defined(_MK_WORKFLOW_SPECULAR)
|
||||
#ifndef MK_WORKFLOW_SPECULAR
|
||||
#define MK_WORKFLOW_SPECULAR
|
||||
#endif
|
||||
#elif defined(_MK_WORKFLOW_ROUGHNESS)
|
||||
#ifndef MK_WORKFLOW_ROUGHNESS
|
||||
#define MK_WORKFLOW_ROUGHNESS
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_WORKFLOW_METALLIC
|
||||
#define MK_WORKFLOW_METALLIC
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_WORKFLOW_METALLIC) || defined(MK_WORKFLOW_SPECULAR) || defined(MK_WORKFLOW_ROUGHNESS)
|
||||
#ifndef MK_WORKFLOW_PBS
|
||||
#define MK_WORKFLOW_PBS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_WORKFLOW_PBS
|
||||
#ifdef _MK_PBS_MAP_0
|
||||
#ifndef MK_PBS_MAP_0
|
||||
#define MK_PBS_MAP_0
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_MK_PBS_MAP_1) && SHADER_TARGET >= 35
|
||||
#ifndef MK_PBS_MAP_1
|
||||
#define MK_PBS_MAP_1
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MK_PBS_MAP_0
|
||||
#ifndef MK_PBS_MAP_0
|
||||
#define MK_PBS_MAP_0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MK_SURFACE_TYPE_TRANSPARENT
|
||||
#ifndef MK_SURFACE_TYPE_TRANSPARENT
|
||||
#define MK_SURFACE_TYPE_TRANSPARENT
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_SURFACE_TYPE_OPAQUE
|
||||
#define MK_SURFACE_TYPE_OPAQUE
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MK_ALPHA_CLIPPING
|
||||
#ifndef MK_ALPHA_CLIPPING
|
||||
#define MK_ALPHA_CLIPPING
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MK_ALPHA_CLIPPING) || defined(MK_SURFACE_TYPE_TRANSPARENT)
|
||||
#ifndef MK_ALPHA_LOOKUP
|
||||
#define MK_ALPHA_LOOKUP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_FLIPBOOK) && SHADER_TARGET >= 35
|
||||
//flipbook can only be used if > 10 interpolators are available
|
||||
#ifndef MK_FLIPBOOK
|
||||
#define MK_FLIPBOOK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_SURFACE_TYPE_TRANSPARENT
|
||||
#if defined(_MK_BLEND_PREMULTIPLY)
|
||||
#ifndef MK_BLEND_PREMULTIPLY
|
||||
#define MK_BLEND_PREMULTIPLY
|
||||
#endif
|
||||
// Premul and additive results in the same keyword but different blend => premul
|
||||
#elif defined(_MK_BLEND_ADDITIVE)
|
||||
#ifndef MK_BLEND_ADDITIVE
|
||||
#define MK_BLEND_ADDITIVE
|
||||
#endif
|
||||
#elif defined(_MK_BLEND_MULTIPLY)
|
||||
#ifndef MK_BLEND_MULTIPLY
|
||||
#define MK_BLEND_MULTIPLY
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_BLEND_ALPHA
|
||||
#define MK_BLEND_ALPHA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_PARTICLES
|
||||
#if defined(_MK_COLOR_BLEND_ADDITIVE)
|
||||
#ifndef MK_COLOR_BLEND_ADDITIVE
|
||||
#define MK_COLOR_BLEND_ADDITIVE
|
||||
#endif
|
||||
#elif defined(_MK_COLOR_BLEND_SUBTRACTIVE)
|
||||
#ifndef MK_COLOR_BLEND_SUBTRACTIVE
|
||||
#define MK_COLOR_BLEND_SUBTRACTIVE
|
||||
#endif
|
||||
#elif defined(_MK_COLOR_BLEND_OVERLAY)
|
||||
#ifndef MK_COLOR_BLEND_OVERLAY
|
||||
#define MK_COLOR_BLEND_OVERLAY
|
||||
#endif
|
||||
#elif defined(_MK_COLOR_BLEND_COLOR)
|
||||
#ifndef MK_COLOR_BLEND_COLOR
|
||||
#define MK_COLOR_BLEND_COLOR
|
||||
#endif
|
||||
#elif defined(_MK_COLOR_BLEND_DIFFERENCE)
|
||||
#ifndef MK_COLOR_BLEND_DIFFERENCE
|
||||
#define MK_COLOR_BLEND_DIFFERENCE
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_COLOR_BLEND_MULTIPLY
|
||||
#define MK_COLOR_BLEND_MULTIPLY
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_COLOR_BLEND_ADDITIVE) || defined(MK_COLOR_BLEND_SUBTRACTIVE) || defined(MK_COLOR_BLEND_OVERLAY) || defined(MK_COLOR_BLEND_COLOR) || defined(MK_COLOR_BLEND_DIFFERENCE) || defined(MK_COLOR_BLEND_MULTIPLY)
|
||||
#ifndef MK_COLOR
|
||||
#define MK_COLOR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_SOFT_FADE) && SHADER_TARGET >= 35
|
||||
#ifndef MK_SOFT_FADE
|
||||
#define MK_SOFT_FADE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MK_CAMERA_FADE
|
||||
#ifndef MK_CAMERA_FADE
|
||||
#define MK_CAMERA_FADE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MK_ALBEDO_MAP
|
||||
#ifndef MK_ALBEDO_MAP
|
||||
#define MK_ALBEDO_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MK_DETAIL_MAP
|
||||
#ifndef MK_DETAIL_MAP
|
||||
#define MK_DETAIL_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_DETAIL_MAP
|
||||
#if defined(_MK_DETAIL_BLEND_MIX)
|
||||
#ifndef MK_DETAIL_BLEND_MIX
|
||||
#define MK_DETAIL_BLEND_MIX
|
||||
#endif
|
||||
#elif defined(_MK_DETAIL_BLEND_ADD)
|
||||
#ifndef MK_DETAIL_BLEND_ADD
|
||||
#define MK_DETAIL_BLEND_ADD
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_DETAIL_BLEND_MULTIPLY
|
||||
#define MK_DETAIL_BLEND_MULTIPLY
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_MK_DETAIL_NORMAL_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_DETAIL_NORMAL_MAP
|
||||
#define MK_DETAIL_NORMAL_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_ALBEDO_MAP)
|
||||
#ifndef MK_TEXCLR
|
||||
#define MK_TEXCLR
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_VERTCLR
|
||||
#define MK_VERTCLR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_COMBINE_VERTEX_COLOR_WITH_ALBEDO_MAP
|
||||
#ifndef MK_VERTCLR
|
||||
#define MK_VERTCLR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_LIT
|
||||
#ifdef _MK_RECEIVE_SHADOWS
|
||||
#ifndef MK_RECEIVE_SHADOWS
|
||||
#define MK_RECEIVE_SHADOWS
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MK_THRESHOLD_MAP
|
||||
#ifndef MK_THRESHOLD_MAP
|
||||
#define MK_THRESHOLD_MAP
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MK_FORWARD_BASE_PASS
|
||||
#if defined(MK_URP) && defined(_ADDITIONAL_LIGHTS_VERTEX) || defined(MK_LWRP) && defined(_ADDITIONAL_LIGHTS_VERTEX) || defined(MK_LEGACY_RP) && defined(VERTEXLIGHT_ON)
|
||||
#ifndef MK_VERTEX_LIGHTING
|
||||
#define MK_VERTEX_LIGHTING
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_NORMAL_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_NORMAL_MAP
|
||||
#define MK_NORMAL_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MK_LIGHT_TRANSMISSION_TRANSLUCENT
|
||||
#ifndef MK_LIGHT_TRANSMISSION_TRANSLUCENT
|
||||
#define MK_LIGHT_TRANSMISSION_TRANSLUCENT
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MK_LIGHT_TRANSMISSION_SUB_SURFACE_SCATTERING
|
||||
#ifndef MK_LIGHT_TRANSMISSION_SUB_SURFACE_SCATTERING
|
||||
#define MK_LIGHT_TRANSMISSION_SUB_SURFACE_SCATTERING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_THICKNESS_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_THICKNESS_MAP
|
||||
#define MK_THICKNESS_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_LIGHT_TRANSMISSION_TRANSLUCENT) || defined(MK_LIGHT_TRANSMISSION_SUB_SURFACE_SCATTERING)
|
||||
#ifndef MK_LightTransmission
|
||||
#define MK_LightTransmission
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_HEIGHT_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_HEIGHT_MAP
|
||||
#define MK_HEIGHT_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_OCCLUSION_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_OCCLUSION_MAP
|
||||
#define MK_OCCLUSION_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_LIGHT_CEL)
|
||||
#ifndef MK_LIGHT_CEL
|
||||
#define MK_LIGHT_CEL
|
||||
#endif
|
||||
#elif defined(_MK_LIGHT_BANDED)
|
||||
#ifndef MK_LIGHT_BANDED
|
||||
#define MK_LIGHT_BANDED
|
||||
#endif
|
||||
#elif defined(_MK_LIGHT_RAMP)
|
||||
#ifndef MK_LIGHT_RAMP
|
||||
#define MK_LIGHT_RAMP
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_LIGHT_BUILTIN
|
||||
#define MK_LIGHT_BUILTIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_ARTISTIC_DRAWN)
|
||||
#ifndef MK_ARTISTIC_DRAWN
|
||||
#define MK_ARTISTIC_DRAWN
|
||||
#endif
|
||||
#elif defined(_MK_ARTISTIC_HATCHING)
|
||||
#ifndef MK_ARTISTIC_HATCHING
|
||||
#define MK_ARTISTIC_HATCHING
|
||||
#endif
|
||||
#elif defined(_MK_ARTISTIC_SKETCH)
|
||||
#ifndef MK_ARTISTIC_SKETCH
|
||||
#define MK_ARTISTIC_SKETCH
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_ARTISTIC_OFF
|
||||
#define MK_ARTISTIC_OFF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_ARTISTIC_DRAWN) || defined(MK_ARTISTIC_HATCHING) || defined(MK_ARTISTIC_SKETCH)
|
||||
#ifndef MK_ARTISTIC
|
||||
#define MK_ARTISTIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_ARTISTIC)
|
||||
#if defined(_MK_ARTISTIC_PROJECTION_SCREEN_SPACE)
|
||||
#ifndef MK_ARTISTIC_PROJECTION_SCREEN_SPACE
|
||||
#define MK_ARTISTIC_PROJECTION_SCREEN_SPACE
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_ARTISTIC_PROJECTION_TANGENT_SPACE
|
||||
#define MK_ARTISTIC_PROJECTION_TANGENT_SPACE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_ARTISTIC_ANIMATION_STUTTER)
|
||||
#ifndef MK_ARTISTIC_ANIMATION_STUTTER
|
||||
#define MK_ARTISTIC_ANIMATION_STUTTER
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_GOOCH_RAMP)
|
||||
#ifndef MK_GOOCH_RAMP
|
||||
#define MK_GOOCH_RAMP
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_MK_GOOCH_BRIGHT_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_GOOCH_BRIGHT_MAP
|
||||
#define MK_GOOCH_BRIGHT_MAP
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_MK_GOOCH_DARK_MAP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_GOOCH_DARK_MAP
|
||||
#define MK_GOOCH_DARK_MAP
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MK_GOOCH_BRIGHT_MAP) && defined(MK_GOOCH_DARK_MAP)
|
||||
#ifndef MK_GOOCH_BRIGHT_AND_DARK_MAP
|
||||
#define MK_GOOCH_BRIGHT_AND_DARK_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_GOOCH_BRIGHT_MAP) || defined(MK_GOOCH_DARK_MAP) || defined(MK_GOOCH_BRIGHT_AND_DARK_MAP)
|
||||
#ifndef MK_GOOCH_MAP
|
||||
#define MK_GOOCH_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS)
|
||||
#if defined(_MK_RIM_DEFAULT)
|
||||
#ifndef MK_RIM_DEFAULT
|
||||
#define MK_RIM_DEFAULT
|
||||
#endif
|
||||
#elif defined(_MK_RIM_SPLIT)
|
||||
#ifndef MK_RIM_SPLIT
|
||||
#define MK_RIM_SPLIT
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_RIM_DEFAULT) || defined(MK_RIM_SPLIT)
|
||||
#ifndef MK_RIM
|
||||
#define MK_RIM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS)
|
||||
#ifdef _MK_IRIDESCENCE_DEFAULT
|
||||
#ifndef MK_IRIDESCENCE_DEFAULT
|
||||
#define MK_IRIDESCENCE_DEFAULT
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MK_IRIDESCENCE_DEFAULT
|
||||
#ifndef MK_IRIDESCENCE
|
||||
#define MK_IRIDESCENCE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(MK_META_PASS) || defined(MK_FORWARD_BASE_PASS))
|
||||
#ifdef _MK_EMISSION
|
||||
#ifndef MK_EMISSION
|
||||
#define MK_EMISSION
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MK_EMISSION_MAP
|
||||
#ifndef MK_EMISSION_MAP
|
||||
#define MK_EMISSION_MAP
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_DIFFUSE_OREN_NAYAR)
|
||||
#ifndef MK_DIFFUSE_OREN_NAYAR
|
||||
#define MK_DIFFUSE_OREN_NAYAR
|
||||
#endif
|
||||
#elif defined(_MK_DIFFUSE_MINNAERT)
|
||||
#ifndef MK_DIFFUSE_MINNAERT
|
||||
#define MK_DIFFUSE_MINNAERT
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_DIFFUSE_LAMBERT
|
||||
#define MK_DIFFUSE_LAMBERT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_WRAPPED_DIFFUSE)
|
||||
#ifndef MK_WRAPPED_DIFFUSE
|
||||
#define MK_WRAPPED_DIFFUSE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_SPECULAR_ISOTROPIC)
|
||||
#ifndef MK_SPECULAR_ISOTROPIC
|
||||
#define MK_SPECULAR_ISOTROPIC
|
||||
#endif
|
||||
#elif defined(_MK_SPECULAR_ANISOTROPIC) && SHADER_TARGET >= 30
|
||||
#ifndef MK_SPECULAR_ANISOTROPIC
|
||||
#define MK_SPECULAR_ANISOTROPIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_SPECULAR_ISOTROPIC) || defined(MK_SPECULAR_ANISOTROPIC)
|
||||
#ifndef MK_SPECULAR
|
||||
#define MK_SPECULAR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS)
|
||||
#if defined(_MK_ENVIRONMENT_REFLECTIONS_ADVANCED)
|
||||
#ifndef MK_ENVIRONMENT_REFLECTIONS_ADVANCED
|
||||
#define MK_ENVIRONMENT_REFLECTIONS_ADVANCED
|
||||
#endif
|
||||
#elif defined(_MK_ENVIRONMENT_REFLECTIONS_AMBIENT)
|
||||
#ifndef MK_ENVIRONMENT_REFLECTIONS_AMBIENT
|
||||
#define MK_ENVIRONMENT_REFLECTIONS_AMBIENT
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_ENVIRONMENT_REFLECTIONS_OFF
|
||||
#define MK_ENVIRONMENT_REFLECTIONS_OFF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_ENVIRONMENT_REFLECTIONS_ADVANCED) || defined(MK_ENVIRONMENT_REFLECTIONS_AMBIENT)
|
||||
#ifndef MK_ENVIRONMENT_REFLECTIONS
|
||||
#define MK_ENVIRONMENT_REFLECTIONS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS) && defined(MK_ENVIRONMENT_REFLECTIONS)
|
||||
#ifdef _MK_FRESNEL_HIGHLIGHTS
|
||||
#ifndef MK_FRESNEL_HIGHLIGHTS
|
||||
#define MK_FRESNEL_HIGHLIGHTS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_ENVIRONMENT_REFLECTIONS) || defined(MK_EMISSION) || defined(MK_FRESNEL_HIGHLIGHTS)
|
||||
#ifndef MK_INDIRECT
|
||||
#define MK_INDIRECT
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_COLOR_GRADING_ALBEDO)
|
||||
#ifndef MK_COLOR_GRADING_ALBEDO
|
||||
#define MK_COLOR_GRADING_ALBEDO
|
||||
#endif
|
||||
#elif defined(_MK_COLOR_GRADING_FINAL_OUTPUT)
|
||||
#ifndef MK_COLOR_GRADING_FINAL_OUTPUT
|
||||
#define MK_COLOR_GRADING_FINAL_OUTPUT
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MK_COLOR_GRADING_ALBEDO) || defined(MK_COLOR_GRADING_FINAL_OUTPUT)
|
||||
#ifndef MK_COLOR_GRADING
|
||||
#define MK_COLOR_GRADING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_VERTEX_ANIMATION_SINE)
|
||||
#ifndef MK_VERTEX_ANIMATION_SINE
|
||||
#define MK_VERTEX_ANIMATION_SINE
|
||||
#endif
|
||||
#elif defined(_MK_VERTEX_ANIMATION_PULSE)
|
||||
#ifndef MK_VERTEX_ANIMATION_PULSE
|
||||
#define MK_VERTEX_ANIMATION_PULSE
|
||||
#endif
|
||||
#elif defined(_MK_VERTEX_ANIMATION_NOISE)
|
||||
#ifndef MK_VERTEX_ANIMATION_NOISE
|
||||
#define MK_VERTEX_ANIMATION_NOISE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTEX_ANIMATION_SINE) || defined(MK_VERTEX_ANIMATION_PULSE) || defined(MK_VERTEX_ANIMATION_NOISE)
|
||||
#ifndef MK_VERTEX_ANIMATION
|
||||
#define MK_VERTEX_ANIMATION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTEX_ANIMATION)
|
||||
#if defined(_MK_VERTEX_ANIMATION_MAP) && SHADER_TARGET >= 30
|
||||
#ifndef MK_VERTEX_ANIMATION_MAP
|
||||
#define MK_VERTEX_ANIMATION_MAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_VERTEX_ANIMATION_STUTTER)
|
||||
#ifndef MK_VERTEX_ANIMATION_STUTTER
|
||||
#define MK_VERTEX_ANIMATION_STUTTER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTEX_ANIMATION_MAP)
|
||||
#define PASS_VERTEX_ANIMATION_UV(uv) uv
|
||||
#else
|
||||
#define PASS_VERTEX_ANIMATION_UV(uv) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_DISSOLVE_DEFAULT)
|
||||
#ifndef MK_DISSOLVE_DEFAULT
|
||||
#define MK_DISSOLVE_DEFAULT
|
||||
#endif
|
||||
#elif defined(_MK_DISSOLVE_BORDER_COLOR)
|
||||
#ifndef MK_DISSOLVE_BORDER_COLOR
|
||||
#define MK_DISSOLVE_BORDER_COLOR
|
||||
#endif
|
||||
#elif defined(_MK_DISSOLVE_BORDER_RAMP) && SHADER_TARGET >= 35
|
||||
#ifndef MK_DISSOLVE_BORDER_RAMP
|
||||
#define MK_DISSOLVE_BORDER_RAMP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_DISSOLVE_DEFAULT) || defined(MK_DISSOLVE_BORDER_COLOR) || defined(MK_DISSOLVE_BORDER_RAMP)
|
||||
#ifndef MK_DISSOLVE
|
||||
#define MK_DISSOLVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_OUTLINE_PASS
|
||||
#if defined(_MK_OUTLINE_HULL_ORIGIN)
|
||||
#ifndef MK_OUTLINE_HULL_ORIGIN
|
||||
#define MK_OUTLINE_HULL_ORIGIN
|
||||
#endif
|
||||
#elif defined(_MK_OUTLINE_HULL_CLIP)
|
||||
#ifndef MK_OUTLINE_HULL_CLIP
|
||||
#define MK_OUTLINE_HULL_CLIP
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_OUTLINE_HULL_OBJECT
|
||||
#define MK_OUTLINE_HULL_OBJECT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_OUTLINE_DATA_UV7)
|
||||
#ifndef MK_OUTLINE_DATA_UV7
|
||||
#define MK_OUTLINE_DATA_UV7
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_OUTLINE_DATA_NORMAL
|
||||
#define MK_OUTLINE_DATA_NORMAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_OUTLINE_NOISE)
|
||||
#ifndef MK_OUTLINE_NOISE
|
||||
#define MK_OUTLINE_NOISE
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_OUTLINE_NOISE_OFF
|
||||
#define MK_OUTLINE_NOISE_OFF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MK_OUTLINE_MAP)
|
||||
#ifndef MK_OUTLINE_MAP
|
||||
#define MK_OUTLINE_MAP
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_REFRACTION
|
||||
#ifdef _MK_REFRACTION_DISTORTION_MAP
|
||||
#ifndef MK_REFRACTION_DISTORTION_MAP
|
||||
#define MK_REFRACTION_DISTORTION_MAP
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MK_INDEX_OF_REFRACTION
|
||||
#ifndef MK_INDEX_OF_REFRACTION
|
||||
#define MK_INDEX_OF_REFRACTION
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_LIT) || defined(MK_INDEX_OF_REFRACTION) || defined(MK_VERTEX_ANIMATION_PULSE) || defined(MK_VERTEX_ANIMATION_NOISE)
|
||||
#ifndef MK_NORMAL
|
||||
#define MK_NORMAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constants
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef OUTLINE_OBJECT_SCALE
|
||||
#define OUTLINE_OBJECT_SCALE 0.00000025
|
||||
#endif
|
||||
#ifndef OUTLINE_ORIGIN_SCALE
|
||||
#define OUTLINE_ORIGIN_SCALE 0.0015
|
||||
#endif
|
||||
#ifndef K_SPEC_DIELECTRIC_MIN
|
||||
#define K_SPEC_DIELECTRIC_MIN 0.04
|
||||
#endif
|
||||
#ifndef K_SPEC_DIELECTRIC_MAX
|
||||
#define K_SPEC_DIELECTRIC_MAX 0.96
|
||||
#endif
|
||||
#ifndef HALF_MIN
|
||||
#define HALF_MIN 6.10e-5
|
||||
#endif
|
||||
#ifndef ONE_MINUS_HALF_MIN
|
||||
#define ONE_MINUS_HALF_MIN 0.999939
|
||||
#endif
|
||||
#ifndef T_Q
|
||||
#define T_Q 0.125
|
||||
#endif
|
||||
#ifndef T_H
|
||||
#define T_H 0.25
|
||||
#endif
|
||||
#ifndef T_V
|
||||
#define T_V 0.5
|
||||
#endif
|
||||
#ifndef THRESHOLD_OFFSET_NORMALIZER
|
||||
#define THRESHOLD_OFFSET_NORMALIZER 0.125
|
||||
#endif
|
||||
/*
|
||||
#ifndef SHINE_MULT
|
||||
//approximately URP smoothness base
|
||||
#define SHINE_MULT 1024
|
||||
#endif
|
||||
*/
|
||||
#ifndef PI
|
||||
#define PI 3.141592
|
||||
#endif
|
||||
#ifndef PI_TWO
|
||||
#define PI_TWO 6.283185
|
||||
#endif
|
||||
#ifndef PI_H
|
||||
#define PI_H 1.570796
|
||||
#endif
|
||||
#ifndef PI_P2
|
||||
#define PI_P2 9.869604
|
||||
#endif
|
||||
#ifndef INV_PI
|
||||
#define INV_PI 0.318309
|
||||
#endif
|
||||
#ifndef REL_LUMA
|
||||
#define REL_LUMA half3(0.2126,0.7152,0.0722)
|
||||
#endif
|
||||
#ifndef REFRACTION_DISTORTION_SCALE
|
||||
#define REFRACTION_DISTORTION_SCALE 0.1
|
||||
#endif
|
||||
#ifndef HALF3_ONE
|
||||
#define HALF3_ONE half3(1.0h, 1.0h, 1.0h)
|
||||
#endif
|
||||
#ifndef REFERENCE_RESOLUTION
|
||||
#define REFERENCE_RESOLUTION half2(3840, 2160)
|
||||
#endif
|
||||
#ifndef REFERENCE_ASPECT
|
||||
#define REFERENCE_ASPECT half2(1.777778, 0.5625)
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Input dependent defines
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(MK_POLYBRUSH) || defined(MK_OUTLINE_MAP) || defined(MK_VERTEX_ANIMATION_MAP) || defined(MK_THRESHOLD_MAP) || defined(MK_PARTICLES) || defined(MK_ALBEDO_MAP) || defined(MK_DISSOLVE) || defined(MK_GOOCH_MAP) || defined(MK_LightTransmission) || defined(MK_NORMAL_MAP) || defined(MK_DETAIL_NORMAL_MAP) || defined(MK_EMISSION_MAP) || defined(MK_OCCLUSION_MAP) || defined(MK_ARTISTIC_HATCHING) || defined(MK_ARTISTIC_DRAWN) || defined(MK_ARTISTIC_SKETCH) || defined(MK_REFRACTION_DISTORTION_MAP)
|
||||
#ifndef MK_TCM
|
||||
#define MK_TCM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_DETAIL_MAP) || defined(MK_DETAIL_NORMAL_MAP)
|
||||
#ifndef MK_TCD
|
||||
#define MK_TCD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_LIT) && (defined(MK_TCM) || defined(MK_TCD)) && defined(MK_HEIGHT_MAP) && defined(_MK_PARALLAX) && SHADER_TARGET >= 30
|
||||
#ifndef MK_PARALLAX
|
||||
#define MK_PARALLAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
#ifndef MK_VD_O
|
||||
#define MK_VD_O
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_NORMAL_MAP) || defined(MK_DETAIL_NORMAL_MAP) || defined(MK_VD_O) || defined(MK_SPECULAR_ANISOTROPIC)
|
||||
#ifndef MK_TBN
|
||||
#define MK_TBN
|
||||
#endif
|
||||
#else
|
||||
#ifndef MK_WN
|
||||
#define MK_WN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_REFRACTION) || defined(MK_IRIDESCENCE) || defined(MK_LightTransmission) || defined(MK_RIM) || defined(MK_SPECULAR) || defined(LIGHTMAP_ON) || defined(UNITY_SHOULD_SAMPLE_SH) || defined(DYNAMICLIGHTMAP_ON) || defined(DIRLIGHTMAP_COMBINED) || defined(MK_RIM) || defined(MK_ENVIRONMENT_REFLECTIONS_ADVANCED) || defined(MK_FRESNEL_HIGHLIGHTS) || defined(MK_DIFFUSE_MINNAERT) || defined(MK_DIFFUSE_OREN_NAYAR)
|
||||
#ifndef MK_VD
|
||||
#define MK_VD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_ARTISTIC) && defined(MK_ARTISTIC_PROJECTION_SCREEN_SPACE) || defined(MK_DISSOLVE_PROJECTION_SCREEN_SPACE)
|
||||
#ifndef MK_NORMALIZED_SCREEN_UV
|
||||
#define MK_NORMALIZED_SCREEN_UV
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_REFRACTION) || defined(MK_SOFT_FADE) || defined(MK_CAMERA_FADE) || defined(MK_NORMALIZED_SCREEN_UV)
|
||||
#ifndef MK_SCREEN_UV
|
||||
#define MK_SCREEN_UV
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_NORMALIZED_SCREEN_UV)
|
||||
#ifndef MK_POS_NULL_CLIP
|
||||
#define MK_POS_NULL_CLIP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_POS_NULL_CLIP) || defined(MK_REFRACTION) || defined(MK_SOFT_FADE) || defined(MK_CAMERA_FADE)
|
||||
#ifndef MK_POS_CLIP
|
||||
#define MK_POS_CLIP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_LIT
|
||||
#ifndef MK_N_DOT_L
|
||||
#define MK_N_DOT_L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_IRIDESCENCE) || defined(MK_FRESNEL_HIGHLIGHTS) || defined(MK_SPECULAR) || defined(MK_DIFFUSE_MINNAERT) || defined(MK_DIFFUSE_OREN_NAYAR) || defined(MK_RIM)
|
||||
#ifndef MK_V_DOT_N
|
||||
#define MK_V_DOT_N
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MK_DIFFUSE_OREN_NAYAR
|
||||
#ifndef MK_V_DOT_L
|
||||
#define MK_V_DOT_L
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MK_SPECULAR)
|
||||
#ifdef MK_SPECULAR_ANISOTROPIC
|
||||
#ifndef MK_T_DOT_HV
|
||||
#define MK_T_DOT_HV
|
||||
#endif
|
||||
#ifndef MK_B_DOT_HV
|
||||
#define MK_B_DOT_HV
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MK_HV
|
||||
#define MK_HV
|
||||
#endif
|
||||
#ifndef MK_N_DOT_HV
|
||||
#define MK_N_DOT_HV
|
||||
#endif
|
||||
//used for C.Sch Fresnel, if switched back to Schlick this should be disabled
|
||||
#ifndef MK_L_DOT_HV
|
||||
#define MK_L_DOT_HV
|
||||
#endif
|
||||
/*
|
||||
//used for Schlick Fresnel
|
||||
#ifndef MK_V_DOT_HV
|
||||
#define MK_V_DOT_HV
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef MK_LightTransmission
|
||||
#ifndef MK_LND
|
||||
#define MK_LND
|
||||
#endif
|
||||
#ifndef MK_V_DOT_LND
|
||||
#define MK_V_DOT_LND
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef MK_LIGHTMODEL_PHONG
|
||||
#ifndef MK_ML_REF_N
|
||||
#define MK_ML_REF_N
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
#ifdef MK_ENVIRONMENT_REFLECTIONS_ADVANCED
|
||||
#ifndef MK_MV_REF_N
|
||||
#define MK_MV_REF_N
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
#if defined(MK_TLD) || defined(MK_TLM)
|
||||
#ifndef MK_ML_DOT_V
|
||||
#define MK_ML_DOT_V
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
/*
|
||||
#ifdef MK_LIGHTMODEL_PHONG
|
||||
#ifndef MK_ML_REF_N_DOT_V
|
||||
#define MK_ML_REF_N_DOT_V
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if defined(MK_TBN) || defined(MK_FLIPBOOK) || defined(MK_TCM) || defined(MK_TCD) || defined(MK_T_DOT_HV) || defined(MK_B_DOT_HV) || defined(MK_WORKFLOW_PBS) || defined(MK_ML_REF_N_DOT_V) || defined(MK_ML_DOT_V) || defined(MK_MV_REF_N) || defined(MK_ML_REF_N) || defined(MK_N_DOT_HV) || defined(MK_HV) || defined(MK_N_DOT_L) || defined(MK_V_DOT_L) || defined(MK_V_DOT_N) || defined(MK_LIT) || defined(MK_DISSOLVE) || defined(MK_REFRACTION)
|
||||
#ifndef MK_SURFACE_DATA_REQUIRED
|
||||
#define MK_SURFACE_DATA_REQUIRED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_LIT) || defined(MK_VD)
|
||||
#ifndef MK_POS_WORLD
|
||||
#define MK_POS_WORLD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_FORWARD_BASE_PASS) || defined(MK_OUTLINE_PASS)
|
||||
#ifndef MK_FOG
|
||||
#define MK_FOG
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
9
Assets/Resources/1/MK/MKToon/Shader/Lib/Config.hlsl.meta
Normal file
9
Assets/Resources/1/MK/MKToon/Shader/Lib/Config.hlsl.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e209de65ba133549acb285c2e392a1e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Assets/Resources/1/MK/MKToon/Shader/Lib/Core.hlsl
Normal file
25
Assets/Resources/1/MK/MKToon/Shader/Lib/Core.hlsl
Normal file
@ -0,0 +1,25 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Core //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_CORE
|
||||
#define MK_TOON_CORE
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
#include "Config.hlsl"
|
||||
#include "Pipeline.hlsl"
|
||||
#include "Uniform.hlsl"
|
||||
#include "Common.hlsl"
|
||||
|
||||
#endif
|
9
Assets/Resources/1/MK/MKToon/Shader/Lib/Core.hlsl.meta
Normal file
9
Assets/Resources/1/MK/MKToon/Shader/Lib/Core.hlsl.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 408679ce0fe9ea94eadad5c4e7a11ffe
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/1/MK/MKToon/Shader/Lib/DepthOnly.meta
Normal file
8
Assets/Resources/1/MK/MKToon/Shader/Lib/DepthOnly.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c018d10d88d3b744ab93891451aa468b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
56
Assets/Resources/1/MK/MKToon/Shader/Lib/DepthOnly/Data.hlsl
Normal file
56
Assets/Resources/1/MK/MKToon/Shader/Lib/DepthOnly/Data.hlsl
Normal file
@ -0,0 +1,56 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon DepthOnly Data //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_DEPTH_ONLY_IO
|
||||
#define MK_TOON_DEPTH_ONLY_IO
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// INPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexInputDepthOnly
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
#if defined(MK_VERTEX_ANIMATION_PULSE) || defined(MK_VERTEX_ANIMATION_NOISE) || defined(MK_PARALLAX)
|
||||
half3 normal : NORMAL;
|
||||
#endif
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
#endif
|
||||
#if defined(MK_PARALLAX)
|
||||
half4 tangent : TANGENT;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OUTPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexOutputDepthOnly
|
||||
{
|
||||
float4 svPositionClip : SV_POSITION;
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 uv : TEXCOORD0;
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
half3 viewTangent : TEXCOORD1;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0f4d55cd59d1694dbaca6d95b8910c8
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,77 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Depth Only Program //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_DEPTH_ONLY
|
||||
#define MK_TOON_DEPTH_ONLY
|
||||
|
||||
#include "../Core.hlsl"
|
||||
#include "Data.hlsl"
|
||||
#include "../Surface.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// VERTEX SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
VertexOutputDepthOnly DepthOnlyVert(VertexInputDepthOnly vertexInput)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexInput);
|
||||
VertexOutputDepthOnly vertexOutput;
|
||||
INITIALIZE_STRUCT(VertexOutputDepthOnly, vertexOutput);
|
||||
UNITY_TRANSFER_INSTANCE_ID(vertexInput, vertexOutput);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vertexOutput);
|
||||
|
||||
#ifdef MK_VERTEX_ANIMATION
|
||||
vertexInput.vertex.xyz = VertexAnimation(PASS_VERTEX_ANIMATION_ARG(_VertexAnimationMap, PASS_VERTEX_ANIMATION_UV(vertexInput.texcoord0.xy), _VertexAnimationIntensity, _VertexAnimationFrequency.xyz, vertexInput.vertex.xyz, vertexInput.normal));
|
||||
#endif
|
||||
|
||||
vertexOutput.svPositionClip = mul(MATRIX_MVP, float4(vertexInput.vertex.xyz, 1.0));
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
vertexOutput.color = vertexInput.color;
|
||||
#endif
|
||||
|
||||
//texcoords
|
||||
#if defined(MK_TCM)
|
||||
vertexOutput.uv = vertexInput.texcoord0.xy;
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
vertexOutput.viewTangent = ComputeViewTangent(ComputeViewObject(vertexInput.vertex.xyz), vertexInput.normal, vertexInput.tangent, cross(vertexInput.normal, vertexInput.tangent.xyz) * vertexInput.tangent.w * unity_WorldTransformParams.w);
|
||||
#endif
|
||||
|
||||
return vertexOutput;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FRAGMENT SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half4 DepthOnlyFrag(VertexOutputDepthOnly vertexOutput) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexOutput);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(vertexOutput);
|
||||
|
||||
MKSurfaceData surfaceData = ComputeSurfaceData
|
||||
(
|
||||
PASS_POSITION_WORLD_ARG(0)
|
||||
PASS_FOG_FACTOR_WORLD_ARG(0)
|
||||
PASS_BASE_UV_ARG(float4(vertexOutput.uv, 0, 0))
|
||||
PASS_LIGHTMAP_UV_ARG(0)
|
||||
PASS_VERTEX_COLOR_ARG(vertexOutput.color)
|
||||
PASS_NORMAL_WORLD_ARG(1)
|
||||
PASS_VERTEX_LIGHTING_ARG(0)
|
||||
PASS_TANGENT_WORLD_ARG(1)
|
||||
PASS_VIEW_TANGENT_ARG(vertexOutput.viewTangent)
|
||||
PASS_BITANGENT_WORLD_ARG(1)
|
||||
PASS_POSITION_CLIP_ARG(0)
|
||||
PASS_NULL_CLIP_ARG(0)
|
||||
PASS_FLIPBOOK_UV_ARG(0)
|
||||
);
|
||||
Surface surface = InitSurface(surfaceData, PASS_TEXTURE_2D(_AlbedoMap, SAMPLER_REPEAT_MAIN), _AlbedoColor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5c5779ef16bb8344b649c4b770a774e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Resources/1/MK/MKToon/Shader/Lib/DepthOnly/Setup.hlsl
Normal file
26
Assets/Resources/1/MK/MKToon/Shader/Lib/DepthOnly/Setup.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Depth Only Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_DEPTH_ONLY_SETUP
|
||||
#define MK_TOON_DEPTH_ONLY_SETUP
|
||||
|
||||
#ifndef MK_DEPTH_ONLY_PASS
|
||||
#define MK_DEPTH_ONLY_PASS
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
//Hightmap is only needed if a UV is required
|
||||
#if !defined(MK_TEXCLR) && !defined(MK_DISSOLVE)
|
||||
#ifdef MK_PARALLAX
|
||||
#undef MK_PARALLAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ProgramDepthOnly.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e49c1fac93b8b14984768192a76926e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Forward.meta
Normal file
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Forward.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89bd1e54e0216f541870d62d8158ce01
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,19 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Forward Add Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_FORWARD_ADD_SETUP
|
||||
#define MK_TOON_FORWARD_ADD_SETUP
|
||||
|
||||
#ifndef MK_FORWARD_ADD_PASS
|
||||
#define MK_FORWARD_ADD_PASS
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
#include "ProgramForward.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6272f36667af7bc41b6c288e4d3da719
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,50 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Forward Base Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_FORWARD_BASE_SETUP
|
||||
#define MK_TOON_FORWARD_BASE_SETUP
|
||||
|
||||
#ifndef MK_FORWARD_BASE_PASS
|
||||
#define MK_FORWARD_BASE_PASS
|
||||
#endif
|
||||
|
||||
//Internal keyword for environment reflections
|
||||
#if !defined(_MK_ENVIRONMENT_REFLECTIONS_ADVANCED)
|
||||
#if defined(MK_URP)
|
||||
#ifndef _ENVIRONMENTREFLECTIONS_OFF
|
||||
#define _ENVIRONMENTREFLECTIONS_OFF
|
||||
#endif
|
||||
#else
|
||||
//Legay & LWRP
|
||||
#ifndef _GLOSSYREFLECTIONS_OFF
|
||||
#define _GLOSSYREFLECTIONS_OFF
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//if particles are used disable dynamic lightmap
|
||||
#if defined(DYNAMICLIGHTMAP_ON) && defined(MK_PARTICLES)
|
||||
#undef DYNAMICLIGHTMAP_ON
|
||||
#endif
|
||||
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
#ifdef _MK_RECEIVE_SHADOWS
|
||||
#ifdef _RECEIVE_SHADOWS_OFF
|
||||
#undef _RECEIVE_SHADOWS_OFF
|
||||
#endif
|
||||
#else
|
||||
#ifndef _RECEIVE_SHADOWS_OFF
|
||||
#define _RECEIVE_SHADOWS_OFF
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
#include "ProgramForward.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7411061d39c72884ea43d2017816ff0e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
113
Assets/Resources/1/MK/MKToon/Shader/Lib/Forward/Data.hlsl
Normal file
113
Assets/Resources/1/MK/MKToon/Shader/Lib/Forward/Data.hlsl
Normal file
@ -0,0 +1,113 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Forward Data //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_IO_FORWARD
|
||||
#define MK_TOON_IO_FORWARD
|
||||
|
||||
#include "../Core.hlsl"
|
||||
#include "../Lighting.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// INPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexInputForward
|
||||
{
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
//use vertexcolors if required
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
//vertex position - always needed
|
||||
float4 vertex : POSITION;
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
//texcoords0 if needed
|
||||
#if defined(MK_FLIPBOOK)// && !defined(UNITY_PARTICLE_INSTANCING_ENABLED)
|
||||
float4 texcoord0 : TEXCOORD0;
|
||||
float texcoordBlend : TEXCOORD3;
|
||||
#else
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MK_FORWARD_BASE_PASS) && defined(DYNAMICLIGHTMAP_ON)
|
||||
//dynammic lightmap uv
|
||||
DECLARE_DYNAMIC_LIGHTMAP_INPUT(2)
|
||||
#endif
|
||||
#ifdef MK_NORMAL
|
||||
half3 normal : NORMAL;
|
||||
#endif
|
||||
#ifdef MK_LIT
|
||||
#ifdef MK_FORWARD_BASE_PASS
|
||||
//static lightmap uv
|
||||
DECLARE_STATIC_LIGHTMAP_INPUT(1);
|
||||
#endif
|
||||
|
||||
//use tangents only if tbn matrix is required
|
||||
#if defined(MK_TBN)
|
||||
half4 tangent : TANGENT;
|
||||
#endif
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OUTPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//If no parallax is used, then a 3 component tbn is enough
|
||||
#ifdef MK_PARALLAX
|
||||
#ifndef TBN_TYPE
|
||||
#define TBN_TYPE half4
|
||||
#endif
|
||||
#else
|
||||
#ifndef TBN_TYPE
|
||||
#define TBN_TYPE half3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Output Setup
|
||||
struct VertexOutputForward
|
||||
{
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
float4 uv : TEXCOORD0;
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
|
||||
//WorldPos + Fog
|
||||
#if defined(MK_POS_WORLD) || defined(MK_FOG)
|
||||
float4 positionWorld : TEXCOORD1; //posWorld XYZ Fog W
|
||||
#endif
|
||||
|
||||
#ifdef MK_NORMAL
|
||||
TBN_TYPE normalWorld : TEXCOORD2;
|
||||
#endif
|
||||
#ifdef MK_LIT
|
||||
#if defined(MK_TBN)
|
||||
TBN_TYPE tangentWorld : TEXCOORD8;
|
||||
TBN_TYPE bitangentWorld : TEXCOORD9;
|
||||
#endif
|
||||
|
||||
//Interplators 5,6,7 + C1 are reserved for lighting stuff
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_CLIP
|
||||
float4 positionClip : TEXCOORD3;
|
||||
#endif
|
||||
#ifdef MK_POS_NULL_CLIP
|
||||
float4 nullClip : TEXCOORD4;
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
float3 flipbookUV : TEXCOORD10;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da8d69ff7e0695c42833e143223799e0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,192 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Forward Program //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_FORWARD
|
||||
#define MK_TOON_FORWARD
|
||||
|
||||
#include "../Forward/Data.hlsl"
|
||||
#include "../Surface.hlsl"
|
||||
#include "../Lighting.hlsl"
|
||||
#include "../Composite.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// VERTEX SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void ForwardVert (VertexInputForward VERTEX_INPUT, out VertexOutputForward vertexOutput, out VertexOutputLight vertexOutputLight)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(VERTEX_INPUT);
|
||||
INITIALIZE_STRUCT(VertexOutputForward, vertexOutput);
|
||||
INITIALIZE_STRUCT(VertexOutputLight, vertexOutputLight);
|
||||
UNITY_TRANSFER_INSTANCE_ID(VERTEX_INPUT, vertexOutput);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vertexOutput);
|
||||
|
||||
#ifdef MK_VERTEX_ANIMATION
|
||||
VERTEX_INPUT.vertex.xyz = VertexAnimation(PASS_VERTEX_ANIMATION_ARG(_VertexAnimationMap, PASS_VERTEX_ANIMATION_UV(VERTEX_INPUT.texcoord0.xy), _VertexAnimationIntensity, _VertexAnimationFrequency.xyz, VERTEX_INPUT.vertex.xyz, VERTEX_INPUT.normal));
|
||||
#endif
|
||||
|
||||
//Clip Pos
|
||||
#ifdef MK_POS_WORLD
|
||||
vertexOutput.positionWorld.xyz = ComputeObjectToWorldSpace(VERTEX_INPUT.vertex.xyz);
|
||||
#else
|
||||
vertexOutput.positionWorld.xyz = 0;
|
||||
#endif
|
||||
vertexOutputLight.SV_CLIP_POS = ComputeObjectToClipSpace(VERTEX_INPUT.vertex.xyz);
|
||||
|
||||
//vertex positions
|
||||
#ifdef MK_NORMAL
|
||||
vertexOutput.normalWorld.xyz = ComputeNormalWorld(VERTEX_INPUT.normal);
|
||||
#endif
|
||||
#ifdef MK_LIT
|
||||
#if defined(MK_TBN)
|
||||
vertexOutput.tangentWorld.xyz = ComputeTangentWorld(VERTEX_INPUT.tangent.xyz);
|
||||
vertexOutput.bitangentWorld.xyz = ComputeBitangentWorld(vertexOutput.normalWorld.xyz, vertexOutput.tangentWorld.xyz, VERTEX_INPUT.tangent.w * unity_WorldTransformParams.w);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//texcoords
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
#if defined(MK_TCM)
|
||||
//XY always RAW Coords
|
||||
//interpolated in pixel shader, artistic UV would take an additional texcoord, could be optimized some day...
|
||||
vertexOutput.uv.xy = VERTEX_INPUT.texcoord0.xy;
|
||||
#else
|
||||
vertexOutput.uv.xy = 0;
|
||||
#endif
|
||||
#if defined(MK_TCD)
|
||||
vertexOutput.uv.zw = VERTEX_INPUT.texcoord0.xy * _DetailMap_ST.xy + _DetailMap_ST.zw;
|
||||
#else
|
||||
vertexOutput.uv.zw = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_PARALLAX
|
||||
half3 viewTangent = ComputeViewTangent(ComputeViewWorld(vertexOutput.positionWorld.xyz), vertexOutput.normalWorld.xyz, vertexOutput.tangentWorld.xyz, vertexOutput.bitangentWorld.xyz);
|
||||
vertexOutput.normalWorld.w = viewTangent.x;
|
||||
vertexOutput.tangentWorld.w = viewTangent.y;
|
||||
vertexOutput.bitangentWorld.w = viewTangent.z;
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
vertexOutput.color = VERTEX_INPUT.color;
|
||||
#endif
|
||||
|
||||
#ifdef MK_LIT
|
||||
#ifdef MK_FORWARD_BASE_PASS
|
||||
#ifdef MK_VERTEX_LIGHTING
|
||||
// Approximated illumination from non-important point lights
|
||||
vertexOutputLight.vertexLighting = ComputeVertexLighting(vertexOutput.positionWorld.xyz, vertexOutput.normalWorld.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef MK_ENVIRONMENT_REFLECTIONS
|
||||
vertexOutputLight.lightmapUV = 0;
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
#if defined(LIGHTMAP_ON)
|
||||
vertexOutputLight.lightmapUV.xy = ComputeStaticLightmapUV(VERTEX_INPUT.staticLightmapUV.xy);
|
||||
#else
|
||||
vertexOutputLight.lightmapUV.rgb = ComputeSHVertex(vertexOutput.normalWorld.xyz);
|
||||
#endif
|
||||
#else
|
||||
//lightmaps and ambient
|
||||
//Static lightmaps
|
||||
#if defined(LIGHTMAP_ON)
|
||||
vertexOutputLight.lightmapUV.xy = ComputeStaticLightmapUV(VERTEX_INPUT.staticLightmapUV.xy);
|
||||
//If no lightmaps used, do vertex lit if enabled
|
||||
#elif defined(UNITY_SHOULD_SAMPLE_SH)
|
||||
vertexOutputLight.lightmapUV.rgb = ComputeSHVertex(vertexOutput.normalWorld.xyz);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
vertexOutputLight.lightmapUV.zw = ComputeDynamicLightmapUV(VERTEX_INPUT.dynamicLightmapUV.xy);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//transform lighting coords
|
||||
TRANSFORM_WORLD_TO_SHADOW_COORDS(vertexOutput, VERTEX_INPUT, vertexOutputLight)
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_CLIP
|
||||
vertexOutput.positionClip = vertexOutputLight.SV_CLIP_POS;
|
||||
#endif
|
||||
#ifdef MK_POS_NULL_CLIP
|
||||
vertexOutput.nullClip = ComputeObjectToClipSpace(0);
|
||||
#endif
|
||||
|
||||
//vertex fog
|
||||
#ifdef MK_FOG
|
||||
vertexOutput.positionWorld.w = FogFactorVertex(vertexOutputLight.SV_CLIP_POS.z);
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
vertexOutput.flipbookUV.xy = VERTEX_INPUT.texcoord0.zw;
|
||||
vertexOutput.flipbookUV.z = VERTEX_INPUT.texcoordBlend;
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FRAGMENT SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half4 ForwardFrag(in VertexOutputForward vertexOutput, in VertexOutputLight vertexOutputLight) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexOutput);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(vertexOutput);
|
||||
|
||||
MKSurfaceData surfaceData = ComputeSurfaceData
|
||||
(
|
||||
PASS_POSITION_WORLD_ARG(vertexOutput.positionWorld.xyz)
|
||||
PASS_FOG_FACTOR_WORLD_ARG(vertexOutput.positionWorld.w)
|
||||
PASS_BASE_UV_ARG(vertexOutput.uv)
|
||||
PASS_LIGHTMAP_UV_ARG(vertexOutputLight.lightmapUV)
|
||||
PASS_VERTEX_COLOR_ARG(vertexOutput.color)
|
||||
PASS_NORMAL_WORLD_ARG(vertexOutput.normalWorld.xyz)
|
||||
PASS_VERTEX_LIGHTING_ARG(vertexOutputLight.vertexLighting)
|
||||
PASS_TANGENT_WORLD_ARG(vertexOutput.tangentWorld.xyz)
|
||||
PASS_VIEW_TANGENT_ARG(half3(vertexOutput.normalWorld.w, vertexOutput.tangentWorld.w, vertexOutput.bitangentWorld.w))
|
||||
PASS_BITANGENT_WORLD_ARG(vertexOutput.bitangentWorld.xyz)
|
||||
PASS_POSITION_CLIP_ARG(vertexOutput.positionClip)
|
||||
PASS_NULL_CLIP_ARG(vertexOutput.nullClip)
|
||||
PASS_FLIPBOOK_UV_ARG(vertexOutput.flipbookUV)
|
||||
);
|
||||
Surface surface = InitSurface(surfaceData, PASS_TEXTURE_2D(_AlbedoMap, SAMPLER_REPEAT_MAIN), _AlbedoColor);
|
||||
MKPBSData pbsData = ComputePBSData(surface, surfaceData);
|
||||
|
||||
#ifdef MK_LIT
|
||||
//Init per light data
|
||||
MKLight light = ComputeMainLight(surfaceData, vertexOutputLight);
|
||||
|
||||
//return light.attenuation;
|
||||
MKLightData lightData = ComputeLightData(light, surfaceData);
|
||||
|
||||
//Do per pass light
|
||||
LightingIndirect(surface, surfaceData, pbsData, light, lightData);
|
||||
LightingDirect(surface, surfaceData, pbsData, light, lightData, surface.direct);
|
||||
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
#ifdef _ADDITIONAL_LIGHTS
|
||||
surface.goochDark = 0;
|
||||
|
||||
uint lightCount = GetAdditionalLightsCount();
|
||||
half4 additionalDirect = 0;
|
||||
for (uint lightIndex = 0u; lightIndex < lightCount; lightIndex++)
|
||||
{
|
||||
MKLight additionalLight = ComputeAdditionalLight(lightIndex, surfaceData, vertexOutputLight);
|
||||
MKLightData additionalLightData = ComputeLightData(additionalLight, surfaceData);
|
||||
LightingDirectAdditional(surface, surfaceData, pbsData, additionalLight, additionalLightData, additionalDirect);
|
||||
surface.direct += additionalDirect;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Finalize the output
|
||||
Composite(surface, surfaceData, pbsData);
|
||||
|
||||
return surface.final;
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 652e831ac4ef59f45b589a1f208ff6a3
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1007
Assets/Resources/1/MK/MKToon/Shader/Lib/Lighting.hlsl
Normal file
1007
Assets/Resources/1/MK/MKToon/Shader/Lib/Lighting.hlsl
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 337f6cff434fc354e86ae26b46a382d4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta.meta
Normal file
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4958ce82ebf376b42a531cc529cbda4e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
71
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/Common.hlsl
Normal file
71
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/Common.hlsl
Normal file
@ -0,0 +1,71 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Meta Common //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_META_COMMON
|
||||
#define MK_TOON_META_COMMON
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/MetaInput.hlsl"
|
||||
#else
|
||||
#include "UnityMetaPass.cginc"
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Meta Common
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct MKMetaData
|
||||
{
|
||||
half3 albedo;
|
||||
half3 emission;
|
||||
half3 specular;
|
||||
#ifdef EDITOR_VISUALIZATION
|
||||
float2 vizUV;
|
||||
float4 lightCoords;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline float4 ComputeMetaPosition(float4 vertexPosObject, float2 staticLightmapUV, float2 dynamicLightmapUV, float4 staticLightmapST, float4 dynLightmapST)
|
||||
{
|
||||
#if defined(MK_URP)
|
||||
return MetaVertexPosition(vertexPosObject, staticLightmapUV, dynamicLightmapUV, staticLightmapST, dynLightmapST);
|
||||
#elif defined(MK_LWRP)
|
||||
return MetaVertexPosition(vertexPosObject, staticLightmapUV, dynamicLightmapUV, staticLightmapST);
|
||||
#else
|
||||
return UnityMetaVertexPosition(vertexPosObject, staticLightmapUV, dynamicLightmapUV, staticLightmapST, dynLightmapST);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half4 ComputeMetaOutput(MKMetaData mkMetaData)
|
||||
{
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
MetaInput metaInput;
|
||||
|
||||
metaInput.Albedo = mkMetaData.albedo;
|
||||
metaInput.Emission = mkMetaData.emission;
|
||||
metaInput.SpecularColor = mkMetaData.specular;
|
||||
|
||||
return MetaFragment(metaInput);
|
||||
#else
|
||||
UnityMetaInput untiyMetaInput;
|
||||
|
||||
untiyMetaInput.Albedo = mkMetaData.albedo;
|
||||
untiyMetaInput.Emission = mkMetaData.emission;
|
||||
untiyMetaInput.SpecularColor = mkMetaData.specular;
|
||||
#ifdef EDITOR_VISUALIZATION
|
||||
untiyMetaInput.VizUV = mkMetaData.vizUV;
|
||||
untiyMetaInput.LightCoord = mkMetaData.lightCoords;
|
||||
#endif
|
||||
|
||||
return UnityMetaFragment(untiyMetaInput);
|
||||
#endif
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c9a7bbcf970b6c4485d290f304e3c83
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
67
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/Data.hlsl
Normal file
67
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/Data.hlsl
Normal file
@ -0,0 +1,67 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Meta Data //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_META_IO
|
||||
#define MK_TOON_META_IO
|
||||
|
||||
#ifndef UNITY_PASS_META
|
||||
#define UNITY_PASS_META
|
||||
#endif
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/MetaInput.hlsl"
|
||||
#else
|
||||
#include "UnityMetaPass.cginc"
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// INPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexInputMeta
|
||||
{
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
half4 color : COLOR;
|
||||
#endif
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
#if defined(DYNAMICLIGHTMAP_ON) || defined(UNITY_PASS_META)
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
#endif
|
||||
#if defined(MK_PARALLAX)
|
||||
half4 tangent : TANGENT;
|
||||
half3 normal : NORMAL;
|
||||
#endif
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OUTPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexOutputMeta
|
||||
{
|
||||
#ifdef MK_TCM
|
||||
float4 uv : TEXCOORD0;
|
||||
#endif
|
||||
float4 svPositionClip : SV_POSITION;
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR;
|
||||
#endif
|
||||
#ifdef EDITOR_VISUALIZATION
|
||||
float2 vizUV : TEXCOORD1;
|
||||
float4 lightCoords : TEXCOORD2;
|
||||
#endif
|
||||
#if defined(MK_PARALLAX)
|
||||
half3 viewTangent : TEXCOORD3;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a8eb3fd042790a4daf16451867b2ef9
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
130
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/ProgramMeta.hlsl
Normal file
130
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/ProgramMeta.hlsl
Normal file
@ -0,0 +1,130 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Meta Program //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_META
|
||||
#define MK_TOON_META
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/MetaInput.hlsl"
|
||||
#else
|
||||
#include "UnityMetaPass.cginc"
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
#include "Common.hlsl"
|
||||
#include "Data.hlsl"
|
||||
#include "../Surface.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// VERTEX SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
VertexOutputMeta MetaVert(VertexInputMeta vertexInput)
|
||||
{
|
||||
VertexOutputMeta vertexOutput;
|
||||
INITIALIZE_STRUCT(VertexOutputMeta, vertexOutput);
|
||||
//vertexposition
|
||||
vertexOutput.svPositionClip = ComputeMetaPosition(vertexInput.vertex, vertexInput.staticLightmapUV.xy, vertexInput.dynamicLightmapUV.xy, unity_LightmapST, unity_DynamicLightmapST);
|
||||
|
||||
//texcoords
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
vertexOutput.uv = 0;
|
||||
#endif
|
||||
#if defined(MK_TCM)
|
||||
vertexOutput.uv.xy = vertexInput.texcoord0.xy * _AlbedoMap_ST.xy + _AlbedoMap_ST.zw;
|
||||
#endif
|
||||
#if defined(MK_TCD)
|
||||
vertexOutput.uv.zw = vertexOutput.uv.xy = vertexInput.texcoord0.xy * _DetailMap_ST.xy + _DetailMap_ST.zw;
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
vertexOutput.color = vertexInput.color;
|
||||
#endif
|
||||
|
||||
#ifdef EDITOR_VISUALIZATION
|
||||
vertexOutput.vizUV = 0;
|
||||
vertexOutput.lightCoords = 0;
|
||||
if (unity_VisualizationMode == EDITORVIZ_TEXTURE)
|
||||
vertexOutput.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, vertexInput.texcoord0.xy, vertexInput.staticLightmapUV.xy, vertexInput.dynamicLightmapUV.xy, unity_EditorViz_Texture_ST);
|
||||
else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK)
|
||||
{
|
||||
vertexOutput.vizUV = vertexInput.staticLightmapUV.xy * unity_LightmapST.xy + unity_LightmapST.zw;
|
||||
vertexOutput.lightCoords = mul(unity_EditorViz_WorldToLight, mul(unity_ObjectToWorld, float4(vertexInput.vertex.xyz, 1)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
vertexOutput.viewTangent = ComputeViewTangent(ComputeViewObject(vertexInput.vertex.xyz), vertexInput.normal, vertexInput.tangent, cross(vertexInput.normal, vertexInput.tangent.xyz) * vertexInput.tangent.w * unity_WorldTransformParams.w);
|
||||
#endif
|
||||
|
||||
return vertexOutput;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FRAGMENT SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half4 MetaFrag (VertexOutputMeta vertexOutput) : SV_Target
|
||||
{
|
||||
MKMetaData mkMetaData;
|
||||
INITIALIZE_STRUCT(MKMetaData, mkMetaData);
|
||||
|
||||
MKSurfaceData surfaceData = ComputeSurfaceData
|
||||
(
|
||||
PASS_POSITION_WORLD_ARG(0)
|
||||
PASS_FOG_FACTOR_WORLD_ARG(0)
|
||||
PASS_BASE_UV_ARG(float4(vertexOutput.uv.xy, 0, 0))
|
||||
PASS_LIGHTMAP_UV_ARG(0)
|
||||
PASS_VERTEX_COLOR_ARG(vertexOutput.color)
|
||||
PASS_NORMAL_WORLD_ARG(1)
|
||||
PASS_VERTEX_LIGHTING_ARG(0)
|
||||
PASS_TANGENT_WORLD_ARG(1)
|
||||
PASS_VIEW_TANGENT_ARG(vertexOutput.viewTangent)
|
||||
PASS_BITANGENT_WORLD_ARG(1)
|
||||
PASS_POSITION_CLIP_ARG(0)
|
||||
PASS_NULL_CLIP_ARG(0)
|
||||
PASS_FLIPBOOK_UV_ARG(0)
|
||||
);
|
||||
Surface surface = InitSurface(surfaceData, PASS_TEXTURE_2D(_AlbedoMap, SAMPLER_REPEAT_MAIN), _AlbedoColor);
|
||||
|
||||
#ifdef MK_LIT
|
||||
MKPBSData mkPBSData;
|
||||
mkPBSData = ComputePBSData(surface, surfaceData);
|
||||
|
||||
#ifdef EDITOR_VISUALIZATION
|
||||
mkMetaData.albedo = mkPBSData.diffuseRadiance;
|
||||
mkMetaData.vizUV = vertexOutput.vizUV;
|
||||
mkMetaData.lightCoords = vertexOutput.lightCoords;
|
||||
#else
|
||||
mkMetaData.albedo = mkPBSData.diffuseRadiance + mkPBSData.specularRadiance * mkPBSData.roughness * 0.5;
|
||||
#endif
|
||||
mkMetaData.specular = mkPBSData.specularRadiance;
|
||||
#else
|
||||
#ifdef EDITOR_VISUALIZATION
|
||||
mkMetaData.albedo = surface.albedo;
|
||||
mkMetaData.vizUV = vertexOutput.vizUV;
|
||||
mkMetaData.lightCoords = vertexOutput.lightCoords;
|
||||
#else
|
||||
mkMetaData.albedo = surface.albedo;
|
||||
#endif
|
||||
mkMetaData.specular = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MK_EMISSION
|
||||
#if defined(MK_EMISSION_MAP)
|
||||
mkMetaData.emission = _EmissionColor * SampleTex2D(PASS_TEXTURE_2D(_EmissionMap, SAMPLER_REPEAT_MAIN), vertexOutput.uv).rgb;
|
||||
#else
|
||||
mkMetaData.emission = _EmissionColor;
|
||||
#endif
|
||||
#else
|
||||
mkMetaData.emission = 0;
|
||||
#endif
|
||||
|
||||
return ComputeMetaOutput(mkMetaData);
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf9221e0d30ac8549952e78fa8f0e78d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/Setup.hlsl
Normal file
26
Assets/Resources/1/MK/MKToon/Shader/Lib/Meta/Setup.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Meta Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_META_SETUP
|
||||
#define MK_TOON_META_SETUP
|
||||
|
||||
#ifndef MK_META_PASS
|
||||
#define MK_META_PASS
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
//Hightmap is only needed if a UV is required
|
||||
#if !defined(MK_TEXCLR) && !defined(MK_DISSOLVE)
|
||||
#ifdef MK_PARALLAX
|
||||
#undef MK_PARALLAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ProgramMeta.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7c7153e0d89d9d48b6e2714efc5d9b7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Outline.meta
Normal file
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Outline.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e90a788dc4be92d45940d10d17c1673c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
80
Assets/Resources/1/MK/MKToon/Shader/Lib/Outline/Data.hlsl
Normal file
80
Assets/Resources/1/MK/MKToon/Shader/Lib/Outline/Data.hlsl
Normal file
@ -0,0 +1,80 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Outline Data //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_OUTLINE_ONLY_IO
|
||||
#define MK_TOON_OUTLINE_ONLY_IO
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// INPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(MK_OUTLINE_DATA_UV7)
|
||||
#define OUTLINE_INPUT half3 normalBaked : TEXCOORD7;
|
||||
#else
|
||||
#define OUTLINE_INPUT
|
||||
#endif
|
||||
|
||||
struct VertexInputOutlineOnly
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
#if defined(MK_OUTLINE_DATA_NORMAL) || defined(MK_PARALLAX) || defined(MK_VERTEX_ANIMATION_PULSE) || defined(MK_VERTEX_ANIMATION_NOISE)
|
||||
half3 normal : NORMAL;
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
//texcoords0 if needed
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
half4 tangent : TANGENT;
|
||||
#endif
|
||||
|
||||
OUTLINE_INPUT
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OUTPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexOutputOutlineOnly
|
||||
{
|
||||
float4 svPositionClip : SV_POSITION;
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 uv : TEXCOORD0;
|
||||
#endif
|
||||
#ifdef MK_FOG
|
||||
float fogFactor : TEXCOORD1;
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
half3 viewTangent : TEXCOORD2;
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_CLIP
|
||||
float4 positionClip : TEXCOORD3;
|
||||
#endif
|
||||
#ifdef MK_POS_NULL_CLIP
|
||||
float4 nullClip : TEXCOORD4;
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
float3 flipbookUV : TEXCOORD10;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5cea16f413c61334f8b601705232a60d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,144 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Outline Program //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_OUTLINE_ONLY_BASE
|
||||
#define MK_TOON_OUTLINE_ONLY_BASE
|
||||
|
||||
#include "../Core.hlsl"
|
||||
#include "Data.hlsl"
|
||||
#include "../Surface.hlsl"
|
||||
#include "../Composite.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// VERTEX SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
VertexOutputOutlineOnly OutlineVert(VertexInputOutlineOnly vertexInput)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexInput);
|
||||
VertexOutputOutlineOnly vertexOutput;
|
||||
INITIALIZE_STRUCT(VertexOutputOutlineOnly, vertexOutput);
|
||||
UNITY_TRANSFER_INSTANCE_ID(vertexInput, vertexOutput);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vertexOutput);
|
||||
|
||||
//texcoords
|
||||
#if defined(MK_TCM)
|
||||
vertexOutput.uv = vertexInput.texcoord0;
|
||||
#endif
|
||||
|
||||
#ifdef MK_OUTLINE_MAP
|
||||
_OutlineSize *= tex2Dlod(_OutlineMap, float4(vertexOutput.uv, 0, 0)).r;
|
||||
#endif
|
||||
|
||||
#ifdef MK_OUTLINE_NOISE
|
||||
_OutlineSize = lerp(_OutlineSize, _OutlineSize * NoiseSimple(normalize(vertexInput.vertex.xyz)), _OutlineNoise);
|
||||
#endif
|
||||
|
||||
#ifdef MK_VERTEX_ANIMATION
|
||||
vertexInput.vertex.xyz = VertexAnimation(PASS_VERTEX_ANIMATION_ARG(_VertexAnimationMap, PASS_VERTEX_ANIMATION_UV(vertexOutput.uv), _VertexAnimationIntensity, _VertexAnimationFrequency.xyz, vertexInput.vertex.xyz, vertexInput.normal));
|
||||
#endif
|
||||
|
||||
#ifdef MK_OUTLINE_FADE
|
||||
float dist = distance(CAMERA_POSITION_WORLD , mul(MATRIX_M, float4(vertexInput.vertex.xyz, 1.0)).xyz);
|
||||
_OutlineSize *= saturate((dist - _OutlineFadeMin) / (_OutlineFadeMax - _OutlineFadeMin));
|
||||
#endif
|
||||
|
||||
#if defined(MK_OUTLINE_HULL_ORIGIN)
|
||||
//float4x4 modelMatrix = MATRIX_M;
|
||||
//vertexInput.vertex.xyz += SafeNormalize(vertexInput.vertex.xyz) * _OutlineSize * OUTLINE_ORIGIN_SCALE;
|
||||
//float3 positionWorld = mul(modelMatrix, float4(vertexInput.vertex.xyz, 1.0)).xyz;
|
||||
float3 scaleOrigin = 1 + _OutlineSize * OUTLINE_ORIGIN_SCALE;
|
||||
float3x3 scale = float3x3
|
||||
(
|
||||
scaleOrigin.x, 0, 0,
|
||||
0, scaleOrigin.y, 0,
|
||||
0, 0, scaleOrigin.z
|
||||
);
|
||||
float3 positionWorld = mul(scale, vertexInput.vertex.xyz);
|
||||
positionWorld = mul(MATRIX_M, float4(positionWorld, 1.0)).xyz;
|
||||
#elif defined(MK_OUTLINE_HULL_OBJECT)
|
||||
#if defined(MK_OUTLINE_DATA_UV7)
|
||||
vertexInput.vertex.xyz += vertexInput.normalBaked * _OutlineSize * OUTLINE_OBJECT_SCALE;
|
||||
#else
|
||||
vertexInput.vertex.xyz += vertexInput.normal * _OutlineSize * OUTLINE_OBJECT_SCALE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_OUTLINE_HULL_ORIGIN)
|
||||
vertexOutput.svPositionClip = ComputeWorldToClipSpace(positionWorld);
|
||||
#else
|
||||
//Make it pixel perfect and SCALED on different aspects and resolutions
|
||||
half scaledAspect = SafeDivide(REFERENCE_ASPECT.x, SafeDivide(_ScreenParams.x, _ScreenParams.y));
|
||||
half scaledResolution = SafeDivide(_ScreenParams.x, REFERENCE_RESOLUTION.x);
|
||||
vertexOutput.svPositionClip = ComputeObjectToClipSpace(vertexInput.vertex.xyz);
|
||||
|
||||
#if defined(MK_OUTLINE_DATA_UV7)
|
||||
half3 normalBakedClip = ComputeNormalObjectToClipSpace(vertexInput.normalBaked.xyz);
|
||||
vertexOutput.svPositionClip.xy += 2 * _OutlineSize * SafeDivide(normalBakedClip.xy, _ScreenParams.xy) * scaledAspect * scaledResolution;
|
||||
#else
|
||||
half3 normalClip = ComputeNormalObjectToClipSpace(vertexInput.normal.xyz);
|
||||
vertexOutput.svPositionClip.xy += 2 * _OutlineSize * SafeDivide(normalClip.xy, _ScreenParams.xy) * scaledAspect * scaledResolution;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
vertexOutput.color = vertexInput.color;
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
vertexOutput.viewTangent = ComputeViewTangent(ComputeViewObject(vertexInput.vertex.xyz), vertexInput.normal, vertexInput.tangent, cross(vertexInput.normal, vertexInput.tangent.xyz) * vertexInput.tangent.w * unity_WorldTransformParams.w);
|
||||
#endif
|
||||
|
||||
#ifdef MK_FOG
|
||||
vertexOutput.fogFactor = FogFactorVertex(vertexOutput.svPositionClip.z);
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_CLIP
|
||||
vertexOutput.positionClip = vertexOutput.svPositionClip;
|
||||
#endif
|
||||
#ifdef MK_POS_NULL_CLIP
|
||||
vertexOutput.nullClip = ComputeObjectToClipSpace(0);
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
vertexOutput.flipbookUV.xy = VERTEX_INPUT.texcoord0.zw;
|
||||
vertexOutput.flipbookUV.z = VERTEX_INPUT.texcoordBlend;
|
||||
#endif
|
||||
return vertexOutput;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FRAGMENT SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half4 OutlineFrag(VertexOutputOutlineOnly vertexOutput) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexOutput);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(vertexOutput);
|
||||
|
||||
MKSurfaceData surfaceData = ComputeSurfaceData
|
||||
(
|
||||
PASS_POSITION_WORLD_ARG(0)
|
||||
PASS_FOG_FACTOR_WORLD_ARG(vertexOutput.fogFactor)
|
||||
PASS_BASE_UV_ARG(float4(vertexOutput.uv.xy, 0, 0))
|
||||
PASS_LIGHTMAP_UV_ARG(0)
|
||||
PASS_VERTEX_COLOR_ARG(vertexOutput.color)
|
||||
PASS_NORMAL_WORLD_ARG(1)
|
||||
PASS_VERTEX_LIGHTING_ARG(0)
|
||||
PASS_TANGENT_WORLD_ARG(1)
|
||||
PASS_VIEW_TANGENT_ARG(vertexOutput.viewTangent)
|
||||
PASS_BITANGENT_WORLD_ARG(1)
|
||||
PASS_POSITION_CLIP_ARG(vertexOutput.positionClip)
|
||||
PASS_NULL_CLIP_ARG(vertexOutput.nullClip)
|
||||
PASS_FLIPBOOK_UV_ARG(vertexOutput.flipbookUV)
|
||||
);
|
||||
Surface surface = InitSurface(surfaceData, PASS_TEXTURE_2D(_AlbedoMap, SAMPLER_REPEAT_MAIN), autoLP4(_OutlineColor.rgb, _AlbedoColor.a));
|
||||
MKPBSData pbsData = ComputePBSData(surface, surfaceData);
|
||||
Composite(surface, surfaceData, pbsData);
|
||||
|
||||
return surface.final;
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffe7c4f91a7655b48acdb8a905e92ef2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Resources/1/MK/MKToon/Shader/Lib/Outline/Setup.hlsl
Normal file
26
Assets/Resources/1/MK/MKToon/Shader/Lib/Outline/Setup.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Outline Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_OUTLINE_SETUP
|
||||
#define MK_TOON_OUTLINE_SETUP
|
||||
|
||||
#ifndef MK_OUTLINE_PASS
|
||||
#define MK_OUTLINE_PASS
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
//Hightmap is only needed if a UV is required
|
||||
#if !defined(MK_TEXCLR) && !defined(MK_DISSOLVE)
|
||||
#ifdef MK_PARALLAX
|
||||
#undef MK_PARALLAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ProgramOutline.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ab771523b76bca4f9e856ba4bf6b5c4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
552
Assets/Resources/1/MK/MKToon/Shader/Lib/Pipeline.hlsl
Normal file
552
Assets/Resources/1/MK/MKToon/Shader/Lib/Pipeline.hlsl
Normal file
@ -0,0 +1,552 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Pipeline //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_PIPELINE
|
||||
#define MK_TOON_PIPELINE
|
||||
|
||||
#include "Config.hlsl"
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Lighting.hlsl"
|
||||
#else
|
||||
#include "AutoLight.cginc"
|
||||
#include "UnityGlobalIllumination.cginc"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Somehow on Metal overloaded methods (with different types) cause a redefinition compiler issue
|
||||
//therefore force float only on Metal here
|
||||
#ifndef SHADER_API_METAL
|
||||
half SafeDivide(half v, half d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
half2 SafeDivide(half2 v, half d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
half2 SafeDivide(half2 v, half2 d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
half3 SafeDivide(half3 v, half d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
half3 SafeDivide(half3 v, half3 d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
half4 SafeDivide(half4 v, half d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
half4 SafeDivide(half4 v, half4 d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
#endif
|
||||
float SafeDivide(float v, float d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
float2 SafeDivide(float2 v, float d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
float2 SafeDivide(float2 v, float2 d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
float3 SafeDivide(float3 v, float d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
float3 SafeDivide(float3 v, float3 d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
float4 SafeDivide(float4 v, float d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
float4 SafeDivide(float4 v, float4 d)
|
||||
{
|
||||
return v / (d + HALF_MIN);
|
||||
}
|
||||
|
||||
half SafeNormalize(half v)
|
||||
{
|
||||
return normalize(v + HALF_MIN);
|
||||
}
|
||||
half2 SafeNormalize(half2 v)
|
||||
{
|
||||
return normalize(v + HALF_MIN);
|
||||
}
|
||||
half3 SafeNormalize(half3 v)
|
||||
{
|
||||
return normalize(v + HALF_MIN);
|
||||
}
|
||||
half4 SafeNormalize(half4 v)
|
||||
{
|
||||
return normalize(v + HALF_MIN);
|
||||
}
|
||||
|
||||
inline half FastPow2(half v)
|
||||
{
|
||||
return v * v;
|
||||
}
|
||||
|
||||
inline half FastPow3(half v)
|
||||
{
|
||||
return v * v * v;
|
||||
}
|
||||
|
||||
inline half FastPow4(half v)
|
||||
{
|
||||
return v * v * v * v;
|
||||
}
|
||||
|
||||
inline half FastPow5(half v)
|
||||
{
|
||||
return v * v * v * v * v;
|
||||
}
|
||||
|
||||
//Single Component Reciprocal
|
||||
inline half Rcp(half v)
|
||||
{
|
||||
#if SHADER_TARGET >= 50
|
||||
return rcp(v);
|
||||
#else
|
||||
//avoid division by 0
|
||||
return SafeDivide(1.0, v);
|
||||
#endif
|
||||
}
|
||||
|
||||
//modified clip function for a complete discard when input equal zero oder smaller
|
||||
inline void Clip0(half c)
|
||||
{
|
||||
//if(any(c < 0.0)) discard;
|
||||
clip(c + HALF_MIN);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Sampling
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if SHADER_TARGET >= 35
|
||||
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
|
||||
#define UNIFORM_TEXTURE_2D_AUTO(textureName) uniform Texture2DArray<half4> textureName;
|
||||
#define UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO(textureName) uniform Texture2DArray<half4> textureName; uniform SamplerState sampler##textureName;
|
||||
#define DECLARE_TEXTURE_2D_ARGS_AUTO(textureName, samplerName) Texture2DArray<half4> textureName, SamplerState samplerName
|
||||
#define UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO_HP(textureName) uniform Texture2DArray<float4> textureName; uniform SamplerState sampler##textureName;
|
||||
#define DECLARE_TEXTURE_2D_ARGS_AUTO_HP(textureName, samplerName) Texture2DArray<float4> textureName, SamplerState samplerName
|
||||
#else
|
||||
#define UNIFORM_TEXTURE_2D_AUTO(textureName) uniform Texture2D<half4> textureName;
|
||||
#define UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO(textureName) uniform Texture2D<half4> textureName; uniform SamplerState sampler##textureName;
|
||||
#define DECLARE_TEXTURE_2D_ARGS_AUTO(textureName, samplerName) Texture2D<half4> textureName, SamplerState samplerName
|
||||
#define UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO_HP(textureName) uniform Texture2D<float4> textureName; uniform SamplerState sampler##textureName;
|
||||
#define DECLARE_TEXTURE_2D_ARGS_AUTO_HP(textureName, samplerName) Texture2D<float4> textureName, SamplerState samplerName
|
||||
#endif
|
||||
|
||||
#define DECLARE_TEXTURE_2D_ARGS(textureName, samplerName) Texture2D<half4> textureName, SamplerState samplerName
|
||||
|
||||
#define UNIFORM_SAMPLER(samplerName) uniform SamplerState sampler##samplerName;
|
||||
#define UNIFORM_TEXTURE_2D(textureName) uniform Texture2D<half4> textureName;
|
||||
|
||||
#define PASS_TEXTURE_2D(textureName, samplerName) textureName, samplerName
|
||||
#else
|
||||
#define UNIFORM_TEXTURE_2D_AUTO(textureName) uniform sampler2D textureName;
|
||||
#define UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO(textureName) uniform sampler2D textureName;
|
||||
#define DECLARE_TEXTURE_2D_ARGS_AUTO(textureName, samplerName) sampler2D textureName
|
||||
#define UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO_HP(textureName) uniform sampler2D textureName;
|
||||
#define DECLARE_TEXTURE_2D_ARGS_AUTO_HP(textureName, samplerName) sampler2D textureName
|
||||
|
||||
#define DECLARE_TEXTURE_2D_ARGS(textureName, samplerName) sampler2D textureName
|
||||
|
||||
#define UNIFORM_SAMPLER(samplerName)
|
||||
#define UNIFORM_TEXTURE_2D(textureName) uniform sampler2D textureName;
|
||||
|
||||
#define PASS_TEXTURE_2D(textureName, samplerName) textureName
|
||||
#endif
|
||||
|
||||
#ifdef MK_POINT_FILTERING
|
||||
UNIFORM_SAMPLER(_point_repeat_Main)
|
||||
#else
|
||||
UNIFORM_SAMPLER(_linear_repeat_Main)
|
||||
#endif
|
||||
UNIFORM_SAMPLER(_point_clamp_Main)
|
||||
#if SHADER_TARGET >= 35
|
||||
#ifdef MK_POINT_FILTERING
|
||||
#ifndef SAMPLER_REPEAT_MAIN
|
||||
#define SAMPLER_REPEAT_MAIN sampler_point_repeat_Main
|
||||
#endif
|
||||
#else
|
||||
#ifndef SAMPLER_REPEAT_MAIN
|
||||
#define SAMPLER_REPEAT_MAIN sampler_linear_repeat_Main
|
||||
#endif
|
||||
#endif
|
||||
#ifndef SAMPLER_CLAMPED_MAIN
|
||||
#define SAMPLER_CLAMPED_MAIN sampler_point_clamp_Main
|
||||
#endif
|
||||
#else
|
||||
#ifndef SAMPLER_REPEAT_MAIN
|
||||
#define SAMPLER_REPEAT_MAIN 0
|
||||
#endif
|
||||
#ifndef SAMPLER_CLAMPED_MAIN
|
||||
#define SAMPLER_CLAMPED_MAIN 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
inline half4 SampleTex2DAuto(DECLARE_TEXTURE_2D_ARGS_AUTO(tex, samplerTex), float2 uv)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
|
||||
return tex.SampleLevel(samplerTex, float3((uv).xy, (float)unity_StereoEyeIndex), 0);
|
||||
#else
|
||||
return tex.SampleLevel(samplerTex, UnityStereoTransformScreenSpaceTex(uv), 0);
|
||||
#endif
|
||||
#else
|
||||
return tex2D(tex, UnityStereoTransformScreenSpaceTex(uv));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline float4 SampleTex2DAutoHP(DECLARE_TEXTURE_2D_ARGS_AUTO_HP(tex, samplerTex), float2 uv)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
|
||||
return tex.SampleLevel(samplerTex, float3((uv).xy, (float)unity_StereoEyeIndex), 0);
|
||||
#else
|
||||
return tex.SampleLevel(samplerTex, UnityStereoTransformScreenSpaceTex(uv), 0);
|
||||
#endif
|
||||
#else
|
||||
return tex2D(tex, UnityStereoTransformScreenSpaceTex(uv));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half4 SampleTex2D(DECLARE_TEXTURE_2D_ARGS(tex, samplerTex), float2 uv)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return tex.Sample(samplerTex, uv);
|
||||
#else
|
||||
return tex2D(tex, uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
//Clamped ramp samplings
|
||||
/*
|
||||
inline half4 SampleRamp1D(DECLARE_TEXTURE_2D_ARGS(ramp, samplerTex), half value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return ramp.Sample(samplerTex, float2(clamp(value, HALF_MIN, ONE_MINUS_HALF_MIN), 0.5));
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(ramp, samplerTex), float2(clamp(value, HALF_MIN, ONE_MINUS_HALF_MIN), 0.5));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half4 SampleRamp2D(DECLARE_TEXTURE_2D_ARGS(ramp, samplerTex), half2 value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return ramp.Sample(samplerTex, clamp(value, HALF_MIN, ONE_MINUS_HALF_MIN));
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(ramp, samplerTex), clamp(value, HALF_MIN, ONE_MINUS_HALF_MIN));
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
//saturated ramp samplings
|
||||
inline half4 SampleRamp1D(DECLARE_TEXTURE_2D_ARGS(ramp, samplerTex), half value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return ramp.Sample(samplerTex, float2(saturate(value), 0.5));
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(ramp, samplerTex), float2(saturate(value), 0.5));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half4 SampleRamp2D(DECLARE_TEXTURE_2D_ARGS(ramp, samplerTex), half2 value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return ramp.Sample(samplerTex, saturate(value));
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(ramp, samplerTex), saturate(value));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
//unclamped ramp samplings
|
||||
inline half4 SampleRamp1D(DECLARE_TEXTURE_2D_ARGS(ramp, samplerTex), half value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return ramp.Sample(samplerTex, float2(value, 0.5));
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(ramp, samplerTex), float2(value, 0.5));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half4 SampleRamp2D(DECLARE_TEXTURE_2D_ARGS(ramp, samplerTex), half2 value)
|
||||
{
|
||||
#if SHADER_TARGET >= 35
|
||||
return ramp.Sample(samplerTex, value);
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(ramp, samplerTex), value);
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
#define SAMPLE_TEX2D_FLIPBOOK(tex, samplerTex, uv, blendUV) SampleTex2DFlipbook(PASS_TEXTURE_2D(tex, samplerTex), uv, blendUV)
|
||||
#else
|
||||
#define SAMPLE_TEX2D_FLIPBOOK(tex, samplerTex, uv, blendUV) SampleTex2D(PASS_TEXTURE_2D(tex, SAMPLER_REPEAT_MAIN), uv)
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef MK_FLIPBOOK
|
||||
#if SHADER_TARGET >= 35
|
||||
#define SAMPLE_TEX2D_FLIPBOOK(tex, samplerTex, uv, blendUV) SampleTex2DFlipbook(PASS_TEXTURE_2D(tex, samplerTex), uv, blendUV)
|
||||
#else
|
||||
#define SAMPLE_TEX2D_FLIPBOOK(tex, uv, blendUV) SampleTex2DFlipbook(PASS_TEXTURE_2D(tex, SAMPLER_REPEAT_MAIN), uv, blendUV)
|
||||
#endif
|
||||
#else
|
||||
#if SHADER_TARGET >= 35
|
||||
#define SAMPLE_TEX2D_FLIPBOOK(tex, samplerTex, uv, blendUV) SampleTex2D(PASS_TEXTURE_2D(tex, samplerTex), uv)
|
||||
#else
|
||||
#define SAMPLE_TEX2D_FLIPBOOK(tex, uv, blendUV) SampleTex2D(PASS_TEXTURE_2D(tex, SAMPLER_REPEAT_MAIN), uv)
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
inline half4 SampleTex2DFlipbook(DECLARE_TEXTURE_2D_ARGS(tex, samplerTex), float2 uv, float3 blendUV)
|
||||
{
|
||||
#ifdef MK_FLIPBOOK
|
||||
half4 color0 = SampleTex2D(PASS_TEXTURE_2D(tex, samplerTex), uv);
|
||||
half4 color1 = SampleTex2D(PASS_TEXTURE_2D(tex, samplerTex), blendUV.xy);
|
||||
return lerp(color0, color1, blendUV.z);
|
||||
#else
|
||||
return SampleTex2D(PASS_TEXTURE_2D(tex, samplerTex), uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct TriplanarUV
|
||||
{
|
||||
float2 x, y, z;
|
||||
half3 weights;
|
||||
};
|
||||
|
||||
inline TriplanarUV UVTriplanar(float3 position, float scale, half blend, half3 normal)
|
||||
{
|
||||
TriplanarUV uv;
|
||||
float3 uvp = position * scale;
|
||||
uv.x = uvp.zy;
|
||||
uv.y = uvp.xz;
|
||||
uv.z = uvp.xy;
|
||||
uv.x.y += 0.5;
|
||||
uv.z.x += 0.5;
|
||||
|
||||
uv.weights = pow(abs(normal), blend);
|
||||
uv.weights = SafeDivide(uv.weights, uv.weights.x + uv.weights.y + uv.weights.z);
|
||||
return uv;
|
||||
}
|
||||
|
||||
inline half4 SampleTriplanar(DECLARE_TEXTURE_2D_ARGS(texX, samplerX), DECLARE_TEXTURE_2D_ARGS(texY, samplerY), DECLARE_TEXTURE_2D_ARGS(texZ, samplerZ), TriplanarUV uv)
|
||||
{
|
||||
half4 colorX = SampleTex2D(PASS_TEXTURE_2D(texX, samplerX), uv.x);
|
||||
half4 colorY = SampleTex2D(PASS_TEXTURE_2D(texY, samplerY), uv.y);
|
||||
half4 colorZ = SampleTex2D(PASS_TEXTURE_2D(texZ, samplerZ), uv.z);
|
||||
|
||||
return colorX * uv.weights.x + colorY * uv.weights.y + colorZ * uv.weights.z;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Transformations
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define CAMERA_POSITION_WORLD _WorldSpaceCameraPos
|
||||
#define MATRIX_VP UNITY_MATRIX_VP
|
||||
#define MATRIX_MVP UNITY_MATRIX_MVP
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
#define MATRIX_M UNITY_MATRIX_M
|
||||
#define MATRIX_I_M UNITY_MATRIX_I_M
|
||||
#define VERTEX_INPUT vertexInput
|
||||
#define SV_CLIP_POS svPositionClip
|
||||
#else
|
||||
#define MATRIX_M unity_ObjectToWorld
|
||||
#define MATRIX_I_M unity_WorldToObject
|
||||
#define VERTEX_INPUT v
|
||||
#define SV_CLIP_POS pos
|
||||
#endif
|
||||
|
||||
#define Z_BUFFER_PARAMS _ZBufferParams
|
||||
|
||||
inline float4 ComputeObjectToClipSpace(float3 positionObject)
|
||||
{
|
||||
return mul(MATRIX_VP, mul(MATRIX_M, float4(positionObject, 1.0)));
|
||||
//return mul(MATRIX_MVP, float4(positionObject, 1.0));
|
||||
}
|
||||
|
||||
inline float3 ComputeObjectToWorldSpace(float3 positionObject)
|
||||
{
|
||||
return mul(MATRIX_M, float4(positionObject, 1.0)).xyz;
|
||||
}
|
||||
|
||||
inline float4 ComputeWorldToClipSpace(float3 positionWorld)
|
||||
{
|
||||
return mul(MATRIX_VP, float4(positionWorld, 1.0));
|
||||
}
|
||||
|
||||
inline half3 ComputeNormalWorld(half3 normalDirectionObject)
|
||||
{
|
||||
#ifdef UNITY_ASSUME_UNIFORM_SCALING
|
||||
return SafeNormalize(mul((float3x3) MATRIX_M, normalDirectionObject));
|
||||
#else
|
||||
// Normal need to be multiply by inverse transpose
|
||||
return SafeNormalize(mul(normalDirectionObject, (float3x3) MATRIX_I_M));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half3 ComputeNormalObjectToClipSpace(half3 normalDirectionObject)
|
||||
{
|
||||
#ifdef UNITY_ASSUME_UNIFORM_SCALING
|
||||
return SafeNormalize(mul((float3x3) UNITY_MATRIX_VP, mul((float3x3) MATRIX_M, normalDirectionObject)));
|
||||
#else
|
||||
// Normal need to be multiply by inverse transpose
|
||||
return SafeNormalize(mul((float3x3) UNITY_MATRIX_VP, mul(normalDirectionObject, (float3x3) MATRIX_I_M)));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half3 ComputeTangentWorld(half3 tangentObject)
|
||||
{
|
||||
return SafeNormalize(mul((float3x3) MATRIX_M, tangentObject));
|
||||
}
|
||||
|
||||
inline half3 ComputeBitangentWorld(half3 normalWorld, half3 tangentWorld, half scale)
|
||||
{
|
||||
return SafeNormalize(cross(normalWorld, tangentWorld)) * scale;
|
||||
}
|
||||
|
||||
inline half3 ComputeViewWorld(float3 positionWorld)
|
||||
{
|
||||
return SafeNormalize(CAMERA_POSITION_WORLD - positionWorld);
|
||||
}
|
||||
|
||||
inline half3 ComputeViewObject(float3 positionObject)
|
||||
{
|
||||
return SafeNormalize(mul(MATRIX_I_M, float4(CAMERA_POSITION_WORLD, 1)).xyz - positionObject);
|
||||
}
|
||||
|
||||
inline half3 ComputeViewTangent(half3 view, half3 normal, half3 tangent, half3 bitangent)
|
||||
{
|
||||
return SafeNormalize(mul(half3x3(tangent, bitangent, normal), view));
|
||||
}
|
||||
|
||||
inline float ComputeLinearDepth(float depth)
|
||||
{
|
||||
return Rcp(Z_BUFFER_PARAMS.z * depth + Z_BUFFER_PARAMS.w);
|
||||
}
|
||||
|
||||
inline float4 ComputeNDC(float4 positionClip)
|
||||
{
|
||||
float4 ndc;
|
||||
|
||||
ndc = positionClip * 0.5;
|
||||
ndc.xy = float2(ndc.x, ndc.y * _ProjectionParams.x) + ndc.w;
|
||||
ndc.zw = positionClip.zw;
|
||||
|
||||
/*
|
||||
#if defined(UNITY_SINGLE_PASS_STEREO)
|
||||
ndc.xy = TransformStereoScreenSpaceTex(ndc.xy, ndc.w);
|
||||
#endif
|
||||
*/
|
||||
|
||||
ndc.xyz = SafeDivide(ndc.xyz, ndc.w);
|
||||
|
||||
return ndc;
|
||||
}
|
||||
|
||||
inline float2 ComputeNormalizedScreenUV(float4 ndc, float4 nullNdc, float scale)
|
||||
{
|
||||
//Orthographic camera is hard to handle => no ability to get "size"
|
||||
//therefore ortho view differs from perspective view
|
||||
|
||||
//NDC offset
|
||||
ndc.xy -= nullNdc.xy;
|
||||
|
||||
//Scale based on rendertarget size
|
||||
#if defined(UNITY_SINGLE_PASS_STEREO)
|
||||
half aspect = SafeDivide(_ScreenParams.x, _ScreenParams.y);
|
||||
#else
|
||||
half aspect = SafeDivide(_ScreenParams.x, _ScreenParams.y);
|
||||
#endif
|
||||
ndc.x *= aspect;
|
||||
ndc.xy *= scale;
|
||||
ndc.xy *= nullNdc.w;
|
||||
|
||||
return ndc.xy;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Fog
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline float FogFactorVertex(float zClipSpace)
|
||||
{
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
return ComputeFogFactor(zClipSpace);
|
||||
#else
|
||||
#if (SHADER_TARGET < 30) || defined(SHADER_API_MOBILE)
|
||||
UNITY_CALC_FOG_FACTOR(zClipSpace);
|
||||
return unityFogFactor;
|
||||
#else
|
||||
return zClipSpace;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void ApplyFog(inout half3 color, float fogFactor)
|
||||
{
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
color = MixFog(color, fogFactor);
|
||||
#else
|
||||
#if defined(MK_FORWARD_BASE_PASS) || defined(MK_OUTLINE_PASS)
|
||||
UNITY_APPLY_FOG_COLOR(fogFactor, color, unity_FogColor);
|
||||
#elif defined(MK_FORWARD_ADD_PASS)
|
||||
UNITY_APPLY_FOG_COLOR(fogFactor, color, half4(0,0,0,0));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Refraction
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
UNIFORM_TEXTURE_2D_AUTO(_CameraOpaqueTexture)
|
||||
#else
|
||||
UNIFORM_TEXTURE_2D_AUTO(_MKToonRefraction)
|
||||
#endif
|
||||
|
||||
inline half3 SampleRefraction(float2 uv)
|
||||
{
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
return SampleTex2DAuto(PASS_TEXTURE_2D(_CameraOpaqueTexture, SAMPLER_CLAMPED_MAIN), uv).rgb;
|
||||
#else
|
||||
return SampleTex2DAuto(PASS_TEXTURE_2D(_MKToonRefraction, SAMPLER_CLAMPED_MAIN), uv).rgb;
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Depth
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
UNIFORM_SAMPLER_AND_TEXTURE_2D_AUTO_HP(_CameraDepthTexture)
|
||||
|
||||
inline float SampleDepth(float2 uv)
|
||||
{
|
||||
return SampleTex2DAutoHP(PASS_TEXTURE_2D(_CameraDepthTexture, SAMPLER_CLAMPED_MAIN), uv).r;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a638fb6fb0f7d744b0cf6fef5df9062
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8642f7715b526534786aa1255b9c16f1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,53 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon ShadowCaster Data //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_SHADOWCASTER_IO
|
||||
#define MK_TOON_SHADOWCASTER_IO
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// INPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexInputShadowCaster
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half3 normal : NORMAL;
|
||||
#ifdef MK_PARALLAX
|
||||
half4 tangent : TANGENT;
|
||||
#endif
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OUTPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexOutputShadowCaster
|
||||
{
|
||||
#ifdef MK_LEGACY_RP
|
||||
V2F_SHADOW_CASTER_NOPOS
|
||||
#endif
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_PARALLAX
|
||||
half3 viewTangent : TEXCOORD6;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 uv : TEXCOORD7;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5fd3b7e293835143aff3a9372e7ed8e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,157 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon ShadowCaster Program //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_SHADOWCASTER
|
||||
#define MK_TOON_SHADOWCASTER
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Shadows.hlsl"
|
||||
#endif
|
||||
|
||||
#include "../Surface.hlsl"
|
||||
#include "Data.hlsl"
|
||||
|
||||
//This should be excluded from the CBuffer
|
||||
uniform float3 _LightDirection;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// VERTEX SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void ShadowCasterVert
|
||||
(
|
||||
VertexInputShadowCaster VERTEX_INPUT,
|
||||
out VertexOutputShadowCaster vertexOutput
|
||||
,out float4 svPositionClip : SV_POSITION
|
||||
)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(VERTEX_INPUT);
|
||||
INITIALIZE_STRUCT(VertexOutputShadowCaster, vertexOutput);
|
||||
UNITY_TRANSFER_INSTANCE_ID(VERTEX_INPUT, vertexOutput);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vertexOutput);
|
||||
|
||||
#ifdef MK_VERTEX_ANIMATION
|
||||
VERTEX_INPUT.vertex.xyz = VertexAnimation(PASS_VERTEX_ANIMATION_ARG(_VertexAnimationMap, PASS_VERTEX_ANIMATION_UV(VERTEX_INPUT.texcoord0.xy), _VertexAnimationIntensity, _VertexAnimationFrequency.xyz, VERTEX_INPUT.vertex.xyz, VERTEX_INPUT.normal));
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_POLYBRUSH)
|
||||
vertexOutput.color = VERTEX_INPUT.color;
|
||||
#endif
|
||||
|
||||
#if defined(MK_TCM)
|
||||
vertexOutput.uv = VERTEX_INPUT.texcoord0.xy * _AlbedoMap_ST.xy + _AlbedoMap_ST.zw;
|
||||
#endif
|
||||
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
half3 normalWorld = ComputeNormalWorld(VERTEX_INPUT.normal);
|
||||
#endif
|
||||
#ifdef MK_PARALLAX
|
||||
half3 viewTangent = ComputeViewTangent(ComputeViewObject(VERTEX_INPUT.vertex.xyz), VERTEX_INPUT.normal, VERTEX_INPUT.tangent, cross(VERTEX_INPUT.normal, VERTEX_INPUT.tangent.xyz) * VERTEX_INPUT.tangent.w * unity_WorldTransformParams.w);
|
||||
#endif
|
||||
|
||||
#if defined(MK_URP)
|
||||
float3 positionWorld = mul(MATRIX_M, float4(VERTEX_INPUT.vertex.xyz, 1.0)).xyz;
|
||||
svPositionClip = mul(MATRIX_VP, float4(ApplyShadowBias(positionWorld, normalWorld, _LightDirection), 1.0));
|
||||
#if UNITY_REVERSED_Z
|
||||
svPositionClip.z = min(svPositionClip.z, svPositionClip.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#else
|
||||
svPositionClip.z = max(svPositionClip.z, svPositionClip.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
#elif defined(MK_LWRP)
|
||||
float3 positionWorld = mul(MATRIX_M, float4(VERTEX_INPUT.vertex.xyz, 1.0)).xyz;
|
||||
float invNdotL = 1.0 - saturate(dot(_LightDirection, normalWorld));
|
||||
float scale = invNdotL * _ShadowBias.y;
|
||||
|
||||
positionWorld = _LightDirection * _ShadowBias.xxx + positionWorld;
|
||||
positionWorld = normalWorld * scale.xxx + positionWorld;
|
||||
svPositionClip = mul(MATRIX_VP, float4(positionWorld, 1));
|
||||
#if UNITY_REVERSED_Z
|
||||
svPositionClip.z = min(svPositionClip.z, svPositionClip.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#else
|
||||
svPositionClip.z = max(svPositionClip.z, svPositionClip.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
#else
|
||||
TRANSFER_SHADOW_CASTER_NOPOS(vertexOutput, svPositionClip)
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FRAGMENT SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half4 ShadowCasterFrag
|
||||
(
|
||||
VertexOutputShadowCaster vertexOutput
|
||||
#ifdef MK_LEGACY_RP
|
||||
#if UNITY_VERSION >= 20171
|
||||
,UNITY_POSITION(vpos)
|
||||
#else
|
||||
,UNITY_VPOS_TYPE vpos : VPOS
|
||||
#endif
|
||||
#endif
|
||||
) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexOutput);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(vertexOutput);
|
||||
|
||||
MKSurfaceData surfaceData = ComputeSurfaceData
|
||||
(
|
||||
PASS_POSITION_WORLD_ARG(0)
|
||||
PASS_FOG_FACTOR_WORLD_ARG(0)
|
||||
PASS_BASE_UV_ARG(float4(vertexOutput.uv.xy, 0, 0))
|
||||
PASS_LIGHTMAP_UV_ARG(0)
|
||||
PASS_VERTEX_COLOR_ARG(vertexOutput.color)
|
||||
PASS_NORMAL_WORLD_ARG(1)
|
||||
PASS_VERTEX_LIGHTING_ARG(0)
|
||||
PASS_TANGENT_WORLD_ARG(1)
|
||||
PASS_VIEW_TANGENT_ARG(vertexOutput.viewTangent)
|
||||
PASS_BITANGENT_WORLD_ARG(1)
|
||||
PASS_POSITION_CLIP_ARG(0)
|
||||
PASS_NULL_CLIP_ARG(0)
|
||||
PASS_FLIPBOOK_UV_ARG(0)
|
||||
);
|
||||
Surface surface = InitSurface(surfaceData, PASS_TEXTURE_2D(_AlbedoMap, SAMPLER_REPEAT_MAIN), _AlbedoColor);
|
||||
|
||||
#if defined(MK_URP) || defined(MK_LWRP)
|
||||
return 0;
|
||||
#else
|
||||
#ifdef MK_SURFACE_TYPE_TRANSPARENT
|
||||
#ifdef MK_TOON_DITHER_MASK
|
||||
/*
|
||||
#ifdef LOD_FADE_CROSSFADE
|
||||
#define _LOD_FADE_ON_ALPHA
|
||||
alpha *= unity_LODFade.y;
|
||||
#endif
|
||||
*/
|
||||
|
||||
// dither mask alpha blending
|
||||
half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25,surface.alpha*0.9375)).a;
|
||||
Clip0(alphaRef);
|
||||
#else
|
||||
Clip0(surface.alpha - 0.5);
|
||||
#endif
|
||||
|
||||
/*
|
||||
//Disabled for now
|
||||
#ifdef LOD_FADE_CROSSFADE
|
||||
#ifdef _LOD_FADE_ON_ALPHA
|
||||
#undef _LOD_FADE_ON_ALPHA
|
||||
#else
|
||||
UnityApplyDitherCrossFade(vpos.xy);
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
SHADOW_CASTER_FRAGMENT(vertexOutput)
|
||||
#endif
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a8e12cbac256f743aff260b9071c628
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,32 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon ShadowCaster Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_SHADOWCASTER_SETUP
|
||||
#define MK_TOON_SHADOWCASTER_SETUP
|
||||
|
||||
#ifndef MK_SHADOWCASTER_PASS
|
||||
#define MK_SHADOWCASTER_PASS
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
#if defined(MK_SURFACE_TYPE_TRANSPARENT) && SHADER_TARGET > 30
|
||||
#ifndef MK_TOON_DITHER_MASK
|
||||
#define MK_TOON_DITHER_MASK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Hightmap is only needed if a UV is required
|
||||
#if !defined(MK_TEXCLR) && !defined(MK_DISSOLVE)
|
||||
#ifdef MK_PARALLAX
|
||||
#undef MK_PARALLAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ProgramShadowCaster.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ac178c504b6a0641a1ce36b9847cfe7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
798
Assets/Resources/1/MK/MKToon/Shader/Lib/Surface.hlsl
Normal file
798
Assets/Resources/1/MK/MKToon/Shader/Lib/Surface.hlsl
Normal file
@ -0,0 +1,798 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Surface //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_SURFACE
|
||||
#define MK_TOON_SURFACE
|
||||
|
||||
#include "Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Surface Data
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Dynamic precalc struct
|
||||
struct MKSurfaceData
|
||||
{
|
||||
#ifdef MK_NORMAL
|
||||
half3 vertexNormalWorld;
|
||||
#endif
|
||||
#ifdef MK_LIT
|
||||
#ifdef MK_ENVIRONMENT_REFLECTIONS
|
||||
float4 lightmapUV;
|
||||
#endif
|
||||
#ifdef MK_VERTEX_LIGHTING
|
||||
half3 vertexLighting;
|
||||
#endif
|
||||
half3 normalWorld;
|
||||
#ifdef MK_TBN
|
||||
half3 tangentWorld;
|
||||
half3 bitangentWorld;
|
||||
#endif
|
||||
#ifdef MK_PARALLAX
|
||||
half height;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_VD
|
||||
half3 viewWorld;
|
||||
#endif
|
||||
#ifdef MK_VD_O
|
||||
half3 viewTangent;
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_WORLD
|
||||
float3 positionWorld;
|
||||
#endif
|
||||
#ifdef MK_FOG
|
||||
float fogFactor;
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
autoLP4 vertexColor;
|
||||
#endif
|
||||
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
float4 baseUV;
|
||||
#endif
|
||||
#ifdef MK_THRESHOLD_MAP
|
||||
float2 thresholdUV;
|
||||
#endif
|
||||
#if defined(MK_SCREEN_UV)
|
||||
float4 screenUV;
|
||||
#endif
|
||||
#if defined(MK_REFRACTION)
|
||||
float2 refractionUV;
|
||||
#endif
|
||||
#ifdef MK_ARTISTIC
|
||||
float2 artisticUV;
|
||||
#endif
|
||||
#ifdef MK_FLIPBOOK
|
||||
float3 flipbookUV;
|
||||
#endif
|
||||
#ifdef MK_DISSOLVE
|
||||
half dissolveClip;
|
||||
#endif
|
||||
|
||||
#ifdef MK_V_DOT_N
|
||||
half VoN;
|
||||
half OneMinusVoN;
|
||||
#endif
|
||||
#ifdef MK_MV_REF_N
|
||||
half3 MVrN;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct MKPBSData
|
||||
{
|
||||
half reflectivity;
|
||||
half oneMinusReflectivity;
|
||||
half roughness;
|
||||
#if defined(MK_ENVIRONMENT_REFLECTIONS) || defined(MK_SPECULAR) || defined(MK_DIFFUSE_OREN_NAYAR) || defined(MK_DIFFUSE_MINNAERT)
|
||||
half roughnessPow2;
|
||||
#endif
|
||||
#if defined(MK_ENVIRONMENT_REFLECTIONS) || defined(MK_SPECULAR)
|
||||
half roughnessPow4;
|
||||
#endif
|
||||
half smoothness;
|
||||
half3 diffuseRadiance;
|
||||
half3 specularRadiance;
|
||||
#ifdef MK_FRESNEL_HIGHLIGHTS
|
||||
half3 fresnel;
|
||||
#endif
|
||||
};
|
||||
|
||||
//dynamic surface struct
|
||||
struct Surface
|
||||
{
|
||||
half4 final;
|
||||
half3 albedo;
|
||||
half alpha;
|
||||
#ifdef MK_REFRACTION
|
||||
half3 refraction;
|
||||
#endif
|
||||
|
||||
// RGB - RAW
|
||||
#if defined(MK_LIT)
|
||||
#ifdef MK_THRESHOLD_MAP
|
||||
half thresholdOffset;
|
||||
#endif
|
||||
half4 goochBright;
|
||||
half4 goochDark;
|
||||
half2 occlusion;
|
||||
#ifdef MK_EMISSION
|
||||
half3 emission;
|
||||
#endif
|
||||
|
||||
#ifdef MK_INDIRECT
|
||||
half3 indirect;
|
||||
#endif
|
||||
half4 direct;
|
||||
|
||||
#ifdef MK_ARTISTIC
|
||||
#if defined(MK_ARTISTIC_DRAWN) || defined(MK_ARTISTIC_SKETCH)
|
||||
half artistic0;
|
||||
#elif defined(MK_ARTISTIC_HATCHING)
|
||||
half3 artistic0;
|
||||
half3 artistic1;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MK_THICKNESS_MAP
|
||||
half thickness;
|
||||
#endif
|
||||
#if defined(MK_RIM)
|
||||
half4 rim;
|
||||
#endif
|
||||
#ifdef MK_IRIDESCENCE
|
||||
half4 iridescence;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
half3 FresnelSchlickGGXIBL(half oneMinusVoN, half3 f0, half smoothness)
|
||||
{
|
||||
return FastPow5(oneMinusVoN) * (max(smoothness, f0) - f0) + f0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Header macros
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef MK_PBS
|
||||
#define PASS_BLENDING_ARG(surface, surfaceData, pbsData) surface, surfaceData, pbsData
|
||||
#else
|
||||
#define PASS_BLENDING_ARG(surface, surfaceData, pbsData) surface, surfaceData
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
#define SURFACE_FLIPBOOK_UV surfaceData.flipbookUV
|
||||
#else
|
||||
#define SURFACE_FLIPBOOK_UV 0
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_WORLD
|
||||
#define PASS_POSITION_WORLD_ARG(positionWorld) positionWorld
|
||||
#else
|
||||
#define PASS_POSITION_WORLD_ARG(positionWorld) 0
|
||||
#endif
|
||||
|
||||
#ifdef MK_FOG
|
||||
#define PASS_FOG_FACTOR_WORLD_ARG(fogFacor) ,fogFacor
|
||||
#else
|
||||
#define PASS_FOG_FACTOR_WORLD_ARG(fogFacor)
|
||||
#endif
|
||||
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
#define PASS_BASE_UV_ARG(baseUV) ,baseUV
|
||||
#else
|
||||
#define PASS_BASE_UV_ARG(baseUV)
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
#define PASS_VERTEX_COLOR_ARG(vertexColor) ,vertexColor
|
||||
#else
|
||||
#define PASS_VERTEX_COLOR_ARG(vertexColor)
|
||||
#endif
|
||||
|
||||
#if defined(MK_NORMAL)
|
||||
#define PASS_NORMAL_WORLD_ARG(normalWorld) ,normalWorld
|
||||
#else
|
||||
#define PASS_NORMAL_WORLD_ARG(normalWorld)
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTEX_LIGHTING)
|
||||
#define PASS_VERTEX_LIGHTING_ARG(vertexLighting) ,vertexLighting
|
||||
#else
|
||||
#define PASS_VERTEX_LIGHTING_ARG(vertexLighting)
|
||||
#endif
|
||||
|
||||
#if defined(MK_TBN)
|
||||
#define PASS_TANGENT_WORLD_ARG(tangentWorld) ,tangentWorld
|
||||
#define PASS_BITANGENT_WORLD_ARG(bitangentWorld) ,bitangentWorld
|
||||
#else
|
||||
#define PASS_TANGENT_WORLD_ARG(bitangentWorld)
|
||||
#define PASS_BITANGENT_WORLD_ARG(bitangentWorld)
|
||||
#endif
|
||||
|
||||
#ifdef MK_ENVIRONMENT_REFLECTIONS
|
||||
#define PASS_LIGHTMAP_UV_ARG(lightmapUV) ,lightmapUV
|
||||
#else
|
||||
#define PASS_LIGHTMAP_UV_ARG(lightmapUV)
|
||||
#endif
|
||||
|
||||
#if defined(MK_PARALLAX)
|
||||
#define PASS_VIEW_TANGENT_ARG(viewTangent) ,viewTangent
|
||||
#else
|
||||
#define PASS_VIEW_TANGENT_ARG(viewTangent)
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_CLIP
|
||||
#define PASS_POSITION_CLIP_ARG(positionClip) ,positionClip
|
||||
#else
|
||||
#define PASS_POSITION_CLIP_ARG(positionClip)
|
||||
#endif
|
||||
|
||||
#ifdef MK_POS_NULL_CLIP
|
||||
#define PASS_NULL_CLIP_ARG(nullClip) ,nullClip
|
||||
#else
|
||||
#define PASS_NULL_CLIP_ARG(nullClip)
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
#define PASS_FLIPBOOK_UV_ARG(flipbookUV) ,flipbookUV
|
||||
#else
|
||||
#define PASS_FLIPBOOK_UV_ARG(flipbookUV)
|
||||
#endif
|
||||
|
||||
//Texture color
|
||||
inline void SurfaceColor(out half3 albedo, out half alpha, DECLARE_TEXTURE_2D_ARGS(albedoMap, samplerTex), float2 uv, float3 blendUV, autoLP4 color)
|
||||
{
|
||||
half4 c;
|
||||
#ifdef MK_OUTLINE_PASS
|
||||
c = half4(color.rgb, SAMPLE_TEX2D_FLIPBOOK(albedoMap, SAMPLER_REPEAT_MAIN, uv, blendUV).a * color.a);
|
||||
#else
|
||||
c = SAMPLE_TEX2D_FLIPBOOK(albedoMap, SAMPLER_REPEAT_MAIN, uv, blendUV) * color;
|
||||
#endif
|
||||
albedo = c.rgb;
|
||||
#if defined(MK_ALPHA_LOOKUP)
|
||||
alpha = c.a;
|
||||
#else
|
||||
alpha = 1.0h;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void SurfaceColor(out half3 albedo, out half alpha, DECLARE_TEXTURE_2D_ARGS(albedoMap, samplerTex), DECLARE_TEXTURE_2D_ARGS(albedoMap1, samplerTex1), DECLARE_TEXTURE_2D_ARGS(albedoMap2, samplerTex2), DECLARE_TEXTURE_2D_ARGS(albedoMap3, samplerTex3), float2 uv, autoLP4 blendColor, float3 blendUV, autoLP4 color)
|
||||
{
|
||||
half4 c0, c1, c2, c3;
|
||||
#ifdef MK_OUTLINE_PASS
|
||||
c0 = half4(color.rgb, SAMPLE_TEX2D_FLIPBOOK(albedoMap, SAMPLER_REPEAT_MAIN, uv, blendUV).a * color.a);
|
||||
c1 = half4(color.rgb, SAMPLE_TEX2D_FLIPBOOK(albedoMap1, SAMPLER_REPEAT_MAIN, uv, blendUV).a) * blendColor.g;
|
||||
c2 = half4(color.rgb, SAMPLE_TEX2D_FLIPBOOK(albedoMap2, SAMPLER_REPEAT_MAIN, uv, blendUV).a) * blendColor.b;
|
||||
c3 = half4(color.rgb, SAMPLE_TEX2D_FLIPBOOK(albedoMap3, SAMPLER_REPEAT_MAIN, uv, blendUV).a) * blendColor.a;
|
||||
#else
|
||||
c0 = SAMPLE_TEX2D_FLIPBOOK(albedoMap, SAMPLER_REPEAT_MAIN, uv, blendUV) * color;
|
||||
c1 = SAMPLE_TEX2D_FLIPBOOK(albedoMap1, SAMPLER_REPEAT_MAIN, uv, blendUV) * blendColor.y;
|
||||
c2 = SAMPLE_TEX2D_FLIPBOOK(albedoMap2, SAMPLER_REPEAT_MAIN, uv, blendUV) * blendColor.z;
|
||||
c3 = SAMPLE_TEX2D_FLIPBOOK(albedoMap3, SAMPLER_REPEAT_MAIN, uv, blendUV) * blendColor.w;
|
||||
#endif
|
||||
|
||||
half4 mixedColor = lerp(lerp(lerp(c0, c1, blendColor.g), c2, blendColor.b), c3, blendColor.a);
|
||||
|
||||
albedo = mixedColor.rgb;
|
||||
#if defined(MK_ALPHA_LOOKUP)
|
||||
alpha = mixedColor.a;
|
||||
#else
|
||||
alpha = 1.0h;
|
||||
#endif
|
||||
}
|
||||
|
||||
//Non texture color
|
||||
inline void SurfaceColor(out half3 albedo, out half alpha, autoLP4 vertexColor, autoLP4 color)
|
||||
{
|
||||
half4 c = vertexColor * color;
|
||||
albedo = c.rgb;
|
||||
#if defined(MK_ALPHA_LOOKUP)
|
||||
alpha = c.a;
|
||||
#else
|
||||
alpha = 1.0h;
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline MKSurfaceData ComputeSurfaceData
|
||||
(
|
||||
//#ifdef MK_POS_WORLD
|
||||
in float3 positionWorld
|
||||
//#endif
|
||||
#ifdef MK_FOG
|
||||
, in float fogFactor
|
||||
#endif
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
, in float4 baseUV
|
||||
#endif
|
||||
#ifdef MK_ENVIRONMENT_REFLECTIONS
|
||||
, in float4 lightmapUV
|
||||
#endif
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
, in autoLP4 vertexColor
|
||||
#endif
|
||||
#ifdef MK_NORMAL
|
||||
, in half3 normalWorld
|
||||
#endif
|
||||
#ifdef MK_VERTEX_LIGHTING
|
||||
, in autoLP3 vertexLighting
|
||||
#endif
|
||||
#if defined(MK_TBN)
|
||||
, in half3 tangentWorld
|
||||
#endif
|
||||
#if defined(MK_PARALLAX)
|
||||
, in half3 viewTangent
|
||||
#endif
|
||||
#if defined(MK_TBN)
|
||||
, in half3 bitangentWorld
|
||||
#endif
|
||||
#ifdef MK_POS_CLIP
|
||||
, in float4 positionClip
|
||||
#endif
|
||||
#ifdef MK_POS_NULL_CLIP
|
||||
, in float4 nullClip
|
||||
#endif
|
||||
#ifdef MK_FLIPBOOK
|
||||
, in float3 flipbookUV
|
||||
#endif
|
||||
)
|
||||
{
|
||||
MKSurfaceData surfaceData;
|
||||
INITIALIZE_STRUCT(MKSurfaceData, surfaceData);
|
||||
|
||||
#ifdef MK_POS_WORLD
|
||||
surfaceData.positionWorld = positionWorld;
|
||||
#endif
|
||||
#ifdef MK_FOG
|
||||
surfaceData.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
surfaceData.vertexColor = vertexColor;
|
||||
#endif
|
||||
|
||||
#if defined(MK_TCM) || defined(MK_TCD)
|
||||
surfaceData.baseUV = 0;
|
||||
#endif
|
||||
#if defined(MK_TCM)
|
||||
surfaceData.baseUV.xy = baseUV.xy * _AlbedoMap_ST.xy + _AlbedoMap_ST.zw;
|
||||
#endif
|
||||
#if defined(MK_TCD)
|
||||
surfaceData.baseUV.zw = baseUV.zw;
|
||||
#endif
|
||||
|
||||
#ifdef MK_FLIPBOOK
|
||||
SURFACE_FLIPBOOK_UV = flipbookUV;
|
||||
#endif
|
||||
|
||||
#ifdef MK_VD
|
||||
surfaceData.viewWorld = SafeNormalize(CAMERA_POSITION_WORLD - surfaceData.positionWorld);
|
||||
#endif
|
||||
|
||||
#ifdef MK_VD_O
|
||||
surfaceData.viewTangent = SafeNormalize(viewTangent);
|
||||
#endif
|
||||
|
||||
#ifdef MK_PARALLAX
|
||||
surfaceData.height = SAMPLE_TEX2D_FLIPBOOK(_HeightMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).r;
|
||||
float2 parallaxUVOffset = Parallax(surfaceData.viewTangent, surfaceData.height, _Parallax, 0.42);
|
||||
|
||||
#if defined(MK_TCM)
|
||||
surfaceData.baseUV.xy += parallaxUVOffset;
|
||||
#endif
|
||||
#if defined(MK_TCD)
|
||||
surfaceData.baseUV.zw += parallaxUVOffset;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_THRESHOLD_MAP
|
||||
surfaceData.thresholdUV = surfaceData.baseUV.xy * _ThresholdMapScale;
|
||||
#endif
|
||||
|
||||
#if defined(MK_SCREEN_UV)
|
||||
surfaceData.screenUV = ComputeNDC(positionClip);
|
||||
#endif
|
||||
|
||||
#if defined(MK_ARTISTIC)
|
||||
#if defined(MK_ARTISTIC_DRAWN)
|
||||
#if defined(MK_ARTISTIC_PROJECTION_SCREEN_SPACE)
|
||||
surfaceData.artisticUV = ComputeNormalizedScreenUV(surfaceData.screenUV, ComputeNDC(nullClip), _DrawnMapScale);
|
||||
#else
|
||||
surfaceData.artisticUV = surfaceData.baseUV.xy * _DrawnMapScale;
|
||||
#endif
|
||||
#elif defined(MK_ARTISTIC_HATCHING)
|
||||
#if defined(MK_ARTISTIC_PROJECTION_SCREEN_SPACE)
|
||||
surfaceData.artisticUV = ComputeNormalizedScreenUV(surfaceData.screenUV, ComputeNDC(nullClip), _HatchingMapScale);
|
||||
#else
|
||||
surfaceData.artisticUV = surfaceData.baseUV.xy * _HatchingMapScale;
|
||||
#endif
|
||||
#elif defined(MK_ARTISTIC_SKETCH)
|
||||
#if defined(MK_ARTISTIC_PROJECTION_SCREEN_SPACE)
|
||||
surfaceData.artisticUV = ComputeNormalizedScreenUV(surfaceData.screenUV, ComputeNDC(nullClip), _SketchMapScale);
|
||||
#else
|
||||
surfaceData.artisticUV = surfaceData.baseUV.xy * _SketchMapScale;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_ARTISTIC_ANIMATION_STUTTER
|
||||
surfaceData.artisticUV.xy += Stutter(_Time.y, _ArtisticFrequency);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//dissolve could be moved above the screen uv to safe some instructions while clipping
|
||||
#ifdef MK_DISSOLVE
|
||||
float2 dissolveUV;
|
||||
#ifdef MK_DISSOLVE_PROJECTION_SCREEN_SPACE
|
||||
dissolveUV = ComputeNormalizedScreenUV(surfaceData.screenUV, ComputeNDC(nullClip), _DissolveMapScale);
|
||||
#else
|
||||
dissolveUV = surfaceData.baseUV.xy;
|
||||
#endif
|
||||
surfaceData.dissolveClip = SAMPLE_TEX2D_FLIPBOOK(_DissolveMap, SAMPLER_REPEAT_MAIN, dissolveUV, SURFACE_FLIPBOOK_UV).r - _DissolveAmount;
|
||||
Clip0(surfaceData.dissolveClip);
|
||||
#endif
|
||||
|
||||
#ifdef MK_NORMAL
|
||||
surfaceData.vertexNormalWorld = SafeNormalize(normalWorld);
|
||||
#endif
|
||||
#ifdef MK_TBN
|
||||
surfaceData.tangentWorld = SafeNormalize(tangentWorld);
|
||||
surfaceData.bitangentWorld = SafeNormalize(bitangentWorld);
|
||||
#endif
|
||||
#if defined(MK_LIT)
|
||||
//get normal direction
|
||||
#ifdef MK_TBN
|
||||
//Normalmap extraction
|
||||
#if defined(MK_NORMAL_MAP) && !defined(MK_DETAIL_NORMAL_MAP)
|
||||
surfaceData.normalWorld = NormalMappingWorld(PASS_TEXTURE_2D(_NormalMap, SAMPLER_REPEAT_MAIN), surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV, _NormalMapIntensity, half3x3(surfaceData.tangentWorld, surfaceData.bitangentWorld, surfaceData.vertexNormalWorld));
|
||||
#elif defined(MK_NORMAL_MAP) && defined(MK_DETAIL_NORMAL_MAP)
|
||||
surfaceData.normalWorld = NormalMappingWorld(PASS_TEXTURE_2D(_NormalMap, SAMPLER_REPEAT_MAIN), surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV, _NormalMapIntensity, PASS_TEXTURE_2D(_DetailNormalMap, SAMPLER_REPEAT_MAIN), surfaceData.baseUV.zw, _DetailNormalMapIntensity, half3x3(surfaceData.tangentWorld, surfaceData.bitangentWorld, surfaceData.vertexNormalWorld));
|
||||
#elif !defined(MK_NORMAL_MAP) && defined(MK_DETAIL_NORMAL_MAP)
|
||||
surfaceData.normalWorld = NormalMappingWorld(PASS_TEXTURE_2D(_DetailNormalMap, SAMPLER_REPEAT_MAIN), surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV, _DetailNormalMapIntensity, half3x3(surfaceData.tangentWorld, surfaceData.bitangentWorld, surfaceData.vertexNormalWorld));
|
||||
#else
|
||||
surfaceData.normalWorld = surfaceData.vertexNormalWorld;
|
||||
#endif
|
||||
|
||||
#ifdef MK_SPECULAR_ANISOTROPIC
|
||||
//rebuild tangent and bitangent
|
||||
surfaceData.tangentWorld = SafeNormalize(cross(surfaceData.normalWorld, half3(0.0, 1.0, 0.0)));
|
||||
surfaceData.bitangentWorld = SafeNormalize(cross(surfaceData.normalWorld, surfaceData.tangentWorld));
|
||||
#endif
|
||||
#else
|
||||
surfaceData.normalWorld = surfaceData.vertexNormalWorld;
|
||||
#endif
|
||||
|
||||
#ifdef MK_VERTEX_LIGHTING
|
||||
surfaceData.vertexLighting = vertexLighting;
|
||||
#endif
|
||||
#ifdef MK_ENVIRONMENT_REFLECTIONS
|
||||
surfaceData.lightmapUV = lightmapUV;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_REFRACTION)
|
||||
#ifdef MK_INDEX_OF_REFRACTION
|
||||
float3 ssY = float3(UNITY_MATRIX_V[1][0], UNITY_MATRIX_V[1][1], UNITY_MATRIX_V[1][2]);
|
||||
float3 ssX = normalize( cross(surfaceData.viewWorld, ssY));
|
||||
|
||||
float4x4 ssView = float4x4
|
||||
(
|
||||
ssX.x, ssX.y, ssX.z, 0,
|
||||
ssY.x, ssY.y, ssY.z, 0,
|
||||
surfaceData.viewWorld, 0,
|
||||
0,0,0,1
|
||||
);
|
||||
|
||||
float2 ssIOR = mul(ssView, float4(surfaceData.vertexNormalWorld, 0.0)).xy;
|
||||
ssIOR.x *= SafeDivide(_ScreenParams.y, _ScreenParams.x);
|
||||
ssIOR *= (1.0 - saturate(dot(surfaceData.vertexNormalWorld, surfaceData.viewWorld))) * _IndexOfRefraction;
|
||||
surfaceData.refractionUV = surfaceData.screenUV.xy - ssIOR;
|
||||
#else
|
||||
surfaceData.refractionUV = surfaceData.screenUV.xy;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_V_DOT_N
|
||||
surfaceData.VoN = saturate(dot(surfaceData.viewWorld, surfaceData.normalWorld));
|
||||
surfaceData.OneMinusVoN = 1.0 - surfaceData.VoN;
|
||||
#endif
|
||||
#ifdef MK_MV_REF_N
|
||||
surfaceData.MVrN = reflect(-surfaceData.viewWorld, surfaceData.normalWorld);
|
||||
#endif
|
||||
return surfaceData;
|
||||
}
|
||||
|
||||
inline void ComputeBlending
|
||||
(
|
||||
inout Surface surface
|
||||
, in MKSurfaceData surfaceData
|
||||
#ifdef MK_PBS
|
||||
, inout MKPBSData pbsData
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if defined(MK_BLEND_PREMULTIPLY) || defined(MK_BLEND_ADDITIVE)
|
||||
#if defined(MK_PBS)
|
||||
pbsData.diffuseRadiance *= surface.alpha;
|
||||
half premulGISpec;
|
||||
#ifdef MK_FRESNEL_HIGHLIGHTS
|
||||
premulGISpec = dot(pbsData.fresnel, REL_LUMA);
|
||||
#else
|
||||
premulGISpec = pbsData.specularRadiance;
|
||||
#endif
|
||||
surface.alpha = surface.alpha * pbsData.oneMinusReflectivity + premulGISpec;
|
||||
#else
|
||||
surface.albedo *= surface.alpha;
|
||||
#endif
|
||||
#elif defined(MK_BLEND_MULTIPLY)
|
||||
#if defined(MK_PBS)
|
||||
surface.albedo = lerp(HALF3_ONE, surface.albedo, surface.alpha);
|
||||
pbsData.diffuseRadiance = lerp(HALF3_ONE, pbsData.diffuseRadiance, surface.alpha * pbsData.oneMinusReflectivity + pbsData.reflectivity);
|
||||
#else
|
||||
surface.albedo = lerp(HALF3_ONE, surface.albedo, surface.alpha);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_SOFT_FADE
|
||||
#if defined(MK_BLEND_PREMULTIPLY) || defined(MK_BLEND_ADDITIVE)
|
||||
surface.albedo *= SoftFade(_SoftFadeNearDistance, _SoftFadeFarDistance, surfaceData.screenUV);
|
||||
#else
|
||||
surface.alpha *= SoftFade(_SoftFadeNearDistance, _SoftFadeFarDistance, surfaceData.screenUV);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_CAMERA_FADE
|
||||
#if defined(MK_BLEND_PREMULTIPLY) || defined(MK_BLEND_ADDITIVE)
|
||||
surface.albedo *= CameraFade(_CameraFadeNearDistance, _CameraFadeFarDistance, surfaceData.screenUV);
|
||||
#else
|
||||
surface.alpha *= CameraFade(_CameraFadeNearDistance, _CameraFadeFarDistance, surfaceData.screenUV);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_LIT
|
||||
#if defined(MK_ALPHA_LOOKUP)
|
||||
surface.goochBright.a *= surface.alpha;
|
||||
surface.goochDark.a *= surface.alpha;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
inline MKPBSData ComputePBSData(inout Surface surface, in MKSurfaceData surfaceData)
|
||||
{
|
||||
MKPBSData pbsData;
|
||||
INITIALIZE_STRUCT(MKPBSData, pbsData);
|
||||
|
||||
half4 pbsInput;
|
||||
|
||||
#if defined(MK_WORKFLOW_METALLIC)
|
||||
#ifdef MK_PBS_MAP_0
|
||||
pbsInput = SAMPLE_TEX2D_FLIPBOOK(_MetallicMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).rrra;
|
||||
pbsInput.a *= _Smoothness;
|
||||
#else
|
||||
pbsInput.rgb = _Metallic;
|
||||
pbsInput.a = _Smoothness;
|
||||
#endif
|
||||
#elif defined(MK_WORKFLOW_ROUGHNESS)
|
||||
#ifdef MK_PBS_MAP_0
|
||||
pbsInput.rgb = SAMPLE_TEX2D_FLIPBOOK(_MetallicMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).rrr;
|
||||
#else
|
||||
pbsInput.rgb = _Metallic;
|
||||
#endif
|
||||
#ifdef MK_PBS_MAP_1
|
||||
pbsInput.a = 1.0 - SAMPLE_TEX2D_FLIPBOOK(_RoughnessMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).r;
|
||||
#else
|
||||
pbsInput.a = 1.0 - _Roughness;
|
||||
#endif
|
||||
#else //MK_WORKFLOW_SPECULAR / Simple
|
||||
#ifdef MK_PBS_MAP_0
|
||||
pbsInput = SAMPLE_TEX2D_FLIPBOOK(_SpecularMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV);
|
||||
pbsInput.a *= _Smoothness;
|
||||
#else
|
||||
pbsInput.rgb = _SpecularColor.rgb;
|
||||
pbsInput.a = _Smoothness;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MK_WORKFLOW_METALLIC)
|
||||
pbsData.smoothness = pbsInput.a;
|
||||
pbsData.oneMinusReflectivity = K_SPEC_DIELECTRIC_MAX - pbsInput.r * K_SPEC_DIELECTRIC_MAX;
|
||||
pbsData.reflectivity = 1.0 - pbsData.oneMinusReflectivity;
|
||||
pbsData.specularRadiance = lerp(K_SPEC_DIELECTRIC_MIN, surface.albedo, pbsInput.r);
|
||||
pbsData.diffuseRadiance = surface.albedo * (pbsData.oneMinusReflectivity * (1.0 - pbsData.specularRadiance));//surface.albedo * pbsData.oneMinusReflectivity;
|
||||
#elif defined(MK_WORKFLOW_ROUGHNESS)
|
||||
pbsData.smoothness = pbsInput.a;
|
||||
pbsData.oneMinusReflectivity = K_SPEC_DIELECTRIC_MAX - pbsInput.r * K_SPEC_DIELECTRIC_MAX;
|
||||
pbsData.reflectivity = 1.0 - pbsData.oneMinusReflectivity;
|
||||
pbsData.specularRadiance = lerp(K_SPEC_DIELECTRIC_MIN, surface.albedo, pbsInput.r);
|
||||
pbsData.diffuseRadiance = surface.albedo * ((1.0 - pbsData.specularRadiance) * pbsData.oneMinusReflectivity);
|
||||
#elif defined(MK_WORKFLOW_SPECULAR)
|
||||
pbsData.reflectivity = max(max(pbsInput.r, pbsInput.g), pbsInput.b);
|
||||
pbsData.smoothness = pbsInput.a;
|
||||
pbsData.oneMinusReflectivity = 1.0 - pbsData.reflectivity;
|
||||
pbsData.specularRadiance = pbsInput.rgb;
|
||||
pbsData.diffuseRadiance = surface.albedo * (half3(1.0, 1.0, 1.0) - pbsInput.rgb);
|
||||
#else //Simple
|
||||
pbsData.reflectivity = 0;
|
||||
pbsData.smoothness = pbsInput.a;
|
||||
pbsData.oneMinusReflectivity = 1.0 - pbsData.reflectivity;
|
||||
pbsData.diffuseRadiance = surface.albedo;
|
||||
pbsData.specularRadiance = pbsInput.rgb;
|
||||
#endif
|
||||
|
||||
pbsData.roughness = 1.0 - pbsData.smoothness;
|
||||
#if defined(MK_ENVIRONMENT_REFLECTIONS) || defined(MK_SPECULAR) || defined(MK_DIFFUSE_OREN_NAYAR) || defined(MK_DIFFUSE_MINNAERT)
|
||||
pbsData.roughnessPow2 = FastPow2(pbsData.roughness);
|
||||
#endif
|
||||
#if defined(MK_ENVIRONMENT_REFLECTIONS) || defined(MK_SPECULAR)
|
||||
pbsData.roughnessPow4 = FastPow2(pbsData.roughnessPow2);
|
||||
#endif
|
||||
|
||||
#ifdef MK_FRESNEL_HIGHLIGHTS
|
||||
pbsData.fresnel = FresnelSchlickGGXIBL(surfaceData.OneMinusVoN, pbsData.specularRadiance, pbsData.smoothness);
|
||||
#endif
|
||||
|
||||
#ifdef MK_PBS
|
||||
ComputeBlending(PASS_BLENDING_ARG(surface, surfaceData, pbsData));
|
||||
#endif
|
||||
|
||||
return pbsData;
|
||||
}
|
||||
|
||||
inline Surface InitSurface(in MKSurfaceData surfaceData, DECLARE_TEXTURE_2D_ARGS(albedoMap, samplerTex), inout half4 albedoTint)
|
||||
{
|
||||
//Init Surface
|
||||
Surface surface;
|
||||
INITIALIZE_STRUCT(Surface, surface);
|
||||
|
||||
#ifdef MK_ARTISTIC
|
||||
#if defined(MK_ARTISTIC_DRAWN)
|
||||
surface.artistic0 = 1.0 - SampleTex2D(PASS_TEXTURE_2D(_DrawnMap, SAMPLER_REPEAT_MAIN), surfaceData.artisticUV).r;
|
||||
#elif defined(MK_ARTISTIC_SKETCH)
|
||||
surface.artistic0 = SampleTex2D(PASS_TEXTURE_2D(_SketchMap, SAMPLER_REPEAT_MAIN), surfaceData.artisticUV).r;
|
||||
#elif defined(MK_ARTISTIC_HATCHING)
|
||||
surface.artistic0 = SampleTex2D(PASS_TEXTURE_2D(_HatchingDarkMap, SAMPLER_REPEAT_MAIN), surfaceData.artisticUV).rgb;
|
||||
surface.artistic1 = SampleTex2D(PASS_TEXTURE_2D(_HatchingBrightMap, SAMPLER_REPEAT_MAIN), surfaceData.artisticUV).rgb;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//init surface color
|
||||
#if defined(MK_TEXCLR)
|
||||
#if defined(MK_PARTICLES) || defined(MK_COMBINE_VERTEX_COLOR_WITH_ALBEDO_MAP)
|
||||
albedoTint *= surfaceData.vertexColor;
|
||||
#endif
|
||||
SurfaceColor(surface.albedo, surface.alpha, PASS_TEXTURE_2D(albedoMap, samplerTex), surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV, albedoTint);
|
||||
#elif defined(MK_POLYBRUSH)
|
||||
SurfaceColor(surface.albedo, surface.alpha, PASS_TEXTURE_2D(albedoMap, samplerTex), PASS_TEXTURE_2D(_AlbedoMap1, samplerTex), PASS_TEXTURE_2D(_AlbedoMap2, samplerTex), PASS_TEXTURE_2D(_AlbedoMap3, samplerTex), surfaceData.baseUV.xy, surfaceData.vertexColor, SURFACE_FLIPBOOK_UV, albedoTint);
|
||||
#else
|
||||
SurfaceColor(surface.albedo, surface.alpha, surfaceData.vertexColor, albedoTint);
|
||||
#endif
|
||||
|
||||
//add detail
|
||||
#ifdef MK_DETAIL_MAP
|
||||
MixAlbedoDetail(surface.albedo, PASS_TEXTURE_2D(_DetailMap, SAMPLER_REPEAT_MAIN), surfaceData.baseUV.zw, SURFACE_FLIPBOOK_UV);
|
||||
#endif
|
||||
|
||||
#if defined(MK_ALPHA_CLIPPING)
|
||||
Clip0(surface.alpha - _AlphaCutoff);
|
||||
#endif
|
||||
|
||||
#ifdef MK_REFRACTION
|
||||
half2 refractionDir;
|
||||
|
||||
#ifdef MK_REFRACTION_DISTORTION_MAP
|
||||
refractionDir = (_RefractionDistortion * REFRACTION_DISTORTION_SCALE * surface.alpha) * UnpackDudv(PASS_TEXTURE_2D(_RefractionDistortionMap, SAMPLER_REPEAT_MAIN), surfaceData.baseUV.xy * _RefractionDistortionMapScale, SURFACE_FLIPBOOK_UV);
|
||||
#else
|
||||
//currently disabled if no normal mapping is set, could be optimized using a procedural noise
|
||||
refractionDir = 0;
|
||||
#endif
|
||||
|
||||
surface.refraction = SampleRefraction(surfaceData.refractionUV + refractionDir);
|
||||
surface.albedo.rgb = lerp(surface.refraction.rgb, surface.albedo.rgb, saturate(surface.alpha - _RefractionDistortionFade));
|
||||
#endif
|
||||
|
||||
#ifdef MK_COLOR_GRADING_ALBEDO
|
||||
surface.albedo = ColorGrading(surface.albedo, _Brightness, _Saturation, _Contrast);
|
||||
#endif
|
||||
|
||||
#ifdef MK_LIT
|
||||
#ifdef MK_THRESHOLD_MAP
|
||||
surface.thresholdOffset = SAMPLE_TEX2D_FLIPBOOK(_ThresholdMap, SAMPLER_REPEAT_MAIN, surfaceData.thresholdUV, SURFACE_FLIPBOOK_UV).r;
|
||||
#endif
|
||||
surface.direct = 0;
|
||||
|
||||
surface.goochBright = _GoochBrightColor;
|
||||
#ifdef MK_LEGACY_RP
|
||||
#ifdef USING_DIRECTIONAL_LIGHT
|
||||
surface.goochDark = _GoochDarkColor;
|
||||
#else
|
||||
surface.goochDark = 0;
|
||||
#endif
|
||||
#else
|
||||
surface.goochDark = _GoochDarkColor;
|
||||
#endif
|
||||
|
||||
#if defined(MK_GOOCH_BRIGHT_MAP)
|
||||
surface.goochBright *= SAMPLE_TEX2D_FLIPBOOK(_GoochBrightMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV);
|
||||
#endif
|
||||
#if defined(MK_GOOCH_DARK_MAP)
|
||||
#ifdef MK_LEGACY_RP
|
||||
#ifdef USING_DIRECTIONAL_LIGHT
|
||||
surface.goochDark *= SAMPLE_TEX2D_FLIPBOOK(_GoochDarkMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV);
|
||||
#endif
|
||||
#else
|
||||
surface.goochDark *= SAMPLE_TEX2D_FLIPBOOK(_GoochDarkMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_INDIRECT
|
||||
surface.indirect = 0;
|
||||
#endif
|
||||
#ifdef MK_THICKNESS_MAP
|
||||
surface.thickness = SAMPLE_TEX2D_FLIPBOOK(_ThicknessMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).r;
|
||||
#endif
|
||||
#if defined(MK_RIM)
|
||||
surface.rim = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MK_IRIDESCENCE
|
||||
surface.iridescence = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MK_OCCLUSION_MAP
|
||||
surface.occlusion = (1.0 - _OcclusionMapIntensity) + SAMPLE_TEX2D_FLIPBOOK(_OcclusionMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).rg * _OcclusionMapIntensity;
|
||||
#else
|
||||
surface.occlusion = 1.0;
|
||||
#endif
|
||||
|
||||
#ifdef MK_EMISSION
|
||||
#if defined(MK_EMISSION_MAP)
|
||||
surface.emission = _EmissionColor * SAMPLE_TEX2D_FLIPBOOK(_EmissionMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).rgb;
|
||||
#else
|
||||
surface.emission = _EmissionColor;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MK_COLOR
|
||||
#if defined(MK_COLOR_BLEND_ADDITIVE)
|
||||
surface.albedo = surface.albedo + surfaceData.vertexColor;
|
||||
surface.alpha *= surfaceData.vertexColor.a;
|
||||
#elif defined(MK_COLOR_BLEND_SUBTRACTIVE)
|
||||
surface.albedo = surface.albedo + surfaceData.vertexColor * (-1.0h);
|
||||
surface.alpha *= surfaceData.vertexColor.a;
|
||||
#elif defined(MK_COLOR_BLEND_OVERLAY)
|
||||
surface.albedo = lerp(1 - 2 * (1 - surface.albedo) * (1 - surface.albedo), 2 * surface.albedo * surfaceData.vertexColor.rgb, step(surface.albedo, 0.5));
|
||||
surface.alpha *= surfaceData.vertexColor.a;
|
||||
#elif defined(MK_COLOR_BLEND_COLOR)
|
||||
half3 aHSL = RGBToHSV(surface.albedo);
|
||||
half3 bHSL = RGBToHSV(surfaceData.vertexColor.rgb);
|
||||
half3 rHSL = half3(bHSL.x, bHSL.y, aHSL.z);
|
||||
surface.albedo = HSVToRGB(rHSL);
|
||||
surface.alpha = surface.alpha * surfaceData.vertexColor.a;
|
||||
#elif defined(MK_COLOR_BLEND_DIFFERENCE)
|
||||
surface.albedo = abs(surface.albedo + surfaceData.vertexColor * (-1.0h));
|
||||
surface.alpha *= surfaceData.vertexColor.a;
|
||||
#else
|
||||
surface.albedo *= surfaceData.vertexColor.rgb;
|
||||
surface.alpha *= surfaceData.vertexColor.a;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//avoid not initialized value
|
||||
surface.final = 0;
|
||||
|
||||
#ifndef MK_PBS
|
||||
ComputeBlending(PASS_BLENDING_ARG(surface, surfaceData, 0));
|
||||
#endif
|
||||
|
||||
return surface;
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74fbfd2e159ca164a9680c5a5c0b7207
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
154
Assets/Resources/1/MK/MKToon/Shader/Lib/Uniform.hlsl
Normal file
154
Assets/Resources/1/MK/MKToon/Shader/Lib/Uniform.hlsl
Normal file
@ -0,0 +1,154 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Uniform //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_UNIFORM
|
||||
#define MK_TOON_UNIFORM
|
||||
|
||||
#if defined(MK_URP)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#elif defined(MK_LWRP)
|
||||
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
#include "UnityCG.cginc"
|
||||
#endif
|
||||
|
||||
#include "Pipeline.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UNIFORM VARIABLES
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The compiler should optimized the code by stripping away unused uniforms
|
||||
// This way its also possible to avoid an inconsistent buffer size error and
|
||||
// use the SRP Batcher, while compile different variants of the shader
|
||||
// Every PerDraw (builtin engine variables) should accessed via the builtin include files
|
||||
// Its not clear if a block based setup for the srp batcher is required,
|
||||
// therefore all uniforms are grouped this way:
|
||||
//
|
||||
// fixed | fixed2 | fixed3 | fixed4
|
||||
// half | half2 | half3 | half4
|
||||
// float | float2 | float3 | float4
|
||||
// Sampler2D | Sampler3D
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
uniform autoLP _AlphaCutoff;
|
||||
uniform autoLP _Metallic;
|
||||
uniform autoLP _Smoothness;
|
||||
uniform autoLP _Roughness;
|
||||
uniform autoLP _Anisotropy;
|
||||
uniform autoLP _LightTransmissionDistortion;
|
||||
uniform autoLP _LightBandsScale;
|
||||
uniform autoLP _LightThreshold;
|
||||
uniform autoLP _DrawnClampMin;
|
||||
uniform autoLP _DrawnClampMax;
|
||||
uniform autoLP _Contrast;
|
||||
uniform autoLP _Saturation;
|
||||
uniform autoLP _Brightness;
|
||||
uniform autoLP _DiffuseSmoothness;
|
||||
uniform autoLP _DiffuseThresholdOffset;
|
||||
uniform autoLP _SpecularSmoothness;
|
||||
uniform autoLP _SpecularThresholdOffset;
|
||||
uniform autoLP _RimSmoothness;
|
||||
uniform autoLP _RimThresholdOffset;
|
||||
uniform autoLP _IridescenceSmoothness;
|
||||
uniform autoLP _IridescenceThresholdOffset;
|
||||
uniform autoLP _LightTransmissionSmoothness;
|
||||
uniform autoLP _LightTransmissionThresholdOffset;
|
||||
uniform autoLP _RimSize;
|
||||
uniform autoLP _IridescenceSize;
|
||||
uniform autoLP _DissolveAmount;
|
||||
uniform autoLP _DissolveBorderSize;
|
||||
uniform autoLP _OutlineNoise;
|
||||
uniform autoLP _DiffuseWrap;
|
||||
uniform autoLP _DetailMix;
|
||||
uniform autoLP _RefractionDistortionFade;
|
||||
uniform autoLP _GoochRampIntensity;
|
||||
uniform autoLP _VertexAnimationIntensity;
|
||||
|
||||
uniform autoLP3 _DetailColor;
|
||||
uniform autoLP3 _SpecularColor;
|
||||
uniform autoLP3 _LightTransmissionColor;
|
||||
|
||||
uniform autoLP4 _AlbedoColor;
|
||||
uniform autoLP4 _DissolveBorderColor;
|
||||
uniform autoLP4 _OutlineColor;
|
||||
uniform autoLP4 _IridescenceColor;
|
||||
uniform autoLP4 _RimColor;
|
||||
uniform autoLP4 _RimBrightColor;
|
||||
uniform autoLP4 _RimDarkColor;
|
||||
uniform autoLP4 _GoochDarkColor;
|
||||
uniform autoLP4 _GoochBrightColor;
|
||||
uniform autoLP4 _VertexAnimationFrequency;
|
||||
|
||||
uniform half _DetailNormalMapIntensity;
|
||||
uniform half _NormalMapIntensity;
|
||||
uniform half _Parallax;
|
||||
uniform half _OcclusionMapIntensity;
|
||||
uniform half _LightBands;
|
||||
uniform half _ThresholdMapScale;
|
||||
uniform half _ArtisticFrequency;
|
||||
uniform half _DissolveMapScale;
|
||||
uniform half _DrawnMapScale;
|
||||
uniform half _SketchMapScale;
|
||||
uniform half _HatchingMapScale;
|
||||
uniform half _OutlineSize;
|
||||
uniform half _SpecularIntensity;
|
||||
uniform half _LightTransmissionIntensity;
|
||||
uniform half _RefractionDistortionMapScale;
|
||||
uniform half _IndexOfRefraction;
|
||||
uniform half _RefractionDistortion;
|
||||
|
||||
uniform half3 _EmissionColor;
|
||||
|
||||
uniform float _SoftFadeNearDistance;
|
||||
uniform float _SoftFadeFarDistance;
|
||||
uniform float _CameraFadeNearDistance;
|
||||
uniform float _CameraFadeFarDistance;
|
||||
uniform float _OutlineFadeMin;
|
||||
uniform float _OutlineFadeMax;
|
||||
|
||||
uniform float4 _AlbedoMap_ST;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform float4 _DetailMap_ST;
|
||||
CBUFFER_END
|
||||
|
||||
UNIFORM_TEXTURE_2D(_AlbedoMap); //1
|
||||
UNIFORM_TEXTURE_2D(_AlbedoMap1);
|
||||
UNIFORM_TEXTURE_2D(_AlbedoMap2);
|
||||
UNIFORM_TEXTURE_2D(_AlbedoMap3);
|
||||
UNIFORM_TEXTURE_2D(_RefractionDistortionMap); //2
|
||||
UNIFORM_TEXTURE_2D(_SpecularMap); //3
|
||||
UNIFORM_TEXTURE_2D(_RoughnessMap); //3
|
||||
UNIFORM_TEXTURE_2D(_MetallicMap); //3
|
||||
UNIFORM_TEXTURE_2D(_DetailMap); //4
|
||||
UNIFORM_TEXTURE_2D(_DetailNormalMap); //5
|
||||
UNIFORM_TEXTURE_2D(_NormalMap); //6
|
||||
UNIFORM_TEXTURE_2D(_HeightMap); //7
|
||||
UNIFORM_TEXTURE_2D(_ThicknessMap); //8
|
||||
UNIFORM_TEXTURE_2D(_OcclusionMap); //9
|
||||
UNIFORM_TEXTURE_2D(_ThresholdMap); //10
|
||||
UNIFORM_TEXTURE_2D(_GoochRamp); //11
|
||||
UNIFORM_TEXTURE_2D(_DiffuseRamp); //12
|
||||
UNIFORM_TEXTURE_2D(_SpecularRamp); //13
|
||||
UNIFORM_TEXTURE_2D(_RimRamp); //14
|
||||
UNIFORM_TEXTURE_2D(_LightTransmissionRamp); //15
|
||||
UNIFORM_TEXTURE_2D(_IridescenceRamp); //16
|
||||
UNIFORM_TEXTURE_2D(_SketchMap); //17
|
||||
UNIFORM_TEXTURE_2D(_DrawnMap); //17
|
||||
UNIFORM_TEXTURE_2D(_HatchingBrightMap); //17
|
||||
UNIFORM_TEXTURE_2D(_HatchingDarkMap); //18
|
||||
UNIFORM_TEXTURE_2D(_GoochBrightMap); //19
|
||||
UNIFORM_TEXTURE_2D(_GoochDarkMap); //20
|
||||
UNIFORM_TEXTURE_2D(_DissolveMap); //21
|
||||
UNIFORM_TEXTURE_2D(_DissolveBorderRamp); //22
|
||||
UNIFORM_TEXTURE_2D(_EmissionMap); //23
|
||||
uniform sampler2D _VertexAnimationMap; //24
|
||||
//Depth //25
|
||||
//Refraction //26
|
||||
uniform sampler2D _OutlineMap; // Only Outline
|
||||
uniform sampler3D _DitherMaskLOD; // Only Shadows
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bde8ab000af0af34e925ee4d1bf2024f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Universal2D.meta
Normal file
8
Assets/Resources/1/MK/MKToon/Shader/Lib/Universal2D.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b934913f864dfdb43b9fcf8830288133
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,49 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Universal2D Data //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_UNIVERSAL2D_IO
|
||||
#define MK_TOON_UNIVERSAL2D_IO
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// INPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexInputUniversal2D
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
#if defined(MK_VERTEX_ANIMATION_PULSE) || defined(MK_VERTEX_ANIMATION_NOISE)
|
||||
half3 normal : NORMAL;
|
||||
#endif
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OUTPUT
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct VertexOutputUniversal2D
|
||||
{
|
||||
float4 svPositionClip : SV_POSITION;
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
autoLP4 color : COLOR0;
|
||||
#endif
|
||||
#ifdef MK_TCM
|
||||
float2 uv : TEXCOORD0;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79d239ea23d334941b97c845bf7150cb
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,75 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Universal2D Program //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_UNIVERSAL2D
|
||||
#define MK_TOON_UNIVERSAL2D
|
||||
|
||||
#include "../Core.hlsl"
|
||||
#include "Data.hlsl"
|
||||
#include "../Surface.hlsl"
|
||||
#include "../Composite.hlsl"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// VERTEX SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
VertexOutputUniversal2D Universal2DVert(VertexInputUniversal2D vertexInput)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexInput);
|
||||
VertexOutputUniversal2D vertexOutput;
|
||||
INITIALIZE_STRUCT(VertexOutputUniversal2D, vertexOutput);
|
||||
UNITY_TRANSFER_INSTANCE_ID(vertexInput, vertexOutput);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vertexOutput);
|
||||
|
||||
#ifdef MK_VERTEX_ANIMATION
|
||||
vertexInput.vertex.xyz = VertexAnimation(PASS_VERTEX_ANIMATION_ARG(_VertexAnimationMap, PASS_VERTEX_ANIMATION_UV(vertexInput.texcoord0.xy), _VertexAnimationIntensity, _VertexAnimationFrequency.xyz, vertexInput.vertex.xyz, vertexInput.normal));
|
||||
#endif
|
||||
|
||||
vertexOutput.svPositionClip = mul(MATRIX_MVP, float4(vertexInput.vertex.xyz, 1.0));
|
||||
|
||||
#if defined(MK_VERTCLR) || defined(MK_PARTICLES) || defined(MK_POLYBRUSH)
|
||||
vertexOutput.color = vertexInput.color;
|
||||
#endif
|
||||
|
||||
//texcoords
|
||||
#if defined(MK_TCM)
|
||||
vertexOutput.uv = vertexInput.texcoord0 * _AlbedoMap_ST.xy + _AlbedoMap_ST.zw;
|
||||
#endif
|
||||
return vertexOutput;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FRAGMENT SHADER
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
half4 Universal2DFrag(VertexOutputUniversal2D vertexOutput) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(vertexOutput);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(vertexOutput);
|
||||
|
||||
MKSurfaceData surfaceData = ComputeSurfaceData
|
||||
(
|
||||
PASS_POSITION_WORLD_ARG(0)
|
||||
PASS_FOG_FACTOR_WORLD_ARG(0)
|
||||
PASS_BASE_UV_ARG(float4(vertexOutput.uv.xy, 0, 0))
|
||||
PASS_LIGHTMAP_UV_ARG(0)
|
||||
PASS_VERTEX_COLOR_ARG(vertexOutput.color)
|
||||
PASS_NORMAL_WORLD_ARG(1)
|
||||
PASS_VERTEX_LIGHTING_ARG(0)
|
||||
PASS_TANGENT_WORLD_ARG(1)
|
||||
PASS_VIEW_TANGENT_ARG(1)
|
||||
PASS_BITANGENT_WORLD_ARG(1)
|
||||
PASS_POSITION_CLIP_ARG(0)
|
||||
PASS_NULL_CLIP_ARG(0)
|
||||
PASS_FLIPBOOK_UV_ARG(0)
|
||||
);
|
||||
Surface surface = InitSurface(surfaceData, PASS_TEXTURE_2D(_AlbedoMap, SAMPLER_REPEAT_MAIN), _AlbedoColor);
|
||||
MKPBSData pbsData = ComputePBSData(surface, surfaceData);
|
||||
Composite(surface, surfaceData, pbsData);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4fd4b86c2192344e84159fdb5c9a5d2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,19 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// MK Toon Universal2D Setup //
|
||||
// //
|
||||
// Created by Michael Kremmel //
|
||||
// www.michaelkremmel.de //
|
||||
// Copyright © 2021 All rights reserved. //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MK_TOON_UNIVERSAL2D_SETUP
|
||||
#define MK_TOON_UNIVERSAL2D_SETUP
|
||||
|
||||
#ifndef MK_UNIVERSAL2D_PASS
|
||||
#define MK_UNIVERSAL2D_PASS
|
||||
#endif
|
||||
|
||||
#include "../Core.hlsl"
|
||||
|
||||
#include "ProgramUniversal2D.hlsl"
|
||||
#endif
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60fb4daa8c31f1b4dabf1b0ad2bf3dcb
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -4738,6 +4738,7 @@ GameObject:
|
||||
- component: {fileID: 6736513976124970964}
|
||||
- component: {fileID: 6736513976126722542}
|
||||
- component: {fileID: 6736513976104981120}
|
||||
- component: {fileID: 254311947008733808}
|
||||
m_Layer: 0
|
||||
m_Name: Bomb
|
||||
m_TagString: Untagged
|
||||
@ -9562,6 +9563,21 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 0
|
||||
--- !u!114 &254311947008733808
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6736513976106828952}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bfb2f14a56c34dcb80031c2336b24f1b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
damage: 100
|
||||
hit: {fileID: 2307028534112872116, guid: 79d768bf87aadec478a5722da8c6d516, type: 3}
|
||||
timeHit: 1.8
|
||||
--- !u!1 &6736513976106878902
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1,5 +1,30 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1101 &-546070858855015587
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: Explode
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 1102293829521826198}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.625
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8,7 +33,13 @@ AnimatorController:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Bomb
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorParameters:
|
||||
- m_Name: Explode
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
@ -24,7 +55,7 @@ AnimatorController:
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1101 &1101016393745526072
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 3
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -376,7 +407,7 @@ AnimatorStateTransition:
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &1101570748783259436
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 3
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -442,7 +473,7 @@ AnimatorStateTransition:
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &1101628936160979654
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 3
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -640,7 +671,7 @@ AnimatorStateTransition:
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &1101999127345121280
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 3
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -662,7 +693,7 @@ AnimatorStateTransition:
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1102 &1102017953835933110
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -689,8 +720,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102026339988270548
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -716,8 +747,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102119963568475716
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -743,7 +774,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102290600603978840
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -770,7 +801,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102293829521826198
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -797,8 +828,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102300038324231582
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -824,8 +855,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102342943334615508
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -851,7 +882,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102349128289543252
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -878,7 +909,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102468043089081518
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -905,7 +936,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102469734140886672
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -932,8 +963,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102478560215277762
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -959,8 +990,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102500793846982196
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -986,7 +1017,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102509494326483986
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -996,6 +1027,7 @@ AnimatorState:
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 1101652252861656132}
|
||||
- {fileID: -546070858855015587}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@ -1013,7 +1045,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102560292473526350
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1040,8 +1072,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102573938536894438
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1067,8 +1099,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102643678307240484
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1094,8 +1126,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102655925780863650
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1121,8 +1153,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102678162120579112
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1148,8 +1180,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102707637426974368
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1175,8 +1207,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102827492225288746
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1202,7 +1234,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102855442037948304
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1229,7 +1261,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102867912869228568
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1256,8 +1288,8 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102878787506406972
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@ -1283,7 +1315,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102884043357014408
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1310,7 +1342,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102892898970591168
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1336,7 +1368,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102903792119357532
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1363,7 +1395,7 @@ AnimatorState:
|
||||
m_TimeParameter:
|
||||
--- !u!1107 &1107240124866355324
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 5
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
@ -1378,7 +1410,7 @@ AnimatorStateMachine:
|
||||
m_Position: {x: 156, y: -108, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102855442037948304}
|
||||
m_Position: {x: 444, y: -108, z: 0}
|
||||
m_Position: {x: 440, y: -110, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102878787506406972}
|
||||
m_Position: {x: 444, y: -204, z: 0}
|
||||
@ -1420,7 +1452,7 @@ AnimatorStateMachine:
|
||||
m_Position: {x: 768, y: 348, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102293829521826198}
|
||||
m_Position: {x: 768, y: 240, z: 0}
|
||||
m_Position: {x: 770, y: 240, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102469734140886672}
|
||||
m_Position: {x: 768, y: 432, z: 0}
|
||||
|
@ -552,73 +552,59 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 1175122412763087250}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2591572350827275293, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572350827275293, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_Materials.Array.size
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.083
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.023
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.26092538
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0.32429546
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.029789386
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0.9087701
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154498, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154498, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_Materials.Array.size
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2591572351042154621, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
- target: {fileID: 2591572351042154621, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: FX Spark
|
||||
objectReference: {fileID: 0}
|
||||
@ -626,8 +612,7 @@ PrefabInstance:
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
--- !u!4 &3727224336371197390 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 2591572351042154496, guid: 2e78e06fcf30c0a4993cde911703d443, type: 3}
|
||||
m_PrefabInstance: {fileID: 1175122413194565070}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &8207300010845384218
|
||||
@ -637,138 +622,111 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 1175122412763087232}
|
||||
m_Modifications:
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.rateOverTime.scalar
|
||||
value: 5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: InitialModule.startSize.minMaxState
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: InitialModule.startSizeY.minMaxState
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: InitialModule.startSizeZ.minMaxState
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[0].inWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[1].inWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[0].inWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[1].inWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[0].outWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[1].outWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[0].outWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107324874188, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[1].outWeight
|
||||
value: 0.33333334
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 9
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.37205154
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.37205148
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 0.37205154
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.01
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.006930769
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.999976
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 594306107340321050, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
- target: {fileID: 594306107340321050, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: MonsterAura
|
||||
objectReference: {fileID: 0}
|
||||
@ -776,7 +734,6 @@ PrefabInstance:
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
--- !u!4 &8780129905727237510 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 594306107339981724, guid: ef48e21b8db1e4c42bf5cad1512c98d4, type: 3}
|
||||
m_PrefabInstance: {fileID: 8207300010845384218}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
19
Assets/Resources/Data/AIData.asset
Normal file
19
Assets/Resources/Data/AIData.asset
Normal file
@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 39f9814b967541eeaf31ef497d721a87, type: 3}
|
||||
m_Name: AIData
|
||||
m_EditorClassIdentifier:
|
||||
_distanceToAgr: 6
|
||||
_percentToRetreet: 0.25
|
||||
_percentToUseProtectBonus: 0.25
|
||||
_manaPercentToCollectBonus: 0.4
|
||||
_distaceToCollectBonus: 3
|
@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82adcc5c04b15af44afe569caa21fa7e
|
||||
guid: 7d4b05a041108bc409b1126fa890ed12
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4890085278179872738
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -19,4 +19,5 @@ MonoBehaviour:
|
||||
uiDataPath: UIData
|
||||
musicDataPath: MusicData
|
||||
itemDataPath: ItemData
|
||||
aiDataPath: AIData
|
||||
chosenWeaponDataPath: ChosenWeapon.json
|
||||
|
@ -17,12 +17,9 @@ MonoBehaviour:
|
||||
hexCaptureManaCost: 10
|
||||
hexHardCaptureManaCost: 20
|
||||
hexHardCaptureTime: 1
|
||||
cellPrefab: {fileID: 1661242500252451528, guid: bcea5b4a96735bd4b936f8f3fefcc688,
|
||||
type: 3}
|
||||
cellLabelPrefab: {fileID: 3836123284387241147, guid: efd47cbd22ddfee4aa2b1391914116fc,
|
||||
type: 3}
|
||||
CoordinatesCanvas: {fileID: 4726489279989878083, guid: f31e0880dd078104bb31dc0fd7ef9f19,
|
||||
type: 3}
|
||||
cellPrefab: {fileID: 1661242500252451528, guid: bcea5b4a96735bd4b936f8f3fefcc688, type: 3}
|
||||
cellLabelPrefab: {fileID: 3836123284387241147, guid: efd47cbd22ddfee4aa2b1391914116fc, type: 3}
|
||||
CoordinatesCanvas: {fileID: 4726489279989878083, guid: f31e0880dd078104bb31dc0fd7ef9f19, type: 3}
|
||||
colors:
|
||||
- _unitColor: 2
|
||||
_texture: {fileID: 2800000, guid: 983242f4b4db7a841af48234cf0021b8, type: 3}
|
||||
@ -30,25 +27,17 @@ MonoBehaviour:
|
||||
_vfxDeathPrefab: {fileID: 0}
|
||||
- _unitColor: 0
|
||||
_texture: {fileID: 2800000, guid: 0298dfcb0756f534a9a125d510461c7a, type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 8021195855904498788, guid: 2f6d0540c8fd7bb46b356ff86962379c,
|
||||
type: 3}
|
||||
_vfxDeathPrefab: {fileID: 8483527721606052447, guid: fd7fc481b936cf84a90d2d01d83e9b06,
|
||||
type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 8021195855904498788, guid: 2f6d0540c8fd7bb46b356ff86962379c, type: 3}
|
||||
_vfxDeathPrefab: {fileID: 8483527721606052447, guid: fd7fc481b936cf84a90d2d01d83e9b06, type: 3}
|
||||
- _unitColor: 1
|
||||
_texture: {fileID: 2800000, guid: 3b75368df991b164583e8cede390e24e, type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 442387583353148024, guid: 53959bc898e9a644daad0282881d596a,
|
||||
type: 3}
|
||||
_vfxDeathPrefab: {fileID: 730781534364879866, guid: 15620662117187f419d41032a4267445,
|
||||
type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 442387583353148024, guid: 53959bc898e9a644daad0282881d596a, type: 3}
|
||||
_vfxDeathPrefab: {fileID: 730781534364879866, guid: 15620662117187f419d41032a4267445, type: 3}
|
||||
- _unitColor: 3
|
||||
_texture: {fileID: 2800000, guid: 1a76a79d5a83143479c76f4f37c4b896, type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 5732852186060375560, guid: 54d847a18c62f57479c53469d4398ceb,
|
||||
type: 3}
|
||||
_vfxDeathPrefab: {fileID: 7140011676602114744, guid: 6d9f179a27798c248b3c35df9139eb85,
|
||||
type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 5732852186060375560, guid: 54d847a18c62f57479c53469d4398ceb, type: 3}
|
||||
_vfxDeathPrefab: {fileID: 7140011676602114744, guid: 6d9f179a27798c248b3c35df9139eb85, type: 3}
|
||||
- _unitColor: 4
|
||||
_texture: {fileID: 2800000, guid: 779719648deedb4478ddebb3b81751ef, type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 1651852338557341938, guid: fa6c1fc3da7c8d24c85a88b00cf598d4,
|
||||
type: 3}
|
||||
_vfxDeathPrefab: {fileID: 4578021055421768374, guid: b2b879dd7ca552a408d4349691d2c8df,
|
||||
type: 3}
|
||||
_vfxCellCapturePrefab: {fileID: 1651852338557341938, guid: fa6c1fc3da7c8d24c85a88b00cf598d4, type: 3}
|
||||
_vfxDeathPrefab: {fileID: 4578021055421768374, guid: b2b879dd7ca552a408d4349691d2c8df, type: 3}
|
||||
|
@ -14,12 +14,16 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
items:
|
||||
- item: {fileID: 11400000, guid: e7adbedb55c5db341a823370b696f709, type: 2}
|
||||
_spawnChance: 0.681
|
||||
_spawnChance: 0.48
|
||||
- item: {fileID: 11400000, guid: 62849ddbcd32e834887aac5eb3d98db0, type: 2}
|
||||
_spawnChance: 0.873
|
||||
_spawnChance: 0.846
|
||||
- item: {fileID: 11400000, guid: ef628c3158b0ea34bb919ca105507009, type: 2}
|
||||
_spawnChance: 0.767
|
||||
- item: {fileID: 0}
|
||||
_spawnChance: 0
|
||||
_spawnChance: 0.721
|
||||
- item: {fileID: 11400000, guid: f824f23273de8df429d37f10b51f9a6f, type: 2}
|
||||
_spawnChance: 0.83
|
||||
- item: {fileID: 11400000, guid: 133e523fdd159754e8bf8927faec5b0f, type: 2}
|
||||
_spawnChance: 0.75
|
||||
- item: {fileID: 11400000, guid: 133e523fdd159754e8bf8927faec5b0f, type: 2}
|
||||
_spawnChance: 0.756
|
||||
fromTimeSpawn: 2.93
|
||||
toTimeSpawn: 10
|
||||
|
17
Assets/Resources/Data/Items/Bomb.asset
Normal file
17
Assets/Resources/Data/Items/Bomb.asset
Normal file
@ -0,0 +1,17 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f23a091c5733400f8f0092a4c0f33c6e, type: 3}
|
||||
m_Name: Bomb
|
||||
m_EditorClassIdentifier:
|
||||
iconPrefab: {fileID: 8639522512577941448, guid: 7b6a7f64e52da514d88aa97ad8f863df, type: 3}
|
||||
icon: {fileID: 21300000, guid: 5a80ac41b33ef3f43945efa70e6dfdb0, type: 3}
|
||||
buildingPrefab: {fileID: 6736513976106828952, guid: 18fb35664a7886842aa1702160b555a8, type: 3}
|
8
Assets/Resources/Data/Items/Bomb.asset.meta
Normal file
8
Assets/Resources/Data/Items/Bomb.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f824f23273de8df429d37f10b51f9a6f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/Resources/Data/Items/CaptureTAbility.asset
Normal file
19
Assets/Resources/Data/Items/CaptureTAbility.asset
Normal file
@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 461496314fe84e509ae72dd06538b62c, type: 3}
|
||||
m_Name: CaptureTAbility
|
||||
m_EditorClassIdentifier:
|
||||
iconPrefab: {fileID: 3197816592181874056, guid: 2704c4f795b0d7748a3e3fa53be4d893, type: 3}
|
||||
icon: {fileID: 21300000, guid: 543c4732bd2d47a41bdbbf2156eb358c, type: 3}
|
||||
aimCanvas: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
|
||||
itterationMove: 000000000000000000000000040000000500000001000000
|
||||
animName: SuperJump
|
8
Assets/Resources/Data/Items/CaptureTAbility.asset.meta
Normal file
8
Assets/Resources/Data/Items/CaptureTAbility.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 133e523fdd159754e8bf8927faec5b0f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -15,8 +15,6 @@ MonoBehaviour:
|
||||
_objectsToSpawn:
|
||||
- {fileID: 5336165614562949988, guid: b65a64902764f84428e8a07b071bad15, type: 3}
|
||||
- {fileID: 5296751824488078361, guid: 7305318dc10267546b643a42c7c21af3, type: 3}
|
||||
joystickView: {fileID: 4385872142190176059, guid: 4df6913b39f4979429158c344680d83f,
|
||||
type: 3}
|
||||
inventoryView: {fileID: 1527356263590969195, guid: ff3bc3b17ddefd14eb798b22cf0a854f,
|
||||
type: 3}
|
||||
adsMob: {fileID: 7017227080055577099, guid: 1328a0e1e252d60408278772275bf560, type: 3}
|
||||
joystickView: {fileID: 4385872142190176059, guid: 4df6913b39f4979429158c344680d83f, type: 3}
|
||||
inventoryView: {fileID: 1527356263590969195, guid: ff3bc3b17ddefd14eb798b22cf0a854f, type: 3}
|
||||
adsMob: {fileID: 3306115827101638291, guid: 829cf0211d46b58489f4cb061c784378, type: 3}
|
||||
|
@ -13,25 +13,23 @@ MonoBehaviour:
|
||||
m_Name: UnitsData
|
||||
m_EditorClassIdentifier:
|
||||
_units:
|
||||
- isPlayer: 1
|
||||
- isPlayer: 0
|
||||
spawnPos:
|
||||
x: 19
|
||||
z: 4
|
||||
unitPrefa: {fileID: 7527582019267571087, guid: f102085e8bc4cad4992d43b84dee1055,
|
||||
type: 3}
|
||||
unitPrefa: {fileID: 7527582019267571087, guid: f102085e8bc4cad4992d43b84dee1055, type: 3}
|
||||
color: 3
|
||||
manaRegen: 10
|
||||
manaRegen: 1000
|
||||
maxMana: 1000
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
- isPlayer: 0
|
||||
- isPlayer: 1
|
||||
spawnPos:
|
||||
x: 3
|
||||
z: 4
|
||||
unitPrefa: {fileID: 3762867976042010436, guid: d00f156879942114488e4db0689a3fb7,
|
||||
type: 3}
|
||||
unitPrefa: {fileID: 3762867976042010436, guid: d00f156879942114488e4db0689a3fb7, type: 3}
|
||||
color: 4
|
||||
manaRegen: 10
|
||||
manaRegen: 100
|
||||
maxMana: 1000
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
@ -39,10 +37,9 @@ MonoBehaviour:
|
||||
spawnPos:
|
||||
x: -1
|
||||
z: 42
|
||||
unitPrefa: {fileID: 742650227762578155, guid: 97b4a76c55741764e880b63d6e1514a9,
|
||||
type: 3}
|
||||
unitPrefa: {fileID: 742650227762578155, guid: 97b4a76c55741764e880b63d6e1514a9, type: 3}
|
||||
color: 0
|
||||
manaRegen: 10
|
||||
manaRegen: 100
|
||||
maxMana: 1000
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
@ -50,10 +47,9 @@ MonoBehaviour:
|
||||
spawnPos:
|
||||
x: -17
|
||||
z: 40
|
||||
unitPrefa: {fileID: 8887939040951305984, guid: 1a81dbbd6ef62324491d9f58654ebe4b,
|
||||
type: 3}
|
||||
unitPrefa: {fileID: 8887939040951305984, guid: 1a81dbbd6ef62324491d9f58654ebe4b, type: 3}
|
||||
color: 1
|
||||
manaRegen: 10
|
||||
manaRegen: 100
|
||||
maxMana: 1000
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
|
@ -15,28 +15,36 @@ MonoBehaviour:
|
||||
_weapons:
|
||||
- name: StandartAttac
|
||||
icon: {fileID: 3777131139682951229, guid: e85f2abe991b09140ac9b67cf8cb24a1, type: 3}
|
||||
objectToThrow: {fileID: 4746165193704193263, guid: 4e7523811a052fd46acf941fc69c8c98,
|
||||
type: 3}
|
||||
VFXGameObject: {fileID: 2957420090356197408, guid: 5d1244f7b80cadd428a70173a01ce889,
|
||||
type: 3}
|
||||
objectToThrow: {fileID: 4746165193704193263, guid: 4e7523811a052fd46acf941fc69c8c98, type: 3}
|
||||
VFXGameObject: {fileID: 2957420090356197408, guid: 5d1244f7b80cadd428a70173a01ce889, type: 3}
|
||||
modifiedDamage: 0
|
||||
damage: 10
|
||||
damage: 30
|
||||
speed: 1
|
||||
disnatce: 5
|
||||
disnatce: 7
|
||||
reloadTime: 3
|
||||
shots: 3
|
||||
shotSound: {fileID: 8300000, guid: 9ea918c6c23577f4e885a8490d2f2046, type: 3}
|
||||
hitSound: {fileID: 8300000, guid: 6c42231c18643dc4d9d8f8d15bc4735b, type: 3}
|
||||
- name: Laser
|
||||
icon: {fileID: 3777131139682951229, guid: dcb79c5472cbd5f4eb050a4acc4b197e, type: 3}
|
||||
objectToThrow: {fileID: 7219588875883387333, guid: ab214974cd498df42867306700ba5fd2,
|
||||
type: 3}
|
||||
VFXGameObject: {fileID: 8715260329460421181, guid: e0388f43a34de79458c79763de903ffb,
|
||||
type: 3}
|
||||
objectToThrow: {fileID: 7219588875883387333, guid: ab214974cd498df42867306700ba5fd2, type: 3}
|
||||
VFXGameObject: {fileID: 8715260329460421181, guid: e0388f43a34de79458c79763de903ffb, type: 3}
|
||||
modifiedDamage: 0
|
||||
damage: 30
|
||||
speed: 0.5
|
||||
disnatce: 3
|
||||
disnatce: 5
|
||||
reloadTime: 3
|
||||
shots: 5
|
||||
shotSound: {fileID: 8300000, guid: 9ea918c6c23577f4e885a8490d2f2046, type: 3}
|
||||
hitSound: {fileID: 8300000, guid: 6c42231c18643dc4d9d8f8d15bc4735b, type: 3}
|
||||
- name: Laser
|
||||
icon: {fileID: 3777131139682951229, guid: dcb79c5472cbd5f4eb050a4acc4b197e, type: 3}
|
||||
objectToThrow: {fileID: 7219588875883387333, guid: ab214974cd498df42867306700ba5fd2, type: 3}
|
||||
VFXGameObject: {fileID: 8715260329460421181, guid: e0388f43a34de79458c79763de903ffb, type: 3}
|
||||
modifiedDamage: 0
|
||||
damage: 30
|
||||
speed: 0.5
|
||||
disnatce: 5
|
||||
reloadTime: 3
|
||||
shots: 5
|
||||
shotSound: {fileID: 8300000, guid: 9ea918c6c23577f4e885a8490d2f2046, type: 3}
|
||||
|
@ -97,10 +97,8 @@ LightmapSettings:
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 112000000, guid: f66706ca7d892da4e9352c5cdc0b2932,
|
||||
type: 2}
|
||||
m_LightingSettings: {fileID: 4890085278179872738, guid: 82adcc5c04b15af44afe569caa21fa7e,
|
||||
type: 2}
|
||||
m_LightingDataAsset: {fileID: 112000000, guid: f66706ca7d892da4e9352c5cdc0b2932, type: 2}
|
||||
m_LightingSettings: {fileID: 4890085278179872738, guid: 82adcc5c04b15af44afe569caa21fa7e, type: 2}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
@ -173,10 +171,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ReferenceResolution: {x: 1080, y: 1920}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
@ -236,6 +234,8 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
- component: {fileID: 963194229}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
@ -243,6 +243,23 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &963194226
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sharedProfile: {fileID: 11400000, guid: 2de9544b84ed15540888b484d269757d, type: 2}
|
||||
isGlobal: 0
|
||||
blendDistance: 0
|
||||
weight: 1
|
||||
priority: 0
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -300,81 +317,14 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0}
|
||||
--- !u!1 &1426991531
|
||||
GameObject:
|
||||
--- !u!81 &963194229
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1426991534}
|
||||
- component: {fileID: 1426991533}
|
||||
- component: {fileID: 1426991532}
|
||||
m_Layer: 5
|
||||
m_Name: Back
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1426991532
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1426991531}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: d60ccf0feab112a4baa66853572c90ad, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1426991533
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1426991531}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!224 &1426991534
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1426991531}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 540, y: 970}
|
||||
m_SizeDelta: {x: 780, y: 240}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &1455205762
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Timers;
|
||||
using UnityEngine;
|
||||
// using GoogleMobileAds.Api;
|
||||
using HexFiled;
|
||||
@ -41,6 +42,7 @@ public class AdsMob : MonoBehaviour
|
||||
{
|
||||
_player.Spawn(HexManager.CellByColor[UnitColor.GREY][Random.Range(0, HexManager.CellByColor[UnitColor.GREY].Count - 1)].coordinates);
|
||||
canvas.SetActive(false);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
|
||||
// public void ShowAd()
|
||||
@ -55,6 +57,7 @@ public class AdsMob : MonoBehaviour
|
||||
public void ShowCanvas(Unit player)
|
||||
{
|
||||
_player = player;
|
||||
Time.timeScale = 0f;
|
||||
canvas.SetActive(true);
|
||||
}
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!850595691 &4890085278179872738
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: New Lighting Settings
|
||||
serializedVersion: 3
|
||||
m_GIWorkflowMode: 1
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 1
|
||||
m_BakeBackend: 1
|
||||
m_LightmapMaxSize: 1024
|
||||
m_BakeResolution: 40
|
||||
m_Padding: 2
|
||||
m_TextureCompression: 1
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 2
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 2
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 256
|
||||
m_FinalGatherFiltering: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 1
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
@ -11,28 +11,27 @@ using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace.AI
|
||||
{
|
||||
public class AIAgent : IFixedExecute, IExecute
|
||||
public class AIAgent : IFixedExecute
|
||||
{
|
||||
private Unit _enemy;
|
||||
private Unit _unit;
|
||||
private Camera _camera;
|
||||
private AIManager _manager;
|
||||
private BotState curentState;
|
||||
public Queue<HexDirection> currentPath;
|
||||
public Action<AIAgent> OnAgentInited;
|
||||
private Vector2 _attackDirection;
|
||||
|
||||
public Unit Enemy => _enemy;
|
||||
public Unit Unit => _unit;
|
||||
|
||||
public BotState CurentState => curentState;
|
||||
|
||||
public AIAgent(UnitInfo enemyInfo, Unit enemy, AIManager manager)
|
||||
public AIAgent(UnitInfo enemyInfo, Unit unit)
|
||||
{
|
||||
currentPath = new Queue<HexDirection>();
|
||||
_enemy = enemy;
|
||||
_unit = unit;
|
||||
_camera = Camera.main;
|
||||
_enemy.OnDeath += AgentDeath;
|
||||
enemy.onPlayerSpawned += InitAgent;
|
||||
_manager = manager;
|
||||
_unit.OnDeath += AgentDeath;
|
||||
unit.onPlayerSpawned += InitAgent;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +43,7 @@ namespace DefaultNamespace.AI
|
||||
|
||||
private void InitAgent(GameObject unit)
|
||||
{
|
||||
_manager.AddAgent(this);
|
||||
AIManager.Instance.AddAgent(this);
|
||||
HexManager.agents.Add(unit, this);
|
||||
OnAgentInited?.Invoke(this);
|
||||
}
|
||||
@ -57,35 +56,27 @@ namespace DefaultNamespace.AI
|
||||
|
||||
public void FixedExecute()
|
||||
{
|
||||
if (curentState == BotState.Attack && !_enemy.IsBusy)
|
||||
if (curentState == BotState.Attack && !_unit.IsBusy)
|
||||
{
|
||||
_enemy.Aim(_attackDirection);
|
||||
_enemy.StartAttack();
|
||||
curentState = _manager.GetNewBehaviour(this);
|
||||
_unit.Aim(_attackDirection);
|
||||
_unit.StartAttack();
|
||||
curentState = AIManager.Instance.GetNewBehaviour(this);
|
||||
}
|
||||
if (currentPath.Count > 0 && !_enemy.IsBusy)
|
||||
if (currentPath.Count > 0 && !_unit.IsBusy)
|
||||
{
|
||||
var dir = currentPath.Dequeue();
|
||||
while (HexManager.UnitCurrentCell[_enemy.Color].cell.GetNeighbor(dir) == null)
|
||||
while (HexManager.UnitCurrentCell[_unit.Color].cell.GetNeighbor(dir) == null)
|
||||
{
|
||||
dir = dir.PlusSixtyDeg();
|
||||
}
|
||||
_enemy.Move(dir);
|
||||
_unit.Move(dir);
|
||||
}
|
||||
if(currentPath.Count == 0 && !_enemy.IsBusy)
|
||||
if(currentPath.Count == 0 && !_unit.IsBusy)
|
||||
{
|
||||
curentState = _manager.GetNewBehaviour(this);
|
||||
curentState = AIManager.Instance.GetNewBehaviour(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (_enemy.UnitView != null)
|
||||
{
|
||||
_enemy.UnitView.BarCanvas.transform.DOLookAt(
|
||||
_enemy.UnitView.BarCanvas.transform.position + _camera.transform.rotation * Vector3.back, 0f,
|
||||
up: _camera.transform.rotation * Vector3.up);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,25 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Controller;
|
||||
using Data;
|
||||
using DefaultNamespace;
|
||||
using DefaultNamespace.AI;
|
||||
using HexFiled;
|
||||
using Items;
|
||||
using Runtime.Controller;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace AI
|
||||
{
|
||||
public class AIManager
|
||||
{
|
||||
private List<AIAgent> _agents;
|
||||
private int _triesToCalculatePath = 0;
|
||||
private int _maxTriesToCalculatePath = 5;
|
||||
private AIData _data;
|
||||
|
||||
private static AIManager _instance;
|
||||
|
||||
@ -30,31 +27,21 @@ namespace AI
|
||||
private set => _instance ??= value;
|
||||
}
|
||||
|
||||
public AIManager(List<AIAgent> agents)
|
||||
|
||||
public AIManager(AIData data)
|
||||
{
|
||||
_agents = agents;
|
||||
|
||||
agents.ForEach(agent => { SetBehaviour(BotState.Patrol, agent); });
|
||||
}
|
||||
|
||||
public AIManager()
|
||||
{
|
||||
_agents = new List<AIAgent>();
|
||||
|
||||
_data = data;
|
||||
Instance = this;
|
||||
HexManager.agents = new Dictionary<GameObject, AIAgent>();
|
||||
}
|
||||
|
||||
public void AddAgent(AIAgent agent)
|
||||
{
|
||||
_agents.Add(agent);
|
||||
|
||||
agent.OnAgentInited += InitAI;
|
||||
}
|
||||
|
||||
public void RemoveAgent(AIAgent agent)
|
||||
{
|
||||
_agents.Remove(agent);
|
||||
agent.OnAgentInited -= InitAI;
|
||||
}
|
||||
|
||||
@ -65,38 +52,66 @@ namespace AI
|
||||
|
||||
private void StartPatrolBehaviour(AIAgent agent)
|
||||
{
|
||||
HexManager.GetNearestDifferCell(agent.Enemy.Color, agent.currentPath);
|
||||
HexManager.GetNearestDifferCell(agent.Unit.Color, agent.currentPath);
|
||||
while (agent.currentPath.Count == 0 && _triesToCalculatePath < _maxTriesToCalculatePath)
|
||||
{
|
||||
HexManager.GetNearestDifferCell(agent.Enemy.Color, agent.currentPath);
|
||||
HexManager.GetNearestDifferCell(agent.Unit.Color, agent.currentPath);
|
||||
_triesToCalculatePath++;
|
||||
}
|
||||
|
||||
_triesToCalculatePath = 0;
|
||||
}
|
||||
|
||||
private Unit GetNearestUnit(int cellDist, AIAgent agent)
|
||||
public static Unit GetNearestUnit(int cellDist, Unit agent)
|
||||
{
|
||||
return (from unit in HexManager.UnitCurrentCell
|
||||
where unit.Key != agent.Enemy.Color &&
|
||||
Vector3.Distance(unit.Value.unit.Instance.transform.position,
|
||||
agent.Enemy.Instance.transform.position) <= cellDist * HexGrid.HexDistance
|
||||
select unit.Value.unit).FirstOrDefault();
|
||||
List<(float dist, Unit unit)> res = new List<(float, Unit)>();
|
||||
try
|
||||
{
|
||||
foreach (var color in (UnitColor[])Enum.GetValues(typeof(UnitColor)))
|
||||
{
|
||||
if (HexManager.UnitCurrentCell.ContainsKey(color) &&
|
||||
HexManager.UnitCurrentCell[color] != (null, null) &&
|
||||
Vector3.Distance(HexManager.UnitCurrentCell[color].unit.Instance.transform.position,
|
||||
agent.Instance.transform.position) <= cellDist * HexGrid.HexDistance
|
||||
&& HexManager.UnitCurrentCell[color].unit.Color != agent.Color)
|
||||
{
|
||||
res.Add((Vector3.Distance(HexManager.UnitCurrentCell[color].unit.Instance.transform.position,
|
||||
agent.Instance.transform.position), HexManager.UnitCurrentCell[color].unit));
|
||||
}
|
||||
}
|
||||
|
||||
return res.Count > 0 ? res.OrderBy(x => x.Item1).First().unit : null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log(e.Message + " " + agent.Color + " ");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public BotState GetNewBehaviour(AIAgent agent)
|
||||
{
|
||||
var attack = agent.Enemy.Inventory.Where(x => x is Bonus { Type: BonusType.Attack }).ToList();
|
||||
if (agent.CurentState is BotState.Attack && agent.Enemy.AttackBonus == 0 && attack.Count > 0)
|
||||
var attack = agent.Unit.Inventory.Where(x => x is Bonus { Type: BonusType.Attack }).ToList();
|
||||
if (agent.CurentState is BotState.Attack && agent.Unit.AttackBonus == 0 && attack.Count > 0)
|
||||
{
|
||||
SetBehaviour(BotState.AttackBonusUsage, agent);
|
||||
return BotState.AttackBonusUsage;
|
||||
}
|
||||
|
||||
var enemy = GetNearestUnit(6, agent);
|
||||
if (enemy != null && agent.Enemy.Hp > agent.Enemy.Data.maxHP / 4 && enemy.IsAlive)
|
||||
|
||||
var enemy = GetNearestUnit(_data.DistanceToAgr, agent.Unit);
|
||||
if (enemy != null && agent.Unit.Hp > agent.Unit.Data.maxHP * _data.PercentToRetreet && enemy.IsAlive)
|
||||
{
|
||||
if (Vector3.Distance(agent.Enemy.Instance.transform.position, enemy.Instance.transform.position) < 4)
|
||||
if (agent.Unit.Hp <= agent.Unit.Data.maxHP * _data.PercentToRetreet ||
|
||||
agent.Unit.UnitView.AvailableShots == 0)
|
||||
{
|
||||
SetBehaviour(BotState.Retreet, agent);
|
||||
return BotState.Retreet;
|
||||
}
|
||||
|
||||
if (Vector3.Distance(agent.Unit.Instance.transform.position, enemy.Instance.transform.position) <=
|
||||
agent.Unit.Weapon.disnatce)
|
||||
{
|
||||
SetBehaviour(BotState.Attack, agent);
|
||||
return BotState.Attack;
|
||||
@ -106,25 +121,23 @@ namespace AI
|
||||
return BotState.Agressive;
|
||||
}
|
||||
|
||||
if (agent.Enemy.Mana <= agent.Enemy.Data.maxMana / 3 &&
|
||||
agent.Enemy.Inventory.Count < agent.Enemy.InventoryCapacity)
|
||||
var item = GetNearestItem(agent);
|
||||
if (((item.dist > 0 && item.dist <= _data.DistaceToCollectBonus) ||
|
||||
agent.Unit.Mana <= agent.Unit.Data.maxMana * _data.ManaPercentToCollectBonus) &&
|
||||
agent.Unit.Inventory.Count < agent.Unit.InventoryCapacity)
|
||||
{
|
||||
SetBehaviour(BotState.CollectingBonus, agent);
|
||||
return BotState.CollectingBonus;
|
||||
}
|
||||
|
||||
var protect = agent.Enemy.Inventory.Where(x => x is Bonus { Type: BonusType.Defence }).ToList();
|
||||
if (protect.Count > 0 && agent.Enemy.Hp <= agent.Enemy.Data.maxHP / 4 && agent.Enemy.DefenceBonus == 0)
|
||||
var protect = agent.Unit.Inventory.Where(x => x is Bonus { Type: BonusType.Defence }).ToList();
|
||||
if (protect.Count > 0 && agent.Unit.Hp <= agent.Unit.Data.maxHP * _data.PercentToUseProtectBonus &&
|
||||
agent.Unit.DefenceBonus == 0)
|
||||
{
|
||||
SetBehaviour(BotState.ProtectBonusUsage, agent);
|
||||
return BotState.ProtectBonusUsage;
|
||||
}
|
||||
|
||||
if (agent.Enemy.Hp <= agent.Enemy.Data.maxHP / 4 && GetNearestUnit(5, agent) != null)
|
||||
{
|
||||
SetBehaviour(BotState.Retreet, agent);
|
||||
return BotState.Retreet;
|
||||
}
|
||||
|
||||
SetBehaviour(BotState.Patrol, agent);
|
||||
return BotState.Patrol;
|
||||
@ -164,7 +177,7 @@ namespace AI
|
||||
|
||||
private void UseBonus(AIAgent agent, BonusType type)
|
||||
{
|
||||
var attack = agent.Enemy.Inventory.Where(x => x is Bonus bonus && bonus.Type == type).ToList();
|
||||
var attack = agent.Unit.Inventory.Where(x => x is Bonus bonus && bonus.Type == type).ToList();
|
||||
if (attack.Count == 0)
|
||||
{
|
||||
GetNewBehaviour(agent);
|
||||
@ -176,44 +189,49 @@ namespace AI
|
||||
|
||||
private void Retreet(AIAgent agent)
|
||||
{
|
||||
var enemy = GetNearestUnit(6, agent)?.Instance.transform;
|
||||
var enemy = GetNearestUnit(6, agent.Unit)?.Instance.transform;
|
||||
if (enemy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var dir = -DirectionHelper.DirectionTo(agent.Enemy.Instance.transform.position,
|
||||
var dir = -DirectionHelper.DirectionTo(agent.Unit.Instance.transform.position,
|
||||
enemy.position);
|
||||
agent.currentPath.Clear();
|
||||
agent.currentPath.Enqueue(DirectionHelper.VectorToDirection(new Vector2(dir.x, dir.z)));
|
||||
}
|
||||
|
||||
private (int dist, HexCell hex) GetNearestItem(AIAgent agent)
|
||||
{
|
||||
var itemsToMove =
|
||||
(from entry in ItemFabric.Items
|
||||
where Vector3.Distance(agent.Unit.Instance.transform.position, entry.Value.transform.position) <
|
||||
10 * HexGrid.HexDistance
|
||||
orderby Vector3.Distance(agent.Unit.Instance.transform.position, entry.Value.transform.position)
|
||||
select entry).ToList();
|
||||
|
||||
|
||||
if (itemsToMove.Count == 0)
|
||||
{
|
||||
return (0, null);
|
||||
}
|
||||
|
||||
var itemToMove = itemsToMove.First();
|
||||
return (
|
||||
(int)(Vector3.Distance(itemToMove.Value.transform.position, agent.Unit.Instance.transform.position) /
|
||||
HexGrid.HexDistance), itemToMove.Value);
|
||||
}
|
||||
|
||||
private void MoveToBonus(AIAgent agent)
|
||||
{
|
||||
HexCell itemToMove = null;
|
||||
var min = 10 * HexGrid.HexDistance;
|
||||
|
||||
foreach (var itemCell in ItemFabric.Items)
|
||||
{
|
||||
if (Vector3.Distance(agent.Enemy.Instance.transform.position, itemCell.Key.transform.position) < min)
|
||||
{
|
||||
min = Vector3.Distance(agent.Enemy.Instance.transform.position, itemCell.Key.transform.position);
|
||||
itemToMove = itemCell.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemToMove == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pathfinding.FindPath(HexManager.UnitCurrentCell[agent.Enemy.Color].cell, itemToMove, agent.currentPath);
|
||||
Pathfinding.FindPath(HexManager.UnitCurrentCell[agent.Unit.Color].cell, GetNearestItem(agent).hex,
|
||||
agent.currentPath);
|
||||
}
|
||||
|
||||
private void AttackEnemy(AIAgent agent)
|
||||
{
|
||||
var enemy = GetNearestUnit(3, agent);
|
||||
var dir = DirectionHelper.DirectionTo(agent.Enemy.Instance.transform.position,
|
||||
var enemy = GetNearestUnit(agent.Unit.Weapon.disnatce, agent.Unit);
|
||||
var dir = DirectionHelper.DirectionTo(agent.Unit.Instance.transform.position,
|
||||
enemy.Instance.transform.position);
|
||||
agent.AttackTarget(new Vector2(dir.x, dir.z));
|
||||
}
|
||||
@ -222,11 +240,11 @@ namespace AI
|
||||
{
|
||||
var enemies = HexManager.UnitCurrentCell
|
||||
.Where(unit =>
|
||||
unit.Value.unit.Color != agent.Enemy.Color &&
|
||||
unit.Value.unit.Color != agent.Unit.Color &&
|
||||
Vector3.Distance(unit.Value.unit.Instance.transform.position,
|
||||
agent.Enemy.Instance.transform.position) <= 6 * HexGrid.HexDistance).ToList();
|
||||
agent.Unit.Instance.transform.position) <= 6 * HexGrid.HexDistance).ToList();
|
||||
|
||||
Pathfinding.FindPath(HexManager.UnitCurrentCell[agent.Enemy.Color].cell,
|
||||
Pathfinding.FindPath(HexManager.UnitCurrentCell[agent.Unit.Color].cell,
|
||||
enemies[Random.Range(0, enemies.Count)].Value.cell, agent.currentPath);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace AI
|
||||
{
|
||||
return;
|
||||
}
|
||||
while (foundPathIter < 3 && currentTile == null)
|
||||
while (foundPathIter < 3 && currentTile != null)
|
||||
{
|
||||
|
||||
if (currentTile.coordinates.Z == endTile.coordinates.Z)
|
||||
|
@ -1,19 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Timers;
|
||||
using System.Collections.Generic;
|
||||
using AI;
|
||||
using CamControl;
|
||||
using Chars;
|
||||
using DefaultNamespace;
|
||||
using DefaultNamespace.AI;
|
||||
using DG.Tweening;
|
||||
using GameUI;
|
||||
using HexFiled;
|
||||
using Items;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
using Weapons;
|
||||
using Object = UnityEngine.Object;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Controller
|
||||
@ -22,18 +18,18 @@ namespace Controller
|
||||
{
|
||||
public GameInit(Controllers controllers, Data.Data data)
|
||||
{
|
||||
|
||||
AIManager aiManager = new AIManager();
|
||||
new AIManager(data.AIData);
|
||||
var hexGrid = new HexGrid(data.FieldData);
|
||||
new MusicController();
|
||||
new VFXController(data.VFXData);
|
||||
new VFXController();
|
||||
MusicController.Instance.SetMusicData(data.MusicData);
|
||||
controllers.Add(hexGrid);
|
||||
var paintedController = new PaintedController();
|
||||
|
||||
data.WeaponsData.WeaponsList.ForEach(x => x.SetModifiedDamage(0));
|
||||
|
||||
ItemFabric itemFabric = new ItemFabric(data.ItemsData);
|
||||
controllers.Add(itemFabric);
|
||||
hexGrid.OnGridLoaded += () => controllers.Add(itemFabric);
|
||||
|
||||
UIController uiController = new UIController(data.UIData);
|
||||
uiController.Spawn(); //TODO при паузе Dotween ругается
|
||||
@ -45,6 +41,7 @@ namespace Controller
|
||||
{
|
||||
var weapon = JsonUtility.FromJson<Weapon>(data.ChosenWeapon);
|
||||
weapon.SetModifiedDamage(0);
|
||||
|
||||
player = new Unit(unit, weapon, hexGrid);
|
||||
PlayerControl playerControl = new PlayerControl(player, uiController.PlayerControlView,
|
||||
uiController.PlayerInventoryView);
|
||||
@ -52,11 +49,16 @@ namespace Controller
|
||||
CameraControl cameraControl =
|
||||
new CameraControl(Camera.main, data.CameraData);
|
||||
controllers.Add(cameraControl);
|
||||
|
||||
player.onPlayerSpawned += p => controllers.Add(playerControl);
|
||||
|
||||
player.OnDeath += unit1 => controllers.Remove(playerControl);
|
||||
|
||||
player.onPlayerSpawned += cameraControl.InitCameraControl;
|
||||
player.onPlayerSpawned += MusicController.Instance.AddAudioListener;
|
||||
units.Add(player);
|
||||
|
||||
player.OnDeath += uiController.AdsMob.ShowCanvas;
|
||||
player.OnDeath += paintedController.PaintOnDeath;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -65,27 +67,22 @@ namespace Controller
|
||||
var enemyController = new EnemyController(unit, enemy);
|
||||
controllers.Add(enemyController);
|
||||
units.Add(enemy);
|
||||
AIAgent agent = new AIAgent(unit, enemy, aiManager);
|
||||
controllers.Add(agent);
|
||||
enemy.OnDeath += x => {controllers.Remove(agent);};
|
||||
AIAgent agent = new AIAgent(unit, enemy);
|
||||
enemy.onPlayerSpawned += x => controllers.Add(agent);
|
||||
enemy.OnDeath += x => { controllers.Remove(agent); };
|
||||
enemy.OnDeath += paintedController.PaintOnDeath;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var unitFactory = new UnitFactory(units, hexGrid);
|
||||
|
||||
hexGrid.OnGridLoaded += unitFactory.Spawn;
|
||||
|
||||
var paintedController = new PaintedController();
|
||||
|
||||
hexGrid.OnHexPainted += paintedController.SetHexColors;
|
||||
|
||||
hexGrid.OnHexPainted += itemFabric.UpdateCellToOpenList;
|
||||
hexGrid.OnHexPainted += paintedController.CheckDeathOrDestroy;
|
||||
}
|
||||
|
||||
private List<Type> SetUpItems()
|
||||
{
|
||||
return new List<Type>() { typeof(Building), typeof(Bonus)};
|
||||
}
|
||||
}
|
||||
}
|
24
Assets/Scripts/Data/AIData.cs
Normal file
24
Assets/Scripts/Data/AIData.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
[CreateAssetMenu(fileName = "AIData", menuName = "Data/AIData", order = 0)]
|
||||
public class AIData : ScriptableObject
|
||||
{
|
||||
[SerializeField] private int _distanceToAgr;
|
||||
[SerializeField][Range(0,1)] private float _percentToRetreet;
|
||||
[SerializeField][Range(0,1)] private float _percentToUseProtectBonus;
|
||||
[SerializeField][Range(0,1)] private float _manaPercentToCollectBonus;
|
||||
[SerializeField] private int _distaceToCollectBonus;
|
||||
|
||||
public int DistanceToAgr => _distanceToAgr;
|
||||
|
||||
public float PercentToUseProtectBonus => _percentToUseProtectBonus;
|
||||
|
||||
public float PercentToRetreet => _percentToRetreet;
|
||||
|
||||
public float ManaPercentToCollectBonus => _manaPercentToCollectBonus;
|
||||
|
||||
public int DistaceToCollectBonus => _distaceToCollectBonus;
|
||||
}
|
||||
}
|
3
Assets/Scripts/Data/AIData.cs.meta
Normal file
3
Assets/Scripts/Data/AIData.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39f9814b967541eeaf31ef497d721a87
|
||||
timeCreated: 1642409153
|
@ -22,21 +22,22 @@ namespace Data
|
||||
private MusicData _musicData;
|
||||
[SerializeField] private string itemDataPath;
|
||||
private ItemsData _itemsData;
|
||||
[SerializeField] private string vfxDataPath;
|
||||
private VFXData _vfxData;
|
||||
[SerializeField] private string aiDataPath;
|
||||
private AIData _aiData;
|
||||
[SerializeField] private string chosenWeaponDataPath;
|
||||
|
||||
public string ChosenWeapon => File.ReadAllText(Application.persistentDataPath + "/" + chosenWeaponDataPath);
|
||||
|
||||
public VFXData VFXData {
|
||||
public AIData AIData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_vfxData == null)
|
||||
if (_aiData == null)
|
||||
{
|
||||
_vfxData = Load<VFXData>("Data/" + vfxDataPath);
|
||||
_aiData = Load<AIData>("Data/" + aiDataPath);
|
||||
}
|
||||
|
||||
return _vfxData;
|
||||
return _aiData;
|
||||
}
|
||||
}
|
||||
public ItemsData ItemsData
|
||||
|
@ -1,10 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
[CreateAssetMenu(fileName = "VFXData", menuName = "Data/VFXData", order = 0)]
|
||||
public class VFXData : ScriptableObject
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20727ea91acd422788176450128f9251
|
||||
timeCreated: 1641837401
|
@ -11,7 +11,8 @@ namespace GameUI
|
||||
[SerializeField] private GameObject item;
|
||||
[SerializeField] private GameObject grid;
|
||||
|
||||
public Action<Building> OnBuildingInvoked;
|
||||
public Action<Item> OnBuildingInvoked;
|
||||
|
||||
|
||||
private List<Button> _buttons;
|
||||
private Button[] _freeButtons;
|
||||
@ -38,7 +39,6 @@ namespace GameUI
|
||||
|
||||
private void SwitchButton(Button button)
|
||||
{
|
||||
var item = _dictionary[button];
|
||||
|
||||
button.gameObject.SetActive(false);
|
||||
for (int i = 0; i < _freeButtons.Length; i++)
|
||||
@ -69,10 +69,10 @@ namespace GameUI
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case Bonus _bonus:
|
||||
case Bonus bonus:
|
||||
{
|
||||
button.onClick.RemoveAllListeners();
|
||||
_bonus.Invoke();
|
||||
bonus.Invoke();
|
||||
for (int i = 0; i < _freeButtons.Length; i++)
|
||||
{
|
||||
if (_freeButtons[i] != null) continue;
|
||||
@ -83,10 +83,13 @@ namespace GameUI
|
||||
button.gameObject.SetActive(false);
|
||||
break;
|
||||
}
|
||||
case Building _building:
|
||||
_building.Invoke(() => SwitchButton(button));
|
||||
|
||||
OnBuildingInvoked?.Invoke(_building);
|
||||
case Building building:
|
||||
building.Invoke(() => SwitchButton(button));
|
||||
OnBuildingInvoked?.Invoke(building);
|
||||
break;
|
||||
case CaptureAbility ability:
|
||||
ability.Invoke(() => SwitchButton(button));
|
||||
OnBuildingInvoked?.Invoke(ability);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -14,17 +14,13 @@ namespace HexFiled
|
||||
public HexCoordinates coordinates;
|
||||
public Action<HexCell> onHexPainted;
|
||||
|
||||
public float gCost;
|
||||
public float hCost;
|
||||
public float fCost;
|
||||
public HexCell parent;
|
||||
|
||||
|
||||
[SerializeField] private HexCell[] neighbors;
|
||||
private Item _item;
|
||||
private UnitColor _color;
|
||||
private MeshRenderer _renderer;
|
||||
|
||||
public HexCell[] Neighbors => neighbors;
|
||||
public UnitColor Color => _color;
|
||||
|
||||
public Item Item => _item;
|
||||
@ -76,7 +72,7 @@ namespace HexFiled
|
||||
public void SetNeighbor(HexDirection direction, HexCell cell)
|
||||
{
|
||||
neighbors[(int)direction] = cell;
|
||||
cell.neighbors[(int)direction.Opposite()] = this;
|
||||
cell.neighbors[(int)direction.Back()] = this;
|
||||
}
|
||||
|
||||
public void PaintHex(UnitColor color)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user