fix: Fog masking

This commit is contained in:
Alexandre Coirier
2026-05-29 15:24:31 +02:00
parent 5611574882
commit aa82cacd5c
8 changed files with 1586 additions and 299 deletions
@@ -0,0 +1,61 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-5747633948245401730
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: M_fog
m_Shader: {fileID: -6465566751694194690, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _MaskID: 2
- _QueueControl: 0
- _QueueOffset: 0
m_Colors:
- _ColorA: {r: 1.244819, g: 0.500609, b: 0.2289997, a: 1}
- _ColorB: {r: 0.7924528, g: 0.2773978, b: 0.09344961, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a718279ac49cd84ea2afe0e7a591235
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -10,7 +10,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1285827998720199852} - component: {fileID: 1285827998720199852}
- component: {fileID: 1521426653995865631} - component: {fileID: 1521426653995865631}
m_Layer: 0 m_Layer: 21
m_Name: Fog m_Name: Fog
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@@ -1508,11 +1508,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_02 value: Fog_02
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -1586,11 +1590,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_07 value: Fog_07
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -1664,11 +1672,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_07 (1) value: Fog_07 (1)
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -1742,11 +1754,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_03 value: Fog_03
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -1820,11 +1836,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_06 value: Fog_06
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -1898,11 +1918,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_04 value: Fog_04
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -1976,11 +2000,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_07 (2) value: Fog_07 (2)
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -2054,11 +2082,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_01 value: Fog_01
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -2132,11 +2164,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_05 value: Fog_05
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -2210,11 +2246,15 @@ PrefabInstance:
- target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: -7511558181221131132, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
objectReference: {fileID: -876546973899608171, guid: 0f1522c6af8cc4d47a4bbc5401f58523, type: 3} objectReference: {fileID: 2100000, guid: 7a718279ac49cd84ea2afe0e7a591235, type: 2}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3} - target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Fog_02 value: Fog_02
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 4ff3091676a78724ca2ae5d60353d400, type: 3}
propertyPath: m_Layer
value: 21
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -215,6 +215,9 @@
}, },
{ {
"m_Id": "aed770d7b8364459a7bfdfc34cbd2ab8" "m_Id": "aed770d7b8364459a7bfdfc34cbd2ab8"
},
{
"m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
} }
], ],
"m_GroupDatas": [], "m_GroupDatas": [],
@@ -271,11 +274,39 @@
}, },
"m_InputSlot": { "m_InputSlot": {
"m_Node": { "m_Node": {
"m_Id": "c5d342277052409f87283f2c60ccf3a1" "m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
}, },
"m_SlotId": 13 "m_SlotId": 13
} }
}, },
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
},
"m_SlotId": 15
},
"m_InputSlot": {
"m_Node": {
"m_Id": "1035dda04278422b988336d6984e2045"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "3e46eb76f3e94a73912aecb313b485e5"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
},
"m_SlotId": 18
}
},
{ {
"m_OutputSlot": { "m_OutputSlot": {
"m_Node": { "m_Node": {
@@ -383,7 +414,7 @@
}, },
"m_InputSlot": { "m_InputSlot": {
"m_Node": { "m_Node": {
"m_Id": "c5d342277052409f87283f2c60ccf3a1" "m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
}, },
"m_SlotId": 16 "m_SlotId": 16
} }
@@ -397,7 +428,7 @@
}, },
"m_InputSlot": { "m_InputSlot": {
"m_Node": { "m_Node": {
"m_Id": "c5d342277052409f87283f2c60ccf3a1" "m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
}, },
"m_SlotId": 17 "m_SlotId": 17
} }
@@ -481,7 +512,7 @@
}, },
"m_InputSlot": { "m_InputSlot": {
"m_Node": { "m_Node": {
"m_Id": "c5d342277052409f87283f2c60ccf3a1" "m_Id": "2f58e7c00b5c4814b4a3d8c13322694d"
}, },
"m_SlotId": 14 "m_SlotId": 14
} }
@@ -528,20 +559,6 @@
"m_SlotId": 0 "m_SlotId": 0
} }
}, },
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "c5d342277052409f87283f2c60ccf3a1"
},
"m_SlotId": 15
},
"m_InputSlot": {
"m_Node": {
"m_Id": "1035dda04278422b988336d6984e2045"
},
"m_SlotId": 0
}
},
{ {
"m_OutputSlot": { "m_OutputSlot": {
"m_Node": { "m_Node": {
@@ -836,6 +853,22 @@
"m_LiteralMode": false "m_LiteralMode": false
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "04f9be2a155a4360a9351c1e284fa94b",
"m_Id": 15,
"m_DisplayName": "Alpha",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": [],
"m_LiteralMode": false
}
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
@@ -1191,9 +1224,9 @@
"m_Expanded": true, "m_Expanded": true,
"m_Position": { "m_Position": {
"serializedVersion": "2", "serializedVersion": "2",
"x": 596.0, "x": 845.0,
"y": 1187.0, "y": 1202.0,
"width": 110.0, "width": 116.0,
"height": 34.0 "height": 34.0
} }
}, },
@@ -1413,6 +1446,62 @@
} }
} }
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "2f58e7c00b5c4814b4a3d8c13322694d",
"m_Group": {
"m_Id": ""
},
"m_Name": "Mask (Custom Function)",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 1002.0,
"y": 1119.0,
"width": 185.0,
"height": 190.0
}
},
"m_Slots": [
{
"m_Id": "c0c268cf854445c3a84028f37581f005"
},
{
"m_Id": "edda2fdb41e64d0d963b57e37eb02902"
},
{
"m_Id": "fafb345f71e44af2a725314204a0d6aa"
},
{
"m_Id": "945c2be648d84367930876227e5c006c"
},
{
"m_Id": "84e8c256f41d4dc5be903041907679c3"
},
{
"m_Id": "04f9be2a155a4360a9351c1e284fa94b"
}
],
"synonyms": [
"code",
"HLSL"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 0,
"m_FunctionName": "Mask",
"m_FunctionSource": "2f64e213049952b44ac4bed6f62cafda",
"m_FunctionSourceUsePragmas": true,
"m_FunctionBody": "Enter function body here..."
}
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData", "m_Type": "UnityEditor.ShaderGraph.CategoryData",
@@ -1580,7 +1669,7 @@
"m_Expanded": true, "m_Expanded": true,
"m_Position": { "m_Position": {
"serializedVersion": "2", "serializedVersion": "2",
"x": 411.0, "x": 410.0,
"y": 443.0, "y": 443.0,
"width": 206.0, "width": 206.0,
"height": 130.0 "height": 130.0
@@ -1803,22 +1892,6 @@
} }
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "45ccaed6d4d547b090b274a4421169f6",
"m_Id": 15,
"m_DisplayName": "Alpha",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": [],
"m_LiteralMode": false
}
{ {
"m_SGVersion": 1, "m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Matrix4ShaderProperty", "m_Type": "UnityEditor.ShaderGraph.Matrix4ShaderProperty",
@@ -2674,8 +2747,8 @@
"m_Expanded": true, "m_Expanded": true,
"m_Position": { "m_Position": {
"serializedVersion": "2", "serializedVersion": "2",
"x": 595.9999389648438, "x": 845.0,
"y": 1220.9998779296875, "y": 1236.0,
"width": 115.0, "width": 115.0,
"height": 34.0 "height": 34.0
} }
@@ -2825,8 +2898,8 @@
"m_Expanded": true, "m_Expanded": true,
"m_Position": { "m_Position": {
"serializedVersion": "2", "serializedVersion": "2",
"x": 594.9999389648438, "x": 844.0,
"y": 1254.9998779296875, "y": 1270.0,
"width": 116.0, "width": 116.0,
"height": 34.0 "height": 34.0
} }
@@ -2977,6 +3050,54 @@
} }
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Matrix4MaterialSlot",
"m_ObjectId": "84e8c256f41d4dc5be903041907679c3",
"m_Id": 17,
"m_DisplayName": "Mask2",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Mask2",
"m_StageCapability": 3,
"m_Value": {
"e00": 1.0,
"e01": 0.0,
"e02": 0.0,
"e03": 0.0,
"e10": 0.0,
"e11": 1.0,
"e12": 0.0,
"e13": 0.0,
"e20": 0.0,
"e21": 0.0,
"e22": 1.0,
"e23": 0.0,
"e30": 0.0,
"e31": 0.0,
"e32": 0.0,
"e33": 1.0
},
"m_DefaultValue": {
"e00": 1.0,
"e01": 0.0,
"e02": 0.0,
"e03": 0.0,
"e10": 0.0,
"e11": 1.0,
"e12": 0.0,
"e13": 0.0,
"e20": 0.0,
"e21": 0.0,
"e22": 1.0,
"e23": 0.0,
"e30": 0.0,
"e31": 0.0,
"e32": 0.0,
"e33": 1.0
}
}
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.MultiplyNode", "m_Type": "UnityEditor.ShaderGraph.MultiplyNode",
@@ -3034,22 +3155,6 @@
"m_DefaultValue": false "m_DefaultValue": false
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "8892c2b112c14c028eddce5e899710b2",
"m_Id": 14,
"m_DisplayName": "MaskID",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "MaskID",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": [],
"m_LiteralMode": false
}
{ {
"m_SGVersion": 1, "m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty",
@@ -3312,7 +3417,7 @@
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Matrix4MaterialSlot", "m_Type": "UnityEditor.ShaderGraph.Matrix4MaterialSlot",
"m_ObjectId": "92ea1472d59d4857abd59195ace147a4", "m_ObjectId": "945c2be648d84367930876227e5c006c",
"m_Id": 16, "m_Id": 16,
"m_DisplayName": "Mask1", "m_DisplayName": "Mask1",
"m_SlotType": 0, "m_SlotType": 0,
@@ -3616,54 +3721,6 @@
"m_LiteralMode": false "m_LiteralMode": false
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Matrix4MaterialSlot",
"m_ObjectId": "a363c8f5686c459792f7e2c53fb8dc8a",
"m_Id": 17,
"m_DisplayName": "Mask2",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Mask2",
"m_StageCapability": 3,
"m_Value": {
"e00": 1.0,
"e01": 0.0,
"e02": 0.0,
"e03": 0.0,
"e10": 0.0,
"e11": 1.0,
"e12": 0.0,
"e13": 0.0,
"e20": 0.0,
"e21": 0.0,
"e22": 1.0,
"e23": 0.0,
"e30": 0.0,
"e31": 0.0,
"e32": 0.0,
"e33": 1.0
},
"m_DefaultValue": {
"e00": 1.0,
"e01": 0.0,
"e02": 0.0,
"e03": 0.0,
"e10": 0.0,
"e11": 1.0,
"e12": 0.0,
"e13": 0.0,
"e20": 0.0,
"e21": 0.0,
"e22": 1.0,
"e23": 0.0,
"e30": 0.0,
"e31": 0.0,
"e32": 0.0,
"e33": 1.0
}
}
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode", "m_Type": "UnityEditor.ShaderGraph.PropertyNode",
@@ -3762,8 +3819,8 @@
"m_Expanded": true, "m_Expanded": true,
"m_Position": { "m_Position": {
"serializedVersion": "2", "serializedVersion": "2",
"x": 592.0, "x": 841.0,
"y": 1153.0, "y": 1168.0,
"width": 114.0, "width": 114.0,
"height": 34.0 "height": 34.0
} }
@@ -3945,6 +4002,29 @@
"m_Labels": [] "m_Labels": []
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "c0c268cf854445c3a84028f37581f005",
"m_Id": 18,
"m_DisplayName": "New",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "New",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{ {
"m_SGVersion": 1, "m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Matrix4ShaderProperty", "m_Type": "UnityEditor.ShaderGraph.Matrix4ShaderProperty",
@@ -4106,23 +4186,8 @@
{ {
"m_Id": "8c26652d47d64417a9ce7a93bb811466" "m_Id": "8c26652d47d64417a9ce7a93bb811466"
}, },
{
"m_Id": "8892c2b112c14c028eddce5e899710b2"
},
{
"m_Id": "fdc7026b3c2f43f9af9342c37132e6cc"
},
{
"m_Id": "92ea1472d59d4857abd59195ace147a4"
},
{
"m_Id": "a363c8f5686c459792f7e2c53fb8dc8a"
},
{ {
"m_Id": "8ead54ba7a8d487ea3f55e930101215f" "m_Id": "8ead54ba7a8d487ea3f55e930101215f"
},
{
"m_Id": "45ccaed6d4d547b090b274a4421169f6"
} }
], ],
"synonyms": [ "synonyms": [
@@ -4837,6 +4902,22 @@
"m_Space": 2 "m_Space": 2
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "edda2fdb41e64d0d963b57e37eb02902",
"m_Id": 14,
"m_DisplayName": "MaskID",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "MaskID",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": [],
"m_LiteralMode": false
}
{ {
"m_SGVersion": 1, "m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Matrix4ShaderProperty", "m_Type": "UnityEditor.ShaderGraph.Matrix4ShaderProperty",
@@ -5072,34 +5153,10 @@
"m_ColorMode": 0 "m_ColorMode": 0
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
"m_ObjectId": "fb84ed33198947c792183c161d398299",
"m_Id": 0,
"m_DisplayName": "Position",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Position",
"m_StageCapability": 1,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_Space": 0
}
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Matrix4MaterialSlot", "m_Type": "UnityEditor.ShaderGraph.Matrix4MaterialSlot",
"m_ObjectId": "fdc7026b3c2f43f9af9342c37132e6cc", "m_ObjectId": "fafb345f71e44af2a725314204a0d6aa",
"m_Id": 13, "m_Id": 13,
"m_DisplayName": "Mask0", "m_DisplayName": "Mask0",
"m_SlotType": 0, "m_SlotType": 0,
@@ -5144,6 +5201,30 @@
} }
} }
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
"m_ObjectId": "fb84ed33198947c792183c161d398299",
"m_Id": 0,
"m_DisplayName": "Position",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Position",
"m_StageCapability": 1,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_Space": 0
}
{ {
"m_SGVersion": 0, "m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
@@ -220,80 +220,6 @@ float WorldDistort(float3 PositionWS, float3 NormalWS, float Angle, float Tripla
return stripes; return stripes;
} }
float ProjectionMask(
float3 PositionWS,
float3 CamPositionWS,
float3 RectPositionWS,
float3 RectNormalWS,
float3 RectUpWS,
float2 RectSize,
float Oval)
{
// Build the rectangle local frame
float3 N = normalize(RectNormalWS);
float3 U = normalize(RectUpWS);
float3 R = normalize(cross(N, U)); // Right axis
U = normalize(cross(R, N)); // Recompute Up orthogonally in case RectUpWS is not perfectly perpendicular to RectNormalWS
// Ray from camera toward the fragment
float3 rayDir = normalize(PositionWS - CamPositionWS);
// Ray-plane intersection
// Plane equation: dot(P - RectPositionWS, N) = 0
float denom = dot(rayDir, N);
// Ray is parallel to the plane or facing away — no hit
if (abs(denom) < 1e-6)
return 0;
float t = dot(RectPositionWS - CamPositionWS, N) / denom;
// Intersection must be in front of the camera (t > 0)
// and not beyond the fragment (t <= distance from camera to fragment)
float tFrag = dot(PositionWS - CamPositionWS, rayDir);
if (t < 0.0 || t > tFrag + 1e-4)
return 0;
// Compute the hit point on the plane
float3 hitPoint = CamPositionWS + rayDir * t;
// Project hit point into the rectangle local space
float3 localVec = hitPoint - RectPositionWS;
float localU = dot(localVec, R); // horizontal axis
float localV = dot(localVec, U); // vertical axis
float halfW = RectSize.x * 0.5;
float halfH = RectSize.y * 0.5;
// Corner radius: 0 = rectangle, min(halfW, halfH) = oval
float radius = saturate(Oval) * min(halfW, halfH);
// Rounded rectangle SDF
float2 uv = float2(localU, localV);
float2 ext = float2(halfW, halfH);
float2 q = abs(uv) - ext + radius;
float sdf = length(max(q, 0.0)) - radius;
return sdf <= 0.0 ? 1.0 : 0.0;
}
float SampleProjectionMask(float3 PositionWS, float4x4 M)
{
if (M[0].w == 0)
return 0;
return ProjectionMask(
PositionWS,
M[0].xyz, // CamPositionWS
M[1].xyz, // RectPositionWS
M[3].xyz, // RectNormalWS
M[2].xyz, // RectUpWS
float2(M[2].w, M[3].w), // RectSize
M[1].w // Shape
);
}
void EnkiBillal_float void EnkiBillal_float
( (
float4 Color, float4 Color,
@@ -308,12 +234,7 @@ void EnkiBillal_float
float StripesWidth, float StripesWidth,
float StripesSmooth, float StripesSmooth,
int Step, int Step,
float MaskID, out float3 Output
float4x4 Mask0,
float4x4 Mask1,
float4x4 Mask2,
out float3 Output,
out float Alpha
) )
{ {
float3 scaledPositionOS = PositionOS * ObjectScale; float3 scaledPositionOS = PositionOS * ObjectScale;
@@ -384,38 +305,6 @@ void EnkiBillal_float
//Output = PerlinColor3D(PositionWS, 5); //Output = PerlinColor3D(PositionWS, 5);
//Output = smoothstep(.97, .93, ao); //Output = smoothstep(.97, .93, ao);
// Mask
if (Mask2[0].w == 1)
{
float mask = SampleProjectionMask(PositionWS, Mask2);
Alpha = (MaskID <= 1) ? 1 - mask : mask;
}
else if (MaskID == 0)
{
Alpha = 1;
}
else
{
float Active = Mask0[0].w + Mask1[0].w; // + Mask2[0].w;
if (Active > 0)
{
float mask = saturate(
SampleProjectionMask(PositionWS, Mask0) +
SampleProjectionMask(PositionWS, Mask1) // +
//SampleProjectionMask(PositionWS, Mask2)
);
Alpha = (MaskID == 1) ? 1 - mask : mask;
}
else
{
Alpha = (MaskID == 1) ? 0 : 1;
}
}
} }
#endif #endif
@@ -0,0 +1,120 @@
#ifndef MASK_INCLUDED
#define MASK_INCLUDED
float ProjectionMask(
float3 PositionWS,
float3 CamPositionWS,
float3 RectPositionWS,
float3 RectNormalWS,
float3 RectUpWS,
float2 RectSize,
float Oval)
{
// Build the rectangle local frame
float3 N = normalize(RectNormalWS);
float3 U = normalize(RectUpWS);
float3 R = normalize(cross(N, U)); // Right axis
U = normalize(cross(R, N)); // Recompute Up orthogonally in case RectUpWS is not perfectly perpendicular to RectNormalWS
// Ray from camera toward the fragment
float3 rayDir = normalize(PositionWS - CamPositionWS);
// Ray-plane intersection
// Plane equation: dot(P - RectPositionWS, N) = 0
float denom = dot(rayDir, N);
// Ray is parallel to the plane or facing away — no hit
if (abs(denom) < 1e-6)
return 0;
float t = dot(RectPositionWS - CamPositionWS, N) / denom;
// Intersection must be in front of the camera (t > 0)
// and not beyond the fragment (t <= distance from camera to fragment)
float tFrag = dot(PositionWS - CamPositionWS, rayDir);
if (t < 0.0 || t > tFrag + 1e-4)
return 0;
// Compute the hit point on the plane
float3 hitPoint = CamPositionWS + rayDir * t;
// Project hit point into the rectangle local space
float3 localVec = hitPoint - RectPositionWS;
float localU = dot(localVec, R); // horizontal axis
float localV = dot(localVec, U); // vertical axis
float halfW = RectSize.x * 0.5;
float halfH = RectSize.y * 0.5;
// Corner radius: 0 = rectangle, min(halfW, halfH) = oval
float radius = saturate(Oval) * min(halfW, halfH);
// Rounded rectangle SDF
float2 uv = float2(localU, localV);
float2 ext = float2(halfW, halfH);
float2 q = abs(uv) - ext + radius;
float sdf = length(max(q, 0.0)) - radius;
return sdf <= 0.0 ? 1.0 : 0.0;
}
float SampleProjectionMask(float3 PositionWS, float4x4 M)
{
if (M[0].w == 0)
return 0;
return ProjectionMask(
PositionWS,
M[0].xyz, // CamPositionWS
M[1].xyz, // RectPositionWS
M[3].xyz, // RectNormalWS
M[2].xyz, // RectUpWS
float2(M[2].w, M[3].w), // RectSize
M[1].w // Shape
);
}
void Mask_float
(
float3 PositionWS,
float MaskID,
float4x4 Mask0,
float4x4 Mask1,
float4x4 Mask2,
out float Alpha
)
{
Alpha = 1;
if (Mask2[0].w == 1)
{
float mask = SampleProjectionMask(PositionWS, Mask2);
Alpha = (MaskID <= 1) ? 1 - mask : mask;
}
else if (MaskID == 0)
{
Alpha = 1;
}
else
{
float Active = Mask0[0].w + Mask1[0].w; // + Mask2[0].w;
if (Active > 0)
{
float mask = saturate(
SampleProjectionMask(PositionWS, Mask0) +
SampleProjectionMask(PositionWS, Mask1) // +
//SampleProjectionMask(PositionWS, Mask2)
);
Alpha = (MaskID == 1) ? 1 - mask : mask;
}
else
{
Alpha = (MaskID == 1) ? 0 : 1;
}
}
}
#endif
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2f64e213049952b44ac4bed6f62cafda
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: