Depthkit package

depthkit_samples
Nadine Ganz 2024-05-14 17:05:58 +02:00
parent a2f8903010
commit c32b0a1a11
197 changed files with 11509 additions and 1 deletions

View File

@ -0,0 +1,31 @@
## Changelog
### 0.5.1
* Update SDK license agreement
### 0.5.0
* Updated to Unity 2022.3
### 0.4.3
* Updated assembly definitions.
### 0.4.2
* Updated com.unity.shadergraph dependency
* Updated depthkit.core.shadergraph dependency
### 0.4.1
* Bug fixes
### 0.4.0
* Updated to Unity 2020.3
* Show clip info removed from Studio Shader Graph Look
### 0.3.1
* Updated Shadergraph asset
### 0.3.0
* Added material property block support
* Use new ShaderGraphLook abstraction as base class for StudioShaderGraphLook
### 0.2.1
* Added depthkit icon to all depthkit components

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8992198b1d798d648a0678829c664237
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ae903a1884798b14d9292216a3b9244b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
{
"name": "Depthkit.Studio.ShaderGraph.Editor",
"references": [
"GUID:d757665d4a59fe94bab8bd5391e60e3d",
"GUID:3fcfa8946fa8f2b4bae0b88785a14d3e",
"GUID:24074500c51871f48bb3112a39fc1e55",
"GUID:dda20bba0e11f0c4abe396c411e7f50c"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 54974cc00f8c95a4ba9f2f211d3cf7ce
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.Collections.Generic;
using System;
namespace Depthkit
{
public class StudioShaderGraphLookGizmosDrawer
{
[DrawGizmo(GizmoType.Selected | GizmoType.Active)]
static void DrawGizmosFor(StudioShaderGraphLook look, GizmoType gizmoType)
{
if (look.showCameraFrustums)
{
Depthkit.Util.RenderMetadataGizmos(look.depthkitClip.metadata, look.transform);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cdd71b63bd749b64b9f159cd4008f61f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,44 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEditor;
namespace Depthkit {
public class StudioShaderGraphMenu
{
[MenuItem ("Assets/Create/Shader/Depthkit/Studio Look - Shader Graph")]
static void CreateDepthkitStudioSRPLookShaderGraph(MenuCommand menuCommand)
{
string filename;
if(Selection.assetGUIDs.Length > 0)
{
string clickedAssetGuid = Selection.assetGUIDs[0];
string clickedPath = AssetDatabase.GUIDToAssetPath(clickedAssetGuid);
filename = Depthkit.Util.GetNextFileName(clickedPath + "/MyStudioLook", ".shadergraph");
}
else
{
filename = Depthkit.Util.GetNextFileName("Assets/MyStudioLook", ".shadergraph");
}
AssetDatabase.CopyAsset("Packages/nyc.scatter.depthkit.studio.shadergraph/Runtime/Resources/Shaders/Depthkit Studio Photo Look Unlit.shadergraph", filename);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4bba83cc42f363e4b9f29e1ce26b6e0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,138 @@
SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT
The text of this license (this “License”) may be found at: www.depthkit.tv/license-agreement-v1
Thank you for your interest in using the Simile Inc dba Scatter ("Scatter") Software Development Kit (the "SDK").
In order to obtain and use the SDK, you must first agree to the terms of this License. If you do not agree to the
terms of this License, then you may not use the SDK.
SDK LICENSE
1. Subject to the terms and conditions of this License, Scatter hereby
grants to you a worldwide, non-exclusive, royalty-free, sublicenseable license to use, reproduce, modify,
embed and redistribute (subject to restrictions below) the software contained in the SDK, including, but
not limited to, the samples, headers, documentation and source code. This License is subject to the
following terms and conditions:
1.1 This license grants you the non-exclusive license and right to use the SDK to develop
methods to play back content produced in the software suite known as Depth Kit (such content referred
to as your “Content”) in the Unity game engine, as well as other features that may be added from time to
time by Scatter. You may not use the SDK to connect Depth Kit to any software platform or game engine
other than Unity.
1.2 For avoidance of doubt, when you use the SDK in or with your Content, you retain all
rights to your Content, and you have no obligations to share or license your Content (including your
source and object code) to Scatter or any third parties; provided, however, Scatter retains all rights to the
SDK and the headers, libraries and APIs of Depth Kit and other tools made available by Scatter, including
those that may be incorporated into your Content by virtue of your producing it through Depth Kit.
1.3 You agree not to commit any act intended to (a) interfere with the normal operation of
Depth Kit or the SDK, (b) provide software to Depth Kit users or developers that would induce breach of
any Scatter agreements, or (c) provide software to Scatter or Depth Kit users that contains malware,
viruses, hacks, bots, Trojan horses, or other malicious code.
1.4 You may not use the SDK for any purpose not expressly permitted by this License. You
may not:
a. decompile;
b. reverse engineer;
c. disassemble; or
d. attempt to derive the source code of any part of the SDK where source code is
not directly provided to you, or any other software or firmware provided to you by Scatter in binary
form (except as and only to the extent any foregoing restriction is prohibited by applicable law).
REDISTRIBUTION
2. Subject to the terms and conditions of this License, your license to redistribute and sublicense the SDK
is also expressly made subject to the following conditions:
2.1 You may sublicense and redistribute the binary or object code form of the SDK in whole
for no charge or as part of a for-charge piece of Content; provided, however, you may only license,
sublicense or redistribute the binary or object code of the SDK (and not the SDKs source code) in its
entirety. The SDK, including its associated libraries, and your Content that includes any portion of the
SDK, may only be used with Depth Kit and may not be used, licensed, or sublicensed to interface with
software that is not authorized and approved by Scatter;
2.2 You must include with all such redistributed or sublicensed SDK code the following copyright
notice: “Copyright 2016-2024 Simile Inc dba Scatter. All rights reserved.”;
2.3 You must give any other recipients of the SDK a copy of this License as such recipients,
licensees or sublicensees may only use the SDK subject to the terms of this License and such recipient's,
licensee's or sublicensee's agreement to and acceptance of this License with Scatter; and
2.4 The SDK includes a “LICENSE” text file (the “License Notice”), and any SDK distribution that
you distribute must include a copy of this License with the License Notice.
GENERAL PROVISIONS
3. Additional Materials
3.1 Scatter may include in this SDK additional content (e.g., samples) for demonstration,
references or other specific purposes. Such content will be clearly marked in the SDK and is subject to
any included terms and conditions.
3.2 Your use of third-party materials included in the SDK, or which the SDK may be dependent
upon (including without limitation Unity), may be subject to other terms and conditions typically found in
separate third-party license agreements or "READ ME" files included with such third-party materials. To
the extent such other terms and conditions conflict with the terms and conditions of this License, the
former will control with respect to the applicable third-party materials. The terms of licensing the Unity
game engine can be found here: https://unity3d.com/legal/terms-of-service/software.
4. THE SDK AND ANY COMPONENT THEREOF ARE PROVIDED “AS IS” AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL Scatter AS THE COPYRIGHT OWNER OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SDK, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOME JURISDICTIONS DO NOT PERMIT THE
EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO YOU MAY HAVE ADDITIONAL
RIGHTS.
5. This License does not grant permission to use the trade names, trademarks, service marks, or product
names of Scatter, including without limitation “Depth Kit,” except as required for reasonable and customary
use in describing the origin of the SDK, and reproducing the content of the License Notice file. Scatter
reserves all rights not expressly granted to you under this License. Neither Scatters name nor the names
of Scatters contributors, licensors, employees, or contractors, may be used to endorse or promote
products developed using the SDK without specific prior written permission of Scatter.
6. You are responsible for ensuring that your use of the SDK and your Content complies with all
applicable laws (including privacy laws) wherever your Content is made available. You acknowledge and
agree that you are solely responsible for any health and safety issues arising from your Content.
7. Your acceptance of the terms and conditions of this License in and of itself and for all of your Content
may be evidenced by your usage of the SDK or acceptance of this License. As this License is updated for
future releases of the SDK, you agree to abide by and meet all requirements of future updates of this
License for those future SDK releases, with acceptance evidenced by usage of the SDK or any element
thereof and the future updates of this License will apply for your Content that may be developed for or
with that future SDK or any element thereof (i.e., you cannot sidestep out of the requirements of future
updates of the License by developing against an older release of the SDK or License). You acknowledge
that future versions of the SDK may be provided for a fee or otherwise under substantially different terms
from those provided hereunder.
8. Scatter reserves the right to terminate this License and all your rights hereunder immediately in the
event you materially breach this License.
9. Furthermore, Scatter also reserves the right to cancel or terminate this License for any of the following
reasons:
a. Intellectual property infringement by you for your Content that is used with or by
the SDK;
b. Content that violates applicable law;
c. Health and safety issues associated with your Content;
d. Use of the SDK with a commercial product other than Depth Kit and Unity; and
e. Failure to provide required notices as set forth above.
10. You agree to fully indemnify Scatter from any and all losses, costs, damages and expenses (including
reasonable attorney's fees) arising out of your Content or any breach of this License.
11. Scatter may discontinue or change functionality of Depth Kit or the SDK at any time, and your
continued use of Depth Kit or the SDK or use of any modified or additional services in connection
therewith is conditioned upon your adherence to the terms of this License, as modified by Scatter from
time to time, as well as any additional license agreements necessitated by additional features.
12. In the event any provision of this License is determined to be invalid, prohibited or unenforceable by a
court or other body of competent jurisdiction, this License shall be construed as if such invalid, prohibited
or unenforceable provision has been more narrowly drawn so as not to be invalid, prohibited or
unenforceable.
13. You may not assign any rights or obligations under this License without the advance written consent
of Scatter, which may be withheld in its sole discretion. Scatter may assign its rights or obligations under
this License in its sole discretion.
14. Failure of either party at any time to enforce any of the provisions of this License will not be construed
as a waiver of such provisions or in any way affect the validity of this License or parts thereof.
15. Your remedies under this License shall be limited to the right to collect money damages, if any, and
you hereby waive your right to injunctive or other equitable relief.
16. You will comply with all applicable export control laws of the United States and any other applicable
governmental authority, including without limitation, the U.S. Export Administration Regulations. You
agree that this License and the SDK and accompanying documentation are Scatter's confidential
information (and is not publicly available), and you will not use it, disclose it or make it available to others
except in accordance with the terms of this License.
17. This License shall be governed by the laws of the State of New York, without giving effect to choice of
law principles. All disputes relating to this License shall be resolved by binding non-appearance-based
arbitration before a single arbitrator in New York County, New York. The arbitration shall be conducted in
accordance with the rules and procedures of JAMS then in effect, and the judgment of the arbitrator shall
be final and capable of entry in any court of competent jurisdiction. You and Scatter agree to submit to the
personal jurisdiction of the courts located within New York County, New York in connection with any
entrance of an arbitrators judgment or decision or any dispute with respect to the arbitration process or
procedure or Scatters exercise of its equitable rights or remedies.
Effective as of October 7, 2016

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: accd3db3850702649b192582b4c748ba
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,4 @@
# Depthkit Studio Shader Graph
Copyright 2021 Scatter All Rights reserved.
***

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b5b24fcf5a540ae478bc4e6cda8ab6c0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ba46b44505c735040a17072cfacf16a0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
{
"name": "Depthkit.Studio.ShaderGraph",
"rootNamespace": "",
"references": [
"GUID:d757665d4a59fe94bab8bd5391e60e3d",
"GUID:24074500c51871f48bb3112a39fc1e55",
"GUID:3fcfa8946fa8f2b4bae0b88785a14d3e"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: dda20bba0e11f0c4abe396c411e7f50c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e4565dab47cc7943af977a7b9763e51
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fd9bf4e67cb58614cb806ce4aace8f45
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,834 @@
{
"m_SGVersion": 2,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "1e87e834b3004eadb4be44b944f20b40",
"m_Properties": [],
"m_Keywords": [],
"m_Nodes": [
{
"m_Id": "0b5384ba6aa9d48692086b77dbdf949f"
},
{
"m_Id": "a7e556535329b487b88375b57cdf7015"
},
{
"m_Id": "dd7eb2834fe84b6c83b2cd165dd83183"
},
{
"m_Id": "86a11d9cb34748df97b0a8cdbf5bb4c2"
},
{
"m_Id": "85729169ae8545939ff706025ae3aee2"
},
{
"m_Id": "f8cf87344305414c90564036c41039fa"
},
{
"m_Id": "55b2f6b9c636423189c4f3fdbb67d19d"
},
{
"m_Id": "84d74407bfa848bbb3bea2be5d47c900"
},
{
"m_Id": "86013cad3f734be0993afe59588c3da3"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "0b5384ba6aa9d48692086b77dbdf949f"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "dd7eb2834fe84b6c83b2cd165dd83183"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "0b5384ba6aa9d48692086b77dbdf949f"
},
"m_SlotId": 2
},
"m_InputSlot": {
"m_Node": {
"m_Id": "86a11d9cb34748df97b0a8cdbf5bb4c2"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "a7e556535329b487b88375b57cdf7015"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "f8cf87344305414c90564036c41039fa"
},
"m_SlotId": 0
}
}
],
"m_VertexContext": {
"m_Position": {
"x": 509.0,
"y": 49.00000762939453
},
"m_Blocks": [
{
"m_Id": "dd7eb2834fe84b6c83b2cd165dd83183"
},
{
"m_Id": "86a11d9cb34748df97b0a8cdbf5bb4c2"
},
{
"m_Id": "85729169ae8545939ff706025ae3aee2"
}
]
},
"m_FragmentContext": {
"m_Position": {
"x": 509.0,
"y": 249.0
},
"m_Blocks": [
{
"m_Id": "f8cf87344305414c90564036c41039fa"
},
{
"m_Id": "55b2f6b9c636423189c4f3fdbb67d19d"
},
{
"m_Id": "84d74407bfa848bbb3bea2be5d47c900"
},
{
"m_Id": "86013cad3f734be0993afe59588c3da3"
}
]
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
}
},
"m_Path": "Shader Graphs",
"m_ConcretePrecision": 0,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": ""
},
"m_ActiveTargets": [
{
"m_Id": "3a98e03429794bc7a9340005787b704f"
},
{
"m_Id": "906e1efb1bad4e80ba7d0186f15c48f9"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubGraphNode",
"m_ObjectId": "0b5384ba6aa9d48692086b77dbdf949f",
"m_Group": {
"m_Id": ""
},
"m_Name": "DepthkitStudioVertex",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 164.0,
"y": 23.000017166137697,
"width": 176.0,
"height": 118.0
}
},
"m_Slots": [
{
"m_Id": "410f5a7825b0b581b035fc73e1bb253a"
},
{
"m_Id": "a9944ebeecc97786816604850442bb41"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"75e8f53258e68fb4aaa9b9a6caf135a4\",\n \"type\": 3\n }\n}",
"m_PropertyGuids": [],
"m_PropertyIds": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
"m_ObjectId": "109a29bfeaf34aeaa0414cb5e13968cb",
"m_MaterialNeedsUpdateHash": 0,
"m_SurfaceType": 0,
"m_RenderingPass": 1,
"m_BlendMode": 0,
"m_ZTest": 4,
"m_ZWrite": false,
"m_TransparentCullMode": 2,
"m_OpaqueCullMode": 2,
"m_SortPriority": 0,
"m_AlphaTest": false,
"m_TransparentDepthPrepass": false,
"m_TransparentDepthPostpass": false,
"m_SupportLodCrossFade": false,
"m_DoubleSidedMode": 0,
"m_DOTSInstancing": false,
"m_Version": 0,
"m_FirstTimeMigrationExecuted": true,
"inspectorFoldoutMask": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
"m_ObjectId": "22ecd981a3a9422cbad27ec1dc655183",
"m_Distortion": false,
"m_DistortionMode": 0,
"m_DistortionDepthTest": true,
"m_AddPrecomputedVelocity": false,
"m_TransparentWritesMotionVec": false,
"m_AlphaToMask": false,
"m_DepthOffset": false,
"m_TransparencyFog": true,
"m_AlphaTestShadow": false,
"m_BackThenFrontRendering": false,
"m_TransparentDepthPrepass": false,
"m_TransparentDepthPostpass": false,
"m_SupportLodCrossFade": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDUnlitSubTarget",
"m_ObjectId": "2f148bf703224e33979088ddf5033061"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
"m_ObjectId": "30ca3384fee8467bbccb09467ecc7d37",
"m_MaterialNeedsUpdateHash": 0,
"m_SurfaceType": 0,
"m_RenderingPass": 1,
"m_BlendMode": 0,
"m_ZTest": 4,
"m_ZWrite": false,
"m_TransparentCullMode": 2,
"m_OpaqueCullMode": 2,
"m_SortPriority": 0,
"m_AlphaTest": false,
"m_TransparentDepthPrepass": false,
"m_TransparentDepthPostpass": false,
"m_SupportLodCrossFade": false,
"m_DoubleSidedMode": 0,
"m_DOTSInstancing": false,
"m_Version": 0,
"m_FirstTimeMigrationExecuted": false,
"inspectorFoldoutMask": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDTarget",
"m_ObjectId": "3a98e03429794bc7a9340005787b704f",
"m_ActiveSubTarget": {
"m_Id": "2f148bf703224e33979088ddf5033061"
},
"m_Datas": [
{
"m_Id": "42785087dc5f4a159620ac31a5da9e3a"
},
{
"m_Id": "109a29bfeaf34aeaa0414cb5e13968cb"
},
{
"m_Id": "22ecd981a3a9422cbad27ec1dc655183"
},
{
"m_Id": "30ca3384fee8467bbccb09467ecc7d37"
},
{
"m_Id": "547eedb1386f4abb8192fd2aa86a9df0"
}
],
"m_CustomEditorGUI": ""
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "410f5a7825b0b581b035fc73e1bb253a",
"m_Id": 1,
"m_DisplayName": "Object Position",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "ObjectPosition",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
"m_ObjectId": "42785087dc5f4a159620ac31a5da9e3a",
"m_Distortion": false,
"m_DistortionMode": 0,
"m_DistortionDepthTest": true,
"m_AddPrecomputedVelocity": false,
"m_TransparentWritesMotionVec": false,
"m_AlphaToMask": false,
"m_DepthOffset": false,
"m_TransparencyFog": true,
"m_AlphaTestShadow": false,
"m_BackThenFrontRendering": false,
"m_TransparentDepthPrepass": false,
"m_TransparentDepthPostpass": false,
"m_SupportLodCrossFade": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
"m_ObjectId": "5172471ceae94641a2e48ba84a3aa9d1",
"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_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDUnlitData",
"m_ObjectId": "547eedb1386f4abb8192fd2aa86a9df0",
"m_EnableShadowMatte": false,
"m_DistortionOnly": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "55b2f6b9c636423189c4f3fdbb67d19d",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Alpha",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "8c93898901f84f5ba084b8c37ddcbde0"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "5d2f5be7cf684cc2ab4c409dbe193bf5",
"m_Id": 0,
"m_DisplayName": "Alpha Clip Threshold",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "AlphaClipThreshold",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.5,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "794492a88c8f4713b44c6cf32b000ab1",
"m_Id": 0,
"m_DisplayName": "Base Color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "BaseColor",
"m_StageCapability": 2,
"m_Value": {
"x": 0.7353569269180298,
"y": 0.7353569269180298,
"z": 0.7353569269180298
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_ColorMode": 0,
"m_DefaultColor": {
"r": 0.5,
"g": 0.5,
"b": 0.5,
"a": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
"m_ObjectId": "79af28f649324f5080dc5328e63c87e9",
"m_Id": 0,
"m_DisplayName": "Normal",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Normal",
"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_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget",
"m_ObjectId": "82469a4abc8e46578d759527bd3f91b3"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "84d74407bfa848bbb3bea2be5d47c900",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.AlphaClipThreshold",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "5d2f5be7cf684cc2ab4c409dbe193bf5"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "85729169ae8545939ff706025ae3aee2",
"m_Group": {
"m_Id": ""
},
"m_Name": "VertexDescription.Tangent",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "cce3a1ab27ea422b8e8c76a3f599017a"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "VertexDescription.Tangent"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "86013cad3f734be0993afe59588c3da3",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Emission",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "88e8c6aa49814573a2af987b861df3c8"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Emission"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "86a11d9cb34748df97b0a8cdbf5bb4c2",
"m_Group": {
"m_Id": ""
},
"m_Name": "VertexDescription.Normal",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "79af28f649324f5080dc5328e63c87e9"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "VertexDescription.Normal"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "88e8c6aa49814573a2af987b861df3c8",
"m_Id": 0,
"m_DisplayName": "Emission",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Emission",
"m_StageCapability": 2,
"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_ColorMode": 1,
"m_DefaultColor": {
"r": 0.0,
"g": 0.0,
"b": 0.0,
"a": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "8c93898901f84f5ba084b8c37ddcbde0",
"m_Id": 0,
"m_DisplayName": "Alpha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 2,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
"m_ObjectId": "906e1efb1bad4e80ba7d0186f15c48f9",
"m_ActiveSubTarget": {
"m_Id": "82469a4abc8e46578d759527bd3f91b3"
},
"m_SurfaceType": 0,
"m_AlphaMode": 0,
"m_TwoSided": false,
"m_AlphaClip": false,
"m_CustomEditorGUI": ""
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "a322aace9c60a38eb3d2d3bca990d0f7",
"m_Id": 1,
"m_DisplayName": "color",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "color",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubGraphNode",
"m_ObjectId": "a7e556535329b487b88375b57cdf7015",
"m_Group": {
"m_Id": ""
},
"m_Name": "DepthkitStudioFragment",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 154.00001525878907,
"y": 174.00001525878907,
"width": 196.0,
"height": 94.0
}
},
"m_Slots": [
{
"m_Id": "a322aace9c60a38eb3d2d3bca990d0f7"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"a335e183b77ea5740bc0e40670766b07\",\n \"type\": 3\n }\n}",
"m_PropertyGuids": [],
"m_PropertyIds": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "a9944ebeecc97786816604850442bb41",
"m_Id": 2,
"m_DisplayName": "Object Normal",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "ObjectNormal",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot",
"m_ObjectId": "cce3a1ab27ea422b8e8c76a3f599017a",
"m_Id": 0,
"m_DisplayName": "Tangent",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Tangent",
"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_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "dd7eb2834fe84b6c83b2cd165dd83183",
"m_Group": {
"m_Id": ""
},
"m_Name": "VertexDescription.Position",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "5172471ceae94641a2e48ba84a3aa9d1"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "VertexDescription.Position"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "f8cf87344305414c90564036c41039fa",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.BaseColor",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "794492a88c8f4713b44c6cf32b000ab1"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1f57a434f2e8d4e40979f248bac82f5c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@ -0,0 +1,610 @@
{
"m_SGVersion": 2,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "ace6b335ddf64be1ba7273626d99fb87",
"m_Properties": [],
"m_Keywords": [
{
"m_Id": "a3f636e1a5594dc58162c8ff4ceec612"
},
{
"m_Id": "7f2b934006314fa08e868d6a9039502c"
},
{
"m_Id": "6a8b9e1ac00e4d488b6f3c89cc1097cb"
},
{
"m_Id": "3f61c78c05d54095931ed00afb3801ec"
}
],
"m_Nodes": [
{
"m_Id": "6ff3ca44940b878fb0d2ab04e0635758"
},
{
"m_Id": "14887e16113c0585bc161a515c21ad8c"
},
{
"m_Id": "fa7f2fdd88d70686a25f29c2ccb3d76d"
},
{
"m_Id": "11292b6c0c689c87bc98d7fd9c2870d9"
},
{
"m_Id": "4b12b0ecf10af88db493f343a2acaa6c"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "11292b6c0c689c87bc98d7fd9c2870d9"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "fa7f2fdd88d70686a25f29c2ccb3d76d"
},
"m_SlotId": 4
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "14887e16113c0585bc161a515c21ad8c"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "fa7f2fdd88d70686a25f29c2ccb3d76d"
},
"m_SlotId": 3
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "4b12b0ecf10af88db493f343a2acaa6c"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "fa7f2fdd88d70686a25f29c2ccb3d76d"
},
"m_SlotId": 6
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "fa7f2fdd88d70686a25f29c2ccb3d76d"
},
"m_SlotId": 5
},
"m_InputSlot": {
"m_Node": {
"m_Id": "6ff3ca44940b878fb0d2ab04e0635758"
},
"m_SlotId": 1
}
}
],
"m_VertexContext": {
"m_Position": {
"x": 292.0,
"y": -85.00003814697266
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 292.0,
"y": 114.99996185302735
},
"m_Blocks": []
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
}
},
"m_Path": "Sub Graphs",
"m_ConcretePrecision": 0,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": "6ff3ca44940b878fb0d2ab04e0635758"
},
"m_ActiveTargets": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.NormalVectorNode",
"m_ObjectId": "11292b6c0c689c87bc98d7fd9c2870d9",
"m_Group": {
"m_Id": ""
},
"m_Name": "Normal Vector",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -322.0000305175781,
"y": -16.99999237060547,
"width": 206.00001525878907,
"height": 130.00001525878907
}
},
"m_Slots": [
{
"m_Id": "2b20f22f85a7de82bd13278a1ce1aac7"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_PreviewMode": 2,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Space": 0
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.PositionNode",
"m_ObjectId": "14887e16113c0585bc161a515c21ad8c",
"m_Group": {
"m_Id": ""
},
"m_Name": "Position",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -327.00006103515627,
"y": -149.99998474121095,
"width": 206.00001525878907,
"height": 130.00001525878907
}
},
"m_Slots": [
{
"m_Id": "bec33244469a2984a161fc093048f8f5"
}
],
"synonyms": [],
"m_Precision": 1,
"m_PreviewExpanded": false,
"m_PreviewMode": 2,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Space": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "2b20f22f85a7de82bd13278a1ce1aac7",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ShaderKeyword",
"m_ObjectId": "3f61c78c05d54095931ed00afb3801ec",
"m_Guid": {
"m_GuidSerialized": "64e90595-8cd6-4ffc-9b73-31acc35eb77a"
},
"m_Name": "Untextured Geometry Settings",
"m_DefaultReferenceName": "ENUM_3F61C78C05D54095931ED00AFB3801EC",
"m_OverrideReferenceName": "DK_UNTEXTURED_FRAGMENT",
"m_GeneratePropertyBlock": true,
"m_KeywordType": 1,
"m_KeywordDefinition": 0,
"m_KeywordScope": 0,
"m_Entries": [
{
"id": 1,
"displayName": "INFER",
"referenceName": "INFER"
},
{
"id": 2,
"displayName": "COLORIZE",
"referenceName": "COLORIZE"
},
{
"id": 3,
"displayName": "CLIP",
"referenceName": "CLIP"
}
],
"m_Value": 0,
"m_IsEditable": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ViewDirectionNode",
"m_ObjectId": "4b12b0ecf10af88db493f343a2acaa6c",
"m_Group": {
"m_Id": ""
},
"m_Name": "View Direction",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -340.0000305175781,
"y": 123.0000228881836,
"width": 206.00001525878907,
"height": 130.00001525878907
}
},
"m_Slots": [
{
"m_Id": "75f09f63847d5d8bb479896d0953b3ff"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_PreviewMode": 2,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Space": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "60e992d836207482984a896a01106dbb",
"m_Id": 4,
"m_DisplayName": "object normal",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "objectnormal",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ShaderKeyword",
"m_ObjectId": "6a8b9e1ac00e4d488b6f3c89cc1097cb",
"m_Guid": {
"m_GuidSerialized": "fdd7d113-dba4-4c06-ba0a-6a3d7b6a7ad4"
},
"m_Name": "Use Edge Mask",
"m_DefaultReferenceName": "BOOLEAN_8460332B_ON",
"m_OverrideReferenceName": "DK_USE_EDGEMASK",
"m_GeneratePropertyBlock": true,
"m_KeywordType": 0,
"m_KeywordDefinition": 0,
"m_KeywordScope": 0,
"m_Entries": [],
"m_Value": 0,
"m_IsEditable": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode",
"m_ObjectId": "6ff3ca44940b878fb0d2ab04e0635758",
"m_Group": {
"m_Id": ""
},
"m_Name": "Out_Vector3",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 292.0,
"y": -85.00003814697266,
"width": 137.0,
"height": 77.0
}
},
"m_Slots": [
{
"m_Id": "9f4ec70f073ae48f8f199e1073d5b0e7"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"IsFirstSlotValid": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "75f09f63847d5d8bb479896d0953b3ff",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "766e2a72766a418fbd553954f82b7fdf",
"m_Id": 3,
"m_DisplayName": "object position",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "objectposition",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ShaderKeyword",
"m_ObjectId": "7f2b934006314fa08e868d6a9039502c",
"m_Guid": {
"m_GuidSerialized": "b187e815-0a7c-48b2-af6a-0fd02a4576f3"
},
"m_Name": "Debug Edge Mask",
"m_DefaultReferenceName": "BOOLEAN_6B279B31_ON",
"m_OverrideReferenceName": "DK_DEBUG_EDGEMASK",
"m_GeneratePropertyBlock": true,
"m_KeywordType": 0,
"m_KeywordDefinition": 0,
"m_KeywordScope": 0,
"m_Entries": [],
"m_Value": 0,
"m_IsEditable": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "9f4ec70f073ae48f8f199e1073d5b0e7",
"m_Id": 1,
"m_DisplayName": "color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "color",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ShaderKeyword",
"m_ObjectId": "a3f636e1a5594dc58162c8ff4ceec612",
"m_Guid": {
"m_GuidSerialized": "12f884e2-1008-4abd-b689-01de6378344e"
},
"m_Name": "Debug Color",
"m_DefaultReferenceName": "BOOLEAN_8864CDC0_ON",
"m_OverrideReferenceName": "DK_USE_DEBUG_COLOR",
"m_GeneratePropertyBlock": true,
"m_KeywordType": 0,
"m_KeywordDefinition": 0,
"m_KeywordScope": 0,
"m_Entries": [],
"m_Value": 0,
"m_IsEditable": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "ae8d8703049d5d8eb8492f8d0548056b",
"m_Id": 6,
"m_DisplayName": "object view direction",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "objectviewdirection",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "bec33244469a2984a161fc093048f8f5",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"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": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "fa7f2fdd88d70686a25f29c2ccb3d76d",
"m_Group": {
"m_Id": ""
},
"m_Name": "DepthkitStudioFragment (Custom Function)",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -14.999993324279786,
"y": -86.00000762939453,
"width": 249.0,
"height": 142.0
}
},
"m_Slots": [
{
"m_Id": "766e2a72766a418fbd553954f82b7fdf"
},
{
"m_Id": "60e992d836207482984a896a01106dbb"
},
{
"m_Id": "fdc0988162d7d68787761b49e2672953"
},
{
"m_Id": "ae8d8703049d5d8eb8492f8d0548056b"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 0,
"m_FunctionName": "DepthkitStudioFragment",
"m_FunctionSource": "dd1362e061ce90145827fc495c9cd566",
"m_FunctionBody": "Enter function body here..."
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "fdc0988162d7d68787761b49e2672953",
"m_Id": 5,
"m_DisplayName": "color",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "color",
"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": [
"X",
"Y",
"Z"
]
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a335e183b77ea5740bc0e40670766b07
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}

View File

@ -0,0 +1,62 @@
{
"m_SerializedProperties": [],
"m_SerializedKeywords": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.ShaderKeyword"
},
"JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"245bc2e2-1a68-481f-9bb2-2d3b935fe2b4\"\n },\n \"m_Name\": \"Two Persp Limit\",\n \"m_DefaultReferenceName\": \"BOOLEAN_CBDC93DB_ON\",\n \"m_OverrideReferenceName\": \"DK_TWO_PERSP_LIMIT\",\n \"m_GeneratePropertyBlock\": true,\n \"m_KeywordType\": 0,\n \"m_KeywordDefinition\": 0,\n \"m_KeywordScope\": 0,\n \"m_Entries\": [],\n \"m_Value\": 0,\n \"m_IsEditable\": true,\n \"m_IsExposable\": true\n}"
}
],
"m_SerializableNodes": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.SubGraphOutputNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"c8a2ec04-00bd-4c95-b0d4-7ab606ba9362\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Out_Vector4\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 441.0,\n \"y\": -185.99998474121095,\n \"width\": 141.0,\n \"height\": 101.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Object Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"ObjectPosition\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Object Normal\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"ObjectNormal\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.CustomFunctionNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"78c86c3f-332a-48ed-a2a3-b54664a589b5\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Custom Function\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 64.99992370605469,\n \"y\": -216.00003051757813,\n \"width\": 250.0,\n \"height\": 166.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"triangle uv\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"triangleuv\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"position\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"position\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"normal\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"normal\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_SourceType\": 0,\n \"m_FunctionName\": \"DepthkitStudioSampleTriangleBuffer\",\n \"m_FunctionSource\": \"619c744aa3e42e74aa5d75c7e3eb92dc\",\n \"m_FunctionBody\": \"Enter function body here...\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.UVNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"014416d3-e713-4727-96ff-d9b940265b93\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"UV\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -149.00001525878907,\n \"y\": -207.00003051757813,\n \"width\": 145.0,\n \"height\": 129.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_OutputChannel\": 0\n}"
}
],
"m_Groups": [],
"m_StickyNotes": [],
"m_SerializableEdges": [
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"014416d3-e713-4727-96ff-d9b940265b93\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"78c86c3f-332a-48ed-a2a3-b54664a589b5\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 3,\n \"m_NodeGUIDSerialized\": \"78c86c3f-332a-48ed-a2a3-b54664a589b5\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"c8a2ec04-00bd-4c95-b0d4-7ab606ba9362\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"78c86c3f-332a-48ed-a2a3-b54664a589b5\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"c8a2ec04-00bd-4c95-b0d4-7ab606ba9362\"\n }\n}"
}
],
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
}
},
"m_Path": "Sub Graphs",
"m_ConcretePrecision": 0,
"m_ActiveOutputNodeGuidSerialized": ""
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 75e8f53258e68fb4aaa9b9a6caf135a4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a580851d94a2dbe43ad3bd7d3b10d8c3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
#ifndef DEPTHKIT_STUDIOSAMPLETRIANGLEBUFFER_HLSL_INCLUDE
#define DEPTHKIT_STUDIOSAMPLETRIANGLEBUFFER_HLSL_INCLUDE
#define DK_CORE_PACKED_TRIANGLE
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/SampleCoreTriangles.cginc"
void DepthkitStudioSampleTriangleBuffer_float(in float2 triangleUV, out float3 position, out float3 normal)
{
Vertex vert = dkSampleTriangleBuffer((uint)triangleUV.x, (uint)triangleUV.y);
position = vert.position;
normal = vert.normal;
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 619c744aa3e42e74aa5d75c7e3eb92dc
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
#ifndef DEPTHKIT_FRAGMENT_HLSL_INCLUDED
#define DEPTHKIT_FRAGMENT_HLSL_INCLUDED
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Includes/DepthkitStudio.cginc"
void DepthkitStudioFragment_float(in float3 object_position, in float3 object_normal, in float3 view_direction, out float3 color)
{
color = dkSampleColorViewWeightedReprojection(view_direction, object_position, object_normal);
}
#endif

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: dd1362e061ce90145827fc495c9cd566
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,67 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
using System;
namespace Depthkit
{
[ExecuteInEditMode]
[AddComponentMenu("Depthkit/Studio/Shader Graph/Depthkit Studio Shader Graph Look")]
public class StudioShaderGraphLook : ShaderGraphLook
{
protected static Shader s_defaultUnlitPhotoLookShader = null;
protected static Material s_defaultUnlitPhotoLookMaterial = null;
protected static Material GetDefaultMaterial()
{
if (s_defaultUnlitPhotoLookShader == null)
{
s_defaultUnlitPhotoLookShader = Shader.Find("Shader Graphs/Depthkit Studio Photo Look Unlit");
}
if (s_defaultUnlitPhotoLookMaterial == null)
{
s_defaultUnlitPhotoLookMaterial = new Material(s_defaultUnlitPhotoLookShader);
}
return s_defaultUnlitPhotoLookMaterial;
}
protected override Material GetDefaultShaderGraph()
{
return GetDefaultMaterial();
}
public override string GetLookName(){ return "Depthkit Studio Shader Graph Look"; }
protected override void SetDataSources()
{
if (meshSource == null)
{
meshSource = depthkitClip.GetDataSource<StudioMeshSource>();
}
if (!meshSource.useTriangleMesh) meshSource.useTriangleMesh = true;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e2ed5688ce254104cb81e4b622d403b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 42c51ff9981f3e24b83cd7ad3c56e235, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
{
"name": "nyc.scatter.depthkit.studio.shadergraph",
"version": "0.5.1",
"displayName": "Depthkit Studio Shader Graph",
"description": "Use the Depthkit Studio Shader Graph Package to render Depthkit captures from Depthkit Studio in Unitys Scriptable Render Pipeline including High Definition RP and Universal RP. This includes the components to visualize and customize Depthkit captures using Unitys Shader Graph system.\n\nNote the Depthkit Studio package suite is designed to render multi-perspective captures from Depthkit Studio. For single-perspective captures from Depthkit Core or Depthkit Cinema, use Depthkit Core package suite.",
"unity": "2022.3",
"dependencies": {
"nyc.scatter.depthkit.core": "0.14.2",
"nyc.scatter.depthkit.studio": "0.10.1",
"nyc.scatter.depthkit.core.shadergraph": "0.6.1",
"com.unity.shadergraph": "14.0.9"
},
"samples": [
{
"displayName": "Prefabs - Depthkit Studio Shader Graph",
"description": "Prefabs for the Scriptable Render Pipelines",
"path": "Samples~/Depthkit Studio Shader Graph Prefabs"
}
],
"keywords": [
"Depthkit",
"Volumetric",
"Scatter"
],
"author": {
"name": "Scatter",
"email": "support@depthkit.tv",
"url": "https://www.depthkit.tv"
}
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 750931ab1ef361c4ea3a7f9d51832b83
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,79 @@
## Changelog
### 0.10.2
* Fix bug where certain fields were not serializing after GUI changes
### 0.10.1
* Update SDK license agreement
### 0.10.0
* Updated to Unity 2022.3
* Better handling of clip reconstruction settings when setting a new metadata asset
### 0.9.3
* Updated assembly definitions.
### 0.9.2
* Bug fixes
### 0.9.1
* Bug fixes
### 0.9.0
* Simplified the texturing and edge masking settings
* Loads texturing, edge masking and depth bias compensation settings from metadata
### 0.8.3
* Bug fixes
### 0.8.2
* Added optional uv generation to geometry generation.
### 0.8.1
* Fix for Studio Visual Effect Graph
### 0.8.0
* Updated to Unity 2020.3
* Improved accuracy of texture blending between perspectives.
* Allow for fading out texture at the boundaries of perspectives using Invalid Edge Width slider.
* Add ability to specify how untextured geometry is handled.
* Improved edge masking usability and performance.
### 0.7.1
* Exposed Disable Main Directional Shadows toggle in BiRP Photo Look shader.
### 0.7.0
* Fixed per perspective radial bias depth compensation.
### 0.6.3
* removed misc files
### 0.6.2
* added define for photolook to ignore main light shadows
### 0.6.1
* Allow BiRP photolook to use shadows from all light types.
### 0.6.0
* Sync look collider and triangle mesh to volume bounds
* Allow BiRP procedural looks to sample light probes
* Once volume bounds are set, only allow reset on pressing the reset button in the inspector
### 0.5.1
* Bug fixes
### 0.5.0
* Added material property block support
* Bug fixes
### 0.3.0
* Improved performance of triangle extraction kernel
* Added depthkit icon to all depthkit components
* Volume Density now is a slider that controls voxels per meter
* Manual Volume bounds are always on in the scene view and control the number of voxels used to reconstruct the clip, no longer does it control the size of the voxels.
* Added Edge Mask feature to **Studio Mesh Source** Component for color blending
* Global edge mask control
* Individual perspective edge mask control
* Changed the color blending occlusion test to be a smoothstep interpolation rather than a hard coded if/else.
* Updated normal generation kernel to output WS Depth to a texture used in the Edge Masking feature. This is disabled entirely if the edge mask is disabled.
* Updated SDF generation to filter out invalid voxels that lie outside of the frustum of all perspectives.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7f9f07865ee91284ebf6d6264772abae
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f1b99e32dab0064483d3db01634e585
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,19 @@
{
"name": "Depthkit.Studio.Editor",
"references": [
"GUID:d757665d4a59fe94bab8bd5391e60e3d",
"GUID:24074500c51871f48bb3112a39fc1e55",
"GUID:7ec71480072be074c8f90dd646706fad"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 03820f29b486bfe4b8252ac12d3554cc
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.Collections.Generic;
using System;
namespace Depthkit
{
public class StudioLookGizmosDrawer
{
[DrawGizmo(GizmoType.Selected | GizmoType.Active)]
static void DrawGizmosFor(StudioLook look, GizmoType gizmoType)
{
if (look.showCameraFrustums)
{
Depthkit.Util.RenderMetadataGizmos(look.depthkitClip.metadata, look.transform);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ccea9d9f79fa5847bebc46c033cb78c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,451 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
namespace Depthkit
{
public class StudioMeshSourceGizmoDrawer
{
[DrawGizmo(GizmoType.Active)]
static void DrawGizmosFor(StudioMeshSource meshSource, GizmoType gizmoType)
{
for (int persp = 0; persp < meshSource.perspectivesCount; ++persp)
{
if (meshSource.showPerspectiveGizmo[persp] && meshSource.clip.metadata.perspectives.Length == meshSource.showPerspectiveGizmo.Length)
{
var perspective = meshSource.clip.metadata.perspectives[persp];
Color camColor = Util.ColorForCamera(persp);
Util.RenderPerspectiveGizmo(perspective, meshSource.transform, camColor, "Perspective " + persp);
}
}
}
}
[CustomEditor(typeof(StudioMeshSource))]
public class StudioMeshSourceEditor : Editor
{
BoxBoundsHandle m_sdfBoundsControl = new BoxBoundsHandle();
SerializedProperty showVolumePreview;
SerializedProperty automaticLevelOfDetail;
SerializedProperty levelOfDetailDistance;
SerializedProperty showLevelOfDetailGizmo;
SerializedProperty recalculateCurrentSurfaceTriangleCount;
SerializedProperty volumeDensity;
SerializedProperty surfaceSensitivity;
SerializedProperty surfaceSmoothingRadius;
SerializedProperty enableSurfaceSmoothing;
SerializedProperty volumePreviewAlpha;
SerializedProperty volumePreviewPointSize;
SerializedProperty globalViewDependentColorBlendWeight;
SerializedProperty globalViewDependentGeometryBlendWeight;
SerializedProperty surfaceNormalColorBlendingPower;
SerializedProperty perViewDisparityThreshold;
SerializedProperty perViewDisparityBlendWidth;
SerializedProperty disparityMin;
SerializedProperty untexturedFragmentSetting;
SerializedProperty generationMethod;
SerializedProperty normalWeightResolutionReduction;
SerializedProperty enableViewDependentGeometry;
SerializedProperty volumeViewpoint;
SerializedProperty weightUnknown;
SerializedProperty weightUnseenMax;
SerializedProperty weightUnseenMin;
SerializedProperty weightUnseenFalloffPower;
SerializedProperty weightInFrontMax;
SerializedProperty weightInFrontMin;
SerializedProperty m_bIsSetup;
SerializedProperty m_totalVoxelCount;
SerializedProperty m_voxelGridDimensions;
SerializedProperty radialBias;
SerializedProperty pauseDataGenerationWhenInvisible;
SerializedProperty pausePlayerWhenInvisible;
MaskGeneratorGUI m_maskGUI;
bool m_showExperimentalVolumeSettings = false;
bool m_showViewDependentControls = false;
bool m_showAdvancedPerPerspectiveSettings = false;
bool m_showAdvancedSurfaceSettings = false;
bool[] m_showViewDependentControlsPerPerspective = null;
void OnEnable()
{
showVolumePreview = serializedObject.FindProperty("showVolumePreview");
automaticLevelOfDetail = serializedObject.FindProperty("automaticLevelOfDetail");
levelOfDetailDistance = serializedObject.FindProperty("levelOfDetailDistance");
recalculateCurrentSurfaceTriangleCount = serializedObject.FindProperty("recalculateCurrentSurfaceTriangleCount");
volumeDensity = serializedObject.FindProperty("m_volumeDensity");
surfaceSensitivity = serializedObject.FindProperty("surfaceSensitivity");
surfaceSmoothingRadius = serializedObject.FindProperty("surfaceSmoothingRadius");
volumePreviewAlpha = serializedObject.FindProperty("volumePreviewAlpha");
volumePreviewPointSize = serializedObject.FindProperty("volumePreviewPointSize");
enableSurfaceSmoothing = serializedObject.FindProperty("enableSurfaceSmoothing");
m_bIsSetup = serializedObject.FindProperty("m_bIsSetup");
showLevelOfDetailGizmo = serializedObject.FindProperty("showLevelOfDetailGizmo");
surfaceNormalColorBlendingPower = serializedObject.FindProperty("surfaceNormalColorBlendingPower");
weightUnknown = serializedObject.FindProperty("weightUnknown");
weightUnseenMax = serializedObject.FindProperty("weightUnseenMax");
weightUnseenMin = serializedObject.FindProperty("weightUnseenMin");
weightUnseenFalloffPower = serializedObject.FindProperty("weightUnseenFalloffPower");
weightInFrontMax = serializedObject.FindProperty("weightInFrontMax");
weightInFrontMin = serializedObject.FindProperty("weightInFrontMin");
perViewDisparityThreshold = serializedObject.FindProperty("perViewDisparityThreshold");
globalViewDependentColorBlendWeight = serializedObject.FindProperty("globalViewDependentColorBlendWeight");
globalViewDependentGeometryBlendWeight = serializedObject.FindProperty("globalViewDependentGeometryBlendWeight");
volumeViewpoint = serializedObject.FindProperty("volumeViewpoint");
enableViewDependentGeometry = serializedObject.FindProperty("enableViewDependentGeometry");
m_totalVoxelCount = serializedObject.FindProperty("m_totalVoxelCount");
m_voxelGridDimensions = serializedObject.FindProperty("m_voxelGridDimensions");
perViewDisparityBlendWidth = serializedObject.FindProperty("perViewDisparityBlendWidth");
disparityMin = serializedObject.FindProperty("disparityMin");
pauseDataGenerationWhenInvisible = serializedObject.FindProperty("pauseDataGenerationWhenInvisible");
pausePlayerWhenInvisible = serializedObject.FindProperty("pausePlayerWhenInvisible");
generationMethod = serializedObject.FindProperty("generationMethod");
normalWeightResolutionReduction = serializedObject.FindProperty("normalWeightResolutionReduction");
radialBias = serializedObject.FindProperty("radialBias");
untexturedFragmentSetting = serializedObject.FindProperty("untexturedFragmentSetting");
m_bIsSetup.boolValue = false;
if (m_maskGUI == null)
{
m_maskGUI = new MaskGeneratorGUI();
}
}
private void OnDisable()
{
m_maskGUI?.Release();
}
private void OnSceneGUI()
{
StudioMeshSource meshSource = target as Depthkit.StudioMeshSource;
bool didChange = m_sdfBoundsControl.center != meshSource.volumeBounds.center || m_sdfBoundsControl.size != meshSource.volumeBounds.size;
m_sdfBoundsControl.center = meshSource.volumeBounds.center;
m_sdfBoundsControl.size = meshSource.volumeBounds.size;
// draw the handle
EditorGUI.BeginChangeCheck();
Matrix4x4 pushPop = Handles.matrix;
Handles.matrix = meshSource.transform.localToWorldMatrix;
m_sdfBoundsControl.DrawHandle();
Handles.matrix = pushPop;
if (EditorGUI.EndChangeCheck())
{
// record the target object before setting new values so changes can be undone/redone
Undo.RecordObject(meshSource, "Change Bounds");
// copy the handle's updated data back to the target object
Bounds newBounds = new Bounds();
newBounds.center = m_sdfBoundsControl.center;
newBounds.size = m_sdfBoundsControl.size;
meshSource.volumeBounds = newBounds;
EditorUtility.SetDirty(meshSource);
}
else if (didChange)
{
EditorUtility.SetDirty(meshSource);
}
}
public override void OnInspectorGUI()
{
bool doResize = false;
bool doGenerate = false;
float val;
StudioMeshSource meshSource = target as StudioMeshSource;
if (meshSource.clip == null) return;
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("Volume Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(volumeDensity, new GUIContent("Volume Density", "Adjust the density of the Depthkit volume in voxels per meter. Higher values capture more detail at the cost of performance and memory usage."));
GUI.enabled = false;
EditorGUILayout.PropertyField(m_voxelGridDimensions);
EditorGUILayout.PropertyField(m_totalVoxelCount);
GUI.enabled = true;
if (GUILayout.Button("Reset Volume Bounds"))
{
meshSource.ResetVolumeBounds();
EditorUtility.SetDirty(meshSource);
}
if (EditorGUI.EndChangeCheck())
{
doResize = true;
doGenerate = true;
}
m_showExperimentalVolumeSettings = EditorGUILayout.Foldout(m_showExperimentalVolumeSettings, "Experimental Volume Settings");
if (m_showExperimentalVolumeSettings)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(surfaceSensitivity, new GUIContent("Adjust Surface Sensitivity", "Tailor this value to what looks best for each specific clip. Surface Sensitivity controls how likely a Surface is to be determined from a point in the volume based on the various depth perspectives. A higher sensitivity is more likely to generate surfaces, which may recover some geometry and also introduce artifacts."));
if (GUILayout.Button("Reset Surface Sensitivity"))
{
meshSource.ResetSurfaceSensitivity();
EditorUtility.SetDirty(meshSource);
doGenerate = true;
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(radialBias, new GUIContent("Depth Bias Compensation", "Time of Flight cameras measure surfaces farther away than they are in reality. The amount of bias depends greatly on the material of the surface being measured. Skin in particular has a large bias. The Depth Bias Compensation is a correction for this error by pulling the surface back towards their true depth. It most useful for recovering high quality faces and hands on otherwise well-calibrated captures. The larger the value, the larger the compensation. 0 means no depth bias compensation is applied."));
EditorGUILayout.Space();
EditorGUILayout.PropertyField(weightUnknown);
EditorGUILayout.PropertyField(weightUnseenMax);
EditorGUILayout.PropertyField(weightUnseenMin);
EditorGUILayout.PropertyField(weightUnseenFalloffPower);
EditorGUILayout.PropertyField(weightInFrontMax);
EditorGUILayout.PropertyField(weightInFrontMin);
if (GUILayout.Button("Load Front Biased Defaults"))
{
meshSource.LoadFrontBiasedDefaults();
EditorUtility.SetDirty(meshSource);
doGenerate = true;
}
EditorGUILayout.PropertyField(showVolumePreview);
if (showVolumePreview.boolValue)
{
EditorGUILayout.PropertyField(volumePreviewAlpha);
EditorGUILayout.PropertyField(volumePreviewPointSize);
}
m_showAdvancedSurfaceSettings = EditorGUILayout.Foldout(m_showAdvancedSurfaceSettings, "Advanced Optimization Settings");
if (m_showAdvancedSurfaceSettings)
{
EditorGUILayout.PropertyField(normalWeightResolutionReduction);
EditorGUILayout.PropertyField(pausePlayerWhenInvisible);
EditorGUILayout.PropertyField(pauseDataGenerationWhenInvisible);
}
if (EditorGUI.EndChangeCheck())
{
doGenerate = true;
}
}
EditorGUILayout.Space();
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("Surface Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(enableSurfaceSmoothing, new GUIContent("Enable Surface Smoothing", "Smooth the output surface to reduce artifacts at the cost of some loss of detail."));
if (enableSurfaceSmoothing.boolValue)
{
EditorGUILayout.PropertyField(surfaceSmoothingRadius);
if (GUILayout.Button("Reset Surface Smoothing"))
{
surfaceSmoothingRadius.floatValue = 0.3f;
}
}
if (GUILayout.Button(new GUIContent("Set Surface Buffer Capacity", "Use this button to sample the current frame to set a reasonable Surface Buffer Capacity tailored to your content.")))
{
recalculateCurrentSurfaceTriangleCount.boolValue = true;
}
GUI.enabled = !recalculateCurrentSurfaceTriangleCount.boolValue;
uint curMaxTriangles = meshSource.maxSurfaceTriangles;
uint newMaxTriangles = (uint)EditorGUILayout.IntField(new GUIContent("Surface Buffer Capacity", "This value determines the maximum number of triangles that can be displayed for each frame of this Clip. Each frame will have a variable size mesh based on the shape of its contents. A higher number ensures that no part of the surface is ever excluded and allocates a larger memory footprint."), (int)curMaxTriangles);
if (newMaxTriangles != curMaxTriangles)
{
meshSource.maxSurfaceTriangles = newMaxTriangles;
doResize = true;
}
GUI.enabled = true;
if (EditorGUI.EndChangeCheck())
{
doGenerate = true;
}
if (meshSource.clip.isSetup == true && meshSource.perspectivesCount == meshSource.clip?.metadata.perspectivesCount)
{
m_showViewDependentControls = EditorGUILayout.Foldout(m_showViewDependentControls, "Texture Settings");
if (m_showViewDependentControls)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.BeginVertical("Box");
EditorGUILayout.LabelField("Color Blending Settings");
EditorGUILayout.PropertyField(globalViewDependentColorBlendWeight, new GUIContent("Dynamic Texture Blend", "Adjust how the texture blend changes dynamically based on the viewer camera position; a value of 0 is no dynamic adjustment. Default is 1."));
EditorGUILayout.PropertyField(surfaceNormalColorBlendingPower, new GUIContent("Fixed Texture Blend", "Adjust how the texture is blended between camera perspectives. Lower values will lead to smoother blending at the risk of ghosting artifacts from misalignment. Higher values will lead to more crisp textures at the risk of hard seems between perspectives. Default is 1."));
//EditorGUILayout.PropertyField(perViewDisparityThreshold, new GUIContent("Surface Disparity Color Threshold", "Adjust the threshold that determines the color for one perspective is occluding another perspective. Default blend weight is 0.025."));
//EditorGUILayout.PropertyField(perViewDisparityBlendWidth, new GUIContent("Disparity Blend Width","The width of the blend between disparate surfaces."));
EditorGUILayout.PropertyField(untexturedFragmentSetting, new GUIContent("Untextured Geometry Settings"));
if ((StudioMeshSource.UntexturedGeometrySettings)untexturedFragmentSetting.intValue == StudioMeshSource.UntexturedGeometrySettings.Colorize)
{
meshSource.untexturedColor = EditorGUILayout.ColorField(new GUIContent("Untextured Fragment Color"), meshSource.untexturedColor, true, false, false);
}
if (EditorGUI.EndChangeCheck())
{
doGenerate = true;
}
bool enableEdgeMask = meshSource.enableEdgeMask;
enableEdgeMask = EditorGUILayout.Toggle("Enable Edge Mask", enableEdgeMask);
if (enableEdgeMask != meshSource.enableEdgeMask)
{
meshSource.enableEdgeMask = enableEdgeMask;
doGenerate = true;
doResize = true;
}
if (enableEdgeMask)
{
EditorGUI.BeginChangeCheck();
m_maskGUI.MaskGui(ref meshSource.maskGenerator, MeshDensity.Low, ref doGenerate, true);
if (EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(meshSource);
}
}
EditorGUILayout.EndVertical();
if (m_showViewDependentControlsPerPerspective == null || m_showViewDependentControlsPerPerspective.Length != meshSource.clip.metadata.perspectivesCount)
{
m_showViewDependentControlsPerPerspective = new bool[meshSource.clip.metadata.perspectivesCount];
for (int p = 0; p < m_showViewDependentControlsPerPerspective.Length; ++p)
{
m_showViewDependentControlsPerPerspective[p] = false;
}
}
m_showAdvancedPerPerspectiveSettings = EditorGUILayout.Foldout(m_showAdvancedPerPerspectiveSettings, "Show Advanced Per Perspective Settings (Experimental)");
if (m_showAdvancedPerPerspectiveSettings)
{
EditorGUI.BeginChangeCheck();
for (int persp = 0; persp < meshSource.perspectivesCount; ++persp)
{
m_showViewDependentControlsPerPerspective[persp] = EditorGUILayout.Foldout(m_showViewDependentControlsPerPerspective[persp], "Perspective " + persp + " Settings");
if (m_showViewDependentControlsPerPerspective[persp])
{
EditorGUILayout.BeginVertical("Box");
EditorGUILayout.LabelField("Color Settings");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Perspective Color Enabled", GUILayout.Width(250));
bool perspColorEnabled = meshSource.perspectiveColorBlendingData.GetPerspectiveEnabled(persp);
perspColorEnabled = EditorGUILayout.Toggle(perspColorEnabled);
meshSource.perspectiveColorBlendingData.SetPerspectiveEnabled(persp, perspColorEnabled);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Enable Perspective Geometry", GUILayout.Width(250));
bool perspGeomEnabled = meshSource.perspectiveGeometryData.EnableGeometry(persp);
perspGeomEnabled = EditorGUILayout.Toggle(perspGeomEnabled);
meshSource.perspectiveGeometryData.EnableGeometry(persp, perspGeomEnabled);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Show Camera Frustum", GUILayout.Width(250));
bool show = meshSource.showPerspectiveGizmo[persp];
show = EditorGUILayout.Toggle(show);
meshSource.showPerspectiveGizmo[persp] = show;
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Color Weight Contribution");
val = meshSource.perspectiveColorBlendingData.GetViewDependentColorBlendContribution(persp);
val = EditorGUILayout.Slider(val, 0.0f, 1.0f);
meshSource.perspectiveColorBlendingData.SetViewDependentColorBlendContribution(persp, val);
GUI.enabled = perspGeomEnabled;
EditorGUILayout.LabelField("Geometry Settings");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Override Radial Bias", GUILayout.Width(250));
bool overrideRadialBias = meshSource.overrideRadialBias[persp];
overrideRadialBias = EditorGUILayout.Toggle(overrideRadialBias);
if (overrideRadialBias != meshSource.overrideRadialBias[persp])
{
meshSource.overrideRadialBias[persp] = overrideRadialBias;
}
EditorGUILayout.EndHorizontal();
GUI.enabled = perspGeomEnabled && overrideRadialBias;
EditorGUILayout.LabelField(new GUIContent("Depth Bias Compensation", "Time of Flight cameras measure surfaces farther away than they are in reality. The amount of bias depends greatly on the material of the surface being measured. Skin in particular has a large bias. The Depth Bias Compensation is a correction for this error by pulling the surface back towards their true depth. It most useful for recovering high quality faces and hands on otherwise well-calibrated captures. The larger the value, the larger the compensation. 0 means no depth bias compensation is applied."));
val = meshSource.radialBiasPersp[persp];
val = EditorGUILayout.Slider(val, StudioMeshSource.radialBiasMin, StudioMeshSource.radialBiasMax);
meshSource.radialBiasPersp[persp] = val;
GUI.enabled = perspGeomEnabled;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Override Weight Unknown", GUILayout.Width(250));
bool overrideWeight = meshSource.perspectiveGeometryData.GetOverrideWeightUnknown(persp);
overrideWeight = EditorGUILayout.Toggle(overrideWeight);
meshSource.perspectiveGeometryData.SetOverrideWeightUnknown(persp, overrideWeight);
EditorGUILayout.EndHorizontal();
GUI.enabled = overrideWeight && perspGeomEnabled;
EditorGUILayout.LabelField("Weight Unknown");
val = meshSource.perspectiveGeometryData.GetWeightUnknown(persp);
val = EditorGUILayout.Slider(val, 0.0001f, 0.05f);
meshSource.perspectiveGeometryData.SetWeightUnknown(persp, val);
EditorGUILayout.EndVertical();
}
}
if (EditorGUI.EndChangeCheck())
{
doGenerate = true;
EditorUtility.SetDirty(meshSource);
}
}
}
}
serializedObject.ApplyModifiedProperties();
if (doResize)
{
meshSource.Resize();
}
if (doGenerate)
{
m_maskGUI.MarkDirty();
meshSource.Generate();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 17c53acf9825a7849a617debb589e01e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,57 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using System.Linq;
using System.Collections.Generic;
using System;
namespace Depthkit
{
public class StudioMeshSourceGizmosDrawer
{
[DrawGizmo(GizmoType.Selected | GizmoType.Active)]
static void DrawGizmosFor(Depthkit.StudioMeshSource meshSource, GizmoType gizmoType)
{
if(meshSource.showLevelOfDetailGizmo)
{
Camera cam = Camera.main;
Vector3 origin = meshSource.transform.position + meshSource.volumeBounds.center;
Vector3 dir = (cam.transform.position - origin).normalized;
float segmentLength = (cam.farClipPlane / meshSource.levelOfDetailDistance) / meshSource.numLevelOfDetailLevels;
for(int i = 0; i < meshSource.numLevelOfDetailLevels; ++i)
{
Color c = Color.HSVToRGB(1.0f / (float)i, 1.0f, 1.0f);
Vector3 start = dir * segmentLength * i + origin;
Vector3 end = start + dir * segmentLength;
Gizmos.color = c;
Gizmos.DrawLine(start, end);
Matrix4x4 storedMatrix = Gizmos.matrix;
Gizmos.matrix = Matrix4x4.Translate(end - cam.transform.position);
Gizmos.matrix *= Matrix4x4.LookAt(cam.transform.position, origin, cam.transform.up);
Gizmos.DrawWireCube(Vector3.zero, new Vector3(1, 1, 0.001f));
Gizmos.matrix = storedMatrix;
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f5df0f092c5b834897bdd52b3b9d940
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,138 @@
SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT
The text of this license (this “License”) may be found at: www.depthkit.tv/license-agreement-v1
Thank you for your interest in using the Simile Inc dba Scatter ("Scatter") Software Development Kit (the "SDK").
In order to obtain and use the SDK, you must first agree to the terms of this License. If you do not agree to the
terms of this License, then you may not use the SDK.
SDK LICENSE
1. Subject to the terms and conditions of this License, Scatter hereby
grants to you a worldwide, non-exclusive, royalty-free, sublicenseable license to use, reproduce, modify,
embed and redistribute (subject to restrictions below) the software contained in the SDK, including, but
not limited to, the samples, headers, documentation and source code. This License is subject to the
following terms and conditions:
1.1 This license grants you the non-exclusive license and right to use the SDK to develop
methods to play back content produced in the software suite known as Depth Kit (such content referred
to as your “Content”) in the Unity game engine, as well as other features that may be added from time to
time by Scatter. You may not use the SDK to connect Depth Kit to any software platform or game engine
other than Unity.
1.2 For avoidance of doubt, when you use the SDK in or with your Content, you retain all
rights to your Content, and you have no obligations to share or license your Content (including your
source and object code) to Scatter or any third parties; provided, however, Scatter retains all rights to the
SDK and the headers, libraries and APIs of Depth Kit and other tools made available by Scatter, including
those that may be incorporated into your Content by virtue of your producing it through Depth Kit.
1.3 You agree not to commit any act intended to (a) interfere with the normal operation of
Depth Kit or the SDK, (b) provide software to Depth Kit users or developers that would induce breach of
any Scatter agreements, or (c) provide software to Scatter or Depth Kit users that contains malware,
viruses, hacks, bots, Trojan horses, or other malicious code.
1.4 You may not use the SDK for any purpose not expressly permitted by this License. You
may not:
a. decompile;
b. reverse engineer;
c. disassemble; or
d. attempt to derive the source code of any part of the SDK where source code is
not directly provided to you, or any other software or firmware provided to you by Scatter in binary
form (except as and only to the extent any foregoing restriction is prohibited by applicable law).
REDISTRIBUTION
2. Subject to the terms and conditions of this License, your license to redistribute and sublicense the SDK
is also expressly made subject to the following conditions:
2.1 You may sublicense and redistribute the binary or object code form of the SDK in whole
for no charge or as part of a for-charge piece of Content; provided, however, you may only license,
sublicense or redistribute the binary or object code of the SDK (and not the SDKs source code) in its
entirety. The SDK, including its associated libraries, and your Content that includes any portion of the
SDK, may only be used with Depth Kit and may not be used, licensed, or sublicensed to interface with
software that is not authorized and approved by Scatter;
2.2 You must include with all such redistributed or sublicensed SDK code the following copyright
notice: “Copyright 2016-2024 Simile Inc dba Scatter. All rights reserved.”;
2.3 You must give any other recipients of the SDK a copy of this License as such recipients,
licensees or sublicensees may only use the SDK subject to the terms of this License and such recipient's,
licensee's or sublicensee's agreement to and acceptance of this License with Scatter; and
2.4 The SDK includes a “LICENSE” text file (the “License Notice”), and any SDK distribution that
you distribute must include a copy of this License with the License Notice.
GENERAL PROVISIONS
3. Additional Materials
3.1 Scatter may include in this SDK additional content (e.g., samples) for demonstration,
references or other specific purposes. Such content will be clearly marked in the SDK and is subject to
any included terms and conditions.
3.2 Your use of third-party materials included in the SDK, or which the SDK may be dependent
upon (including without limitation Unity), may be subject to other terms and conditions typically found in
separate third-party license agreements or &quot;READ ME&quot; files included with such third-party materials. To
the extent such other terms and conditions conflict with the terms and conditions of this License, the
former will control with respect to the applicable third-party materials. The terms of licensing the Unity
game engine can be found here: https://unity3d.com/legal/terms-of-service/software.
4. THE SDK AND ANY COMPONENT THEREOF ARE PROVIDED “AS IS” AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL Scatter AS THE COPYRIGHT OWNER OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SDK, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOME JURISDICTIONS DO NOT PERMIT THE
EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO YOU MAY HAVE ADDITIONAL
RIGHTS.
5. This License does not grant permission to use the trade names, trademarks, service marks, or product
names of Scatter, including without limitation “Depth Kit,” except as required for reasonable and customary
use in describing the origin of the SDK, and reproducing the content of the License Notice file. Scatter
reserves all rights not expressly granted to you under this License. Neither Scatters name nor the names
of Scatters contributors, licensors, employees, or contractors, may be used to endorse or promote
products developed using the SDK without specific prior written permission of Scatter.
6. You are responsible for ensuring that your use of the SDK and your Content complies with all
applicable laws (including privacy laws) wherever your Content is made available. You acknowledge and
agree that you are solely responsible for any health and safety issues arising from your Content.
7. Your acceptance of the terms and conditions of this License in and of itself and for all of your Content
may be evidenced by your usage of the SDK or acceptance of this License. As this License is updated for
future releases of the SDK, you agree to abide by and meet all requirements of future updates of this
License for those future SDK releases, with acceptance evidenced by usage of the SDK or any element
thereof and the future updates of this License will apply for your Content that may be developed for or
with that future SDK or any element thereof (i.e., you cannot sidestep out of the requirements of future
updates of the License by developing against an older release of the SDK or License). You acknowledge
that future versions of the SDK may be provided for a fee or otherwise under substantially different terms
from those provided hereunder.
8. Scatter reserves the right to terminate this License and all your rights hereunder immediately in the
event you materially breach this License.
9. Furthermore, Scatter also reserves the right to cancel or terminate this License for any of the following
reasons:
a. Intellectual property infringement by you for your Content that is used with or by
the SDK;
b. Content that violates applicable law;
c. Health and safety issues associated with your Content;
d. Use of the SDK with a commercial product other than Depth Kit and Unity; and
e. Failure to provide required notices as set forth above.
10. You agree to fully indemnify Scatter from any and all losses, costs, damages and expenses (including
reasonable attorney's fees) arising out of your Content or any breach of this License.
11. Scatter may discontinue or change functionality of Depth Kit or the SDK at any time, and your
continued use of Depth Kit or the SDK or use of any modified or additional services in connection
therewith is conditioned upon your adherence to the terms of this License, as modified by Scatter from
time to time, as well as any additional license agreements necessitated by additional features.
12. In the event any provision of this License is determined to be invalid, prohibited or unenforceable by a
court or other body of competent jurisdiction, this License shall be construed as if such invalid, prohibited
or unenforceable provision has been more narrowly drawn so as not to be invalid, prohibited or
unenforceable.
13. You may not assign any rights or obligations under this License without the advance written consent
of Scatter, which may be withheld in its sole discretion. Scatter may assign its rights or obligations under
this License in its sole discretion.
14. Failure of either party at any time to enforce any of the provisions of this License will not be construed
as a waiver of such provisions or in any way affect the validity of this License or parts thereof.
15. Your remedies under this License shall be limited to the right to collect money damages, if any, and
you hereby waive your right to injunctive or other equitable relief.
16. You will comply with all applicable export control laws of the United States and any other applicable
governmental authority, including without limitation, the U.S. Export Administration Regulations. You
agree that this License and the SDK and accompanying documentation are Scatter's confidential
information (and is not publicly available), and you will not use it, disclose it or make it available to others
except in accordance with the terms of this License.
17. This License shall be governed by the laws of the State of New York, without giving effect to choice of
law principles. All disputes relating to this License shall be resolved by binding non-appearance-based
arbitration before a single arbitrator in New York County, New York. The arbitration shall be conducted in
accordance with the rules and procedures of JAMS then in effect, and the judgment of the arbitrator shall
be final and capable of entry in any court of competent jurisdiction. You and Scatter agree to submit to the
personal jurisdiction of the courts located within New York County, New York in connection with any
entrance of an arbitrators judgment or decision or any dispute with respect to the arbitration process or
procedure or Scatters exercise of its equitable rights or remedies.
Effective as of October 7, 2016

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e63ea5f9a05183842a1780713c390fe3
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,2 @@
# Depthkit Studio
Copyright 2021 Scatter All Rights reserved.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f067819468e7b434e966128474072c6b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fae5fceea5e024643a2580c408c56fe2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c6bcf403a7484a4a9153b3f20b1b940
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f6c39bca641cdaf46a71dcfdeb31fe85
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 42c51ff9981f3e24b83cd7ad3c56e235, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
{
"name": "Depthkit.Studio",
"rootNamespace": "",
"references": [
"GUID:d757665d4a59fe94bab8bd5391e60e3d"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 24074500c51871f48bb3112a39fc1e55
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7fcf3938ccb32574d8f74d06952be6a7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEngine.Rendering;
namespace Depthkit
{
[SelectionBase]
[ExecuteInEditMode]
[AddComponentMenu("Depthkit/Studio/Built-in RP/Depthkit Studio Built-in Look")]
public class StudioLook : ProceduralLook
{
protected static Shader s_defaultUnlitPhotoLookShader = null;
protected static Material s_defaultUnlitPhotoLookMaterial = null;
protected static Material GetDefaultMaterial()
{
if (s_defaultUnlitPhotoLookShader == null)
{
s_defaultUnlitPhotoLookShader = Shader.Find("Depthkit/Studio/Depthkit Studio Photo Look Built-in RP");
}
if (s_defaultUnlitPhotoLookMaterial == null)
{
s_defaultUnlitPhotoLookMaterial = new Material(s_defaultUnlitPhotoLookShader);
}
return s_defaultUnlitPhotoLookMaterial;
}
public override string GetLookName() { return "Depthkit Studio Look"; }
protected override void SetDataSources()
{
if (meshSource == null)
{
meshSource = depthkitClip.GetDataSource<StudioMeshSource>();
}
}
protected override void SetDefaults()
{
if (lookMaterial == null)
{
lookMaterial = GetDefaultMaterial();
}
base.SetDefaults();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0ecc1bf60b3d3d41b59c6fb40121b5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 42c51ff9981f3e24b83cd7ad3c56e235, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0ce27562bebb8014db2d39cd0ef4e183
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 26dbc0a8fdc45d247846a8814b4c83aa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dbc2efe69b91fb544909c24e6bbb37f8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,357 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#pragma kernel ExtractSurfaceFromVolume8x8x8 SDF_READ_ONLY GROUP_SIZE=8 DK_CORE_PACKED_TRIANGLE
#pragma kernel ExtractSurfaceFromVolume4x4x4 SDF_READ_ONLY GROUP_SIZE=4 DK_CORE_PACKED_TRIANGLE
#pragma kernel ExtractSurfaceFromVolumeWithUVs8x8x8 SDF_READ_ONLY GROUP_SIZE=8 DK_CORE_PACKED_TRIANGLE DK_TEXTURE_ATLAS
#pragma kernel ExtractSurfaceFromVolumeWithUVs4x4x4 SDF_READ_ONLY GROUP_SIZE=4 DK_CORE_PACKED_TRIANGLE DK_TEXTURE_ATLAS
static const uint GROUP_THREAD_COUNT = GROUP_SIZE * GROUP_SIZE * GROUP_SIZE;
static const uint TILE_BORDER = 2;
static const uint TILE_SIZE = GROUP_SIZE + TILE_BORDER * 2;
static const uint TILE_VOXEL_COUNT = TILE_SIZE * TILE_SIZE * TILE_SIZE;
//sdf samples with a border of 1 to compute normals for edges
groupshared float g_sdfSamples[TILE_VOXEL_COUNT];
static const float epsilon = 1e-5;
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/DataSource/StudioMeshSourceCommon.cginc"
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Includes/DepthkitStudioUniforms.cginc"
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/CoreVertex.cginc"
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/CoreTriangle.cginc"
#ifdef DK_TEXTURE_ATLAS
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Includes/DepthkitStudio.cginc"
#endif
static const uint triangleConnectionTableSize = 256 * 16;
static const uint triangleOffsetsSize = 72;
static const uint numberOfTrianglesSize = 256;
static const uint triangleConnectionTableOffset = 0;
static const uint triangleOffsetsOffset = triangleConnectionTableSize;
static const uint numberOfTrianglesOffset = triangleConnectionTableSize + triangleOffsetsSize;
AppendStructuredBuffer<Triangle> _TriangleBuffer; // position only output
StructuredBuffer<int> _TriangleDataBuffer;
// cube offsets represent a morton ordering of cube locations in a 8 voxel 3d grid
//
// front slice back slice
// +---+---+ +---+---+
// | 2 | 3 | | 6 | 7 |
// +---+---+ +---+---+
// | 0 | 1 | | 4 | 5 |
// +---+---+ +---+---+
//
static const int3 cubeOffsets[11] =
{
{ 0, 0, 0 }, //0
{ 1, 0, 0 }, //1
{ 0, 0, 1 }, //2
{ 1, 0, 1 }, //3
{ 0, 1, 0 }, //4
{ 1, 1, 0 }, //5
{ 0, 1, 1 }, //6
{ 1, 1, 1 }, //7
{ -1, 0, 0 }, //8
{ 0, -1, 0 }, //9
{ 0, 0, -1 }, //10
};
static const uint possibleTriangleCounts[6] =
{
0, 1, 2, 3, 4, 5
};
float _TriangleCullingThreshold;
float _SdfThreshold;
// encode the cube number of triangles index as a bitfield of the cells with a valid sdf value ( > 0 in our case)
// non-morten ordered cube offsets
uint classifyCube(uint3 id)
{
float currentVoxSdf = g_sdfSamples[toIndex3D((int3) id, (uint3) TILE_SIZE)];
if (currentVoxSdf > Invalid_Sdf_compare) return 0;
float voxOffset1 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[1], (uint3) TILE_SIZE)];
if (voxOffset1 > Invalid_Sdf_compare) return 0;
float voxOffset3 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[3], (uint3) TILE_SIZE)];
if (voxOffset3 > Invalid_Sdf_compare) return 0;
float voxOffset2 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[2], (uint3) TILE_SIZE)];
if (voxOffset2 > Invalid_Sdf_compare) return 0;
float voxOffset4 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[4], (uint3) TILE_SIZE)];
if (voxOffset4 > Invalid_Sdf_compare) return 0;
float voxOffset5 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[5], (uint3) TILE_SIZE)];
if (voxOffset5 > Invalid_Sdf_compare) return 0;
float voxOffset7 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[7], (uint3) TILE_SIZE)];
if (voxOffset7 > Invalid_Sdf_compare) return 0;
float voxOffset6 = g_sdfSamples[toIndex3D((int3) id + cubeOffsets[6], (uint3) TILE_SIZE)];
if (voxOffset6 > Invalid_Sdf_compare) return 0;
const uint cubeindexBitfield =
((currentVoxSdf > _SdfThreshold) << 0) |
((voxOffset1 > _SdfThreshold) << 1) |
((voxOffset3 > _SdfThreshold) << 2) |
((voxOffset2 > _SdfThreshold) << 3) |
((voxOffset4 > _SdfThreshold) << 4) |
((voxOffset5 > _SdfThreshold) << 5) |
((voxOffset7 > _SdfThreshold) << 6) |
((voxOffset6 > _SdfThreshold) << 7);
return cubeindexBitfield;
}
float3 sdfNormal(uint3 id)
{
float centerSdf = g_sdfSamples[toIndex3D((int3) id, (uint3) TILE_SIZE)];
return normalize(
(centerSdf - clamp(g_sdfSamples[toIndex3D((int3) id + cubeOffsets[1], (uint3) TILE_SIZE)], -_SdfSensitivity, _SdfSensitivity)) * (float3) cubeOffsets[1] +
(centerSdf - clamp(g_sdfSamples[toIndex3D((int3) id + cubeOffsets[4], (uint3) TILE_SIZE)], -_SdfSensitivity, _SdfSensitivity)) * (float3) cubeOffsets[4] +
(centerSdf - clamp(g_sdfSamples[toIndex3D((int3) id + cubeOffsets[2], (uint3) TILE_SIZE)], -_SdfSensitivity, _SdfSensitivity)) * (float3) cubeOffsets[2] +
(centerSdf - clamp(g_sdfSamples[toIndex3D((int3) id + cubeOffsets[8], (uint3) TILE_SIZE)], -_SdfSensitivity, _SdfSensitivity)) * (float3) cubeOffsets[8] +
(centerSdf - clamp(g_sdfSamples[toIndex3D((int3) id + cubeOffsets[9], (uint3) TILE_SIZE)], -_SdfSensitivity, _SdfSensitivity)) * (float3) cubeOffsets[9] +
(centerSdf - clamp(g_sdfSamples[toIndex3D((int3) id + cubeOffsets[10], (uint3) TILE_SIZE)], -_SdfSensitivity, _SdfSensitivity)) * (float3) cubeOffsets[10]);
}
#ifdef DK_TEXTURE_ATLAS
int GetHighestWeightedPerspectiveForVert(inout Vertex vert, out float weight)
{
float highestWeight = 0;
int highestWeightPerspective = -1;
for (uint perspectiveIndex = 0; perspectiveIndex < (uint) _PerspectivesCount; perspectiveIndex++)
{
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
float4 fallbackColor1 = float4(0, 0, 0, 0);
float4 fallbackColor2 = float4(0, 0, 0, 0);
#endif
for (uint perspectiveIndex = 0; perspectiveIndex < (uint) _PerspectivesCount; perspectiveIndex++)
{
float3 surfaceToEyeDir = dkGetDepthCameraDirection(perspectiveIndex) * -1;
float4 accumulatedColor = float4(0, 0, 0, 0);
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
accumulatedColor += GetCamContribution(perspectiveIndex, surfaceToEyeDir, vert.position, vert.normal, fallbackColor1, fallbackColor2);
#else
accumulatedColor += GetCamContribution(perspectiveIndex, surfaceToEyeDir, vert.position, vert.normal);
#endif
if (accumulatedColor.w > highestWeight)
{
highestWeight = accumulatedColor.w;
highestWeightPerspective = perspectiveIndex;
}
}
}
weight = highestWeight;
vert.uv.z = (highestWeightPerspective + 1) / (_PerspectivesCount + 1.0f);
return highestWeightPerspective;
}
uint GetHighestWeightedPerspectiveForTriangle(inout Vertex v1, inout Vertex v2, inout Vertex v3)
{
float w1 = 0, w2 = 0, w3 = 0;
int id1 = GetHighestWeightedPerspectiveForVert(v1, w1);
int id2 = GetHighestWeightedPerspectiveForVert(v2, w2);
int id3 = GetHighestWeightedPerspectiveForVert(v3, w3);
float z = min(v1.uv.z, min(v2.uv.z, v3.uv.z));
v1.uv.z = v2.uv.z = v3.uv.z = z;
float maxW = max(w1, max(w2, w3));
if (maxW > 0) {
if (maxW == w1) return id1;
else if (maxW == w2) return id2;
else return id3;
}
return 0;
}
void fillAtlasUVForVertex(uint perspectiveIndex, inout Vertex vert)
{
float2 perspectiveUV, depthUV, colorUV;
float3 depthViewSpacePos;
dkWorldToPerspectiveUV(perspectiveIndex, vert.position, perspectiveUV, depthUV, colorUV, depthViewSpacePos);
int2 perspectiveResolution = dkGetPerspectiveResolution();
float scale = 1.0f / (float)_PerspectivesCount;
if (perspectiveResolution.x > perspectiveResolution.y)
{
perspectiveUV.y = perspectiveUV.y * scale + scale * perspectiveIndex;
perspectiveResolution.y *= _PerspectivesCount;
}
else
{
perspectiveUV.x = perspectiveUV.x * scale + scale * perspectiveIndex;
perspectiveResolution.x *= _PerspectivesCount;
}
int borderPixels = min(perspectiveResolution.x, perspectiveResolution.y) * 0.1;
float2 border = borderPixels / (float)perspectiveResolution;
perspectiveUV = border + perspectiveUV * (1 - border*2);
vert.uv = float4(perspectiveUV, vert.uv.z, 0);
}
void fillAtlasUVsForTriangle(inout Triangle t)
{
int perspectiveIndex = GetHighestWeightedPerspectiveForTriangle(t.vertex[0], t.vertex[1], t.vertex[2]);
fillAtlasUVForVertex(perspectiveIndex, t.vertex[0]);
fillAtlasUVForVertex(perspectiveIndex, t.vertex[1]);
fillAtlasUVForVertex(perspectiveIndex, t.vertex[2]);
}
#endif // DK_TEXTURE_ATLAS
bool MCPointCompare(float3 left, float3 right)
{
if (left.x < right.x)
return true;
else if (left.x > right.x)
return false;
if (left.y < right.y)
return true;
else if (left.y > right.y)
return false;
if (left.z < right.z)
return true;
else if (left.z > right.z)
return false;
return false;
}
// This interpolation function handles issues with normal linear interpolation that lead to cracks
// see the note in http://paulbourke.net/geometry/polygonise/
// > It has been suggested that the interpolation should be handled as shown here,
// > that this solves an issue of small cracks in the isosurface.
// > http://paulbourke.net/geometry/polygonise/interp.c
float3 MCLinearInterp(float3 p0, float3 p1, float value0, float value1, float isolevel)
{
if (MCPointCompare(p1, p0))
{
float3 temp;
temp = p0;
p0 = p1;
p1 = temp;
temp.x = value0;
value0 = value1;
value1 = temp.x;
}
if (abs(value0 - value1) > epsilon) {
return p0 + (p1 - p0) * (isolevel - value0) / (value1 - value0);
}
return p0;
}
void ExtractSurfaceFromVolume(uint3 id, uint3 groupId, uint3 groupThreadId, uint groupIndex)
{
const int3 tileOffset = int3(groupThreadId + TILE_BORDER);
const int3 tileToVoxelOffset = int3((groupId * GROUP_SIZE) - TILE_BORDER);
const int3 voxel = tileToVoxelOffset + tileOffset;
uint ind;
//sample sdf for my tile positions
[unroll]
for (ind = groupIndex; ind < TILE_VOXEL_COUNT; ind += GROUP_THREAD_COUNT)
{
int3 sample = tileToVoxelOffset + (int3) toCoord3D(ind, (uint3) TILE_SIZE);
g_sdfSamples[ind] = _SdfBuffer[toIndex3DClamp(sample, _VoxelGrid)];
}
GroupMemoryBarrierWithGroupSync();
//make sure there's a voxel here
if (voxel.x < 0 || voxel.y < 0 || voxel.z < 0 || voxel.x >= (int) _VoxelGrid.x || voxel.y >= (int)_VoxelGrid.y || voxel.z >= (int)_VoxelGrid.z)
return;
uint cubeClassification = classifyCube(tileOffset);
uint numTris = possibleTriangleCounts[_TriangleDataBuffer[numberOfTrianglesOffset + cubeClassification]];
for (uint t = 0; t < numTris; t++)
{
Triangle tri = newTriangle();
[unroll]
for (int i = 0; i < 3; i++) // for each vertex in triangle
{
uint edge = clamp(_TriangleDataBuffer[triangleConnectionTableOffset + cubeClassification * 16 + t * 3 + i], 0, 11); // cubedata.y == 0..255 from bitfield of 8 octants
int3 point0 = int3(tileOffset.x + _TriangleDataBuffer[triangleOffsetsOffset + edge * 6],
tileOffset.y + _TriangleDataBuffer[triangleOffsetsOffset + edge * 6 + 1],
tileOffset.z + _TriangleDataBuffer[triangleOffsetsOffset + edge * 6 + 2]);
int3 point1 = int3(tileOffset.x + _TriangleDataBuffer[triangleOffsetsOffset + edge * 6 + 3],
tileOffset.y + _TriangleDataBuffer[triangleOffsetsOffset + edge * 6 + 4],
tileOffset.z + _TriangleDataBuffer[triangleOffsetsOffset + edge * 6 + 5]);
float value0 = g_sdfSamples[toIndex3D(point0, (uint3) TILE_SIZE)];
float value1 = g_sdfSamples[toIndex3D(point1, (uint3) TILE_SIZE)];
if (value0 >= Invalid_Sdf_compare) value0 = _SdfThreshold;
if (value1 >= Invalid_Sdf_compare) value1 = _SdfThreshold;
float3 vertex = float3(tileToVoxelOffset) + MCLinearInterp(point0, point1, value0, value1, _SdfThreshold);
float3 normal = MCLinearInterp(sdfNormal(point0), sdfNormal(point1), value0, value1, _SdfThreshold);
tri.vertex[i].position = scaledPositionf(vertex);
tri.vertex[i].normal = clamp3(normal, float3(-1.0, -1.0, -1.0), float3(1.0, 1.0, 1.0));
}
float d1 = abs(distance(tri.vertex[1].position, tri.vertex[0].position));
float d2 = abs(distance(tri.vertex[2].position, tri.vertex[0].position));
float d3 = abs(distance(tri.vertex[1].position, tri.vertex[2].position));
if (d1 < _TriangleCullingThreshold && d2 < _TriangleCullingThreshold && d3 < _TriangleCullingThreshold)
{
#ifdef DK_TEXTURE_ATLAS
fillAtlasUVsForTriangle(tri);
#endif
_TriangleBuffer.Append(tri);
}
}
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void ExtractSurfaceFromVolume8x8x8(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
ExtractSurfaceFromVolume(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void ExtractSurfaceFromVolume4x4x4(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
ExtractSurfaceFromVolume(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void ExtractSurfaceFromVolumeWithUVs8x8x8(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
ExtractSurfaceFromVolume(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void ExtractSurfaceFromVolumeWithUVs4x4x4(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
ExtractSurfaceFromVolume(id, GroupId, GroupThreadId, GroupIndex);
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b681efadf8b7cd4eb78405a35cae12b
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 2361348
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,169 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#pragma kernel GeneratePerPixelNormalWeights16x16 BLOCK_SIZE=16
#pragma kernel GeneratePerPixelNormalWeights8x8 BLOCK_SIZE=8
#pragma kernel GeneratePerPixelNormalWeights4x4 BLOCK_SIZE=4
#pragma kernel GeneratePerPixelNormalWeightsAndWsDepth16x16 BLOCK_SIZE=16 WRITE_WS_DEPTH=1
#pragma kernel GeneratePerPixelNormalWeightsAndWsDepth8x8 BLOCK_SIZE=8 WRITE_WS_DEPTH=1
#pragma kernel GeneratePerPixelNormalWeightsAndWsDepth4x4 BLOCK_SIZE=4 WRITE_WS_DEPTH=1
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#ifdef WRITE_WS_DEPTH
RWTexture2D<float> _WSDepth;
#endif
RWTexture2D<float> _NormalWeights;
float4 _NormalTexture_TexelSize;
static const uint BLOCK_THREAD_COUNT = BLOCK_SIZE * BLOCK_SIZE;
static const uint TILE_BORDER = 1;
static const uint TILE_SIZE = BLOCK_SIZE + TILE_BORDER * 2;
static const uint TILE_PIXEL_COUNT = TILE_SIZE * TILE_SIZE;
static const uint KERNEL_WIDTH = 1;
groupshared float3 g_samples[TILE_PIXEL_COUNT];
// ------------
//| 7 | 2 | 5 |
//| 1 | 0 | 3 |
//| 6 | 4 | 8 |
// ------------
static const int2 offsets[9] = {
{0,0}, //0
{-1,0}, //1
{0,-1}, //2
{1,0}, //3
{0,1}, //4
{1,-1}, //5
{-1, 1}, //6
{-1, -1}, //7
{1, 1} //8
};
float length2(float3 vec)
{
return (vec.x * vec.x
+ vec.y * vec.y
+ vec.z * vec.z);
}
void GeneratePerPixelNormalWeights(uint3 id, uint3 GroupId, uint3 GroupThreadId, uint GroupIndex)
{
uint ind;
//////////////////////////////////////
//Fill a tile's worth of shared memory
//////////////////////////////////////
const int2 tileUpperLeft = int2(GroupId.xy * BLOCK_SIZE) - (int2)TILE_BORDER;
[unroll]
for (ind = GroupIndex; ind < TILE_PIXEL_COUNT; ind += BLOCK_THREAD_COUNT)
{
int2 pixel = tileUpperLeft + (int2)toCoord(ind, TILE_SIZE);
pixel = clamp(pixel, int2(0,0), int2(_NormalTexture_TexelSize.zw)); // clamp to edges of cpptex
float2 uv = pixel * _NormalTexture_TexelSize.xy;
float2 colorUV, depthUV;
dkGetColorAndDepthUV(uv, colorUV, depthUV);
float2 perspectiveUV = dkGetPerspectiveCoordFromPackedUV(uv);
uint perspectiveIndex = dkGetPerspectiveIndexFromCoord(perspectiveUV);
//TODO when doing reduced resolution, we want bilinear interp? i think no
float depth = dkLoadDepth(depthUV, perspectiveIndex, perspectiveUV);
g_samples[ind] = dkPackedUVToLocal(uv, depth).xyz;
}
GroupMemoryBarrierWithGroupSync(); //wait for everyone
///////////////////////////////////////////////////////////////////////////////////
//exit here if we are out of bounds of the texture, have to do it after the barrier
///////////////////////////////////////////////////////////////////////////////////
if((int)id.x >= (int)_NormalTexture_TexelSize.z || (int)id.y >= (int)_NormalTexture_TexelSize.w)
{
return;
}
/////////////////////////////////////////////////////////////////////////////////
//Dervie the tile sample ids from the group thread id and fetch the shared sample
/////////////////////////////////////////////////////////////////////////////////
int2 tileOffset = GroupThreadId.xy + TILE_BORDER;
uint id0 = toIndex(tileOffset + offsets[0], TILE_SIZE);
uint id1 = toIndex(tileOffset + offsets[1], TILE_SIZE);
uint id2 = toIndex(tileOffset + offsets[2], TILE_SIZE);
uint id3 = toIndex(tileOffset + offsets[3], TILE_SIZE);
uint id4 = toIndex(tileOffset + offsets[4], TILE_SIZE);
float3 normal = normalize(
cross(g_samples[id1] - g_samples[id0], g_samples[id2] - g_samples[id0]) +
cross(g_samples[id3] - g_samples[id0], g_samples[id4] - g_samples[id0]));
//////////////////////////////////////////////
//Write to the texture at disaptch id location
//////////////////////////////////////////////
float normalWeight = abs(dot(normal, float3(0.0, 0.0, 1.0)));
_NormalWeights[id.xy] = normalWeight;
#ifdef WRITE_WS_DEPTH
_WSDepth[id.xy] = g_samples[id0].z;
#endif
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
void GeneratePerPixelNormalWeights16x16(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GeneratePerPixelNormalWeights(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
void GeneratePerPixelNormalWeights8x8(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GeneratePerPixelNormalWeights(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
void GeneratePerPixelNormalWeights4x4(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GeneratePerPixelNormalWeights(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
void GeneratePerPixelNormalWeightsAndWsDepth16x16(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GeneratePerPixelNormalWeights(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
void GeneratePerPixelNormalWeightsAndWsDepth8x8(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GeneratePerPixelNormalWeights(id, GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
void GeneratePerPixelNormalWeightsAndWsDepth4x4(uint3 id : SV_DispatchThreadID, uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GeneratePerPixelNormalWeights(id, GroupId, GroupThreadId, GroupIndex);
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6f7e72c94af5640bd9190503414cdcbb
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 65536
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,106 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
Shader "Depthkit/GenerateNormalWeights"{
Properties{
[HideInInspector]_MainTex ("Texture", 2D) = "white" {}
}
SubShader{
// markers that specify that we don't need culling
// or reading/writing to the depth buffer
Cull Off
ZWrite Off
ZTest Always
//horizontal
Pass {
CGPROGRAM
#include "UnityCG.cginc"
#define DK_USE_BUILT_IN_COLOR_CONVERSION
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#pragma vertex vert
#pragma fragment frag
sampler2D _MainTex;
float4 _NormalTexture_TexelSize;
//the object data that's put into the vertex shader
struct appdata{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
//the data that's used to generate fragments and can be read by the fragment shader
struct v2f{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert(appdata v){
v2f o;
o.position = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag(v2f i) : SV_TARGET{
float3 positions[5] = {
float3(0,0,0),
float3(0,0,0),
float3(0,0,0),
float3(0,0,0),
float3(0,0,0)
};
float2 offsets[5] = {
{0,0},
{-_NormalTexture_TexelSize.x,0},
{0,-_NormalTexture_TexelSize.y},
{_NormalTexture_TexelSize.x,0},
{0,_NormalTexture_TexelSize.y},
};
[unroll(5)]
for (int sample = 0; sample < 5; sample++)
{
float2 uv = i.uv + offsets[sample];
float2 colorUV, depthUV;
dkGetColorAndDepthUV(uv, colorUV, depthUV);
float2 perspectiveUV = dkGetPerspectiveCoordFromPackedUV(uv);
uint perspectiveIndex = dkGetPerspectiveIndexFromCoord(perspectiveUV);
float depth = dkSampleDepth(depthUV, perspectiveIndex, perspectiveUV);
positions[sample] = dkPackedUVToLocal(uv, depth).xyz;
}
float3 normal = normalize(
cross(positions[1] - positions[0], positions[2] - positions[0]) +
cross(positions[3] - positions[0], positions[4] - positions[0]));
return float4(abs(dot(normal, float3(0.0,0.0,1.0))), 0, 0, 1);
}
ENDCG
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f4e383131e4d84e8a8c094953b75f5b6
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,362 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#pragma kernel GenerateVolumeSinglePass GROUP_SIZE=8
//multipass
#pragma kernel KGenerateVolumeMultiPassInit GROUP_SIZE=8
#pragma kernel KGenerateVolumeMultiPassAccumulate GROUP_SIZE=8
#pragma kernel KGenerateVolumeMultiPassResolve DK_SEPARATE_WEIGHT_READONLY GROUP_SIZE=8
#define VOX_INVALID 0
#define VOX_UNKNOWN 1 // or really inside when carved
#define VOX_UNSEEN 2
#define VOX_IN_FRONT 3
static const float epsilon = 1e-10;
static const float PI = 3.14159265f;
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/DataSource/StudioMeshSourceCommon.cginc"
Texture2D<float> _NormalTexture;
float4 _NormalTexture_TexelSize;
struct PerspectiveGeometry
{
int enabled;
int overrideWeightUnknown;
float weightUnknown;
float viewDependentUnseenAmount;
float viewDependentInFrontAmount;
float viewDependentWeight;
float pad1;
float pad2;
};
StructuredBuffer<PerspectiveGeometry> _PerspectiveGeometryData;
float _WeightUnknown = 0.0025f;
float _WeightUnseenMax = 1.0f;
float _WeightUnseenMin = 0.001f;
float _WeightUnseenFalloffPower = 10.0f;
float _WeightInFrontMax = 1.0f;
float _WeightInFrontMin = 0.1f;
///////////////////////////////////
void CalculateSDF(in float3 voxelCenter, in float3 position, in float depth, in uint perspectiveIndex, inout float sdf, inout int flag)
{
float3 viewspacePos3d = dkWorldSpaceToDepthCameraObjectSpace(perspectiveIndex, voxelCenter);
// sdf is the direction and distance from the dk surface,
// sign is tested in depth camera view space, distance is in unity object space.
sdf = sign(viewspacePos3d.z - dkNormalizedDepthToMeters(perspectiveIndex, depth)) * distance(position, voxelCenter);
flag = sdf > 0.0 ? VOX_UNSEEN : VOX_IN_FRONT;
}
bool CalculateSDFWeight(in uint perspectiveIndex, in float3 voxelCenter, in float sdf, in int flag, in PerspectiveGeometry geom, in float normalWeight, inout float weight)
{
// Attenuate the weight by the squared distance to the camera.
// Closer cameras will affect the surface more than distant cameras
float3 camPosition = dkGetDepthCameraPosition(perspectiveIndex);
float camDistSquared = distanceSquared(voxelCenter, camPosition);
float viewWeight = geom.viewDependentWeight;
// flag values are either VOX_UNSEEN or VOX_IN_FRONT
if (flag == VOX_UNSEEN)
{
// Cutoff at _SdfSensitivity
if (sdf > _SdfSensitivity)
{
return false;
}
// Interpolate weight based on distance from surface up to _SdfSensitivity
weight = max(pow(abs(remap(sdf, 0, _SdfSensitivity, _WeightUnseenMax, 0.0f)), _WeightUnseenFalloffPower), _WeightUnseenMin);
// Distance to camera based weighting
weight = max(weight / (camDistSquared + 1.0f), _WeightUnseenMin) * normalWeight * lerp(1.0f, viewWeight, geom.viewDependentUnseenAmount);
}
else if (flag == VOX_IN_FRONT)
{
// Distance to camera based weighting
weight = max(_WeightInFrontMax * 100.0 / (camDistSquared + 1.0f), _WeightInFrontMin) * normalWeight * lerp(1.0f, viewWeight, geom.viewDependentInFrontAmount);
}
return true;
}
bool GetSDFContribution(in uint perspectiveIndex, in float3 pos3d, inout int flag, out float sdf, out float normalWeight)
{
sdf = 0.0f; //0 is on the surface
normalWeight = 0.0;
bool result = true;
float2 perspectiveUV, colorUV, depthUV;
float3 viewSpacePos3d;
dkWorldToPerspectiveUV(perspectiveIndex, pos3d, perspectiveUV, depthUV, colorUV, viewSpacePos3d);
if (perspectiveUV.x <= 0.f || perspectiveUV.y <= 0.f || perspectiveUV.x >= 1.0f || perspectiveUV.y >= 1.0f)
{
// Flag voxel as invalid and return false.
flag = VOX_INVALID;
result = false; //early out if the voxel is out of bounds of the perspective
}
else
{
float depth = dkLoadDepth(depthUV, perspectiveIndex, perspectiveUV);
float2 packedUV = dkPerspectiveToPackedUV(perspectiveIndex, perspectiveUV);
packedUV = saturate(packedUV);
normalWeight = _NormalTexture[uint2(packedUV * _NormalTexture_TexelSize.zw)];
if (!dkValidateNormalizedDepth(perspectiveIndex, depth))
{
// invalid depth returned here, flag voxel and return false
flag = VOX_UNKNOWN;
result = false; //early out if no valid depth here
}
else
{
float3 unprojected = dkPerspectiveUVToWorld(perspectiveIndex, perspectiveUV, depth).xyz;
CalculateSDF(pos3d, unprojected, depth, perspectiveIndex, sdf, flag);
}
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void GetSDFCamContribution(in uint perspectiveIndex, in float3 pos3d, inout float accumulatedWeight, inout float accumulatedSDF)
{
int flag = VOX_UNKNOWN;
float sdf;
float newWeight = 0.0;
float normalWeight = 0.0f;
PerspectiveGeometry data = _PerspectiveGeometryData[perspectiveIndex];
if (data.enabled == 0)
return; //this perspective is disabled
if (GetSDFContribution(perspectiveIndex, pos3d, flag, sdf, normalWeight))
{
if (!CalculateSDFWeight(perspectiveIndex, pos3d, sdf, flag, data, normalWeight, newWeight))
return;
}
else
{
// GetSDFContribution return false and the flag values are either VOX_UNKNOWN or VOX_INVALID
// weight unknown voxels are updated to lie at the _sdfSensitivity on the inside of the surface
float weightUnknown = lerp(_WeightUnknown, data.weightUnknown, data.overrideWeightUnknown);
// weight unknown values larger than epsilon are used to keep the surface from getting noisy
if (flag == VOX_UNKNOWN && weightUnknown >= epsilon)
{
sdf = -_SdfSensitivity;
newWeight = weightUnknown;
}
else
{
// for voxels flagged invalid or unknown voxels with very low weight known values, the sdf and weight is not updated.
// This is so the accumulatedSDF remains at the InvalidSDF value so they can be filtered out
// return without updating the accumulatedSDF and accumulatedWeight value.
return;
}
}
// accumulatedSDF is set to InvalidSDF so the first perspective that has a valid update to this must set it
if (accumulatedSDF >= Invalid_Sdf_compare)
{
accumulatedSDF = newWeight * sdf;
accumulatedWeight = newWeight;
}
else
{
// subsequent perspectives can accumulate the sdf and weight values
accumulatedSDF += newWeight * sdf;
accumulatedWeight += newWeight;
}
}
///////////////////////////////////
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void GenerateVolumeSinglePass(uint3 id : SV_DispatchThreadID)
{
if (id.x >= _VoxelGrid.x || id.y >= _VoxelGrid.y || id.z >= _VoxelGrid.z)
return;
float accumulatedWeight = 0.0f;
float accumulatedSDF = Invalid_Sdf;
float3 pos3d = scaledPosition(id);
for (uint perspectiveIndex = 0; perspectiveIndex < (uint) _PerspectivesCount; perspectiveIndex++)
{
GetSDFCamContribution(perspectiveIndex, pos3d, accumulatedWeight, accumulatedSDF);
}
uint linearIndexOut = linearIndex((int3) id);
if (accumulatedWeight > 0.0)
{
_SdfBuffer[linearIndexOut] = accumulatedSDF / accumulatedWeight;
}
else
{
_SdfBuffer[linearIndexOut] = Invalid_Sdf;
}
}
///////////////////MULTIPASS////////////////
uint _CurrentPerspective;
#ifdef DK_SEPARATE_WEIGHT_READONLY
StructuredBuffer<float> _SdfWeightBuffer;
#else
RWStructuredBuffer<float> _SdfWeightBuffer;
#endif
void GenerateVolumeMultiPass(in uint3 id, out uint SDFIndex, inout float accumulatedSDF, inout float accumulatedWeight)
{
float3 pos3d = scaledPosition(id);
GetSDFCamContribution(_CurrentPerspective, pos3d, accumulatedWeight, accumulatedSDF);
SDFIndex = linearIndex((int3) id);
}
void GenerateVolumeMultiPassAccumulate(uint3 id)
{
float accumulatedWeight = 0.0f;
float accumulatedSDF = Invalid_Sdf;
uint SDFIndex;
GenerateVolumeMultiPass(id, SDFIndex, accumulatedSDF, accumulatedWeight);
if (accumulatedSDF < Invalid_Sdf_compare)
{
float currentSDF = _SdfBuffer[SDFIndex];
float currentWeight;
if (currentSDF < Invalid_Sdf_compare)
{
currentWeight = _SdfWeightBuffer[SDFIndex];
currentSDF += accumulatedSDF;
currentWeight += accumulatedWeight;
}
else
{
currentSDF = accumulatedSDF;
currentWeight = accumulatedWeight;
}
_SdfBuffer[SDFIndex] = currentSDF;
#ifndef DK_SEPARATE_WEIGHT_READONLY
_SdfWeightBuffer[SDFIndex] = currentWeight;
#endif
}
}
void GenerateVolumeMultiPassResolve(uint3 id)
{
float accumulatedWeight = 0.0f;
float accumulatedSDF = Invalid_Sdf;
uint SDFIndex;
GenerateVolumeMultiPass(id, SDFIndex, accumulatedSDF, accumulatedWeight);
float currentSDF = _SdfBuffer[linearIndex((int3) id)];
float currentWeight = 0.f;
if (accumulatedSDF < Invalid_Sdf_compare)
{
if (currentSDF < Invalid_Sdf_compare)
{
currentWeight = _SdfWeightBuffer[SDFIndex];
currentSDF += accumulatedSDF;
currentWeight += accumulatedWeight;
}
else
{
currentSDF = accumulatedSDF;
currentWeight = accumulatedWeight;
}
if (currentWeight > 0.0f)
{
_SdfBuffer[SDFIndex] = currentSDF / currentWeight;
}
}
else if (currentSDF < Invalid_Sdf_compare)
{
currentWeight = _SdfWeightBuffer[SDFIndex];
if (currentWeight > 0.0f)
{
_SdfBuffer[SDFIndex] = currentSDF / currentWeight;
}
}
}
void GenerateVolumeMultiPassInit(uint3 id)
{
float accumulatedWeight = 0.0f;
float accumulatedSDF = Invalid_Sdf;
uint SDFIndex;
GenerateVolumeMultiPass(id, SDFIndex, accumulatedSDF, accumulatedWeight);
if (accumulatedSDF < Invalid_Sdf_compare)
{
_SdfBuffer[SDFIndex] = accumulatedSDF;
#ifndef DK_SEPARATE_WEIGHT_READONLY
_SdfWeightBuffer[SDFIndex] = accumulatedWeight;
#endif
}
else
{
_SdfBuffer[SDFIndex] = Invalid_Sdf;
}
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void KGenerateVolumeMultiPassInit(uint3 id : SV_DispatchThreadID)
{
if (id.x >= _VoxelGrid.x || id.y >= _VoxelGrid.y || id.z >= _VoxelGrid.z)
return;
GenerateVolumeMultiPassInit(id);
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void KGenerateVolumeMultiPassAccumulate(uint3 id : SV_DispatchThreadID)
{
if (id.x >= _VoxelGrid.x || id.y >= _VoxelGrid.y || id.z >= _VoxelGrid.z)
return;
GenerateVolumeMultiPassAccumulate(id);
}
[numthreads(GROUP_SIZE, GROUP_SIZE, GROUP_SIZE)]
void KGenerateVolumeMultiPassResolve(uint3 id : SV_DispatchThreadID)
{
if (id.x >= _VoxelGrid.x || id.y >= _VoxelGrid.y || id.z >= _VoxelGrid.z)
return;
GenerateVolumeMultiPassResolve(id);
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d9a2b1ae49b1de34eaae8d9a9351f31e
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,54 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#pragma kernel GenerateVolumePreview SDF_READ_ONLY
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/DataSource/StudioMeshSourceCommon.cginc"
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Utils.cginc"
struct Vert
{
float3 position;
float4 color;
};
RWStructuredBuffer<Vert> _Points;
float4x4 _LocalToWorldMatrix;
[numthreads(8, 8, 8)]
void GenerateVolumePreview(uint3 id : SV_DispatchThreadID)
{
int sdfIndex = linearIndex(id);
float sdfVal = _SdfBuffer[sdfIndex];
if (sdfVal > Invalid_Sdf_compare)
{
_Points[sdfIndex].position = 0;
_Points[sdfIndex].color = 0;
}
else
{
float val = saturate(remap(sdfVal, -_SdfSensitivity, _SdfSensitivity, 0.0f, 1.0f));
val = abs(val - 0.5f) * 2.0f; //if val is 0 it is on the surface
float3 pos3d = scaledPosition(id);
_Points[sdfIndex].position = mul(_LocalToWorldMatrix, float4(pos3d, 1)).xyz;
_Points[sdfIndex].color = float4(hsv2rgb(float3(val, 1, 1)), 1.0 - val); //red + fully opaque is closest to the surface
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 427a7a1747d4d7549a773b69f344e70e
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 2361348
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,77 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#ifndef _DEPTHKIT_STUDIOMESHSOURCECOMMON_CGINC
#define _DEPTHKIT_STUDIOMESHSOURCECOMMON_CGINC
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Utils.cginc"
int _VoxelGridX;
int _VoxelGridY;
int _VoxelGridZ;
float3 _VoxelGridf;
float3 _BoundsSize;
float3 _BoundsCenter;
float _SdfSensitivity = 0.015f; // tweakable sdf range
float _IsoLODScalar;
static uint3 _VoxelGrid = uint3(_VoxelGridX, _VoxelGridY, _VoxelGridZ);
static uint3 _VoxelGridLOD = uint3(_VoxelGridf / _IsoLODScalar);
#ifdef SDF_READ_ONLY
StructuredBuffer<float> _SdfBuffer;
#else
RWStructuredBuffer<float> _SdfBuffer;
#endif
static const float Invalid_Sdf = 3.14159265e+30F; // invalid sdf value
static const float Invalid_Sdf_compare = 3.14159265e+25F; // comparison value to avoid precision issues
uint linearIndex(int3 id)
{
return toIndex3DClamp(id, _VoxelGridLOD);
}
// get the scaled positions using the geometry LOD level
float3 scaledPosition(uint3 id)
{
float3 fid = float3(id) * _IsoLODScalar; // multiply position up by LOD level * 2 to stretch the position to the whole voxel grid space
float3 voxNDC = (fid / _VoxelGridf) - .5; //apply this to the voxel space bounds to get into normalized voxel space
float3 pos3d = _BoundsCenter + _BoundsSize * voxNDC;
return pos3d;
}
float3 scaledPositionf(float3 id)
{
float3 fid = id * _IsoLODScalar; // multiply position up by LOD level * 2 to stretch the position to the whole voxel grid space
float3 voxNDC = (fid / _VoxelGridf) - .5; //apply this to the voxel space bounds to get into normalized voxel space
float3 pos3d = _BoundsCenter + _BoundsSize * voxNDC;
return pos3d;
}
uint3 quantizePosition(float3 wsPosition)
{
float3 voxNDC = (wsPosition - _BoundsCenter) / _BoundsSize;
float3 fid = (voxNDC + 0.5) * _VoxelGridf;
return uint3(fid / _IsoLODScalar);
}
#endif // _DEPTHKIT_STUDIOMESHSOURCECOMMON_CGINC

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e513014276d827d4c9506ced1f4b760c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
Shader "Depthkit/Studio/VolumePreview"
{
SubShader
{
Tags { "Queue" = "Transparent" "RenderType"="Transparent" }
LOD 200
Pass
{
Cull Off ZWrite Off
Fog { Mode off }
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#include "UnityCG.cginc"
#pragma target 5.0
#pragma vertex vert
#pragma fragment frag
struct Vert
{
float3 position;
float4 color;
};
StructuredBuffer<Vert> _Points;
float _SdfAlpha = 0.02;
float _PointSize = 1.0;
struct v2f
{
float4 pos : SV_POSITION;
float4 col : COLOR;
float size : PSIZE;
};
v2f vert(uint id : SV_VertexID)
{
Vert vert = _Points[id];
v2f OUT;
OUT.pos = UnityObjectToClipPos(float4(vert.position, 1));
OUT.col = vert.color.rgba;
OUT.size = _PointSize;
return OUT;
}
float4 frag(v2f IN) : COLOR
{
return float4(IN.col.rgb, IN.col.a * saturate(_SdfAlpha));
}
ENDCG
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 448b3e87abe38b04f8f576ea329696a9
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 49cc2ba3993bbfd42aa87f068d93ac60
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,154 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#ifndef _DEPTHKIT_STUDIO_CGINC
#define _DEPTHKIT_STUDIO_CGINC
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/SampleEdgeMask.cginc"
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Includes/DepthkitStudioUniforms.cginc"
DK_EDGEMASK_UNIFORMS
float viewBlend(float cosTheta, float multiplier)
{
float scale = 1.0 / max(multiplier, FLOAT_EPS);
return 1.0 / (1.0 + scale + cosTheta * -1.0) * scale;
}
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
float4 GetCamContribution(uint perspectiveIndex, float3 surfaceToEyeDir, float3 pos3d, float3 normal, inout float4 fallbackColor1, inout float4 fallbackColor2)
#else
float4 GetCamContribution(uint perspectiveIndex, float3 surfaceToEyeDir, float3 pos3d, float3 normal)
#endif
{
//ignore cameras from backfacing directions
float3 sensorPosition = dkGetDepthCameraPosition(perspectiveIndex);
float3 surfaceToSensorDir = normalize(sensorPosition - pos3d);
float normalDotSensor = dot(surfaceToSensorDir, normal);
float normWeight = step(0.0f, normalDotSensor);
// back-project into NDC camera space then into texture space for sampling depth and colour frames
float2 perspectiveUV, colorUV, depthUV;
float3 depthViewSpacePos;
dkWorldToPerspectiveUV(perspectiveIndex, pos3d, perspectiveUV, depthUV, colorUV, depthViewSpacePos);
float2 inBounds = step(float2(0.0f, 0.0f), perspectiveUV.xy) * step(perspectiveUV.xy, float2(1.0f, 1.0f));
float valid = inBounds.x * inBounds.y * (float)(_PerspectiveColorBlending[perspectiveIndex].enablePerspective);
// calculate weights
float viewWeight = viewBlend(dot(surfaceToEyeDir, surfaceToSensorDir), _GlobalViewDependentColorBlendWeight * 5.0);
// normal based weighting
normWeight *= pow(max(normalDotSensor, 0), _SurfaceNormalColorBlendingPower);
float mixedWeight = valid * viewWeight * normWeight;
#ifndef DK_UNTEXTURED_FRAGMENT_INFER
// early out before any texture sampling if possible
if (mixedWeight <= 0) return float4(0, 0, 0, 0);
#endif
#if defined(DK_USE_EDGEMASK)
float2 maskUV = perspectiveUV.xy * _PaddedUVScaleFactor;
float edgeMaskValue = _MaskTexture.SampleLevel(_Mask_LinearClamp, float3(maskUV, _PerspectiveToSlice[perspectiveIndex].x), 0).r;
float edgeWeight = 10.0f / (10.0f + pow(edgeMaskValue * (1 + viewWeight), 5.0f));
mixedWeight *= edgeWeight;
#endif
//sample depth and color w/ bilinear interpolation
float depth = dkSampleDepth(depthUV, perspectiveIndex, perspectiveUV);
valid *= (float)dkValidateNormalizedDepth(perspectiveIndex, depth);
mixedWeight *= valid;
float3 unprojected = dkPerspectiveUVToWorld(perspectiveIndex, perspectiveUV, depth).xyz;
float disparity = distance(unprojected, pos3d);
//interpolate over the disparity threshold
mixedWeight *= smoothstep(_PerViewDisparityThreshold + _PerViewDisparityBlendWidth, _PerViewDisparityThreshold - _PerViewDisparityBlendWidth, disparity);
#if defined(DK_USE_DEBUG_COLOR)
float3 newColor = dkGetDebugCameraColor(perspectiveIndex);
#elif defined(DK_USE_EDGEMASK) && defined(DK_DEBUG_EDGEMASK)
float3 newColor = dkGetDebugCameraColor(perspectiveIndex);
mixedWeight = edgeWeight * valid;
#else
float3 newColor = dkSampleColor(colorUV);
#endif
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
// Last level fallback is view dependence and validity only
float fallbackWeight = valid * viewWeight;
fallbackColor2 += float4(newColor * fallbackWeight, fallbackWeight);
// First level fallback also includes normal weight to prevent texture from cameras that can't see the surface at all
fallbackWeight *= normWeight;
fallbackColor1 += float4(newColor * fallbackWeight, fallbackWeight);
#endif
return float4(newColor * mixedWeight, mixedWeight);
}
float3 dkSampleColorViewWeightedReprojection(float3 surfaceToEyeDir, float3 objectPosition, float3 objectNormal)
{
float4 accumulatedColor = float4(0, 0, 0, 0);
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
float4 fallbackColor1 = float4(0, 0, 0, 0);
float4 fallbackColor2 = float4(0, 0, 0, 0);
#endif
for (uint perspectiveIndex = 0; perspectiveIndex < (uint) _PerspectivesCount; perspectiveIndex++)
{
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
accumulatedColor += GetCamContribution(perspectiveIndex, surfaceToEyeDir, objectPosition, objectNormal, fallbackColor1, fallbackColor2);
#else
accumulatedColor += GetCamContribution(perspectiveIndex, surfaceToEyeDir, objectPosition, objectNormal);
#endif
}
if (accumulatedColor.w > 0.0f)
{
accumulatedColor.rgb /= accumulatedColor.w;
}
#ifdef DK_UNTEXTURED_FRAGMENT_INFER
else if (fallbackColor1.w > 0.0f)
{
accumulatedColor.rgb = fallbackColor1.rgb / fallbackColor1.w;
}
else if (fallbackColor2.w > 0.0f)
{
accumulatedColor.rgb = fallbackColor2.rgb / fallbackColor2.w;
}
#endif
else
{
#ifdef DK_UNTEXTURED_FRAGMENT_CLIP
discard;
#endif
#ifdef DK_UNTEXTURED_FRAGMENT_COLORIZE
accumulatedColor.rgb = _UntexturedFragDefaultColor;
#endif
}
return accumulatedColor.rgb;
}
#endif // _DEPTHKIT_STUDIO_CGINC

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d0bdd966e0a30fa4dba3e42b215a29a4
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#ifndef _DEPTHKIT_STUDIO_UNIFORMS_CGINC
#define _DEPTHKIT_STUDIO_UNIFORMS_CGINC
//TODO per perspective edge blending is unnecessary if the feature is disabled
struct PerspectiveColorBlending
{
int enablePerspective;
float viewWeightPowerContribution;
};
float _PerViewDisparityThreshold = 0.05f;
float _PerViewDisparityBlendWidth = 0.05f;
float _SurfaceNormalColorBlendingPower = 1.0f;
float _GlobalViewDependentColorBlendWeight = 1.0f;
float3 _UntexturedFragDefaultColor;
float _InvalidateEdgeWidth = 0.5f;
StructuredBuffer<PerspectiveColorBlending> _PerspectiveColorBlending;
#endif //_DEPTHKIT_CORE_UNIFORMS_CGINC

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5911d9d99005e6f40b9cc73ccf763b6c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8248fb617e3626c40a8e122c9b518a1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,106 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
float4x4 _LocalTransform;
float4x4 _LocalTransformInverse;
float _ShadowAmount;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
uint id : SV_VertexID;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
float4 world_position : TEXCOORD1;
float4 object_position : TEXCOORD2;
float3 object_normal : TEXCOORD3;
#if defined(DK_USE_LIGHTPROBES) && defined(DK_FORWARDBASE_PASS)
float3 indirect : COLOR0;
#endif
UNITY_FOG_COORDS(4)
SHADOW_COORDS(5)
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
Vertex vert = dkSampleTriangleBuffer(floor(v.id / 3), v.id % 3);
o.uv = vert.uv.xy;
o.object_position = float4(vert.position, 1);
float4 localPosition = mul(_LocalTransform, o.object_position);
o.world_position = mul(unity_ObjectToWorld, localPosition);
o.object_normal = vert.normal;
#if defined(DK_TEXTURE_ATLAS)
v.vertex = o.object_position;
o.pos = float4((o.uv * 2.0f - 1.0f) * float2(1, -1), vert.uv.z, 1);
return o;
#else
#if defined(DK_USE_LIGHTPROBES) && defined(DK_FORWARDBASE_PASS)
float3 worldNormal = UnityObjectToWorldNormal(mul((float3x3)_LocalTransform, o.object_normal));
o.indirect = max(0, ShadeSH9(half4(worldNormal, 1)));
#endif
v.vertex = localPosition;
o.pos = UnityObjectToClipPos(v.vertex);
UNITY_TRANSFER_FOG(o, o.pos);
TRANSFER_SHADOW(o);
return o;
#endif
}
fixed4 frag(v2f i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
float3 viewDir = mul((float3x3) _LocalTransformInverse, mul(unity_WorldToObject, normalize(_WorldSpaceCameraPos.xyz - i.world_position.xyz))).xyz;
float3 color = dkSampleColorViewWeightedReprojection(viewDir, i.object_position.xyz, i.object_normal.xyz);
#if defined(DK_NO_MAIN_LIGHT) && defined(DK_FORWARDBASE_PASS)
#if defined(DK_USE_LIGHTPROBES)
color = color * i.indirect;
#endif
#else
float3 shadow = lerp(float3(1.0, 1.0, 1.0), SHADOW_ATTENUATION(i), saturate(_ShadowAmount));
#if defined(DK_USE_LIGHTPROBES) && defined(DK_FORWARDBASE_PASS)
color = lerp(color * i.indirect, color, shadow);
#else
color *= shadow;
#endif
#endif
float4 c = fixed4(color, 1);
// apply fog
UNITY_APPLY_FOG(i.fogCoord, c);
return c;
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3750948ff73c8924a98ed9648e7b83d5
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,174 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Depthkit/Studio/Depthkit Studio Photo Look Built-in RP"
{
Properties
{
_ShadowAmount("Shadow Amount", Range(0.0,1.0)) = 1.0
[Toggle(DK_USE_LIGHTPROBES)] _SampleProbes("Use Light Probes", Float) = 1
[Toggle(DK_USE_DEBUG_COLOR)] _DebugColor("Debug Per Perspective Color", Float) = 0
[Toggle(DK_USE_EDGEMASK)] _EdgeMask("Enable Edge Mask", Float) = 0
[Toggle(DK_DEBUG_EDGEMASK)] _DebugEdgeMask("Show Edge Mask Debug", Float) = 0
[Toggle(DK_NO_MAIN_LIGHT)] _NoMainLight("Disable Main Directional Shadows", Float) = 0
[KeywordEnum(INFER, COLORIZE, CLIP)] DK_UNTEXTURED_FRAGMENT("Untextured Geometry Settings", Float) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
AlphaToMask On
Cull Off
Pass
{
Tags {"LightMode" = "ForwardBase"}
Blend One OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature_local DK_USE_LIGHTPROBES
#pragma shader_feature_local DK_USE_DEBUG_COLOR
#pragma shader_feature_local DK_USE_EDGEMASK
#pragma shader_feature_local DK_DEBUG_EDGEMASK
#pragma shader_feature_local DK_NO_MAIN_LIGHT
#pragma shader_feature_local DK_UNTEXTURED_FRAGMENT_INFER
#pragma shader_feature_local DK_UNTEXTURED_FRAGMENT_COLORIZE
#pragma shader_feature_local DK_UNTEXTURED_FRAGMENT_CLIP
#pragma shader_feature_local DK_TEXTURE_ATLAS
// make fog work
#pragma multi_compile_fog
#pragma multi_compile_fwdbase
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#define DK_USE_BUILT_IN_COLOR_CONVERSION
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Includes/DepthkitStudio.cginc"
#define DK_CORE_PACKED_TRIANGLE
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/SampleCoreTriangles.cginc"
#define DK_FORWARDBASE_PASS
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Looks/DepthkitStudioPhotoLook.cginc"
ENDCG
}
Pass
{
Tags {"LightMode" = "ForwardAdd"}
BlendOp Max
Blend One One
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature_local DK_USE_LIGHTPROBES
#pragma shader_feature_local DK_USE_DEBUG_COLOR
#pragma shader_feature_local DK_USE_EDGEMASK
#pragma shader_feature_local DK_DEBUG_EDGEMASK
#pragma shader_feature_local DK_UNTEXTURED_FRAGMENT_INFER
#pragma shader_feature_local DK_UNTEXTURED_FRAGMENT_COLORIZE
#pragma shader_feature_local DK_UNTEXTURED_FRAGMENT_CLIP
#pragma shader_feature_local DK_TEXTURE_ATLAS
// make fog work
#pragma multi_compile_fog
#pragma multi_compile_fwdadd_fullshadows
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#define DK_USE_BUILT_IN_COLOR_CONVERSION
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Includes/DepthkitStudio.cginc"
#define DK_CORE_PACKED_TRIANGLE
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/SampleCoreTriangles.cginc"
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/Looks/DepthkitStudioPhotoLook.cginc"
ENDCG
}
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Fog {Mode Off}
ZWrite On ZTest LEqual Cull Off
Offset 1, 1
CGPROGRAM
#pragma vertex caster_vert
#pragma fragment caster_frag
#pragma multi_compile_shadowcaster
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#define DK_USE_BUILT_IN_COLOR_CONVERSION
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#define DK_CORE_PACKED_TRIANGLE
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/SampleCoreTriangles.cginc"
float4x4 _LocalTransform;
struct appdata {
float4 vertex : POSITION;
float3 normal : NORMAL;
uint id : SV_VertexID;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
V2F_SHADOW_CASTER;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f caster_vert( appdata v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
Vertex vert;
vert = dkSampleTriangleBuffer(floor(v.id / 3), v.id % 3);
v.vertex = mul(_LocalTransform, float4(vert.position, 1));
v.normal = mul((float3x3)_LocalTransform, vert.normal);
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
return o;
}
float4 caster_frag( v2f i ) : COLOR
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
}
Fallback "VertexLit"
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7b24078afb471f94199f84c678e7f250
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2b0a88827d673f45a6af8d8353d3a69
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,104 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
#pragma kernel GaussianBlur3x3x3 TILE_BORDER=1
#pragma kernel GaussianBlur5x5x5 TILE_BORDER=2
#pragma kernel GaussianBlur7x7x7 TILE_BORDER=3
#pragma kernel GaussianBlur9x9x9 TILE_BORDER=4
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Utils.cginc"
#include "Packages/nyc.scatter.depthkit.studio/Runtime/Resources/Shaders/DataSource/StudioMeshSourceCommon.cginc"
StructuredBuffer<float> _PingData;
RWStructuredBuffer<float> _PongData;
float3 _DataSize;
float3 _Axis;
float _GaussianExponential;
float _GaussianNormalization;
static const uint BLOCK_SIZE = 8; // 8x8x8 dispatch tile
static const uint BLOCK_THREAD_COUNT = BLOCK_SIZE * BLOCK_SIZE * BLOCK_SIZE; //512 dispatch threads
static const int KERNEL_WIDTH = TILE_BORDER;
static const uint TILE_SIZE = BLOCK_SIZE + TILE_BORDER * 2;
static const uint TILE_VOXEL_COUNT = TILE_SIZE * TILE_SIZE * TILE_SIZE;
groupshared float g_samples[TILE_VOXEL_COUNT];
void GaussianBlur(uint3 GroupId, uint3 GroupThreadId, uint GroupIndex)
{
uint ind;
const int3 tile_upperleft = int3(GroupId * uint3(BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)) - TILE_BORDER;
[unroll]
for (ind = GroupIndex; ind < TILE_VOXEL_COUNT; ind += BLOCK_THREAD_COUNT)
{
int3 voxel = tile_upperleft + (int3) toCoord3D(ind, uint3(TILE_SIZE, TILE_SIZE, TILE_SIZE));
float sdfSample = _PingData[toIndex3DClamp(voxel, (uint3) _DataSize)];
g_samples[ind] = sdfSample;
}
GroupMemoryBarrierWithGroupSync();
int3 coord = GroupThreadId + TILE_BORDER;
const int3 voxel = tile_upperleft + coord;
//make sure there's a pixel here
if (voxel.x < 0 || voxel.y < 0 || voxel.z < 0 || voxel.x >= _DataSize.x || voxel.y >= _DataSize.y || voxel.z >= _DataSize.z)
return;
float r = 0.0;
[unroll]
for (int kernel_ind = -KERNEL_WIDTH; kernel_ind < KERNEL_WIDTH + 1; kernel_ind++)
{
int3 sampleCoord = ((int3) _Axis * kernel_ind) + coord;
float gaussian = _GaussianNormalization * exp(_GaussianExponential * float(kernel_ind * kernel_ind));
r += g_samples[toIndex3D(sampleCoord, (uint3) TILE_SIZE)] * gaussian;
}
//only use the final value if this voxel wasn't blurred with invalid voxels
_PongData[toIndex3D(voxel, (uint3) _DataSize)] = r > Invalid_Sdf_compare ? g_samples[toIndex3D(coord, (uint3) TILE_SIZE)] : r;
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)]
void GaussianBlur3x3x3(uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GaussianBlur(GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)]
void GaussianBlur5x5x5(uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GaussianBlur(GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)]
void GaussianBlur7x7x7(uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GaussianBlur(GroupId, GroupThreadId, GroupIndex);
}
[numthreads(BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)]
void GaussianBlur9x9x9(uint3 GroupId : SV_GroupID, uint3 GroupThreadId : SV_GroupThreadID, uint GroupIndex : SV_GroupIndex)
{
GaussianBlur(GroupId, GroupThreadId, GroupIndex);
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de54d488756fe46439b18b8c2e670189
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,76 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
Shader "Depthkit/HalfTextureBlit"{
Properties{
[HideInInspector]_MainTex ("Texture", 2D) = "white" {}
}
SubShader{
// markers that specify that we don't need culling
// or reading/writing to the depth buffer
Cull Off
ZWrite Off
ZTest Always
//horizontal
Pass {
CGPROGRAM
#include "UnityCG.cginc"
#define DK_USE_BUILT_IN_COLOR_CONVERSION
#include "Packages/nyc.scatter.depthkit.core/Runtime/Resources/Shaders/Includes/Depthkit.cginc"
#pragma vertex vert
#pragma fragment frag
sampler2D _MainTex;
//the object data that's put into the vertex shader
struct appdata{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
//the data that's used to generate fragments and can be read by the fragment shader
struct v2f{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert(appdata v)
{
v2f o;
o.position = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag(v2f i) : SV_TARGET
{
uint perspectiveIndex;
float2 depthUV, colorUV, perspectiveUV;
dkUnpackUVs(i.uv, colorUV, depthUV, perspectiveUV, perspectiveIndex);
return tex2D(_MainTex, depthUV);
}
ENDCG
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ae566db9711376549880fb778e323595
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9213a18d0389cd445a2caaddc15879d9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,82 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using System;
namespace Depthkit
{
[Serializable]
public struct PerspectiveColorBlending
{
#pragma warning disable CS0414
public static PerspectiveColorBlending[] Create(int count)
{
PerspectiveColorBlending[] data = new PerspectiveColorBlending[count];
for (int i = 0; i < count; ++i)
{
data[i].enabled = 1;
data[i].viewWeightPowerContribution = 1.0f;
}
return data;
}
public int enabled;
public float viewWeightPowerContribution;
};
#pragma warning restore CS0414
[Serializable]
public class PerspectiveColorBlendingData : SyncedStructuredBuffer<PerspectiveColorBlending>
{
public PerspectiveColorBlendingData(string name, int count) : base(name, count, PerspectiveColorBlending.Create(count))
{ }
public float GetViewDependentColorBlendContribution(int perspective)
{
return m_data[perspective].viewWeightPowerContribution;
}
public void SetViewDependentColorBlendContribution(int perspective, float contribution)
{
contribution = Mathf.Clamp01(contribution);
if (!Mathf.Approximately(contribution, m_data[perspective].viewWeightPowerContribution))
{
m_data[perspective].viewWeightPowerContribution = contribution;
MarkDirty();
}
}
public bool GetPerspectiveEnabled(int perspective)
{
return m_data[perspective].enabled == 1;
}
public void SetPerspectiveEnabled(int perspective, bool enabled)
{
if ((m_data[perspective].enabled == 1) != enabled)
{
m_data[perspective].enabled = enabled ? 1 : 0;
MarkDirty();
}
}
};
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f6d2d3a90a30b14d94698f6d61c34d6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,188 @@
/************************************************************************************
Depthkit Unity SDK License v1
Copyright 2016-2024 Simile Inc dba Scatter. All Rights reserved.
Licensed under the the Simile Inc dba Scatter ("Scatter")
Software Development Kit License Agreement (the "License");
you may not use this SDK except in compliance with the License,
which is provided at the time of installation or download,
or which otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at http://www.depthkit.tv/license-agreement-v1
Unless required by applicable law or agreed to in writing,
the SDK distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
************************************************************************************/
using UnityEngine;
using System;
namespace Depthkit
{
[Serializable]
public struct PerspectiveGeometry
{
#pragma warning disable CS0414
public static PerspectiveGeometry[] Create(int count)
{
PerspectiveGeometry[] data = new PerspectiveGeometry[count];
for (int i = 0; i < count; ++i)
{
data[i].enabled = 1;
data[i].weightUnknown = 0.005f;
data[i].viewDependentUnseenAmount = 1.0f;
data[i].viewDependentInFrontAmount = 1.0f;
data[i].viewDependentWeight = 1.0f;
data[i].overrideWeightUnknown = 0;
data[i].pad2 = 0.0f;
data[i].pad1 = 0.0f;
}
return data;
}
public int enabled;
public int overrideWeightUnknown;
public float weightUnknown;
public float viewDependentUnseenAmount;
public float viewDependentInFrontAmount;
public float viewDependentWeight;
float pad2;
float pad1;
};
#pragma warning restore CS0414
[Serializable]
public class PerspectiveGeometryData : SyncedStructuredBuffer<PerspectiveGeometry>
{
[SerializeField]
private bool[] m_geometryMatchesColorWeights;
[SerializeField]
private float[] m_viewDependentContributions;
public PerspectiveGeometryData(string name, int count) : base(name, count, PerspectiveGeometry.Create(count))
{
m_geometryMatchesColorWeights = new bool[count];
m_viewDependentContributions = new float[count];
for (int i = 0; i < count; ++i)
{
m_geometryMatchesColorWeights[i] = false;
m_viewDependentContributions[i] = 1.0f;
}
}
public bool EnableGeometry(int perspective)
{
return m_data[perspective].enabled == 1;
}
public void EnableGeometry(int perspective, bool enable)
{
if ((m_data[perspective].enabled == 1) != enable)
{
m_data[perspective].enabled = enable ? 1 : 0;
MarkDirty();
}
}
public bool GetOverrideWeightUnknown(int perspective)
{
return m_data[perspective].overrideWeightUnknown == 1;
}
public void SetOverrideWeightUnknown(int perspective, bool enable)
{
if ((m_data[perspective].overrideWeightUnknown == 1) != enable)
{
m_data[perspective].overrideWeightUnknown = enable ? 1 : 0;
MarkDirty();
}
}
public float GetWeightUnknown(int perspective)
{
return m_data[perspective].weightUnknown;
}
public void SetWeightUnknown(int perspective, float weight)
{
weight = Mathf.Clamp(weight, 0.0001f, 0.05f);
if (!Mathf.Approximately(weight, m_data[perspective].weightUnknown))
{
m_data[perspective].weightUnknown = weight;
MarkDirty();
}
}
public bool MatchViewDependentColorWeight(int perspective)
{
return m_geometryMatchesColorWeights[perspective];
}
public void MatchViewDependentColorWeight(int perspective, bool match)
{
m_geometryMatchesColorWeights[perspective] = match;
}
public float GetViewDependentContribution(int perspective)
{
return m_viewDependentContributions[perspective];
}
public void SetViewDependentContribution(int perspective, float contribution)
{
contribution = Mathf.Clamp01(contribution);
m_viewDependentContributions[perspective] = contribution;
}
public float GetViewDependentWeight(int perspective)
{
return m_data[perspective].viewDependentWeight;
}
public void SetViewDependentWeight(int perspective, float contribution)
{
contribution = Mathf.Clamp01(contribution);
if(!Mathf.Approximately(contribution, m_data[perspective].viewDependentWeight))
{
m_data[perspective].viewDependentWeight = contribution;
MarkDirty();
}
}
public float GetViewDependentInFrontAmount(int perspective)
{
return m_data[perspective].viewDependentInFrontAmount;
}
public void SetViewDependentInFrontAmount(int perspective, float amount)
{
amount = Mathf.Clamp01(amount);
if (!Mathf.Approximately(amount, m_data[perspective].viewDependentInFrontAmount))
{
m_data[perspective].viewDependentInFrontAmount = amount;
MarkDirty();
}
}
public float GetViewDependentUnseenAmount(int perspective)
{
return m_data[perspective].viewDependentUnseenAmount;
}
public void SetViewDependentUnseenAmount(int perspective, float amount)
{
amount = Mathf.Clamp01(amount);
if (!Mathf.Approximately(amount, m_data[perspective].viewDependentUnseenAmount))
{
m_data[perspective].viewDependentUnseenAmount = amount;
MarkDirty();
}
}
};
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2f5380172f071fc4693c113a7f29d84c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
{
"name": "nyc.scatter.depthkit.studio",
"version": "0.10.2",
"displayName": "Depthkit Studio",
"description": "Use the Depthkit Studio Package to render Depthkit captures from Depthkit Studio in Unitys Built-in Render Pipeline. The Depthkit Studio package suite is designed to render multi-perspective captures from Depthkit Studio. For single-perspective captures from Depthkit Core or Depthkit Cinema, use Depthkit Core package suite.",
"unity": "2022.3",
"dependencies": {
"nyc.scatter.depthkit.core" : "0.14.3"
},
"samples": [
{
"displayName": "Prefabs - Depthkit Studio Built-in",
"description": "Prefabs for the Built-in Render Pipeline",
"path": "Samples~/Depthkit Studio Built-in Prefabs"
}
],
"keywords": [
"Depthkit",
"Volumetric",
"Scatter"
],
"author": {
"name": "Scatter",
"email": "support@depthkit.tv",
"url": "https://www.depthkit.tv"
}
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7d80ceb33449c6a449ec76ee6fc0b4e7
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c230c481c9e964f4d850ed486b246157 guid: 585671dd1ba10445a9da9e6785bf8278
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 26250145170194127a71906605df1a2d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ce0b986cfc693406bbd330443d32a252
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 04fdadb0bdc4540cb9f2a474538a1ab6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More