From 0d848e4d079b2047ac9c5b74cf8ffcb106f18749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Wed, 28 Jun 2023 00:35:46 +0800 Subject: [PATCH] bug fix --- Assets/Plugins/UnityGLTF.meta | 8 + Assets/Plugins/UnityGLTF/CHANGELOG.md | 554 + Assets/Plugins/UnityGLTF/CHANGELOG.md.meta | 7 + Assets/Plugins/UnityGLTF/Editor.meta | 8 + Assets/Plugins/UnityGLTF/Editor/Scripts.meta | 8 + .../Editor/Scripts/GLTFComponentInspector.cs | 82 + .../Scripts/GLTFComponentInspector.cs.meta | 11 + .../Editor/Scripts/GLTFExportMenu.cs | 134 + .../Editor/Scripts/GLTFExportMenu.cs.meta | 11 + .../UnityGLTF/Editor/Scripts/GLTFImporter.cs | 619 + .../Editor/Scripts/GLTFImporter.cs.meta | 11 + .../Editor/Scripts/GLTFImporterInspector.cs | 334 + .../Scripts/GLTFImporterInspector.cs.meta | 11 + .../Editor/Scripts/GLTFImporterNormals.cs | 11 + .../Scripts/GLTFImporterNormals.cs.meta | 11 + .../UnityGLTF/Editor/Scripts/Internal.meta | 8 + .../Editor/Scripts/Internal/AvatarUtils.cs | 219 + .../Scripts/Internal/AvatarUtils.cs.meta | 11 + .../Scripts/Internal/GLTFMaterialHelper.cs | 271 + .../Internal/GLTFMaterialHelper.cs.meta | 11 + .../Editor/Scripts/Internal/HumanoidSetup.cs | 102 + .../Scripts/Internal/HumanoidSetup.cs.meta | 11 + .../Internal/UnityGLTF.Internal.asmref | 3 + .../Internal/UnityGLTF.Internal.asmref.meta | 7 + .../Scripts/Internal/UnityGLTFTabbedEditor.cs | 49 + .../Internal/UnityGLTFTabbedEditor.cs.meta | 3 + .../Internal/UnityGltfShaderUpgradeMeta.cs | 25 + .../UnityGltfShaderUpgradeMeta.cs.meta | 3 + .../UnityGLTF/Editor/Scripts/InternalUI.meta | 8 + .../UnityGLTF/Editor/Scripts/PbrShaderGUI.cs | 278 + .../Editor/Scripts/PbrShaderGUI.cs.meta | 11 + .../UnityGLTF/Editor/Scripts/ShaderGraph.meta | 8 + .../ShaderGraph/InternalShaderGraph.meta | 8 + .../InternalShaderGraph/PBRGraphGUI.cs | 496 + .../InternalShaderGraph/PBRGraphGUI.cs.meta | 11 + .../InternalShaderGraph/ShaderGraphHelpers.cs | 56 + .../ShaderGraphHelpers.cs.meta | 11 + .../ShaderGraphOverrideImporter.cs | 105 + .../ShaderGraphOverrideImporter.cs.meta | 11 + .../ShaderGraphOverrideImporterEditor.cs | 26 + .../ShaderGraphOverrideImporterEditor.cs.meta | 11 + .../UnityGLTF.ShaderGraph.Internal.asmref | 3 + ...UnityGLTF.ShaderGraph.Internal.asmref.meta | 7 + .../Scripts/ShaderGraph/InternalURP.meta | 8 + .../InternalURP/PBRGraphUniversalGUI.cs | 57 + .../InternalURP/PBRGraphUniversalGUI.cs.meta | 11 + .../InternalURP/UnityGLTF.URP.Internal.asmref | 3 + .../UnityGLTF.URP.Internal.asmref.meta | 7 + .../ShaderGraph/NoCompilationWarning.cs | 1 + .../ShaderGraph/NoCompilationWarning.cs.meta | 11 + .../Scripts/ShaderGraph/ShaderConverters.cs | 240 + .../ShaderGraph/ShaderConverters.cs.meta | 3 + .../ShaderGraph/UnityGLTF.ShaderGraph.asmdef | 28 + .../UnityGLTF.ShaderGraph.asmdef.meta | 7 + .../UnityGLTF/Editor/UnityGLTFEditor.asmdef | 37 + .../Editor/UnityGLTFEditor.asmdef.meta | 7 + Assets/Plugins/UnityGLTF/Runtime.meta | 8 + Assets/Plugins/UnityGLTF/Runtime/Plugins.meta | 8 + .../Runtime/Plugins/GLTFSerialization.meta | 8 + .../Plugins/GLTFSerialization/AssemblyInfo.cs | 3 + .../GLTFSerialization/AssemblyInfo.cs.meta | 11 + .../GLTFSerialization/AttributeAccessor.cs | 17 + .../AttributeAccessor.cs.meta | 11 + .../Plugins/GLTFSerialization/Exceptions.cs | 40 + .../GLTFSerialization/Exceptions.cs.meta | 11 + .../Plugins/GLTFSerialization/Extensions.meta | 8 + .../Extensions/EXT_texture_exr.cs | 29 + .../Extensions/EXT_texture_exr.cs.meta | 3 + .../ExtTextureTransformExtension.cs | 88 + .../ExtTextureTransformExtension.cs.meta | 11 + .../ExtTextureTransformExtensionFactory.cs | 45 + ...xtTextureTransformExtensionFactory.cs.meta | 11 + .../Extensions/GLTFJsonExtensions.cs | 412 + .../Extensions/GLTFJsonExtensions.cs.meta | 11 + .../Extensions/KHR_LightsPunctualExtension.cs | 392 + .../KHR_LightsPunctualExtension.cs.meta | 11 + .../KHR_LightsPunctualExtensionFactory.cs | 49 + ...KHR_LightsPunctualExtensionFactory.cs.meta | 11 + .../Extensions/KHR_animation_pointer.cs | 38 + .../Extensions/KHR_animation_pointer.cs.meta | 3 + .../Extensions/KHR_materials_clearcoat.cs | 96 + .../KHR_materials_clearcoat.cs.meta | 3 + .../KHR_materials_emissive_strength.cs | 56 + .../KHR_materials_emissive_strength.cs.meta | 11 + .../Extensions/KHR_materials_ior.cs | 53 + .../Extensions/KHR_materials_ior.cs.meta | 3 + .../Extensions/KHR_materials_iridescence.cs | 88 + .../KHR_materials_iridescence.cs.meta | 3 + ...aterials_pbrSpecularGlossinessExtension.cs | 98 + ...als_pbrSpecularGlossinessExtension.cs.meta | 11 + ...s_pbrSpecularGlossinessExtensionFactory.cs | 51 + ...SpecularGlossinessExtensionFactory.cs.meta | 11 + .../Extensions/KHR_materials_specular.cs | 81 + .../Extensions/KHR_materials_specular.cs.meta | 3 + .../Extensions/KHR_materials_transmission.cs | 58 + .../KHR_materials_transmission.cs.meta | 3 + .../KHR_materials_unlitExtension.cs | 38 + .../KHR_materials_unlitExtension.cs.meta | 11 + .../KHR_materials_unlitExtensionFactory.cs | 23 + ...HR_materials_unlitExtensionFactory.cs.meta | 11 + .../Extensions/KHR_materials_volume.cs | 80 + .../Extensions/KHR_materials_volume.cs.meta | 3 + .../Extensions/MSFT_LODExtension.cs | 47 + .../Extensions/MSFT_LODExtension.cs.meta | 11 + .../Extensions/MSFT_LODExtensionFactory.cs | 36 + .../MSFT_LODExtensionFactory.cs.meta | 11 + .../Plugins/GLTFSerialization/GLBBuilder.cs | 538 + .../GLTFSerialization/GLBBuilder.cs.meta | 11 + .../Plugins/GLTFSerialization/GLBObject.cs | 101 + .../GLTFSerialization/GLBObject.cs.meta | 11 + .../Plugins/GLTFSerialization/GLTFHelpers.cs | 1079 + .../GLTFSerialization/GLTFHelpers.cs.meta | 11 + .../Plugins/GLTFSerialization/GLTFObject.cs | 20 + .../GLTFSerialization/GLTFObject.cs.meta | 11 + .../Plugins/GLTFSerialization/GLTFParser.cs | 175 + .../GLTFSerialization/GLTFParser.cs.meta | 11 + .../GLTFSerialization.asmdef | 16 + .../GLTFSerialization.asmdef.meta | 7 + .../Plugins/GLTFSerialization/IGLTFObject.cs | 12 + .../GLTFSerialization/IGLTFObject.cs.meta | 11 + .../Legacy~/GLTFSerialization.csproj.meta | 7 + .../Plugins/GLTFSerialization/Math.meta | 8 + .../Plugins/GLTFSerialization/Math/Color.cs | 65 + .../GLTFSerialization/Math/Color.cs.meta | 11 + .../GLTFSerialization/Math/Matrix4x4.cs | 185 + .../GLTFSerialization/Math/Matrix4x4.cs.meta | 11 + .../GLTFSerialization/Math/Quaternion.cs | 76 + .../GLTFSerialization/Math/Quaternion.cs.meta | 11 + .../Plugins/GLTFSerialization/Math/Vector2.cs | 51 + .../GLTFSerialization/Math/Vector2.cs.meta | 11 + .../Plugins/GLTFSerialization/Math/Vector3.cs | 61 + .../GLTFSerialization/Math/Vector3.cs.meta | 11 + .../Plugins/GLTFSerialization/Math/Vector4.cs | 62 + .../GLTFSerialization/Math/Vector4.cs.meta | 11 + .../Plugins/GLTFSerialization/Properties.meta | 8 + .../Properties/AssemblyInfo.cs | 36 + .../Properties/AssemblyInfo.cs.meta | 11 + .../Plugins/GLTFSerialization/Schema.meta | 8 + .../GLTFSerialization/Schema/Accessor.cs | 874 + .../GLTFSerialization/Schema/Accessor.cs.meta | 11 + .../Schema/AccessorSparse.cs | 91 + .../Schema/AccessorSparse.cs.meta | 11 + .../Schema/AccessorSparseIndices.cs | 95 + .../Schema/AccessorSparseIndices.cs.meta | 11 + .../Schema/AccessorSparseValues.cs | 80 + .../Schema/AccessorSparseValues.cs.meta | 11 + .../Schema/AnimationChannel.cs | 73 + .../Schema/AnimationChannel.cs.meta | 11 + .../Schema/AnimationChannelTarget.cs | 94 + .../Schema/AnimationChannelTarget.cs.meta | 11 + .../Schema/AnimationSampler.cs | 103 + .../Schema/AnimationSampler.cs.meta | 11 + .../Plugins/GLTFSerialization/Schema/Asset.cs | 105 + .../GLTFSerialization/Schema/Asset.cs.meta | 11 + .../GLTFSerialization/Schema/BufferView.cs | 139 + .../Schema/BufferView.cs.meta | 11 + .../Schema/CameraOrthographic.cs | 101 + .../Schema/CameraOrthographic.cs.meta | 11 + .../Schema/CameraPerspective.cs | 116 + .../Schema/CameraPerspective.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFAnimation.cs | 96 + .../Schema/GLTFAnimation.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFBuffer.cs | 78 + .../Schema/GLTFBuffer.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFCamera.cs | 106 + .../Schema/GLTFCamera.cs.meta | 11 + .../Schema/GLTFChildOfRootProperty.cs | 50 + .../Schema/GLTFChildOfRootProperty.cs.meta | 11 + .../Schema/GLTFExtensions.cs | 0 .../Schema/GLTFExtensions.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFId.cs | 424 + .../GLTFSerialization/Schema/GLTFId.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFImage.cs | 102 + .../Schema/GLTFImage.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFMaterial.cs | 243 + .../Schema/GLTFMaterial.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFMesh.cs | 143 + .../GLTFSerialization/Schema/GLTFMesh.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFProperty.cs | 240 + .../Schema/GLTFProperty.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFRoot.cs | 566 + .../GLTFSerialization/Schema/GLTFRoot.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFScene.cs | 76 + .../Schema/GLTFScene.cs.meta | 11 + .../GLTFSerialization/Schema/GLTFTexture.cs | 85 + .../Schema/GLTFTexture.cs.meta | 11 + .../Schema/GLTF_DirectionalLight.cs | 102 + .../Schema/GLTF_DirectionalLight.cs.meta | 11 + .../GLTFSerialization/Schema/GLTF_Light.cs | 98 + .../Schema/GLTF_Light.cs.meta | 11 + .../Schema/GLTF_PointLight.cs | 57 + .../Schema/GLTF_PointLight.cs.meta | 11 + .../Schema/GLTF_SpotLight.cs | 119 + .../Schema/GLTF_SpotLight.cs.meta | 11 + .../GLTFSerialization/Schema/IExtension.cs | 80 + .../Schema/IExtension.cs.meta | 11 + .../Schema/MaterialCommonConstant.cs | 106 + .../Schema/MaterialCommonConstant.cs.meta | 11 + .../Schema/MaterialNormalTextureInfo.cs | 76 + .../Schema/MaterialNormalTextureInfo.cs.meta | 11 + .../Schema/MaterialOcclusionTextureInfo.cs | 80 + .../MaterialOcclusionTextureInfo.cs.meta | 11 + .../Schema/MaterialPBRMetallicRoughness.cs | 168 + .../MaterialPBRMetallicRoughness.cs.meta | 11 + .../GLTFSerialization/Schema/MeshPrimitive.cs | 381 + .../Schema/MeshPrimitive.cs.meta | 11 + .../Plugins/GLTFSerialization/Schema/Node.cs | 281 + .../GLTFSerialization/Schema/Node.cs.meta | 11 + .../GLTFSerialization/Schema/Sampler.cs | 144 + .../GLTFSerialization/Schema/Sampler.cs.meta | 11 + .../Plugins/GLTFSerialization/Schema/Skin.cs | 129 + .../GLTFSerialization/Schema/Skin.cs.meta | 11 + .../GLTFSerialization/Schema/TextureInfo.cs | 120 + .../Schema/TextureInfo.cs.meta | 11 + .../Plugins/GLTFSerialization/Utilities.meta | 8 + .../Utilities/JsonReaderExtensions.cs | 12 + .../Utilities/JsonReaderExtensions.cs.meta | 11 + .../Utilities/StreamExtensions.cs | 65 + .../Utilities/StreamExtensions.cs.meta | 11 + .../GLTFSerialization/Utilities/SubStream.cs | 131 + .../Utilities/SubStream.cs.meta | 11 + .../Runtime/Plugins/Optimization.meta | 8 + .../Plugins/Optimization/AssemblyInfo.cs | 3 + .../Plugins/Optimization/AssemblyInfo.cs.meta | 11 + .../BinaryWriterWithLessAllocations.cs | 293 + .../BinaryWriterWithLessAllocations.cs.meta | 11 + .../Optimization/UnityGLTF.Helpers.asmdef | 14 + .../UnityGLTF.Helpers.asmdef.meta | 7 + Assets/Plugins/UnityGLTF/Runtime/Prefabs.meta | 8 + .../UnityGLTF/Runtime/Prefabs/GLTF.prefab | 59 + .../Runtime/Prefabs/GLTF.prefab.meta | 7 + .../Plugins/UnityGLTF/Runtime/Resources.meta | 8 + .../Resources/MetalGlossChannelSwap.shader | 70 + .../MetalGlossChannelSwap.shader.meta | 9 + .../Runtime/Resources/NormalChannel.shader | 66 + .../Resources/NormalChannel.shader.meta | 9 + .../UnityGLTF/Runtime/Resources/README.txt | 23 + .../Runtime/Resources/README.txt.meta | 7 + .../Resources/Standard (Specular setup).mat | 83 + .../Standard (Specular setup).mat.meta | 8 + .../Standard (Specular setup).shadervariants | 15 + ...ndard (Specular setup).shadervariants.meta | 8 + .../Runtime/Resources/TestScenePrefab.prefab | 313 + .../Resources/TestScenePrefab.prefab.meta | 7 + Assets/Plugins/UnityGLTF/Runtime/Scripts.meta | 8 + .../UnityGLTF/Runtime/Scripts/Async.meta | 8 + .../Scripts/Async/AsyncCoroutineHelper.cs | 40 + .../Async/AsyncCoroutineHelper.cs.meta | 11 + .../Runtime/Scripts/Async/TaskExtensions.cs | 18 + .../Scripts/Async/TaskExtensions.cs.meta | 11 + .../UnityGLTF/Runtime/Scripts/Cache.meta | 8 + .../Scripts/Cache/AnimationCacheData.cs | 27 + .../Scripts/Cache/AnimationCacheData.cs.meta | 11 + .../Runtime/Scripts/Cache/AssetCache.cs | 117 + .../Runtime/Scripts/Cache/AssetCache.cs.meta | 11 + .../Runtime/Scripts/Cache/BufferCacheData.cs | 19 + .../Scripts/Cache/BufferCacheData.cs.meta | 11 + .../Runtime/Scripts/Cache/ExportCache.cs | 110 + .../Runtime/Scripts/Cache/ExportCache.cs.meta | 3 + .../Scripts/Cache/MaterialCacheData.cs | 36 + .../Scripts/Cache/MaterialCacheData.cs.meta | 11 + .../Runtime/Scripts/Cache/MeshCacheData.cs | 31 + .../Scripts/Cache/MeshCacheData.cs.meta | 11 + .../Scripts/Cache/RefCountedCacheData.cs | 125 + .../Scripts/Cache/RefCountedCacheData.cs.meta | 11 + .../Runtime/Scripts/Cache/TextureCacheData.cs | 25 + .../Scripts/Cache/TextureCacheData.cs.meta | 11 + .../UnityGLTF/Runtime/Scripts/Exceptions.cs | 41 + .../Runtime/Scripts/Exceptions.cs.meta | 11 + .../UnityGLTF/Runtime/Scripts/Extensions.meta | 8 + .../KHR_animation_pointer_Resolver.cs | 95 + .../KHR_animation_pointer_Resolver.cs.meta | 3 + .../Scripts/Extensions/MaterialExtensions.cs | 201 + .../Extensions/MaterialExtensions.cs.meta | 11 + .../Scripts/Extensions/SchemaExtensions.cs | 606 + .../Extensions/SchemaExtensions.cs.meta | 11 + .../Scripts/Extensions/TextMeshExport.cs | 85 + .../Scripts/Extensions/TextMeshExport.cs.meta | 11 + .../UnityGLTF/Runtime/Scripts/Factories.meta | 8 + .../Scripts/Factories/ImporterFactory.cs | 18 + .../Scripts/Factories/ImporterFactory.cs.meta | 11 + .../Runtime/Scripts/GLTFComponent.cs | 150 + .../Runtime/Scripts/GLTFComponent.cs.meta | 11 + .../Runtime/Scripts/GLTFRecorderComponent.cs | 141 + .../Scripts/GLTFRecorderComponent.cs.meta | 11 + .../Runtime/Scripts/GLTFSceneExporter.cs | 1164 + .../Runtime/Scripts/GLTFSceneExporter.cs.meta | 11 + .../Runtime/Scripts/GLTFSceneImporter.cs | 1075 + .../Runtime/Scripts/GLTFSceneImporter.cs.meta | 11 + .../UnityGLTF/Runtime/Scripts/GLTFSettings.cs | 227 + .../Runtime/Scripts/GLTFSettings.cs.meta | 11 + .../Runtime/Scripts/InstantiatedGLTFObject.cs | 65 + .../Scripts/InstantiatedGLTFObject.cs.meta | 11 + .../Runtime/Scripts/JsonPointer.meta | 3 + .../JsonPointer/IJsonPointerResolver.cs | 7 + .../JsonPointer/IJsonPointerResolver.cs.meta | 3 + .../UnityGLTF/Runtime/Scripts/Loader.meta | 8 + .../Runtime/Scripts/Loader/FileLoader.cs | 73 + .../Runtime/Scripts/Loader/FileLoader.cs.meta | 11 + .../Runtime/Scripts/Loader/IDataLoader.cs | 10 + .../Scripts/Loader/IDataLoader.cs.meta | 11 + .../Runtime/Scripts/Loader/IDataLoader2.cs | 9 + .../Scripts/Loader/IDataLoader2.cs.meta | 11 + .../Runtime/Scripts/Loader/ILoader.cs | 18 + .../Runtime/Scripts/Loader/ILoader.cs.meta | 11 + .../Scripts/Loader/LegacyLoaderWrapper.cs | 56 + .../Loader/LegacyLoaderWrapper.cs.meta | 11 + .../Scripts/Loader/StorageFolderLoader.cs | 39 + .../Loader/StorageFolderLoader.cs.meta | 11 + .../Scripts/Loader/UnityWebRequestLoader.cs | 97 + .../Loader/UnityWebRequestLoader.cs.meta | 3 + .../Scripts/Loader/WebRequestLoader.cs | 101 + .../Scripts/Loader/WebRequestLoader.cs.meta | 11 + .../Runtime/Scripts/MemoryChecker.cs | 53 + .../Runtime/Scripts/MemoryChecker.cs.meta | 11 + .../Runtime/Scripts/RenderPipelines.meta | 8 + .../RenderPipelines/RoughRefraction.cs | 62 + .../RenderPipelines/RoughRefraction.cs.meta | 11 + .../RenderPipelines/RoughRefractionFeature.cs | 86 + .../RoughRefractionFeature.cs.meta | 11 + .../UnityGltf.RenderPipelines.asmdef | 30 + .../UnityGltf.RenderPipelines.asmdef.meta | 7 + .../Runtime/Scripts/SceneExporter.meta | 8 + .../SceneExporter/ExporterAccessors.cs | 1143 + .../SceneExporter/ExporterAccessors.cs.meta | 11 + .../SceneExporter/ExporterAnimation.cs | 1358 + .../SceneExporter/ExporterAnimation.cs.meta | 11 + .../ExporterAnimationHumanoid.cs | 207 + .../ExporterAnimationHumanoid.cs.meta | 3 + .../SceneExporter/ExporterAnimationPointer.cs | 609 + .../ExporterAnimationPointer.cs.meta | 11 + .../Scripts/SceneExporter/ExporterCameras.cs | 77 + .../SceneExporter/ExporterCameras.cs.meta | 3 + .../Scripts/SceneExporter/ExporterLights.cs | 87 + .../SceneExporter/ExporterLights.cs.meta | 3 + .../SceneExporter/ExporterMaterials.cs | 933 + .../SceneExporter/ExporterMaterials.cs.meta | 3 + .../Scripts/SceneExporter/ExporterMeshes.cs | 526 + .../SceneExporter/ExporterMeshes.cs.meta | 3 + .../Scripts/SceneExporter/ExporterSkinning.cs | 180 + .../SceneExporter/ExporterSkinning.cs.meta | 3 + .../Scripts/SceneExporter/ExporterTextures.cs | 789 + .../SceneExporter/ExporterTextures.cs.meta | 3 + .../Runtime/Scripts/SceneImporter.meta | 3 + .../SceneImporter/ImporterAnimation.cs | 346 + .../SceneImporter/ImporterAnimation.cs.meta | 3 + .../Scripts/SceneImporter/ImporterLODs.cs | 93 + .../SceneImporter/ImporterLODs.cs.meta | 3 + .../Scripts/SceneImporter/ImporterLights.cs | 53 + .../SceneImporter/ImporterLights.cs.meta | 3 + .../SceneImporter/ImporterMaterials.cs | 641 + .../SceneImporter/ImporterMaterials.cs.meta | 3 + .../Scripts/SceneImporter/ImporterMeshes.cs | 573 + .../SceneImporter/ImporterMeshes.cs.meta | 3 + .../Scripts/SceneImporter/ImporterSkinning.cs | 97 + .../SceneImporter/ImporterSkinning.cs.meta | 3 + .../Scripts/SceneImporter/ImporterTextures.cs | 444 + .../SceneImporter/ImporterTextures.cs.meta | 3 + .../UnityGLTF/Runtime/Scripts/Timeline.meta | 8 + .../Runtime/Scripts/Timeline/GLTFRecorder.cs | 468 + .../Scripts/Timeline/GLTFRecorder.cs.meta | 11 + .../Scripts/Timeline/GLTFRecorderBehaviour.cs | 129 + .../Timeline/GLTFRecorderBehaviour.cs.meta | 11 + .../Scripts/Timeline/GLTFRecorderClip.cs | 35 + .../Scripts/Timeline/GLTFRecorderClip.cs.meta | 11 + .../Scripts/Timeline/GLTFRecorderHelper.cs | 59 + .../Timeline/GLTFRecorderHelper.cs.meta | 3 + .../Scripts/Timeline/GLTFRecorderTrack.cs | 16 + .../Timeline/GLTFRecorderTrack.cs.meta | 11 + .../UnityGLTF/Runtime/Scripts/URIHelper.cs | 70 + .../Runtime/Scripts/URIHelper.cs.meta | 11 + .../Runtime/Scripts/UniformMaps.meta | 8 + .../Scripts/UniformMaps/BaseGraphMap.cs | 272 + .../Scripts/UniformMaps/BaseGraphMap.cs.meta | 3 + .../UniformMaps/MetalRough2StandardMap.cs | 123 + .../MetalRough2StandardMap.cs.meta | 11 + .../Scripts/UniformMaps/MetalRoughMap.cs | 98 + .../Scripts/UniformMaps/MetalRoughMap.cs.meta | 11 + .../Scripts/UniformMaps/PBRGraphMap.cs | 350 + .../Scripts/UniformMaps/PBRGraphMap.cs.meta | 11 + .../UniformMaps/SpecGloss2StandardMap.cs | 137 + .../UniformMaps/SpecGloss2StandardMap.cs.meta | 11 + .../Scripts/UniformMaps/SpecGlossMap.cs | 48 + .../Scripts/UniformMaps/SpecGlossMap.cs.meta | 11 + .../Scripts/UniformMaps/StandardMap.cs | 379 + .../Scripts/UniformMaps/StandardMap.cs.meta | 11 + .../Runtime/Scripts/UniformMaps/UniformMap.cs | 145 + .../Scripts/UniformMaps/UniformMap.cs.meta | 11 + .../Scripts/UniformMaps/UnlitGraphMap.cs | 31 + .../Scripts/UniformMaps/UnlitGraphMap.cs.meta | 3 + .../Runtime/Scripts/UniformMaps/UnlitMap.cs | 63 + .../Scripts/UniformMaps/UnlitMap.cs.meta | 11 + Assets/Plugins/UnityGLTF/Runtime/Shaders.meta | 8 + .../Shaders/PbrMetallicRoughness.shader | 340 + .../Shaders/PbrMetallicRoughness.shader.meta | 9 + .../Shaders/PbrSpecularGlossiness.shader | 350 + .../Shaders/PbrSpecularGlossiness.shader.meta | 9 + .../Runtime/Shaders/ShaderGraph.meta | 8 + .../Shaders/ShaderGraph/2020-Legacy.meta | 8 + .../PBRGraph-Double.override-graph | 0 .../PBRGraph-Double.override-graph.meta | 15 + ...PBRGraph-Transparent-Double.override-graph | 0 ...aph-Transparent-Double.override-graph.meta | 15 + .../PBRGraph-Transparent.override-graph | 0 .../PBRGraph-Transparent.override-graph.meta | 15 + .../UnlitGraph-Double.override-graph | 0 .../UnlitGraph-Double.override-graph.meta | 15 + ...litGraph-Transparent-Double.override-graph | 0 ...aph-Transparent-Double.override-graph.meta | 15 + .../UnlitGraph-Transparent.override-graph | 0 ...UnlitGraph-Transparent.override-graph.meta | 15 + .../Shaders/ShaderGraph/PBRGraph.shadergraph | 23777 ++++++++++++++++ .../ShaderGraph/PBRGraph.shadergraph.meta | 10 + .../Shaders/ShaderGraph/PBRHelpers.cginc | 119 + .../Shaders/ShaderGraph/PBRHelpers.cginc.meta | 7 + .../TextureTransform.shadersubgraph | 2267 ++ .../TextureTransform.shadersubgraph.meta | 10 + .../ShaderGraph/UnlitGraph.shadergraph | 2657 ++ .../ShaderGraph/UnlitGraph.shadergraph.meta | 10 + .../Runtime/Shaders/UnityStandardInput.cginc | 272 + .../Shaders/UnityStandardInput.cginc.meta | 9 + .../Runtime/Shaders/UnityStandardShadow.cginc | 191 + .../Shaders/UnityStandardShadow.cginc.meta | 9 + .../UnityGLTF/Runtime/Shaders/Unlit.shader | 63 + .../Runtime/Shaders/Unlit.shader.meta | 9 + .../Runtime/Shaders/VertexColor.cginc | 134 + .../Runtime/Shaders/VertexColor.cginc.meta | 9 + .../UnityGLTF/Runtime/UnityGLTFScripts.asmdef | 62 + .../Runtime/UnityGLTFScripts.asmdef.meta | 7 + .../UnityGLTF/Samples~/Sample Scenes.meta | 8 + .../Samples~/Sample Scenes/AnimatedCube.unity | 519 + .../Sample Scenes/AnimatedCube.unity.meta | 7 + .../Sample Scenes/AssetMergeTestScene.unity | 525 + .../AssetMergeTestScene.unity.meta | 7 + .../Samples~/Sample Scenes/Benchmark.unity | 375 + .../Sample Scenes/Benchmark.unity.meta | 7 + .../BinaryBoomBoxTestScene.unity | 507 + .../BinaryBoomBoxTestScene.unity.meta | 7 + .../Sample Scenes/BinaryBuggyTestScene.unity | 519 + .../BinaryBuggyTestScene.unity.meta | 7 + .../Sample Scenes/BinaryCorsetTestScene.unity | 507 + .../BinaryCorsetTestScene.unity.meta | 7 + .../BinaryLanternTestScene.unity | 519 + .../BinaryLanternTestScene.unity.meta | 7 + .../Sample Scenes/BoomBoxTestScene.unity | 507 + .../Sample Scenes/BoomBoxTestScene.unity.meta | 7 + .../Sample Scenes/BuggyTestScene.unity | 519 + .../Sample Scenes/BuggyTestScene.unity.meta | 7 + .../Sample Scenes/ConstantTestScene.unity | 518 + .../ConstantTestScene.unity.meta | 7 + .../Sample Scenes/CorsetTestScene.unity | 507 + .../Sample Scenes/CorsetTestScene.unity.meta | 7 + .../Samples~/Sample Scenes/Editor.meta | 8 + .../Editor/SampleModelListInspector.cs | 176 + .../Editor/SampleModelListInspector.cs.meta | 11 + .../Editor/SampleModelListParser.cs | 329 + .../Editor/SampleModelListParser.cs.meta | 11 + .../UnityGLTF.Samples.Misc.Editor.asmdef | 23 + .../UnityGLTF.Samples.Misc.Editor.asmdef.meta | 7 + .../Sample Scenes/ExportTestScene.unity | 955 + .../Sample Scenes/ExportTestScene.unity.meta | 7 + .../FarmlandDioramaTestScene.unity | 476 + .../FarmlandDioramaTestScene.unity.meta | 7 + .../LanternSpecGlossTestScene.unity | 508 + .../LanternSpecGlossTestScene.unity.meta | 7 + .../Sample Scenes/LanternTestScene.unity | 519 + .../Sample Scenes/LanternTestScene.unity.meta | 7 + .../Samples~/Sample Scenes/Materials.meta | 8 + .../Sample Scenes/Materials/ConstantMat.mat | 86 + .../Materials/ConstantMat.mat.meta | 8 + .../Materials/GLTFStandardMaterial.mat | 77 + .../Materials/GLTFStandardMaterial.mat.meta | 8 + .../Sample Scenes/Materials/Material.001.mat | 83 + .../Materials/Material.001.mat.meta | 8 + .../Sample Scenes/Materials/TestMaterial1.mat | 77 + .../Materials/TestMaterial1.mat.meta | 8 + .../Materials/UnityStandardMaterial.mat | 78 + .../Materials/UnityStandardMaterial.mat.meta | 8 + .../Samples~/Sample Scenes/Models.meta | 8 + .../Samples~/Sample Scenes/Models/d8.fbx | Bin 0 -> 17244 bytes .../Samples~/Sample Scenes/Models/d8.fbx.meta | 108 + .../Sample Scenes/MultiSceneTest.unity | 491 + .../Sample Scenes/MultiSceneTest.unity.meta | 7 + .../Sample Scenes/SciFiHelmetTestScene.unity | 519 + .../SciFiHelmetTestScene.unity.meta | 7 + .../Samples~/Sample Scenes/Scripts.meta | 8 + .../Sample Scenes/Scripts/GLTFExporterTest.cs | 17 + .../Scripts/GLTFExporterTest.cs.meta | 11 + .../Scripts/MultiSceneComponent.cs | 58 + .../Scripts/MultiSceneComponent.cs.meta | 11 + .../Scripts/OrbitCameraController.cs | 113 + .../Scripts/OrbitCameraController.cs.meta | 11 + .../Scripts/RootMergeComponent.cs | 83 + .../Scripts/RootMergeComponent.cs.meta | 11 + .../Sample Scenes/Scripts/SampleModelList.cs | 48 + .../Scripts/SampleModelList.cs.meta | 11 + .../Sample Scenes/Scripts/SimpleWebServer.cs | 238 + .../Scripts/SimpleWebServer.cs.meta | 11 + .../Scripts/UnityGLTF.Samples.Misc.asmdef | 16 + .../UnityGLTF.Samples.Misc.asmdef.meta | 7 + .../Scripts/VisualizeMeshAttributes.cs | 60 + .../Scripts/VisualizeMeshAttributes.cs.meta | 11 + .../Scripts/WebServerComponent.cs | 22 + .../Scripts/WebServerComponent.cs.meta | 11 + .../SkinnedAnimationTestScene.unity | 608 + .../SkinnedAnimationTestScene.unity.meta | 7 + .../Sample Scenes/StreamBinaryTestScene.unity | 460 + .../StreamBinaryTestScene.unity.meta | 7 + .../Sample Scenes/StreamTestScene.unity | 460 + .../Sample Scenes/StreamTestScene.unity.meta | 7 + .../Sample Scenes/TestSceneScene.unity | 519 + .../Sample Scenes/TestSceneScene.unity.meta | 7 + .../Sample Scenes/TextureTransformTest.unity | 532 + .../TextureTransformTest.unity.meta | 7 + .../Sample Scenes/TransformTest.unity | 513 + .../Sample Scenes/TransformTest.unity.meta | 7 + .../TriangleWithoutIndicesTestScene.unity | 509 + ...TriangleWithoutIndicesTestScene.unity.meta | 7 + .../Samples~/Sample Scenes/UWPTestScene.unity | 469 + .../Sample Scenes/UWPTestScene.unity.meta | 7 + Assets/Plugins/UnityGLTF/package.json | 25 + Assets/Plugins/UnityGLTF/package.json.meta | 7 + Packages/manifest.json | 2 +- Packages/packages-lock.json | 12 +- 524 files changed, 78452 insertions(+), 12 deletions(-) create mode 100644 Assets/Plugins/UnityGLTF.meta create mode 100644 Assets/Plugins/UnityGLTF/CHANGELOG.md create mode 100644 Assets/Plugins/UnityGLTF/CHANGELOG.md.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/InternalUI.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Legacy~/GLTFSerialization.csproj.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Prefabs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Async.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/WebRequestLoader.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/WebRequestLoader.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/MemoryChecker.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/MemoryChecker.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc create mode 100644 Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc.meta create mode 100644 Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity create mode 100644 Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity.meta create mode 100644 Assets/Plugins/UnityGLTF/package.json create mode 100644 Assets/Plugins/UnityGLTF/package.json.meta diff --git a/Assets/Plugins/UnityGLTF.meta b/Assets/Plugins/UnityGLTF.meta new file mode 100644 index 0000000..95daa42 --- /dev/null +++ b/Assets/Plugins/UnityGLTF.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cca4e724a4f1a794f94359c549baa672 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/CHANGELOG.md b/Assets/Plugins/UnityGLTF/CHANGELOG.md new file mode 100644 index 0000000..cebb14a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/CHANGELOG.md @@ -0,0 +1,554 @@ +# Changelog +All notable changes to this package will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [1.24.0-pre.2] - 2023-03-28 +- fix: nullref when importing files without animation in the editor + +## [1.24.0-pre] - 2023-03-27 +- feat: allow Mecanim Humanoid import in Editor with Avatar creation +- feat: better structure for glTF importer with tabs +- fix: don't try to generate UV coordinates for non-triangle meshes +- fix: don't attempt to recalculate normals/tangents for non-triangle meshes +- fix: wrap material extraction in StartEditing/StopEditing calls (fixes #81) +- fix: imports that failed on first try (e.g. missing textures, other errors) would keep using the old asset identifier instead of defaulting to the new one +- fix: runtime recording of SkinnedMeshRenderers without blend shapes was failing in some cases (fixes #80) +- fix: disabling Volume from PBRGraph would still use volume values +- fix: imported animation blendshape frame weights were not roundtripping well +- fix: some animations not imported in Mecanim mode +- fix: compilation issues with ShaderGraph package not present + +## [1.23.1-pre] - 2023-03-15 +- fix: ExportMesh not exporting submeshes in some cases +- fix: missing export mesh marker + +## [1.23.0-pre] - 2023-03-03 +- fix: revert other possible modifications when recording animations +- fix: exporting animation curves failed for blendshape animations on missing targets +- fix: better info for which object has missing curves on animation export +- feat: transparent/double-sided materials can now be upgraded from 2020.x to 2021.x+ + +## [1.22.4-pre] - 2023-02-25 +- fix: revert prefab modifications when recording humanoid animation from prefab assets to work around AnimationMode limitations +- fix: creation of duplicated keyframe when there is only one keyframe +- change: clarify log for rotation animation export with wrong number of curves + +## [1.22.3-pre] - 2023-02-09 +- fix: specular extension factor roundtrip was incorrect +- fix: MSFT_lods import created the wrong hierarchy and the culling option wasn't working +- fix: edge case in node/mesh imports in extensions that could lead to a stack overflow +- fix: calling `GLTFImporterInspector.FixTextureImportSettings` could result in an infite loop when called from an AssetPostprocessor + +## [1.22.2-pre] - 2023-02-04 +- fix: set morph target names from mesh extras on import (#70, thanks @emperorofmars) + +## [1.22.1-pre] - 2023-02-04 +- fix: broken texture references prevented files from loading entirely +- fix: .bin file was not properly registered as dependency for the imported .gltf asset +- fix: shader issue with instance ID transfer on 2021.x (#71, thanks @Jerem-35) +- fix: normal map colorspace was wrong on Mac in some cases (#74, thanks @robertlong) +- fix: ORM maps were exported with empty/unneeded alpha channel (#77, thanks @robertlong) + +## [1.22.0-pre] - 2023-02-01 +- feat: expose ExportNode API +- feat: optionally calculate and place bounds markers in GltfRecorder for viewers that don't caclulate bounds from animated skinned meshes properly (experimental) + +## [1.21.1-pre] - 2023-01-20 +- fix: animator being disabled after exporting humanoid animationclip +- fix: ignore MotionT and MotionQ on animator, can't be resolved for KHR_animation, seems to be a magic unity name +- fix: build error by accessing imageContentHash +- change: export HDR textures with zip compression by default + +## [1.21.0-pre] - 2023-01-14 +- feat: allow aborting export when not in Play Mode and meshes are not readable - seems to be a random Unity synchronization context issue +- fix: don't export unsupported light types (e.g. area light has type "rectangle" which is not supported in glTF) +- fix: Export human motion translation +- fix: prevent exporting the same baked humanoid clip for different avatars, needs individual clips since we're baking them (not retargeting at runtime) +- fix: reusing animation clips between objects with different hierarchies caused some targets to be missing, depending on export order +- change: remove warning for KHR_animation_pointer resolving when the unresolved object is a transform, that's part of core + +## [1.20.3-pre] - 2023-01-13 +- fix: wrong texture name in Texture Transform check +- fix: better check if a texture is a normal map and needs the right import settings +- fix: uris with escaped characters didn't correctly import in the editor + +## [1.20.2-pre] - 2023-01-12 +- fix: export of color animations where only one channel is animated +- fix: order of animationcurve properties when exporing animated colors in component where e.g. a user started by animating a single channel first (e.g. alpha) and later added keyframes for other channels + +## [1.20.1-pre] - 2023-01-10 +- fix: issue with exporting shared texture samplers in some cases +- fix: weights on skinned meshes shouldn't be resolved by custom KHR_animation_pointer resolvers as they're part of the core spec +- change: remove logs when caching data +- change: move cache clear button into settings +- add: KHR_materials_clearcoat roundtrip support (no in-editor visualization yet) + +## [1.20.0-pre] - 2023-01-04 +- add: caching of texture bytes on disc for faster export (can be disabled in UnityGLTFSettings) + +## [1.19.1-pre] - 2023-01-03 +- add: AfterPrimitiveExport event + +## [1.19.0-pre] - 2022-12-14 +- add: spritesheet keyframe animation export +- change: print warning when animation pointer cant be resolved and add filtering of objects that cant be resolved before building animation data +- fix: index discrepancy between _exportedMaterials and _root.Materials lead to wrong texture indices being returned in some cases +- fix: don't write and declare IOR when it's at the default value +- fix: importing textures with names resulted in those names not being used (only image names were used) +- fix: importing files without baseMap but using texture transforms for normal or emissive would result in texture transforms not being used + +## [1.18.5-pre] - 2022-12-02 +- fix: default material was missing in build + +## [1.18.4-pre] - 2022-12-02 +- fix: GLTFRecorder didn't properly record with animation pointer off anymore +- fix: unified access to SkinnedMeshRenderer weights on export +- fix: nullrefs in ExportPlan with missing SkinnedMeshRenderer +- feat: allow passing custom settings into GLTFRecorder + +## [1.18.3-pre] - 2022-11-14 +- fix: disabled MeshRenderers and SkinnedMeshRenderers were not exported despite ExportDisabledGameObjects being on +- fix: sample root transform as well in Humanoid export to prevent shifting it around when recording + +## [1.18.2-pre] - 2022-11-10 +- fix: exception thrown when trying to add a material instance id twice + +## [1.18.1-pre] - 2022-11-09 +- fix: ExportMeshes was not exporting new meshes since the internal material check didn't let it through + +## [1.18.0-pre] - 2022-11-07 +- fix: blend shape weight animation wasn't properly exported in some cases +- fix: IOR extension may end up as null when IOR was animated +- fix: rough refracton LOD access is now affected by alpha blending +- feat: HDR render textures can be exported now +- feat: add ExportMesh(Mesh) API as convenience helper +- feat: add material remapping to glTF/GLB importer +- chore: code cleanup for rough refraction and material inspector +- change: animation export code paths have been consolidated, less differences between KHR_animation_pointer and regular export +- change: bumped min Unity version to 2019.4 + +## [1.17.2-pre] - 2022-10-21 +- fix: set linear export setting before accessing texture exporter settings for unknown textures + +## [1.17.1-pre] - 2022-10-19 +- fix: glb export now using utf8 (no BOM) +- fix: simplify and fix normals export + +## [1.17.0-pre] - 2022-10-12 +- add: import options for animation loop and re-enable by default for Mecanim +- fix: reimport assets when colorspace changes +- fix: texture map type needs to be passed into UniqueTexture, otherwise textures used for different things don't get exported correctly +- fix: bake smoothness values into roughness map if there's no good conversion +- fix: alpha cutout export on BiRP +- fix: base color warning should only be shown for transparent objects +- fix: improve alpha cutout inspector for 2020.3 +- fix: smoothness was inverted / removed even if no smoothness map existed +- change: refactor TextureMapType to contain options for conversion to clean up export and introduce ability to convert smoothness +- change: refactor textureSlots, usage of textureSlot names and how they should be called + +## [1.16.3-pre] - 2022-10-06 +- fix: KHR_animation_pointer bug with re-used animations targeting properties on nodes + +## [1.16.2-pre] - 2022-09-30 +- fix: blend shapes and blend shape animations were not imported (note: sparse accessor import not working yet) +- fix: allow doublesided and transparent import on 2020.3 URP with PBRGraph +- fix: make RegisterPrimitivesWithNode API public, belongs to ExportMesh +- fix: UnlitGraph used wrong texture transform in some cases +- fix: BiRP texture import on legacy shaders in < 2020.3 had flipped texture transforms +- fix: ExporterMaterials compilation issue on 2018.x +- fix: some TMPro materials were exported incorrectly + +## [1.16.1-pre] - 2022-09-25 +- fix: first-time import was failing to find shaders on 2020.x in some cases +- fix: TMPro texture conversion one export was blurry at the bottom of the texture +- fix: transmission/volume mat was incorrectly imported +- fix: transparency was incorrectly imported on 2020.x +- fix: material validation on 2021.x wasn't properly turning transparency on for some imports +- fix: no compilation errors on 2018.4 + 2019.4 + +## [1.16.0-pre] - 2022-09-21 +- fix: checking materials for _ST shader properties was failing on specific Unity versions +- fix: AnimationPointerResolver was warning in cases that are allowed / no warning needed +- fix: build compilation issues on 2022+ +- fix: default scene name differed from glTFast, which broke switching importers. Both use "Scene" now +- fix: import warnings for metallicRoughness texture swizzling only print when a metallicRoughness texture is actually used +- feat: tangents are recalculated on import now +- feat: TMPro meshes export with baked texture now instead of SDF texture +- feat: added AfterTextureExportDelegate/BeforeTextureExportDelegate and UniqueTexture hash for modifying textures on export +- change: explicit bool option to turn KHR_materials_volume export on and off +- change: removed outdated samples from package +- change: if a mesh in the glTF doesn't specify a name it will import without name now instead of using a default name + +## [1.15.0-pre] - 2022-09-13 +- fix: workaround for ShaderGraph bug on 2021.2+ that breaks defining baseColorTexture_ST manually +- fix: workaround for Unity regression in 2022.1+ where checking material properties returns wrong results in some cases +- feat: allow exporting of Humanoid animation clips (get baked to generic) +- change: texture aniso values >= 1 now result in LinearMipmapLinear filtering to match visual result in Unity better + +## [1.14-0-pre] - 2022-09-11 +- fix: log error instead of exception for missing textures on export +- feat: allow referencing GameObjects for `KHR_animation_pointer` +- change: animated fields with `KHR_animation_pointer` now try to find their correct Unity properties instead of the serialized field (m_ prefix disappears) + +## [1.13.0-pre] - 2022-09-05 +- add: preliminary HDR texture export in EXT_texture_exr extension +- fix: Unity Editor module related issues +- fix: wrongly exporting two keyframes for animations with only one keyframe +- fix: children of lights and cameras were inverted + +## [1.12.2-pre] - 2022-08-29 +- fix: KHR_animation_pointer export where member is declared on base type + +## [1.12.1-pre] - 2022-08-23 +- fix: nullref in export of missing mesh + +## [1.12.0-pre] - 2022-08-23 +- fix: emissive color alpha was set to 1 in some roundtrip cases when it should have been 0 +- fix: nullref in import when glTF had null textures (against the spec, but other viewers tolerate it) +- fix: unlit double sided was incorrectly imported in BiRP +- fix: PBRGraphUI didn't properly draw infos for SkinnedMeshRenderer +- fix: added safeguards against Shader.Find not working in first imports (fixes #51) +- fix: textures without mipmaps should export closer to intended now +- fix: missing pbrMetallicRoughness property was treated incorrectly +- fix: BeforeSceneExport was missing from gltf+bin exports +- feat: warn in PBRGraphGUI when UV0 isn't present (fixes #52) +- feat: texture channel swizzling on URP/Lit > PBRGraph material conversion in 2022.1+ +- feat: expose ExportMesh API using UniquePrimitive array to export arbitrary meshes from extensions (#55, thanks @robertlong) +- feat: GLTFSettings can now be passed into GLTFSceneExporter directly, falls back to project settings if none are provided +- remove: public settings API on GLTFSceneExporter is now gone. Pass in custom settings via ExportOptions if needed. + +## [1.11.0-pre] - 2022-07-27 +- fix: converting PBRGraph and UnlitGraph to each other shouldn't warn +- fix: multiple animators referencing the same clip exported animations incorrectly with KHR_animation_pointer on +- fix: implemented partial animation target removal when some bindings animate missing objects +- change: asset identifier for imported assets is now an explicit option +- change: removed compilation flag to use new asset identifier, use the explicit option instead + +## [1.10.1-pre] - 2022-07-18 +- fix: accessor submesh primtives were incorrectly assigned after internal duplication +- fix: don't add import dependency on shaders, load them by GUID instead +- fix: URI-escaped file names weren't always resolved correctly +- fix: some KHR_animation_pointer export type fixes (vec3 colors vs. vec4 colors) +- feat: add color helpers to PBRGraphGUI +- feat: add UnlitGraph for 2021.2+ +- feat: new API, GetPrimitivesForMesh to add extensions to exported meshes (e.g. KHR_materials_variants) + +## [1.10.0-pre] - 2022-07-06 +- fix: PBRGraph assignable again from shader dropdown +- fix: various KHR_animation_pointer fixes to extension usage and property names +- fix: compilation fixes for Unity 2018/2019 +- feat: add helper, callbacks and script generator for shader conversion +- change: Importer/Exporter are now multiple partials +- change: change GetAnimationTargetIdFrom[..] to Get[..]Index to clarify what it does + +## [1.9.0-pre] - 2022-06-22 +- fix: properly set BiRP ShaderGraph transparency keywords +- feat: PBRGraph property names now match glTF names directly (breaking change from 1.7.0+) +- feat: PBRGraph now has a custom shader GUI that also validates keywords + +## [1.8.1-pre] - 2022-06-22 +- fixed: same animation used on different objects should result in different pointer values with KHR_animation_pointer used +- fixed: nullref when adding animation data for null object (e.g. unused property clip) +- fixed: too many nodes get overwritten by duplicate animations with animation pointer +- changed: GetAnimationId now takes root transform parameter +- fixed: previously seen KHR_animation_pointer is now added to resolve list (e.g. when using animations on multiple objects and animating component values) + +## [1.8.0-pre.2] - 2022-06-14 +- fixed: OcclusionTexture tiling now defaults to (1,1) +- fixed: build errors on certain platforms + +## [1.8.0-pre] - 2022-06-10 +- fixed: fixed package version, color space changes require minor version bump, not just patch +- fixed: C# version error on 2020.3 + +## [1.7.1-pre.3] - 2022-06-10 +- feat: show extensions and textures in importer inspector +- feat: export texture coord (UV0 / UV1) separately for "occlusionTexture" and "everything else", same as three.js +- fixed: editor import of .gltf files with textures now uses those textures directly instead of creating new ones +- fixed: exporting only includes extensions that are actually used or explicitly enabled +- fixed: no more differences in color space between exporting glTF + textures or glb with embedded textures +- fixed: importer properly declares shaders as dependencies, fixes library reimport errors + +## [1.7.1-pre.2] - 2022-06-08 +- fixed: animation clip import in Editor working again + +## [1.7.1-pre] - 2022-06-07 +- feat: sparse accessors import (partial) +- feat: UV rotation import/export (for baseColorTexture only right now) +- fixed: GLTFRecorderComponent error in play mode when only new input system is present +- fixed: animation export with KHR_animation_pointer and reused nodes +- fixed: passing invalid file names to Export could result in wrong buffer paths in JSON + +## [1.7.0-pre] - 2022-06-01 +- feat: experimental support for KHR_animation_pointer +- feat: experimental URP (2020.3+) & BiRP (2021.2+) Shader Graph for export and import, `UnityGLTF/PBRGraph` +- feat: approximated support for exporting and importing KHR_materials_transmission, KHR_materials_volume, KHR_materials_ior, KHR_materials_iridescence, best used with `UnityGLTF/PBRGraph` +- feat: renderer features and post effect for rough refraction / transmission (for URP and BiRP) +- fixed: light and camera directions were flipped when animated +- fixed: normal textures were exported with wrong color space in .gltf +- fixed: WebRequestLoader edge case with relative paths +- improved: better heuristic for PBR material export and generally better glTF-related material property export + +## [1.6.1-pre.3] - 2022-05-10 +- feat: allow replacing logger for GLTFSceneExporter with a custom one, allows to reduce number of logs +- feat: added more ProfilerMarkers +- removed: removed submodules from repository to make usage as submodule in other projects easier +- fixed: bad performance in GLTFRecorder when recording lots of animation and/or Blendshape weights +- fixed: some mismatched ProfilerMarker.Begin/End calls +- fixed: less allocations when writing accessors + +## [1.6.1-pre.2] - 2022-05-06 +- feat: allow recording root object in worldspace in GLTFRecorder + +## [1.6.1-pre] - 2022-05-06 +- feat: added experimental support for KHR_animation_pointer in-editor animation export (for select properties), can be turned on in `ProjectSettings/UnityGltf` +- feat: added scene export as GLB (fixes #22) +- fixed: roundtrip issues with glTFast when alpha testing is used +- fixed: no build errors in Samples anymore +- fixed: allow exporting skinned mesh animations even when the mesh isn't readable (bone animation is then still exported) + +## [1.6.0-pre] - 2022-04-28 +- feat: added WebGL import support (export was already supported) +- feat: added WebGL animation export support +- feat: added onLoadComplete action to GLTFComponent +- feat: added ProfilerMarkers for export +- feat: import support for KHR_materials_emissive_strength +- changed: replaced FileLoader/WebRequestLoader with simpler UnityWebRequestLoader for better platform support. Use the previous ones if you need streaming. +- removed: removed unused shader variants from BiRP shaders +- fixed: sparse accessor JSON is properly parsed (no sparse accessor import support yet though) +- fixed: no more validation errors regarding minMag filters, bufferView.byteStride for animation samplers, bufferView.target for index/vertex data +- fixed: only export KHR_materials_emissive_strength if emissive intensity > 1 +- fixed: URP roundtrip now works with glTFast imports (#42) +- fixed: better handling of filenames for glTF + bin + textures export (#41, #40) +- fixed: add vertex color alpha support, add _EmissionMap_ST support to BiRP shader +- fixed: exporting Prefab assets directly from Project Window wasn't working properly when ExportDisabled was off +- fixed: regression with serialization and roundtrip behaviour of spotlights + +## [1.5.0-pre.2] - 2022-04-20 +- fixed: incorrect UV offset for tiled textures on export in some cases +- feat: show exported glTF/GLB in explorer after exporting via Menu Item +- feat: expose API for `GetAnimationId` for custom export logic + +## [1.5.0-pre] - 2022-04-08 + +- added: dialogue window will ask when meshes are not readable at runtime in the editor +- added: more samples regarding custom material extension export +- changed: more GltfSceneExporter methods are now public to allow for custom extension exporting +- changed: moving back to proper versioning; big jump from 1.0 to 1.5 to show that lots of changes have happened +- fixed: no more ScriptedImporter collisions between UnityGltf, glTFast and Siccity glTF +- fixed: corrected some export callback orders +- fixed: random hangs when importing .gltf files via ScriptedImporter +- fixed: correctly importing wrapModeS and wrapModeT now +- fixed: correctly importing Mask mode and cutoff now + +## [1.0.4-preview.35] - 2022-03-11 +- added better logs for unsupported animation tracks on export +- added public methods in GLTFSceneExporter to allow for custom animation export +- added first batch of samples for custom extensions export +- fixed: Auto Referenced is back on on AsmDefs to keep legacy behaviour +- fixed: first timeline keyframe was exported incorrectly in some cases +- fixed: skins should be exported even when animation export is off +- fixed: animation clips shouldn't be exported when exporting from Timeline recorder +- fixed: MetallicGlossMap scale was incorrectly exported in some cases + +## [1.0.4-preview.34] - 2022-02-23 +- added Accessor reuse between exported animations when they come from the same AnimationClip/speed pair +- added optional project setting to export animation clips with unique names (lots of viewers don't support that) +- fixed animation clips being merged when the same clip was used in multiple Animators + +## [1.0.4-preview.33] - 2022-02-21 +- added export option to merge animator states with identical names into one animation +- fixed export of multiple animations when they had the same name (was implicitly merged before, now explicit) +- fixed export of multiple animations when they had the same animator state name but different speeds + +## [1.0.4-preview.32] - 2022-02-10 +- fixed compilation issues on older Unity versions +- fixed exporting in memory to GLB byte array +- fixed dependency to Timeline and some modules not being clear / not guarded +- fixed Readme containing outdated install instructions +- fixed compiler errors when building to some platforms + +## [1.0.4-preview.31] - 2022-02-08 +- added ability to record and export blend shapes at runtime +- fixed settings not being loaded from Resources correctly at runtime +- fixed another case of duplicate recorded keyframes + +## [1.0.4-preview.30] - 2022-02-08 +- added start events to recorder, made key methods virtual +- fixed GLTF recorder component global shortcuts; now uses regular keycode during play mode + +## [1.0.4-preview.29] - 2022-02-07 +- added GLTFRecorderComponent to record at runtime +- renamed recorder files to follow existing filenames +- fixed compilation warning in GLTFSceneImporter +- fixed: create export directory if it doesn't exist +- fixed: blendshape export was missing flag to export no blendshapes at all +- fixed: in some cases would attempt to record duplicate timestamps which is not allowed +- fixed build error from GLTFSceneExporter + +## [1.0.4-preview.28] - 2022-02-07 +- added glTF Timeline exporter track that allows for both editor and runtime animation export +- added ability to export RenderTextures instead of erroring out, these can be exported for a while now +- added export callbacks and made an initial set of export methods public to enable custom export extensions (similar to three.js export callbacks) +- added export generator name +- fixed URP/Unlit color not being exported +- fixed light intensity values being incorrect depending on Unity settings +- fixed removeEmptyRootObjects on import not actually removing empty root objects +- fixed warning when exporting texture transforms if _MainTex_ST is present but _MainTex isn't +- fixed non-specific textures using the wrong export type in some cases, asking the AssetImporter now if one exists +- changed menu items, export options are now in "Assets/UnityGltf/" instead of a toplevel "GLTF" menu + +## [1.0.4-preview.27] - 2021-12-02 +- fixed `_scaleFactor` not being applied to child transform positions for editor import +- fixed roundtrip issues when exporting models that have been imported by UnityGLTF or glTFast +- fixed metallicGlossMap being in the wrong color space on export if emission texture was also used +- fixed light/occlusion map being in the wrong color space during roundtrip + +## [1.0.4-preview.26] - 2021-11-16 +- fixed objects with EditorOnly tag being exported, are skipped now + +## [1.0.4-preview.25] - 2021-11-12 +- fixed imported object names potentially not being unique +- fixed normal map export format when build target is Android +- fixed export of animations when multiple exported objects share the same animation name (gets merged on export now) +- moved GLTF serialization from DLL to package to improve platform support (Unity will compile this for all platforms, no need for special DLLs) +- added sparse accessor export for blendshape positions/normals +- added ability to generate secondary UVs in UnityGLTF importer +- added warning when trying to use KTX2 textures which is currently not supported + +## [1.0.4-preview.24] - 2021-06-14 +- fix: don't attempt to export blendshape normals/tangents when mesh doesn't have them +- fix: warn and skip null bones in SkinnedMeshRenderer export +- added: settings for determining texture export type (png/jpeg depending on alpha channel) and JPEG quality +- added: setting to determine if vertex colors should be exported + +## [1.0.4-preview.23] - 2021-05-28 +- fixed animation export from legacy Animation component +- fixed exporting blendshapes for meshes that don't have bones +- fixed empty textures being generated on import +- fixed emission keyword missing on material import when only color but no texture was set +- fixed metallic and fade export not being correct in some cases +- added option to select which properties (normals/tangents) to export with blendshapes + +## [1.0.4-preview.22] - 2021-05-04 +- fixed ScriptedImporter not importing meshes from SkinnedMeshRenderers +- fixed ScriptedImporter not importing AnimationClips +- fixed ScriptedImporter changing material names on import +- fixed blend shape data being exported multiple times when meshes have multiple submeshes +- added blendshape animation export + +## [1.0.4-preview.21] - 2021-04-26 +- fixed settings file directory not being created on settings file creation + +## [1.0.4-preview.20] - 2021-04-24 +- added settings provider to change GLTF settings from `Project Settings/UnityGLTF` +- added settings for control over object export based on visibility (`Camera.cullingMask`) and active state (`GameObject.activeInHierarchy`) +- changed: experimental texture-from-disk export is now disabled by default +- fixed exporting GameObjects with names that contain invalid filename characters +- fixed normal sampling in built-in pipeline which most likely was never correct with scaled normals +- fixed texture sampling for export/import that resulted in incorrect Point sampling in some cases +- fixed some issues with exporting skinned mesh renderers +- fixed regression with multi material/submesh export + +## [1.0.4-preview.18] - 2021-04-16 +- CHANGED: package name is now back to org.khronos.unitygltf +- fixed missing mesh logging an error, is now a warning +- fixed property export order for URP shaders that also have built-in property fallbacks +- fixed export path omitting extensions for cases such as 15-1.0.3.glb +- fixed issue with shared meshes that have different materials not being properly exported (https://github.com/prefrontalcortex/UnityGLTF/issues/15) +- added MenuItem validation methods to disable them if no valid object for export is selected +- added ability to export selected Prefabs from the Project window directly +- changed the GLTFImporter to overrideExt for 2020.1+ so that importer for .glb files can be chosen when multiple are present + +## [1.0.4-preview.17] - 2021-03-23 +- fixed ACCESSOR_INDEX_PRIMITIVE_RESTART for meshes that have exactly 256 or 65536 vertices and used the wrong buffer type +- fixed vertex color import color space and alpha usage +- fixed incorrect keyframe values causing import abort, just warns now +- fixed GLB/GLTF export paths sometimes being incorrect (double or no extension) +- changed: GLB importer now embeds all meshes and textures as sub assets instead of putting them in the project; needs better importer inspector to allow for asset remapping. + +## [1.0.4-preview.16] - 2021-03-15 +- fixed color space issues with vertex colors and emissive +- fixed export of UV offset/tiling for non-main textures +- fixed exporting materials as PBR when they have _Metallic and _Glossiness (required only _MetallicGlossMap before) + +## [1.0.4-preview.15] - 2021-02-23 +- fixed issues with material export in URP where PBR wasn't properly detected and exported + +## [1.0.4-preview.14] - 2021-02-10 +- fixed issues with KHR_materials_pbrSpecularGlossinessExtension and materials that don't have textures + +## [1.0.4-preview.13] - 2021-01-30 +- fixed missing references in materials and prefabs +- fixed issue preventing build with UnityGLTF in project +- moved samples into subfolder +- added support for animation clip speed being set inside Animator States + +## [1.0.4-preview.12] - 2020-12-15 +- fix compilation errors in GLTFSerialization.dll on recompiling +- fix Newtonsoft.Json being copied to output directory +- fix a number of animation export issues +- add KHR_materials_unlit extension import and export + +## [1.0.4-preview.11] - 2020-11-27 +- fix KHR_lights_punctual extension always being set, even if no lights were exported +- fix invalid primitives being exported for meshes with 0 vertices +- removed export rotation offset that caused incorrect rotation in other softwares + +## [1.0.4-preview.10] - 2020-11-16 +- fix error thrown when vertex arrays have 0 elements (this is valid in FBX) +- add light export/import extensions +- merged a number of PRs that fix nullrefs on export/import + +## [1.0.4-preview.9] - 2020-10-03 +- merged in a number of material fix and null ref PRs +- add namespaces to scripts that didn't have them + +## [1.0.4-preview.8] - 2020-09-10 +- built GLTFSerialization.dll against Newtonsoft.JSON 12.0.3 +- removed Newtonsoft.JSON.dll from package +- added dependency on com.unity.nuget.newtonsoft-json@2.0.0 +- added 2020.2 compatibility + +## [1.0.4-preview.7] - 2020-07-24 +- fix sRGB/linear conversion for normal maps depending on Unity color space + +## [1.0.4-preview.6] - 2020-07-15 +- fix sRGB/linear conversion for colors exported from Unity +- fix rotation order for 180° hack +- note: please use Linear color space, normal maps break in Gamma color space right now + +## [1.0.4-preview.5] - 2020-07-13 +- hack: added 180° rotation on export (experimental), needs to be tested with animations, only works with a single root transform on export +- changed back to "preview" instead of "pfc" tag because stupid PackMan + +## [1.0.4-pfc.4] - 2020-07-12 +- fix meta files for Tests folder + +## [1.0.4-pfc.2] - 2020-07-07 +- fix build errors preventing builds +- fix PBR texture roundtrip with incorrect red channel + +## [1.0.4-pfc] - 2020-04-24 +- lots of improvements to animation export +- automatic keyframe reduction +- BREAKING: disabled UV2 and vertex color export for web +- fixed texture export from memory instead of from disk +- fix breaking animations in SceneViewer due to omitted LINEAR sampler specification + +## [1.0.0-pfc.4] - 2020-01-16 +- rebased all pfc feature branches on latest master +- back to org.khronos scope for easier switching between versions +- added animation export +- added PNG/JPG texture export from disk where available + +## [1.0.1] - 2019-04-03 +- Upgraded to 2017.4 +- Included various fixes (will update) +- Includes UPM package + +## [1.0.0] - 2018-09-21 +- first built unity package release of UnityGLTF diff --git a/Assets/Plugins/UnityGLTF/CHANGELOG.md.meta b/Assets/Plugins/UnityGLTF/CHANGELOG.md.meta new file mode 100644 index 0000000..4352b47 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2ac567cb9b76e6a4490f2f54aa52c067 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor.meta b/Assets/Plugins/UnityGLTF/Editor.meta new file mode 100644 index 0000000..23639d3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f5f45ddfa210e204f88be87c65820b64 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts.meta new file mode 100644 index 0000000..5b70430 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d3936188a676ff4a9194add4e985b7c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs new file mode 100644 index 0000000..33ac18a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs @@ -0,0 +1,82 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace UnityGLTF +{ + [CustomEditor(typeof(GLTFComponent))] + public class GLTFComponentInspector : Editor + { + private Vector2 scrollPosition = Vector2.zero; + + public override void OnInspectorGUI() + { + DrawDefaultInspector(); + serializedObject.ApplyModifiedProperties(); + +#if UNITY_ANIMATION + var gltfComponent = serializedObject.targetObject as GLTFComponent; + if (gltfComponent != null && gltfComponent.Animations != null) + { + EditorGUILayout.LabelField("Animations:"); + using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition)) + { + scrollPosition = scrollView.scrollPosition; + foreach (var animation in gltfComponent.Animations) + { + DrawAnimation(animation); + } + } + } +#endif + } + + private void DrawAnimation(Animation animation) + { + GUILayout.Label(animation.name); + + foreach (AnimationState animationState in animation) + { + using (new EditorGUILayout.HorizontalScope()) + { + var clip = animationState.clip; + var clipName = clip.name; + GUILayout.Label(clipName); + + var isPlaying = animation.IsPlaying(clipName); + string playPause = isPlaying ? "pause" : "play"; + + var buttonPressed = GUILayout.Button(playPause); + + if (buttonPressed) + { + if (isPlaying) + { + animation.Stop(clipName); + } + else + { + animation.Play(clipName); + } + } + } + } + } + + private void SetClipsPlaying(Animation animation, bool play) + { + foreach (AnimationState animationState in animation) + { + if (play) + { + animation.Play(animationState.clip.name); + } + else + { + animation.Stop(animationState.clip.name); + } + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs.meta new file mode 100644 index 0000000..1568359 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFComponentInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 843e1771f80e49643aed2baa52c2394d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs new file mode 100644 index 0000000..9103b51 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs @@ -0,0 +1,134 @@ +using System; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace UnityGLTF +{ + public static class GLTFExportMenu + { + private const string MenuPrefix = "Assets/UnityGLTF/"; + + public static string RetrieveTexturePath(UnityEngine.Texture texture) + { + var path = AssetDatabase.GetAssetPath(texture); + // texture is a subasset + if (AssetDatabase.GetMainAssetTypeAtPath(path) != typeof(Texture2D)) + { + var ext = System.IO.Path.GetExtension(path); + if (string.IsNullOrWhiteSpace(ext)) return texture.name + ".png"; + path = path.Replace(ext, "-" + texture.name + ext); + } + return path; + } + + private static bool TryGetExportNameAndRootTransformsFromSelection(out string sceneName, out Transform[] rootTransforms) + { + if (Selection.transforms.Length > 1) + { + sceneName = SceneManager.GetActiveScene().name; + rootTransforms = Selection.transforms; + return true; + } + if (Selection.transforms.Length == 1) + { + sceneName = Selection.activeGameObject.name; + rootTransforms = Selection.transforms; + return true; + } + if (Selection.objects.Any() && Selection.objects.All(x => x is GameObject)) + { + sceneName = Selection.objects.First().name; + rootTransforms = Selection.objects.Select(x => (x as GameObject).transform).ToArray(); + return true; + } + + sceneName = null; + rootTransforms = null; + return false; + } + + [MenuItem(MenuPrefix + "Export selected as glTF", true)] + private static bool ExportSelectedValidate() + { + return TryGetExportNameAndRootTransformsFromSelection(out _, out _); + } + + [MenuItem(MenuPrefix + "Export selected as glTF")] + private static void ExportSelected() + { + if (!TryGetExportNameAndRootTransformsFromSelection(out var sceneName, out var rootTransforms)) + { + Debug.LogError("Can't export: selection is empty"); + return; + } + + Export(rootTransforms, false, sceneName); + } + + [MenuItem(MenuPrefix + "Export selected as GLB", true)] + private static bool ExportGLBSelectedValidate() + { + return TryGetExportNameAndRootTransformsFromSelection(out _, out _); + } + + [MenuItem(MenuPrefix + "Export selected as GLB")] + private static void ExportGLBSelected() + { + if (!TryGetExportNameAndRootTransformsFromSelection(out var sceneName, out var rootTransforms)) + { + Debug.LogError("Can't export: selection is empty"); + return; + } + Export(rootTransforms, true, sceneName); + } + + [MenuItem(MenuPrefix + "Export active scene as glTF")] + private static void ExportScene() + { + var scene = SceneManager.GetActiveScene(); + var gameObjects = scene.GetRootGameObjects(); + var transforms = Array.ConvertAll(gameObjects, gameObject => gameObject.transform); + + Export(transforms, false, scene.name); + } + + [MenuItem(MenuPrefix + "Export active scene as GLB")] + private static void ExportSceneGLB() + { + var scene = SceneManager.GetActiveScene(); + var gameObjects = scene.GetRootGameObjects(); + var transforms = Array.ConvertAll(gameObjects, gameObject => gameObject.transform); + + Export(transforms, true, scene.name); + } + + private static void Export(Transform[] transforms, bool binary, string sceneName) + { + var settings = GLTFSettings.GetOrCreateSettings(); + var exportOptions = new ExportOptions { TexturePathRetriever = RetrieveTexturePath }; + var exporter = new GLTFSceneExporter(transforms, exportOptions); + + var invokedByShortcut = Event.current?.type == EventType.KeyDown; + var path = settings.SaveFolderPath; + if (!invokedByShortcut || !Directory.Exists(path)) + path = EditorUtility.SaveFolderPanel("glTF Export Path", settings.SaveFolderPath, ""); + + if (!string.IsNullOrEmpty(path)) + { + var ext = binary ? ".glb" : ".gltf"; + var resultFile = GLTFSceneExporter.GetFileName(path, sceneName, ext); + settings.SaveFolderPath = path; + if(binary) + exporter.SaveGLB(path, sceneName); + else + exporter.SaveGLTFandBin(path, sceneName); + + Debug.Log("Exported to " + resultFile); + EditorUtility.RevealInFinder(resultFile); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs.meta new file mode 100644 index 0000000..ba88ff8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFExportMenu.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd3d2ca14e7c1084888c77f15c69ae56 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs new file mode 100644 index 0000000..e6f559f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs @@ -0,0 +1,619 @@ +#if UNITY_2017_1_OR_NEWER + +// glTFast is on the path to being official, so it should have highest priority as importer by default +// This ifdef is included for completeness. +// Other glTF importers should specify this via AsmDef dependency, for example +// `com.atteneder.gltfast@3.0.0: HAVE_GLTFAST` and then checking here `#if HAVE_GLTFAST` +#if HAVE_GLTFAST +#define ANOTHER_IMPORTER_HAS_HIGHER_PRIORITY +#endif + +#if !ANOTHER_IMPORTER_HAS_HIGHER_PRIORITY && !UNITYGLTF_FORCE_DEFAULT_IMPORTER_OFF +#define ENABLE_DEFAULT_GLB_IMPORTER +#endif +#if UNITYGLTF_FORCE_DEFAULT_IMPORTER_ON +#define ENABLE_DEFAULT_GLB_IMPORTER +#endif + +using UnityEditor; +using System.IO; +using UnityEngine; +using System.Collections.Generic; +using System.Linq; +using System; +using Object = UnityEngine.Object; +using UnityGLTF.Loader; +using GLTF.Schema; +using GLTF; +using Unity.Collections; +#if UNITY_2020_2_OR_NEWER +using UnityEditor.AssetImporters; +#else +using UnityEditor.Experimental.AssetImporters; +#endif + +namespace UnityGLTF +{ +#if UNITY_2020_2_OR_NEWER +#if ENABLE_DEFAULT_GLB_IMPORTER + [ScriptedImporter(ImporterVersion, new[] { "glb", "gltf" })] +#else + [ScriptedImporter(ImporterVersion, null, overrideExts: new[] { "glb", "gltf" })] +#endif +#else + [ScriptedImporter(ImporterVersion, new[] { "glb" })] +#endif + public class GLTFImporter : ScriptedImporter + { + private const int ImporterVersion = 7; + + private static void EnsureShadersAreLoaded() + { + const string PackagePrefix = "Packages/org.khronos.unitygltf/"; + var shaders = new string[] { + PackagePrefix + "Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph", + PackagePrefix + "Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph", + PackagePrefix + "Runtime/Shaders/PbrMetallicRoughness.shader", + PackagePrefix + "Runtime/Shaders/PbrSpecularGlossiness.shader", + PackagePrefix + "Runtime/Shaders/Unlit.shader", + }; + + foreach (var shaderPath in shaders) + { + AssetDatabase.LoadAssetAtPath(shaderPath); + } + } + + [Tooltip("Turn this off to create an explicit GameObject for the glTF scene. A scene root will always be created if there's more than one root node.")] + [SerializeField] internal bool _removeEmptyRootObjects = true; + [SerializeField] internal float _scaleFactor = 1.0f; + [SerializeField] internal int _maximumLod = 300; + [SerializeField] internal bool _readWriteEnabled = true; + [SerializeField] internal bool _generateColliders = false; + [SerializeField] internal bool _swapUvs = false; + [SerializeField] internal bool _generateLightmapUVs = false; + [SerializeField] internal GLTFImporterNormals _importNormals = GLTFImporterNormals.Import; + [SerializeField] internal GLTFImporterNormals _importTangents = GLTFImporterNormals.Import; + [SerializeField] internal AnimationMethod _importAnimations = AnimationMethod.Mecanim; + [SerializeField] internal bool _addAnimatorComponent = false; + [SerializeField] internal bool _animationLoopTime = true; + [SerializeField] internal bool _animationLoopPose = false; + [SerializeField] internal bool _importMaterials = true; + [Tooltip("Enable this to get the same main asset identifiers as glTFast uses. This is recommended for new asset imports. Note that changing this for already imported assets will break their scene references and require manually re-adding the affected assets.")] + [SerializeField] internal bool _useSceneNameIdentifier = false; + + // for humanoid importer + [SerializeField] internal bool m_OptimizeGameObjects = false; + [SerializeField] internal HumanDescription m_HumanDescription = new HumanDescription(); + + // material remapping + [SerializeField] private Material[] m_Materials = new Material[0]; + + [Serializable] + internal class ExtensionInfo + { + public string name; + public bool supported; + public bool used; + public bool required; + } + + [Serializable] + public class TextureInfo + { + public Texture2D texture; + public bool shouldBeLinear; + } + +#if !UNIYT_2020_2_OR_NEWER + private class NonReorderableAttribute : Attribute {} +#endif + + // Import messages (extensions, warnings, errors, ...) + [NonReorderable] [SerializeField] internal List _extensions; + [NonReorderable] [SerializeField] private List _textures; + [SerializeField] internal string _mainAssetIdentifier; + + internal List Textures => _textures; + + private static string[] GatherDependenciesFromSourceFile(string path) + { + // only supported glTF for now - would be harder to check for external references in glb assets. + if (!path.ToLowerInvariant().EndsWith(".gltf")) return Array.Empty(); + + var dependencies = new List(); + + // read minimal JSON, check if there's a bin buffer, and load that. + // all other assets should be "proper assets" and be found by the asset database, but we're not importing .bin + // since it's too common as a file type. + var gltf = GLTFRoot.Deserialize(new StreamReader(path)); + var externalBuffers = gltf?.Buffers?.Where(b => b?.Uri != null && b.Uri.ToLowerInvariant().EndsWith(".bin")); + if (externalBuffers != null) + { + var dir = Path.GetDirectoryName(path); + foreach (var buffer in externalBuffers) + { + var uri = buffer.Uri; + if (!File.Exists(Path.Combine(dir, uri))) + uri = Uri.UnescapeDataString(uri); + if (File.Exists(Path.Combine(dir, uri))) + dependencies.Add(Path.Combine(dir, uri)); + // TODO check if inside the project/any package, could be an absolute path + else if (File.Exists(uri)) + dependencies.Add(uri); + } + } + + return dependencies.ToArray(); + } + + public override void OnImportAsset(AssetImportContext ctx) + { + string sceneName = null; + GameObject gltfScene = null; + AnimationClip[] animations = null; + Mesh[] meshes = null; + + var uniqueNames = new List() { "main asset" }; + EnsureShadersAreLoaded(); + + string GetUniqueName(string desiredName) + { + var uniqueName = ObjectNames.GetUniqueName(uniqueNames.ToArray(), desiredName); + if (!uniqueNames.Contains(uniqueName)) uniqueNames.Add(uniqueName); + return uniqueName; + } + +#if UNITY_2017_3_OR_NEWER + // We explicitly turn the new identifier on for new imports, that is, when no meta file existed before this import. + // We do this early, so that when imports fail, we still get the new identifier. Unity already sets import settings on failed imports. + if (!_useSceneNameIdentifier) + { + var importer = GetAtPath(ctx.assetPath); + if (importer.importSettingsMissing) + { + _useSceneNameIdentifier = true; + } + } +#endif + + try + { + sceneName = Path.GetFileNameWithoutExtension(ctx.assetPath); + CreateGLTFScene(ctx.assetPath, out gltfScene, out animations); + var rootGltfComponent = gltfScene.GetComponent(); + if (rootGltfComponent) DestroyImmediate(rootGltfComponent); + + // Remove empty roots + if (_removeEmptyRootObjects) + { + var t = gltfScene.transform; + var existingAnimator = t.GetComponent(); + var hadAnimator = (bool)existingAnimator; + var existingAvatar = existingAnimator ? existingAnimator.avatar : default; + if (existingAnimator) + DestroyImmediate(existingAnimator); + + while ( + gltfScene.transform.childCount == 1 && + gltfScene.GetComponents().Length == 1) + { + var parent = gltfScene; + var importName = parent.name; + gltfScene = gltfScene.transform.GetChild(0).gameObject; + gltfScene.name = importName; // root name is always name of the file anyways + t = gltfScene.transform; + t.parent = null; // To keep transform information in the new parent + DestroyImmediate(parent); // Get rid of the parent + } + + // Re-add animator if it was removed + if (hadAnimator) + { + var newAnimator = gltfScene.AddComponent(); + newAnimator.avatar = existingAvatar; + } + } + + // Ensure there are no hide flags present (will cause problems when saving) + gltfScene.hideFlags &= ~(HideFlags.HideAndDontSave); + foreach (Transform child in gltfScene.transform) + { + child.gameObject.hideFlags &= ~(HideFlags.HideAndDontSave); + } + + // scale all localPosition values if necessary + if (!Mathf.Approximately(_scaleFactor, 1)) + { + var transforms = gltfScene.GetComponentsInChildren(); + foreach (var tr in transforms) + { + tr.localPosition *= _scaleFactor; + } + } + + // Get meshes + var meshHash = new HashSet(); + var meshFilters = gltfScene.GetComponentsInChildren().Select(x => (x.gameObject, x.sharedMesh)).ToList(); + meshFilters.AddRange(gltfScene.GetComponentsInChildren().Select(x => (x.gameObject, x.sharedMesh))); + var vertexBuffer = new List(); + meshes = meshFilters.Select(mf => + { + var mesh = mf.sharedMesh; + + if (meshHash.Contains(mesh)) + return null; + meshHash.Add(mesh); + + if (!Mathf.Approximately(_scaleFactor, 1.0f)) + { + vertexBuffer.Clear(); + mesh.GetVertices(vertexBuffer); + for (var i = 0; i < vertexBuffer.Count; ++i) + { + vertexBuffer[i] *= _scaleFactor; + } + mesh.SetVertices(vertexBuffer); + } + if (_generateLightmapUVs) + { + var uv2 = mesh.uv2; + if (uv2 == null || uv2.Length < 1) + { + var hasTriangleTopology = true; + for (var i = 0; i < mesh.subMeshCount; i++) + hasTriangleTopology &= mesh.GetTopology(i) == MeshTopology.Triangles; + + // uv2 = Unwrapping.GeneratePerTriangleUV(mesh); + // mesh.SetUVs(1, uv2); + + // There seems to be a bug in Unity's splitting code: + // for some meshes, the result is broken after splitting. + if (hasTriangleTopology) + Unwrapping.GenerateSecondaryUVSet(mesh); + } + } + if (_swapUvs) + { + var uv = mesh.uv; + var uv2 = mesh.uv2; + mesh.uv = uv2; + if(uv.Length > 0) + mesh.uv2 = uv; + } + + if (_importNormals == GLTFImporterNormals.None) + mesh.normals = new Vector3[0]; + else if (_importNormals == GLTFImporterNormals.Calculate && mesh.GetTopology(0) == MeshTopology.Triangles) + mesh.RecalculateNormals(); + else if (_importNormals == GLTFImporterNormals.Import && mesh.normals.Length == 0 && mesh.GetTopology(0) == MeshTopology.Triangles) + mesh.RecalculateNormals(); + + if (_importTangents == GLTFImporterNormals.None) + mesh.tangents = new Vector4[0]; + else if (_importTangents == GLTFImporterNormals.Calculate && mesh.GetTopology(0) == MeshTopology.Triangles) + mesh.RecalculateTangents(); + else if (_importTangents == GLTFImporterNormals.Import && mesh.tangents.Length == 0 && mesh.GetTopology(0) == MeshTopology.Triangles) + mesh.RecalculateTangents(); + + mesh.UploadMeshData(!_readWriteEnabled); + + if (_generateColliders) + { + var collider = mf.gameObject.AddComponent(); + collider.sharedMesh = mesh; + } + + return mesh; + }).Where(x => x).ToArray(); + + if (animations != null) + { + foreach (var clip in animations) + { + ctx.AddObjectToAsset(GetUniqueName(clip.name), clip); + } + } + + // we can't add the Animators as subassets here, since they require their state machines to be direct subassets themselves. + // foreach (var anim in animators) + // { + // ctx.AddObjectToAsset(GetUniqueName(anim.runtimeAnimatorController.name), anim.runtimeAnimatorController as AnimatorController); + // foreach (var layer in (anim.runtimeAnimatorController as AnimatorController).layers) + // { + // ctx.AddObjectToAsset(GetUniqueName(layer.name + "-state"), layer.stateMachine); + // } + // } + + if (_importAnimations == AnimationMethod.MecanimHumanoid) + { + var avatar = HumanoidSetup.AddAvatarToGameObject(gltfScene); + if (avatar && avatar.isValid) + ctx.AddObjectToAsset("avatar", avatar); + } + + var renderers = gltfScene.GetComponentsInChildren(); + + if (_importMaterials) + { + // Get materials + var map = GetExternalObjectMap(); + var materialHash = new HashSet(); + var materials = renderers.SelectMany(r => + { + return r.sharedMaterials.Select(mat => + { + if (materialHash.Add(mat)) + { + var matName = string.IsNullOrEmpty(mat.name) ? mat.shader.name : mat.name; + if (matName == mat.shader.name) + { + matName = matName.Substring(Mathf.Min(matName.LastIndexOf("/", StringComparison.Ordinal) + 1, matName.Length - 1)); + } + mat.name = matName; + } + + return mat; + }); + }).Distinct().ToArray(); + + // apply material remap + foreach(var r in renderers) + { + // remap materials to external objects + var m = r.sharedMaterials; + for (var i = 0; i < m.Length; i++) + { + var si = new SourceAssetIdentifier(m[i]); + if (map.ContainsKey(si)) + m[i] = map[si] as Material; + } + r.sharedMaterials = m; + }; + + // Get textures + var textureHash = new HashSet(); + var texMaterialMap = new Dictionary>(); + var textures = materials.SelectMany(mat => + { + var shader = mat.shader; + if (!shader) return Enumerable.Empty(); + + var matTextures = new List(); + for (var i = 0; i < ShaderUtil.GetPropertyCount(shader); ++i) + { + if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv) + { + var propertyName = ShaderUtil.GetPropertyName(shader, i); + var tex = mat.GetTexture(propertyName) as Texture2D; + if (tex) + { + if (textureHash.Add(tex)) + { + var texName = tex.name; + if (string.IsNullOrEmpty(texName)) + { + if (propertyName.StartsWith("_")) texName = propertyName.Substring(Mathf.Min(1, propertyName.Length - 1)); + tex.name = texName; + } + matTextures.Add(tex); + } + + List materialMaps; + if (!texMaterialMap.TryGetValue(tex, out materialMaps)) + { + materialMaps = new List(); + texMaterialMap.Add(tex, materialMaps); + } + + materialMaps.Add(new TexMaterialMap(mat, propertyName, propertyName == "_BumpMap" || propertyName == "normalTexture" || propertyName.EndsWith("NormalTexture"))); + } + } + } + return matTextures; + }).Distinct().ToArray(); + + // Save textures as separate assets and rewrite refs + // TODO: Support for other texture types + if (textures.Length > 0) + { + foreach (var tex in textures) + { + if (AssetDatabase.Contains(tex) && AssetDatabase.GetAssetPath(tex) != ctx.assetPath) + { +#if UNITY_2020_2_OR_NEWER + ctx.DependsOnArtifact( +#else + ctx.DependsOnSourceAsset( +#endif + AssetDatabase.GetAssetPath(tex)); + } + else + { + ctx.AddObjectToAsset(GetUniqueName(tex.name), tex); + } + } + } + +#if !UNITY_2022_1_OR_NEWER + AssetDatabase.Refresh(); +#endif + + // Save materials as separate assets and rewrite refs + if (materials.Length > 0) + { + foreach (var mat in materials) + { + // ensure materials that are overriden aren't shown in the hierarchy. + var si = new SourceAssetIdentifier(mat); + if (map.ContainsKey(si)) + mat.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector; + + ctx.AddObjectToAsset(GetUniqueName(mat.name), mat); + } + } + + m_Materials = materials; + +#if !UNITY_2022_1_OR_NEWER + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); +#endif + } + else + { + var temp = GameObject.CreatePrimitive(PrimitiveType.Plane); + temp.SetActive(false); + var defaultMat = new[] { temp.GetComponent().sharedMaterial }; + DestroyImmediate(temp); + + foreach (var rend in renderers) + { + rend.sharedMaterials = defaultMat; + } + } + } + catch + { + if (gltfScene) DestroyImmediate(gltfScene); + throw; + } + +#if UNITY_2017_3_OR_NEWER + if (!_useSceneNameIdentifier) + { + // Set main asset + _mainAssetIdentifier = "main asset"; + ctx.AddObjectToAsset(_mainAssetIdentifier, gltfScene); + } + else + { + // This will be a breaking change, but would be aligned to the import naming from glTFast - allows switching back and forth between importers. + _mainAssetIdentifier = $"scenes/{gltfScene.name}"; + ctx.AddObjectToAsset(_mainAssetIdentifier, gltfScene); + } + + // Add meshes + foreach (var mesh in meshes) + { + try + { + ctx.AddObjectToAsset(GetUniqueName("mesh-" + mesh.name), mesh); + } catch(System.InvalidOperationException e) { + Debug.LogWarning(e.ToString(), mesh); + } + } + +#if UNITY_2020_2_OR_NEWER + ctx.DependsOnCustomDependency(ColorSpaceDependency); +#endif + ctx.SetMainObject(gltfScene); +#else + // Set main asset + ctx.SetMainAsset("main asset", gltfScene); + + // Add meshes + foreach (var mesh in meshes) + { + try { + ctx.AddSubAsset("mesh " + mesh.name, mesh); + } catch (System.InvalidOperationException e) { + Debug.LogWarning(e.ToString(), mesh); + } + } +#endif + } + + private const string ColorSpaceDependency = nameof(GLTFImporter) + "_" + nameof(PlayerSettings.colorSpace); + +#if UNITY_2020_2_OR_NEWER + [InitializeOnLoadMethod] + private static void UpdateColorSpace() + { + AssetDatabase.RegisterCustomDependency(ColorSpaceDependency, Hash128.Compute((int) PlayerSettings.colorSpace)); + } +#endif + + private void CreateGLTFScene(string projectFilePath, out GameObject scene, out AnimationClip[] animationClips) + { + var importOptions = new ImportOptions + { + DataLoader = new FileLoader(Path.GetDirectoryName(projectFilePath)), + AnimationMethod = _importAnimations, + AnimationLoopTime = _animationLoopTime, + AnimationLoopPose = _animationLoopPose, + }; + using (var stream = File.OpenRead(projectFilePath)) + { + GLTFRoot gLTFRoot; + GLTFParser.ParseJson(stream, out gLTFRoot); + stream.Position = 0; // Make sure the read position is changed back to the beginning of the file + var loader = new GLTFSceneImporter(gLTFRoot, stream, importOptions); + loader.MaximumLod = _maximumLod; + loader.IsMultithreaded = true; + + loader.LoadSceneAsync().Wait(); + + if (gLTFRoot.ExtensionsUsed != null) + { + _extensions = gLTFRoot.ExtensionsUsed + .Select(x => new ExtensionInfo() + { + name = x, + supported = true, + used = true, + required = gLTFRoot.ExtensionsRequired?.Contains(x) ?? false, + }) + .ToList(); + } + else + { + _extensions = new List(); + } + + _textures = loader.TextureCache + .Where(x => x != null) + .Select(x => new TextureInfo() { texture = x.Texture, shouldBeLinear = x.IsLinear }) + .ToList(); + + scene = loader.LastLoadedScene; + animationClips = loader.CreatedAnimationClips; + } + } + + private void CopyOrNew(T asset, string assetPath, Action replaceReferences) where T : Object + { + var existingAsset = AssetDatabase.LoadAssetAtPath(assetPath); + if (existingAsset) + { + EditorUtility.CopySerialized(asset, existingAsset); + replaceReferences(existingAsset); + return; + } + + AssetDatabase.CreateAsset(asset, assetPath); + } + + private class TexMaterialMap + { + public UnityEngine.Material Material { get; set; } + public string Property { get; set; } + public bool IsNormalMap { get; set; } + + public TexMaterialMap(UnityEngine.Material material, string property, bool isNormalMap) + { + Material = material; + Property = property; + IsNormalMap = isNormalMap; + } + } + + public override bool SupportsRemappedAssetType(Type type) + { + if (type == typeof(Material)) + return true; + return base.SupportsRemappedAssetType(type); + } + } +} +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs.meta new file mode 100644 index 0000000..11233c0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 804e1ce4c496647cfa3f1a1134187c71 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs new file mode 100644 index 0000000..30e92c5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs @@ -0,0 +1,334 @@ +#if UNITY_2017_1_OR_NEWER +using System; +using System.IO; +using System.Linq; +using System.Text; +using UnityEditor; + +using UnityEngine; +#if UNITY_2020_2_OR_NEWER +using UnityEditor.AssetImporters; +#else +using UnityEditor.Experimental.AssetImporters; +#endif + +namespace UnityGLTF +{ + [CustomEditor(typeof(GLTFImporter))] + [CanEditMultipleObjects] + internal class GLTFImporterInspector : UnityGLTFTabbedEditor + { + private string[] _importNormalsNames; + + public override void OnEnable() + { + AddTab(new GltfAssetImporterTab(this, "Model", ModelInspectorGUI)); + AddTab(new GltfAssetImporterTab(this, "Animation", AnimationInspectorGUI)); + AddTab(new GltfAssetImporterTab(this, "Materials", MaterialInspectorGUI)); + AddTab(new GltfAssetImporterTab(this, "Extensions", ExtensionInspectorGUI)); + + base.OnEnable(); + } + + private void TextureWarningsGUI(GLTFImporter t) + { + if (!t) return; + if (!TextureImportSettingsAreCorrect(t)) + { + EditorGUILayout.HelpBox("Some Textures have incorrect linear/sRGB settings. Results might be incorrect.", MessageType.Warning); + if (GUILayout.Button("Fix All")) + { + FixTextureImportSettings(t); + } + } + } + + private void ModelInspectorGUI() + { + var t = target as GLTFImporter; + if (!t) EditorGUILayout.LabelField("NOOOO"); + + if (!t) return; + + // serializedObject.Update(); + if (_importNormalsNames == null) + { + _importNormalsNames = Enum.GetNames(typeof(GLTFImporterNormals)) + .Select(n => ObjectNames.NicifyVariableName(n)) + .ToArray(); + } + EditorGUILayout.LabelField("Scene", EditorStyles.boldLabel); + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._removeEmptyRootObjects))); + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._scaleFactor))); + // EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._maximumLod)), new GUIContent("Maximum Shader LOD")); + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Meshes", EditorStyles.boldLabel); + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._readWriteEnabled)), new GUIContent("Read/Write")); + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._generateColliders))); + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Geometry", EditorStyles.boldLabel); + EditorGUI.BeginChangeCheck(); + var importNormalsProp = serializedObject.FindProperty(nameof(GLTFImporter._importNormals)); + var importNormals = EditorGUILayout.Popup("Normals", importNormalsProp.intValue, _importNormalsNames); + if (EditorGUI.EndChangeCheck()) + { + importNormalsProp.intValue = importNormals; + } + EditorGUI.BeginChangeCheck(); + var importTangentsProp = serializedObject.FindProperty(nameof(GLTFImporter._importTangents)); + var importTangents = EditorGUILayout.Popup("Tangents", importTangentsProp.intValue, _importNormalsNames); + if (EditorGUI.EndChangeCheck()) + { + importTangentsProp.intValue = importTangents; + } + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._swapUvs)), new GUIContent("Swap UVs")); + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._generateLightmapUVs)), new GUIContent("Generate Lightmap UVs")); + EditorGUILayout.Separator(); + + TextureWarningsGUI(t); + } + + private void AnimationInspectorGUI() + { + var t = target as GLTFImporter; + if (!t) return; + + var anim = serializedObject.FindProperty(nameof(GLTFImporter._importAnimations)); + EditorGUILayout.PropertyField(anim, new GUIContent("Animation Type")); + if (anim.enumValueIndex > 0) + { + var loopTime = serializedObject.FindProperty(nameof(GLTFImporter._animationLoopTime)); + EditorGUILayout.PropertyField(loopTime, new GUIContent("Loop Time")); + if (loopTime.boolValue) + { + EditorGUI.indentLevel++; + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._animationLoopPose)), new GUIContent("Loop Pose")); + EditorGUI.indentLevel--; + } + } + + // warn if Humanoid rig import has failed + if (!HasModified() && anim.enumValueIndex == (int) AnimationMethod.MecanimHumanoid && !AssetDatabase.LoadAssetAtPath(t.assetPath)) + { + EditorGUILayout.Separator(); + EditorGUILayout.HelpBox("The model doesn't contain a valid Humanoid rig. See the console for more information.", MessageType.Error); + } + } + + private void MaterialInspectorGUI() + { + var t = target as GLTFImporter; + if (!t) return; + + var mats = serializedObject.FindProperty("m_Materials"); + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._importMaterials))); + EditorGUILayout.Separator(); + + // extract and remap materials + if (mats != null && mats.serializedObject != null) + { + EditorGUI.indentLevel++; + var externalObjectMap = t.GetExternalObjectMap(); + + void ExtractMaterial(Material subAsset, bool importImmediately) + { + if (!subAsset) return; + var filename = SanitizePath(subAsset.name); + var dirName = Path.GetDirectoryName(t.assetPath) + "/Materials"; + if (!Directory.Exists(dirName)) + Directory.CreateDirectory(dirName); + var destinationPath = dirName + "/" + filename + ".mat"; + var assetPath = AssetDatabase.GetAssetPath(subAsset); + + var clone = Instantiate(subAsset); + AssetDatabase.CreateAsset(clone, destinationPath); + + var assetImporter = AssetImporter.GetAtPath(assetPath); + assetImporter.AddRemap(new AssetImporter.SourceAssetIdentifier(subAsset), clone); + + if (importImmediately) + { + AssetDatabase.WriteImportSettingsIfDirty(assetPath); + AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); + } + } + + const string key2 = nameof(GLTFImporterInspector) + "_RemapMaterials_List"; + var newVal2 = EditorGUILayout.BeginFoldoutHeaderGroup(SessionState.GetBool(key2, false), "Remap Materials (" + mats.arraySize + ")"); + SessionState.SetBool(key2, newVal2); + if (newVal2) + { + for (var i = 0; i < mats.arraySize; i++) + { + var mat = mats.GetArrayElementAtIndex(i).objectReferenceValue as Material; + if (!mat) continue; + var id = new AssetImporter.SourceAssetIdentifier(mat); + externalObjectMap.TryGetValue(id, out var remap); + EditorGUILayout.BeginHorizontal(); + // EditorGUILayout.ObjectField(/*mat.name,*/ mat, typeof(Material), false); + EditorGUI.BeginChangeCheck(); + var newObj = EditorGUILayout.ObjectField(mat.name, remap, typeof(Material), false); + if (EditorGUI.EndChangeCheck()) + { + if (newObj && newObj != mat) + t.AddRemap(id, newObj); + else + t.RemoveRemap(id); + } + + if (!remap) + { + if (GUILayout.Button("Extract", GUILayout.Width(60))) + { + ExtractMaterial(mat, true); + GUIUtility.ExitGUI(); + } + } + else + { + if (GUILayout.Button("Restore", GUILayout.Width(60))) + { + t.RemoveRemap(id); +#if UNITY_2022_2_OR_NEWER + SaveChanges(); +#else + ApplyAndImport(); +#endif + GUIUtility.ExitGUI(); + } + } + + EditorGUILayout.EndHorizontal(); + } + } + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(" "); + if (GUILayout.Button("Restore Materials")) + { + for (var i = 0; i < mats.arraySize; i++) + { + var mat = mats.GetArrayElementAtIndex(i).objectReferenceValue as Material; + if (!mat) continue; + t.RemoveRemap(new AssetImporter.SourceAssetIdentifier(mat)); + } + } + + if (GUILayout.Button("Extract Materials")) + { + for (var i = 0; i < mats.arraySize; i++) + { + AssetDatabase.StartAssetEditing(); + ExtractMaterial(mats.GetArrayElementAtIndex(i).objectReferenceValue as Material, false); + AssetDatabase.StopAssetEditing(); + var assetPath = AssetDatabase.GetAssetPath(target); + AssetDatabase.WriteImportSettingsIfDirty(assetPath); + AssetDatabase.Refresh(); + } + } + + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + } + + EditorGUILayout.EndFoldoutHeaderGroup(); + + EditorGUILayout.Separator(); + + var identifierProp = serializedObject.FindProperty(nameof(GLTFImporter._useSceneNameIdentifier)); + if (!identifierProp.boolValue) + { + EditorGUILayout.HelpBox("This asset uses the old main asset identifier. Upgrade to the new one if you want to seamlessly switch between glTFast and UnityGLTF on import.\nNOTE: This will break existing scene references.", MessageType.Info); + if (GUILayout.Button("Update Asset Identifier")) + { + identifierProp.boolValue = true; + serializedObject.ApplyModifiedProperties(); + try + { +#if UNITY_2022_2_OR_NEWER + SaveChanges(); +#else + ApplyAndImport(); +#endif + GUIUtility.ExitGUI(); + } + catch + { + // ignore - seems in some cases the GameObjectInspector will throw + } + } + } + // EditorGUILayout.PropertyField(serializedObject.FindProperty("_useJpgTextures"), new GUIContent("Use JPG Textures")); + + EditorGUILayout.Separator(); + + TextureWarningsGUI(t); + } + + private void ExtensionInspectorGUI() + { + var t = target as GLTFImporter; + if (!t) return; + + EditorGUI.BeginDisabledGroup(true); + var mainAssetIdentifierProp = serializedObject.FindProperty(nameof(GLTFImporter._mainAssetIdentifier)); + EditorGUILayout.PropertyField(mainAssetIdentifierProp); + + EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(GLTFImporter._extensions)), new GUIContent("Extensions")); + EditorGUI.EndDisabledGroup(); + } + + public static bool TextureImportSettingsAreCorrect(GLTFImporter importer) + { + return importer.Textures.All(x => + { + if (AssetDatabase.Contains(x.texture) && AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(x.texture)) is TextureImporter textureImporter) + { + return textureImporter.sRGBTexture == !x.shouldBeLinear; + } + return true; + }); + } + + public static void FixTextureImportSettings(GLTFImporter importer) + { + var haveStartedAssetEditing = false; + foreach (var x in importer.Textures) + { + if (!AssetDatabase.Contains(x.texture) || !(AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(x.texture)) is TextureImporter textureImporter)) continue; + + // skip if already correct + if (textureImporter.sRGBTexture == !x.shouldBeLinear) + continue; + + if (!haveStartedAssetEditing) + { + haveStartedAssetEditing = true; + AssetDatabase.StartAssetEditing(); + } + + textureImporter.sRGBTexture = !x.shouldBeLinear; + textureImporter.SaveAndReimport(); + } + + if (haveStartedAssetEditing) + AssetDatabase.StopAssetEditing(); + } + + private static string SanitizePath(string subAssetName) + { + // make filename safe without using Regex + var invalidChars = Path.GetInvalidFileNameChars(); + var sb = new StringBuilder(subAssetName); + for (int i = 0; i < sb.Length; i++) + { + if (invalidChars.Contains(sb[i])) + { + sb[i] = '_'; + } + } + return sb.ToString(); + } + } +} +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs.meta new file mode 100644 index 0000000..26605d4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 20d4d64afd8e74d39a8d8fad13d909fc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs new file mode 100644 index 0000000..31f4b9a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs @@ -0,0 +1,11 @@ +#if UNITY_2017_1_OR_NEWER +namespace UnityGLTF +{ + public enum GLTFImporterNormals + { + Import, + Calculate, + None + } +} +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs.meta new file mode 100644 index 0000000..1468a68 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/GLTFImporterNormals.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3961a7b54dd64330a1228d3aa9993c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal.meta new file mode 100644 index 0000000..b1b0477 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 043bcd2f8cd689d4298a4ff9f11d1056 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs new file mode 100644 index 0000000..d147a52 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs @@ -0,0 +1,219 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace UnityGLTF +{ + internal class AvatarUtils + { + // A static dictionary containing the mapping from joint/bones names in the model + // to the names Unity uses for them internally. + // In this case they match the naming from the included Mixamo model on the left + // and the Unity equivalent name on the right. + // This does not need to be hard-coded. + public static Dictionary HumanSkeletonNames = new Dictionary() + { + {"mixamorig:Spine1", "Chest"}, + {"mixamorig:Head", "Head" }, + {"mixamorig:Hips", "Hips" }, + {"mixamorig:LeftHandIndex3", "Left Index Distal" }, + {"mixamorig:LeftHandIndex2", "Left Index Intermediate" }, + {"mixamorig:LeftHandIndex1", "Left Index Proximal" }, + {"mixamorig:LeftHandPinky3", "Left Little Distal" }, + {"mixamorig:LeftHandPinky2", "Left Little Intermediate" }, + {"mixamorig:LeftHandPinky1", "Left Little Proximal" }, + {"mixamorig:LeftHandMiddle3", "Left Middle Distal" }, + {"mixamorig:LeftHandMiddle2", "Left Middle Intermediate" }, + {"mixamorig:LeftHandMiddle1", "Left Middle Proximal" }, + {"mixamorig:LeftHandRing3", "Left Ring Distal" }, + {"mixamorig:LeftHandRing2", "Left Ring Intermediate" }, + {"mixamorig:LeftHandRing1", "Left Ring Proximal" }, + {"mixamorig:LeftHandThumb3", "Left Thumb Distal" }, + {"mixamorig:LeftHandThumb2", "Left Thumb Intermediate" }, + {"mixamorig:LeftHandThumb1", "Left Thumb Proximal" }, + {"mixamorig:LeftFoot", "LeftFoot" }, + {"mixamorig:LeftHand", "LeftHand" }, + {"mixamorig:LeftForeArm", "LeftLowerArm" }, + {"mixamorig:LeftLeg", "LeftLowerLeg" }, + {"mixamorig:LeftShoulder", "LeftShoulder" }, + {"mixamorig:LeftToeBase", "LeftToes" }, + {"mixamorig:LeftArm", "LeftUpperArm" }, + {"mixamorig:LeftUpLeg", "LeftUpperLeg" }, + {"mixamorig:Neck", "Neck" }, + {"mixamorig:RightHandIndex3", "Right Index Distal" }, + {"mixamorig:RightHandIndex2", "Right Index Intermediate" }, + {"mixamorig:RightHandIndex1", "Right Index Proximal" }, + {"mixamorig:RightHandPinky3", "Right Little Distal" }, + {"mixamorig:RightHandPinky2", "Right Little Intermediate" }, + {"mixamorig:RightHandPinky1", "Right Little Proximal" }, + {"mixamorig:RightHandMiddle3", "Right Middle Distal" }, + {"mixamorig:RightHandMiddle2", "Right Middle Intermediate" }, + {"mixamorig:RightHandMiddle1", "Right Middle Proximal" }, + {"mixamorig:RightHandRing3", "Right Ring Distal" }, + {"mixamorig:RightHandRing2", "Right Ring Intermediate" }, + {"mixamorig:RightHandRing1", "Right Ring Proximal" }, + {"mixamorig:RightHandThumb3", "Right Thumb Distal" }, + {"mixamorig:RightHandThumb2", "Right Thumb Intermediate" }, + {"mixamorig:RightHandThumb1", "Right Thumb Proximal" }, + {"mixamorig:RightFoot", "RightFoot" }, + {"mixamorig:RightHand", "RightHand" }, + {"mixamorig:RightForeArm", "RightLowerArm" }, + {"mixamorig:RightLeg", "RightLowerLeg" }, + {"mixamorig:RightShoulder", "RightShoulder" }, + {"mixamorig:RightToeBase", "RightToes" }, + {"mixamorig:RightArm", "RightUpperArm" }, + {"mixamorig:RightUpLeg", "RightUpperLeg" }, + {"mixamorig:Spine", "Spine" }, + {"mixamorig:Spine2", "UpperChest" }, + + // Other common Avatar formats can also be added here + // { "root", "" }, + { "hips", "Hips" }, + { "spine", "Spine" }, + { "chest", "Chest" }, + { "upperChest", "UpperChest" }, + { "neck", "Neck" }, + { "head", "Head" }, + { "leftEye", "LeftEye" }, + // { "eyeL_end", "" }, + { "rightEye", "RightEye" }, + // { "eyeR_end", "" }, + { "leftShoulder", "LeftShoulder" }, + { "leftUpperArm", "LeftUpperArm" }, + { "leftLowerArm", "LeftLowerArm" }, + { "leftHand", "LeftHand" }, + // { "leftThumbMetacarpal", "" }, + // { "leftThumbProximal", "" }, + // { "leftThumbDistal", "" }, + // { "thumbdistalL_end", "" }, + // { "leftIndexProximal", "" }, + // { "leftIndexIntermediate", "" }, + // { "leftIndexDistal", "" }, + // { "indexdistalL_end", "" }, + // { "leftMiddleProximal", "" }, + // { "leftMiddleIntermediate", "" }, + // { "leftMiddleDistal", "" }, + // { "middledistalL_end", "" }, + // { "leftRingProximal", "" }, + // { "leftRingIntermediate", "" }, + // { "leftRingDistal", "" }, + // { "ringdistalL_end", "" }, + // { "leftLittleProximal", "" }, + // { "leftLittleIntermediate", "" }, + // { "leftLittleDistal", "" }, + // { "littledistalL_end", "" }, + { "rightShoulder", "RightShoulder" }, + { "rightUpperArm", "RightUpperArm" }, + { "rightLowerArm", "RightLowerArm" }, + { "rightHand", "RightHand" }, + // { "rightThumbMetacarpal", "" }, + // { "rightThumbProximal", "" }, + // { "rightThumbDistal", "" }, + // { "thumbdistalR_end", "" }, + // { "rightIndexProximal", "" }, + // { "rightIndexIntermediate", "" }, + // { "rightIndexDistal", "" }, + // { "indexdistalR_end", "" }, + // { "rightMiddleProximal", "" }, + // { "rightMiddleIntermediate", "" }, + // { "rightMiddleDistal", "" }, + // { "middledistalR_end", "" }, + // { "rightRingProximal", "" }, + // { "rightRingIntermediate", "" }, + // { "rightRingDistal", "" }, + // { "ringdistalR_end", "" }, + // { "rightLittleProximal", "" }, + // { "rightLittleIntermediate", "" }, + // { "rightLittleDistal", "" }, + // { "littledistalR_end", "" }, + { "leftUpperLeg", "LeftUpperLeg" }, + { "leftLowerLeg", "LeftLowerLeg" }, + { "leftFoot", "LeftFoot" }, + { "leftToes", "LeftToes" }, + // { "toesL_end", "" }, + { "rightUpperLeg", "RightUpperLeg" }, + { "rightLowerLeg", "RightLowerLeg" }, + { "rightFoot", "RightFoot" }, + { "rightToes", "RightToes" }, + // { "toesR_end", "" }, + + }; + + /// + /// Create a HumanDescription out of an avatar GameObject. + /// The HumanDescription is what is needed to create an Avatar object + /// using the AvatarBuilder API. This function takes care of + /// creating the HumanDescription by going through the avatar's + /// hierarchy, defining its T-Pose in the skeleton, and defining + /// the transform/bone mapping in the HumanBone array. + /// + /// Root of your avatar object + /// A HumanDescription which can be fed to the AvatarBuilder API + public static HumanDescription CreateHumanDescription(GameObject avatarRoot) + { + HumanDescription description = new HumanDescription() + { + armStretch = 0.05f, + feetSpacing = 0f, + hasTranslationDoF = false, + legStretch = 0.05f, + lowerArmTwist = 0.5f, + lowerLegTwist = 0.5f, + upperArmTwist = 0.5f, + upperLegTwist = 0.5f, + skeleton = CreateSkeleton(avatarRoot), + human = CreateHuman(avatarRoot), + }; + return description; + } + + //Create a SkeletonBone array out of an Avatar GameObject + //This assumes that the Avatar as supplied is in a T-Pose + //The local positions of its bones/joints are used to define this T-Pose + private static SkeletonBone[] CreateSkeleton(GameObject avatarRoot) + { + List skeleton = new List(); + + Transform[] avatarTransforms = avatarRoot.GetComponentsInChildren(); + foreach (Transform avatarTransform in avatarTransforms) + { + SkeletonBone bone = new SkeletonBone() + { + name = avatarTransform.name, + position = avatarTransform.localPosition, + rotation = avatarTransform.localRotation, + scale = avatarTransform.localScale + }; + + skeleton.Add(bone); + } + return skeleton.ToArray(); + } + + //Create a HumanBone array out of an Avatar GameObject + //This is where the various bones/joints get associated with the + //joint names that Unity understands. This is done using the + //static dictionary defined at the top. + private static HumanBone[] CreateHuman(GameObject avatarRoot) + { + List human = new List(); + + Transform[] avatarTransforms = avatarRoot.GetComponentsInChildren(); + foreach (Transform avatarTransform in avatarTransforms) + { + if (HumanSkeletonNames.TryGetValue(avatarTransform.name, out string humanName)) + { + HumanBone bone = new HumanBone + { + boneName = avatarTransform.name, + humanName = humanName, + limit = new HumanLimit() + }; + bone.limit.useDefaultValues = true; + + human.Add(bone); + } + } + return human.ToArray(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs.meta new file mode 100644 index 0000000..fcaf104 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/AvatarUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15daddec8a84e584db94b127e7bd05b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs new file mode 100644 index 0000000..cfd6e9a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs @@ -0,0 +1,271 @@ +#if !NO_INTERNALS_ACCESS + +using System.Linq; +using System.Text; +using UnityEngine; + +#if UNITY_EDITOR +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEditorInternal; +#endif + +namespace UnityGLTF +{ + public static class GLTFMaterialHelper + { + /// + /// Return false if other delegates should take over. Only return true if you did work and assigned material.shader = newShader. + /// + public delegate bool ConvertMaterialToGLTFDelegate(Material material, Shader oldShader, Shader newShader); + private static event ConvertMaterialToGLTFDelegate ConvertMaterialDelegates; + + public static void RegisterMaterialConversionToGLTF(ConvertMaterialToGLTFDelegate converter) => ConvertMaterialDelegates += converter; + public static void UnregisterMaterialConversionToGLTF(ConvertMaterialToGLTFDelegate converter) => ConvertMaterialDelegates -= converter; + + public static void ConvertMaterialToGLTF(Material material, Shader oldShader, Shader newShader) + { + if (ConvertMaterialDelegates != null) + { + var list = ConvertMaterialDelegates.GetInvocationList(); + foreach (var entry in list) + { + var cb = (ConvertMaterialToGLTFDelegate) entry; + if (cb != null && cb.Invoke(material, oldShader, newShader)) + { + return; + } + } + } + + // IDEA ideally this would use the same code path as material export/import - would reduce the amount of code duplication considerably. + // E.g. calling something like + // var glTFMaterial = ExportMaterial(material); + // ImportAndOverrideMaterial(material, glTFMaterial); + // that uses all the same heuristics, texture conversions, ... + + var msg = "No automatic conversion\nfrom " + oldShader.name + "\nto " + newShader.name + "\nfound.\n\nYou can create a conversion script, adjust which old properties map to which new properties, and switch the shader again."; + +#if UNITY_EDITOR + var choice = EditorUtility.DisplayDialogComplex("Shader Conversion", msg, "Just set shader", "Cancel", "Create and open conversion script"); + switch (choice) + { + case 0: // OK + material.shader = newShader; + break; + case 1: // Cancel + break; + case 2: // Alt + var path = ShaderConversion.CreateConversionScript(oldShader, newShader); + InternalEditorUtility.OpenFileAtLineExternal(path, 0); + break; + } +#else + Debug.Log(msg + " Make sure your material properties match the new shader. You can add your own conversion callbacks via `RegisterMaterialConversionToGLTF`. If you think this should have been converted automatically: please open a feature request!"); + material.shader = newShader; +#endif + } + + public static void ValidateMaterialKeywords(Material material) + { + // TODO ensure we're setting correct keywords for + // - existence of a normal map + // - existence of emission color values or texture + // - + + // var needsVolumeTransmission = false; + // needsVolumeTransmission |= material.HasProperty(thicknessFactor) && material.GetFloat(thicknessFactor) > 0; + // needsVolumeTransmission |= material.HasProperty(transmissionFactor) && material.GetFloat(transmissionFactor) > 0; + // material.SetKeyword("_VOLUME_TRANSMISSION", needsVolumeTransmission); + // + // var needsIridescence = material.HasProperty(iridescenceFactor) && material.GetFloat(iridescenceFactor) > 0; + // material.SetKeyword("_IRIDESCENCE", needsIridescence); + // + // var needsSpecular = material.HasProperty(specularFactor) && material.GetFloat(specularFactor) > 0; + // material.SetKeyword("_SPECULAR", needsSpecular); + + if (material.IsKeywordEnabled("_VOLUME_TRANSMISSION_ON")) + { + // // approximation when transmission is on but roughness == 0 + // // (no opaque pass required) + // TODO does weird things with transparency but still rendering into the Opaque Texture for some reason + // if (material.HasProperty("roughnessFactor") && material.GetFloat("roughnessFactor") == 0) + // { + // // enforce transparent + // if (material.HasProperty("_QueueControl")) material.SetFloat("_QueueControl", 0); + // if (material.HasProperty("_BUILTIN_QueueControl")) material.SetFloat("_BUILTIN_QueueControl", 0); + // if (material.HasProperty("_BUILTIN_Surface")) material.SetFloat("_BUILTIN_Surface", 1); + // if (material.HasProperty("_Surface")) material.SetFloat("_Surface", 1); + // material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); + // material.EnableKeyword("_BUILTIN_SURFACE_TYPE_TRANSPARENT"); + // material.renderQueue = -1; + // } + // else + { + // enforce Opaque + if (material.HasProperty("_BUILTIN_Surface")) material.SetFloat("_BUILTIN_Surface", 0); + if (material.HasProperty("_Surface")) material.SetFloat("_Surface", 0); + material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT"); + material.DisableKeyword("_BUILTIN_SURFACE_TYPE_TRANSPARENT"); + + // enforce queue control and render queue 3000 + if (material.HasProperty("_QueueControl")) material.SetFloat("_QueueControl", 1); + if (material.HasProperty("_BUILTIN_QueueControl")) material.SetFloat("_BUILTIN_QueueControl", 1); + + // not a great choice: using 2999 as magic value for "we automatically set the queue for you" + // so the change can be reverted if someone toggles transmission on and then off again. + material.renderQueue = 2999; + } + } + else + { + if (material.renderQueue == 2999) + { + if (material.HasProperty("_QueueControl")) material.SetFloat("_QueueControl", 0); + if (material.HasProperty("_BUILTIN_QueueControl")) material.SetFloat("_BUILTIN_QueueControl", 0); + material.renderQueue = -1; + } + } + + if (material.HasProperty("emissiveFactor")) + material.globalIlluminationFlags = MaterialEditor.FixupEmissiveFlag(material.GetColor("emissiveFactor"), material.globalIlluminationFlags); + + if (!material.IsKeywordEnabled("_TEXTURE_TRANSFORM_ON")) + { + if (material.GetTextureScale("baseColorTexture") != Vector2.one || material.GetTextureOffset("baseColorTexture") != Vector2.zero) + { + SetKeyword(material, "_TEXTURE_TRANSFORM", true); + } + } + } + + public static void SetKeyword(Material material, string keyword, bool state) + { + if (state) + material.EnableKeyword(keyword + "_ON"); + else + material.DisableKeyword(keyword + "_ON"); + + if (material.HasProperty(keyword)) + material.SetFloat(keyword, state ? 1 : 0); + } + } + +#if UNITY_EDITOR + internal static class ShaderConversion + { + public static string CreateConversionScript(Shader oldShader, Shader newShader) + { + var classShaderName = oldShader.name + .Replace("/", "_") + .Replace(" ", "_") + .Replace("\\", "_"); + + var scriptFile = ShaderConversionScriptTemplate; + scriptFile = scriptFile.Replace("", classShaderName); + scriptFile = scriptFile.Replace("", oldShader.name); + + var sb = new StringBuilder(); + foreach(var (propName, propDisplayName, type) in GetShaderProperties(oldShader)) + { + sb.AppendLine($"\t\tvar {propName} = material.{MethodFromType("Get", type)}(\"{propName}\"); // {propDisplayName}"); + } + + var sb2 = new StringBuilder(); + foreach(var (propName, propDisplayName, type) in GetShaderProperties(newShader)) + { + sb2.AppendLine($"\t\t// material.{MethodFromType("Set", type)}(\"{propName}\", insert_value_here); // {propDisplayName}"); + } + + scriptFile = scriptFile.Replace("\t\t", sb.ToString()); + scriptFile = scriptFile.Replace("\t\t", sb2.ToString()); + + const string dir = "Assets/Editor/ShaderConversions"; + Directory.CreateDirectory(dir); + var fileName = dir + "/" + classShaderName + ".cs"; + if (!File.Exists(fileName) || EditorUtility.DisplayDialog("File already exists", $"The file \"{fileName}\" already exists. Replace?", "Replace", "Cancel")) + File.WriteAllText(fileName, scriptFile); + + AssetDatabase.Refresh(); + + return fileName; + } + + private static IEnumerable<(string propName, string propDisplayName, ShaderUtil.ShaderPropertyType type)> GetShaderProperties(Shader shader) + { + var c = ShaderUtil.GetPropertyCount(shader); + for (var i = 0; i < c; i++) + { + if (ShaderUtil.IsShaderPropertyHidden(shader, i)) continue; + if (ShaderUtil.IsShaderPropertyNonModifiableTexureProperty(shader, i)) continue; + + var propName = ShaderUtil.GetPropertyName(shader, i); + if(propName.StartsWith("unity_")) continue; + + var propDisplayName = ShaderUtil.GetPropertyDescription(shader, i); + var type = ShaderUtil.GetPropertyType(shader, i); + yield return (propName, propDisplayName, type); + } + } + + private static string MethodFromType(string prefix, ShaderUtil.ShaderPropertyType propertyType) + { + switch (propertyType) + { + case ShaderUtil.ShaderPropertyType.Color: return prefix + "Color"; + case ShaderUtil.ShaderPropertyType.Float: return prefix + "Float"; +#if UNITY_2021_1_OR_NEWER + case ShaderUtil.ShaderPropertyType.Int: return prefix + "Int"; +#endif + case ShaderUtil.ShaderPropertyType.Range: return prefix + "Float"; + case ShaderUtil.ShaderPropertyType.Vector: return prefix + "Vector"; + case ShaderUtil.ShaderPropertyType.TexEnv: return prefix + "Texture"; + } + + return prefix + "UnknownPropertyType"; // compiler error + } + + private const string ShaderConversionScriptTemplate = +@"using UnityEditor; +using UnityEngine; +using UnityGLTF; + +class Convert__to_GLTF +{ + const string shaderName = """"; + + [InitializeOnLoadMethod] + private static void Register() + { + GLTFMaterialHelper.RegisterMaterialConversionToGLTF(ConvertMaterialProperties); + } + + private static bool ConvertMaterialProperties(Material material, Shader oldShader, Shader newShader) + { + if (oldShader.name != shaderName) return false; + + // Reading old shader properties. + + + material.shader = newShader; + + // Assigning new shader properties. + // Uncomment lines you need, and set properties from values from the section above. + + + + // Ensure keywords are correctly set after conversion. + // Example: + // if (material.GetFloat(""_VERTEX_COLORS"") > 0.5f) material.EnableKeyword(""_VERTEX_COLORS_ON""); + + ShaderGraphHelpers.ValidateMaterialKeywords(material); + return true; + } +} +"; + } +#endif +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs.meta new file mode 100644 index 0000000..38df10a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/GLTFMaterialHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad1a4409c80a9004781468cca77d6224 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs new file mode 100644 index 0000000..5219881 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs @@ -0,0 +1,102 @@ +using System; +using System.Reflection; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace UnityGLTF +{ + internal static class HumanoidSetup + { + private static MethodInfo _SetupHumanSkeleton; + + internal static Avatar AddAvatarToGameObject(GameObject gameObject) + { + HumanDescription description = AvatarUtils.CreateHumanDescription(gameObject); + var bones = description.human; + SetupHumanSkeleton(gameObject, ref bones, out var skeletonBones, out var hasTranslationDoF); + description.human = bones; + description.skeleton = skeletonBones; + description.hasTranslationDoF = hasTranslationDoF; + + Avatar avatar = AvatarBuilder.BuildHumanAvatar(gameObject, description); + avatar.name = "Avatar"; + + if (!avatar.isValid) + { + Object.DestroyImmediate(avatar); + return null; + } + + var animator = gameObject.GetComponent(); + if (animator) animator.avatar = avatar; + return avatar; + } + + private static void SetupHumanSkeleton( + GameObject modelPrefab, + ref HumanBone[] humanBoneMappingArray, + out SkeletonBone[] skeletonBones, + out bool hasTranslationDoF) + { + _SetupHumanSkeleton = typeof(AvatarSetupTool).GetMethod(nameof(SetupHumanSkeleton), (BindingFlags)(-1)); + skeletonBones = Array.Empty(); + hasTranslationDoF = false; + + _SetupHumanSkeleton?.Invoke(null, new object[] + { + modelPrefab, + humanBoneMappingArray, + skeletonBones, + hasTranslationDoF + }); + } + + + // AvatarSetupTools + // AvatarBuilder.BuildHumanAvatar + // AvatarConfigurationStage.CreateStage + // AssetImporterTabbedEditor + // ModelImporterRigEditor + +#if TESTING + [MenuItem("Tools/Copy Hierarchy Array")] + static void _Copy(MenuCommand command) + { + var gameObject = Selection.activeGameObject; + var sb = new System.Text.StringBuilder(); + + void Traverse(Transform tr) + { + sb.AppendLine(tr.name); + foreach (Transform child in tr) + { + Traverse(child); + } + } + + Traverse(gameObject.transform); + EditorGUIUtility.systemCopyBuffer = sb.ToString(); + } + + [MenuItem("Tools/Setup Humanoid")] + static void _Do(MenuCommand command) + { + var gameObject = Selection.activeGameObject; + // SetupHumanSkeleton(go, ref humanBoneMappingArray, out var skeletonBones, out var hasTranslationDoF); + AddAvatarToGameObject(gameObject); + } + + [MenuItem("Tools/Open Avatar Editor")] + static void _OpenEditor(MenuCommand command) + { + var gameObject = Selection.activeGameObject; + var avatar = gameObject.GetComponent().avatar; + var e = (AvatarEditor) Editor.CreateEditor(avatar, typeof(AvatarEditor)); + e.m_CameFromImportSettings = true; + Selection.activeObject = e; + e.SwitchToEditMode(); + } +#endif + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs.meta new file mode 100644 index 0000000..e97453b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/HumanoidSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 977986ddaa6e7594c81ccb48155a39a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref new file mode 100644 index 0000000..34419fe --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref @@ -0,0 +1,3 @@ +{ + "reference": "GUID:343deaaf83e0cee4ca978e7df0b80d21" +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref.meta new file mode 100644 index 0000000..c52f022 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTF.Internal.asmref.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9c9262dcd4069cd4aafbfe7eabf0bf41 +AssemblyDefinitionReferenceImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs new file mode 100644 index 0000000..29548ec --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using UnityEditor; +using UnityEditor.AssetImporters; +using UnityEngine; + +[assembly: InternalsVisibleTo("UnityGLTFEditor")] + +namespace UnityGLTF +{ + internal class UnityGLTFTabbedEditor : AssetImporterTabbedEditor + { + private readonly List _tabs = new List(); + + protected void AddTab(GltfAssetImporterTab tab) + { + if (!_tabs.Contains(tab)) _tabs.Add(tab); + tabs = _tabs.Select(x => (BaseAssetImporterTabUI) x).ToArray(); + m_TabNames = _tabs.Select(t => t.Label).ToArray(); + } + + public GltfAssetImporterTab GetTab(int index) + { + if (_tabs == null || _tabs.Count < 1) return null; + if (index < 0) index = 0; + if (index >= _tabs.Count) index = _tabs.Count - 1; + return _tabs[index]; + } + + public override void OnEnable() => base.OnEnable(); + } + + internal class GltfAssetImporterTab : BaseAssetImporterTabUI + { + internal readonly string Label; + private readonly Action _tabGui; + + public GltfAssetImporterTab(AssetImporterEditor panelContainer, string label, Action tabGui) : base(panelContainer) + { + this.Label = label; + this._tabGui = tabGui; + } + + internal override void OnEnable() { } + public override void OnInspectorGUI() => _tabGui?.Invoke(); + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs.meta new file mode 100644 index 0000000..3e2d81d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGLTFTabbedEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 198f536c3cf84dfe9d5617d32d40d7b0 +timeCreated: 1678788492 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs new file mode 100644 index 0000000..6b4d46c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public interface IUnityGltfShaderUpgradeMeta + { + Shader SourceShader { get; } + bool IsUnlit { get; } + bool IsTransparent { get; } + bool IsDoublesided { get; } + } + + public class UnityGltfShaderUpgradeMeta : ScriptableObject + { + public Shader sourceShader; + public bool isTransparent = false; + public bool isDoublesided = false; + + internal string GenerateNameString() + { + var isUnlit = sourceShader && sourceShader.name.Contains("Unlit"); + return (isTransparent ? "_tr" : "") + (isDoublesided ? "_ds" : "") + (isUnlit ? "_unlit" : ""); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs.meta new file mode 100644 index 0000000..d986ced --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/Internal/UnityGltfShaderUpgradeMeta.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 26fa35d7d798408bb796a50daa5a8a6f +timeCreated: 1677690411 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/InternalUI.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/InternalUI.meta new file mode 100644 index 0000000..6509002 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/InternalUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa6ac3fcfd75d5c469e07cedac8f2f57 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs new file mode 100644 index 0000000..117109f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs @@ -0,0 +1,278 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +using System; +using UnityEngine; + +namespace UnityEditor +{ + internal class PbrShaderGUI : ShaderGUI + { + private enum WorkflowMode + { + SpecularGlossiness, + MetallicRoughness, + Unlit + } + + public enum BlendMode + { + Opaque, + Mask, + Blend + } + + private static class Styles + { + public static GUIContent albedoText = new GUIContent("Base Color", "Albedo (RGB) and Transparency (A)"); + public static GUIContent vertexColorText = new GUIContent("Apply Vertex Colors", "Process vertex colors"); + public static GUIContent alphaCutoffText = new GUIContent("Alpha Cutoff", "Threshold for alpha cutoff"); + public static GUIContent specularMapText = new GUIContent("Spec Gloss", "Specular (RGB) and Glossiness (A)"); + public static GUIContent metallicMapText = new GUIContent("Metal Rough", "Metallic (B) and Roughness (G)"); + public static GUIContent metallicText = new GUIContent("Metallic", "Metallic value"); + public static GUIContent metallicScaleText = new GUIContent("Metallic", "Metallic scale factor"); + public static GUIContent roughnessText = new GUIContent("Roughness", "Roughness value"); + + public static GUIContent roughnessScaleText = new GUIContent("Roughness", "Roughness scale factor"); + public static GUIContent glossinessText = new GUIContent("Glossiness", "Glossiness value"); + public static GUIContent glossinessScaleText = new GUIContent("Glossiness", "Glossiness scale factor"); + public static GUIContent normalMapText = new GUIContent("Normal Map", "Normal Map"); + public static GUIContent occlusionText = new GUIContent("Occlusion", "Occlusion (R)"); + public static GUIContent emissionText = new GUIContent("Emissive", "Emissive (RGB)"); + + public static string primaryMapsText = "Main Maps"; + public static string renderingMode = "Rendering Mode"; + public static GUIContent emissiveWarning = new GUIContent("Emissive value is animated but the material has not been configured to support emissive. Please make sure the material itself has some amount of emissive."); + public static readonly string[] blendNames = Enum.GetNames(typeof(BlendMode)); + } + + MaterialProperty blendMode = null; + MaterialProperty albedoMap = null; + MaterialProperty albedoColor = null; + MaterialProperty vertexColors = null; + MaterialProperty alphaCutoff = null; + MaterialProperty specularMap = null; + MaterialProperty specularColor = null; + MaterialProperty metallicMap = null; + MaterialProperty metallic = null; + MaterialProperty smoothness = null; + MaterialProperty bumpScale = null; + MaterialProperty bumpMap = null; + MaterialProperty occlusionStrength = null; + MaterialProperty occlusionMap = null; + MaterialProperty emissionColor = null; + MaterialProperty emissionMap = null; + + MaterialEditor m_MaterialEditor; + WorkflowMode m_WorkflowMode = WorkflowMode.MetallicRoughness; + + bool m_FirstTimeApply = true; + + public void FindProperties(MaterialProperty[] props) + { + blendMode = FindProperty("_Mode", props); + albedoMap = FindProperty("_MainTex", props); + albedoColor = FindProperty("_Color", props); + vertexColors = FindProperty("_VertexColors", props); + alphaCutoff = FindProperty("_Cutoff", props); + specularMap = FindProperty("_SpecGlossMap", props, false); + specularColor = FindProperty("_SpecColor", props, false); + metallicMap = FindProperty("_MetallicGlossMap", props, false); + metallic = FindProperty("_Metallic", props, false); + if (specularMap != null && specularColor != null) + m_WorkflowMode = WorkflowMode.SpecularGlossiness; + else if (metallicMap != null && metallic != null) + m_WorkflowMode = WorkflowMode.MetallicRoughness; + else + m_WorkflowMode = WorkflowMode.Unlit; + smoothness = FindProperty("_Glossiness", props); + bumpScale = FindProperty("_BumpScale", props); + bumpMap = FindProperty("_BumpMap", props); + occlusionStrength = FindProperty("_OcclusionStrength", props); + occlusionMap = FindProperty("_OcclusionMap", props); + emissionColor = FindProperty("_EmissionColor", props); + emissionMap = FindProperty("_EmissionMap", props); + } + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) + { + FindProperties(props); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly + m_MaterialEditor = materialEditor; + Material material = materialEditor.target as Material; + + // Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing + // material to a standard shader. + // Do this before any GUI code has been issued to prevent layout issues in subsequent GUILayout statements (case 780071) + if (m_FirstTimeApply) + { + MaterialChanged(material, m_WorkflowMode); + m_FirstTimeApply = false; + } + + ShaderPropertiesGUI(material); + } + + public void ShaderPropertiesGUI(Material material) + { + // Use default labelWidth + EditorGUIUtility.labelWidth = 0f; + + // Detect any changes to the material + EditorGUI.BeginChangeCheck(); + { + BlendModePopup(); + + // Primary properties + GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel); + DoAlbedoArea(material); + DoSpecularMetallicArea(); + m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null); + m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null); + DoEmissionArea(material); + + EditorGUILayout.Space(); + } + if (EditorGUI.EndChangeCheck()) + { + foreach (var obj in blendMode.targets) + MaterialChanged((Material)obj, m_WorkflowMode); + } + } + + internal void DetermineWorkflow(MaterialProperty[] props) + { + if (FindProperty("_SpecGlossMap", props, false) != null && FindProperty("_SpecColor", props, false) != null) + m_WorkflowMode = WorkflowMode.SpecularGlossiness; + else if (FindProperty("_MetallicGlossMap", props, false) != null && FindProperty("_Metallic", props, false) != null) + m_WorkflowMode = WorkflowMode.MetallicRoughness; + else + m_WorkflowMode = WorkflowMode.Unlit; + } + + void BlendModePopup() + { + EditorGUI.showMixedValue = blendMode.hasMixedValue; + var mode = (BlendMode)blendMode.floatValue; + + EditorGUI.BeginChangeCheck(); + mode = (BlendMode)EditorGUILayout.Popup(Styles.renderingMode, (int)mode, Styles.blendNames); + if (EditorGUI.EndChangeCheck()) + { + m_MaterialEditor.RegisterPropertyChangeUndo("Rendering Mode"); + blendMode.floatValue = (float)mode; + } + + EditorGUI.showMixedValue = false; + } + + void DoAlbedoArea(Material material) + { + m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoColor); + m_MaterialEditor.ShaderProperty(vertexColors, Styles.vertexColorText, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); + + if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Mask)) + { + m_MaterialEditor.ShaderProperty(alphaCutoff, Styles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1); + } + } + + void DoEmissionArea(Material material) + { + bool hadEmissionTexture = emissionMap.textureValue != null; + + // Texture and HDR color controls + m_MaterialEditor.TexturePropertySingleLine(Styles.emissionText, emissionMap, emissionColor); + + // If texture was assigned and color was black set color to white + float brightness = emissionColor.colorValue.maxColorComponent; + if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f) + emissionColor.colorValue = Color.white; + } + + void DoSpecularMetallicArea() + { + bool hasGlossMap = false; + if (m_WorkflowMode == WorkflowMode.SpecularGlossiness) + { + hasGlossMap = specularMap.textureValue != null; + m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap, hasGlossMap ? null : specularColor); + m_MaterialEditor.ShaderProperty(smoothness, hasGlossMap ? Styles.glossinessScaleText : Styles.glossinessText, 2); + } + else if (m_WorkflowMode == WorkflowMode.MetallicRoughness) + { + hasGlossMap = metallicMap.textureValue != null; + m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap); + m_MaterialEditor.ShaderProperty(metallic, hasGlossMap ? Styles.metallicScaleText : Styles.metallicText, 2); + m_MaterialEditor.ShaderProperty(smoothness, hasGlossMap ? Styles.roughnessScaleText : Styles.roughnessText, 2); + } + } + + public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode, float alphaCutoff) + { + switch (blendMode) + { + case BlendMode.Opaque: + material.SetOverrideTag("RenderType", "Opaque"); + material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); + material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); + material.SetInt("_ZWrite", 1); + material.DisableKeyword("_ALPHATEST_ON"); + material.DisableKeyword("_ALPHABLEND_ON"); + material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Geometry; + break; + case BlendMode.Mask: + material.SetOverrideTag("RenderType", "TransparentCutout"); + material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); + material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); + material.SetInt("_ZWrite", 1); + material.EnableKeyword("_ALPHATEST_ON"); + material.DisableKeyword("_ALPHABLEND_ON"); + material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest; + material.SetFloat("_Cutoff", alphaCutoff); + break; + case BlendMode.Blend: + material.SetOverrideTag("RenderType", "Transparent"); + material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha); + material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); + material.SetInt("_ZWrite", 0); + material.DisableKeyword("_ALPHATEST_ON"); + material.EnableKeyword("_ALPHABLEND_ON"); + material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent; + break; + } + + material.SetFloat("_Mode", (float)blendMode); + } + + static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) + { + // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation + // (MaterialProperty value might come from renderer material property block) + SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap")); + if (workflowMode == WorkflowMode.SpecularGlossiness) + SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); + else if (workflowMode == WorkflowMode.MetallicRoughness) + SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); + + bool shouldEmissionBeEnabled = material.GetColor("_EmissionColor") != Color.black; + SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); + } + + static void MaterialChanged(Material material, WorkflowMode workflowMode) + { + SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode"), material.GetFloat("_Cutoff")); + + SetMaterialKeywords(material, workflowMode); + } + + static void SetKeyword(Material m, string keyword, bool state) + { + if (state) + m.EnableKeyword(keyword); + else + m.DisableKeyword(keyword); + } + } +} // namespace UnityEditor diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs.meta new file mode 100644 index 0000000..33c4d9a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc50aae8534b8c442a9e309b546db682 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph.meta new file mode 100644 index 0000000..337c70c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4f9d8791ed9e9674d871b47bf1c186ea +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph.meta new file mode 100644 index 0000000..1bf69ad --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f708e30d7503fc42998ad4dc358d3d5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs new file mode 100644 index 0000000..b77650e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs @@ -0,0 +1,496 @@ +#if !NO_INTERNALS_ACCESS +#if UNITY_2021_3_OR_NEWER +#define HAVE_BUILTIN_SHADERGRAPH +#define HAVE_CATEGORIES +#endif + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +#if HAVE_BUILTIN_SHADERGRAPH +using UnityEditor.Rendering; +using UnityEditor.Rendering.BuiltIn.ShaderGraph; +#endif +using UnityEngine; +using UnityEngine.Rendering; + +namespace UnityGLTF +{ + public class PBRGraphGUI : +#if HAVE_BUILTIN_SHADERGRAPH + BuiltInBaseShaderGUI +#else + ShaderGUI +#endif + { +#if UNITY_2021_1_OR_NEWER + public override void ValidateMaterial(Material material) + { + base.ValidateMaterial(material); + GLTFMaterialHelper.ValidateMaterialKeywords(material); + } +#endif + + protected MaterialEditor materialEditor; + protected MaterialProperty[] properties; + private MaterialInfo currentMaterialInfo; + +#if HAVE_CATEGORIES + private readonly MaterialHeaderScopeList m_MaterialScopeList = new MaterialHeaderScopeList(uint.MaxValue & ~(uint)Expandable.Advanced); + private const int ExpandableMeshProperties = 1 << 8; + private static readonly GUIContent MeshProperties = new GUIContent("Mesh Properties"); + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + this.materialEditor = materialEditor; + this.properties = properties; + + Material targetMat = materialEditor.target as Material; + if (!targetMat || !targetMat.shader) return; + + if (m_FirstTimeApply) + { + OnOpenGUI(targetMat, materialEditor, properties); + m_FirstTimeApply = false; + } + + // need to set these via reflection... + // m_MaterialEditor = materialEditor; + // m_Properties = properties; + if (m_MaterialEditor == null) m_MaterialEditor = typeof(BuiltInBaseShaderGUI).GetField(nameof(m_MaterialEditor), BindingFlags.Instance | BindingFlags.NonPublic); + if (m_Properties == null) m_Properties = typeof(BuiltInBaseShaderGUI).GetField(nameof(m_Properties), BindingFlags.Instance | BindingFlags.NonPublic); + m_MaterialEditor.SetValue(this, materialEditor); + m_Properties.SetValue(this, properties); + + var fullPath = System.IO.Path.GetFullPath(AssetDatabase.GetAssetPath(targetMat)); + var isMutable = !fullPath.Contains("Library/PackageCache") && !fullPath.Contains("Library\\PackageCache"); + if (targetMat && targetMat.shader.name.StartsWith("Hidden/UnityGLTF")) + { + if (isMutable) + { + DrawFixMeBox("This is a legacy shader. Please click \"Fix\" to upgrade to PBRGraph/UnlitGraph.", MessageType.Warning, () => + { + var isUnlit = targetMat.shader.name.Contains("Unlit"); + var newShaderGuid = isUnlit ? "59541e6caf586ca4f96ccf48a4813a51" : "478ce3626be7a5f4ea58d6b13f05a2e4"; + var newShader = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(newShaderGuid)); + Undo.RegisterCompleteObjectUndo(targetMat, "Convert to UnityGltf shader"); + GLTFMaterialHelper.ConvertMaterialToGLTF(targetMat, targetMat.shader, newShader); + }); + } + else + { + DrawFixMeBox("This is a legacy shader. Upgrade to PBRGraph/UnlitGraph for more options.", MessageType.Warning, null); + } + } + + m_MaterialScopeList.DrawHeaders(materialEditor, targetMat); + } + + private FieldInfo m_MaterialEditor; + private FieldInfo m_Properties; + + public override void OnOpenGUI(Material material, MaterialEditor materialEditor, MaterialProperty[] properties) + { + m_MaterialScopeList.RegisterHeaderScope(Styles.SurfaceOptions, (uint)Expandable.SurfaceOptions, DrawSurfaceOptions); + m_MaterialScopeList.RegisterHeaderScope(MeshProperties, (uint)ExpandableMeshProperties, DrawGameObjectInfo); + m_MaterialScopeList.RegisterHeaderScope(Styles.SurfaceInputs, (uint)Expandable.SurfaceInputs, DrawSurfaceInputs); + m_MaterialScopeList.RegisterHeaderScope(Styles.AdvancedLabel, (uint)Expandable.Advanced, DrawAdvancedOptions); + } +#else + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + this.materialEditor = materialEditor; + this.properties = properties; + + Material targetMat = materialEditor.target as Material; + + DrawGameObjectInfo(targetMat); +#if !UNITY_2021_1_OR_NEWER + DrawSurfaceOptions(targetMat); +#endif + _DrawSurfaceInputs(targetMat); + } +#endif + + private struct MaterialInfo + { + public bool hasColor; + public bool hasUV0; + public bool hasUV1; + public int occlusionTextureTexCoord; + public int baseColorTextureTexCoord; + } + + private static bool HasAnyTextureAssigned(Material targetMaterial) + { + var s = targetMaterial.shader; + var propertyCount = ShaderUtil.GetPropertyCount(s); + for (var i = 0; i < propertyCount; i++) + { + if (ShaderUtil.GetPropertyType(s, i) != ShaderUtil.ShaderPropertyType.TexEnv) continue; + if (ShaderUtil.IsShaderPropertyHidden(s, i)) continue; + var tex = targetMaterial.GetTexture(ShaderUtil.GetPropertyName(s, i)); + if (tex) return true; + } + return false; + } + +#if !UNITY_2021_1_OR_NEWER + private static readonly Dictionary ShaderNameToGuid = new Dictionary() + { + { "UnityGLTF/PBRGraph", "478ce3626be7a5f4ea58d6b13f05a2e4" }, + { "UnityGLTF/PBRGraph-Transparent", "0a931320a74ca574b91d2d7d4557dcf1" }, + { "UnityGLTF/PBRGraph-Transparent-Double", "54352a53405971b41a6587615f947085" }, + { "UnityGLTF/PBRGraph-Double", "8bc739b14fe811644abb82057b363ba8" }, + + { "UnityGLTF/UnlitGraph", "59541e6caf586ca4f96ccf48a4813a51" }, + { "UnityGLTF/UnlitGraph-Transparent", "83f2caca07949794fb997734c4b0520f" }, + { "UnityGLTF/UnlitGraph-Transparent-Double", "8a8841b4fb2f63644896f4e2b36bc06d" }, + { "UnityGLTF/UnlitGraph-Double", "33ee70a7f505ddb4e80d235c3d70766d" }, + }; + + private void DrawSurfaceOptions(Material targetMaterial) + { + EditorGUILayout.Space(); + + var shaderName = targetMaterial.shader.name.Replace("Hidden/", ""); + var isTransparent = shaderName.Contains("-Transparent"); + var isDoubleSided = shaderName.Contains("-Double"); + var isCutout = targetMaterial.GetFloat("alphaCutoff") >= 0; + var indexOfDash = shaderName.IndexOf("-", StringComparison.Ordinal); + var baseShaderName = indexOfDash < 0 ? shaderName : shaderName.Substring(0, indexOfDash); + // EditorGUILayout.LabelField("Shader Name", baseShaderName); + + void SetShader() + { + var newName = baseShaderName + (isTransparent ? "-Transparent" : "") + (isDoubleSided ? "-Double" : ""); + Undo.RegisterCompleteObjectUndo(targetMaterial, "Set Material Options"); + targetMaterial.shader = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(ShaderNameToGuid[newName])); + var currentCutoff = targetMaterial.GetFloat("alphaCutoff"); + if (!isCutout && currentCutoff == 0) currentCutoff = -0.0001f; // Hack to ensure we can actually switch states here + targetMaterial.SetFloat("alphaCutoff", Mathf.Abs(currentCutoff) * (isCutout ? 1 : -1)); + } + + var newT = EditorGUILayout.Toggle("Transparent", isTransparent); + if (newT != isTransparent) + { + isTransparent = newT; + SetShader(); + } + var newD = EditorGUILayout.Toggle("Double Sided", isDoubleSided); + if (newD != isDoubleSided) + { + isDoubleSided = newD; + SetShader(); + } + var newA = EditorGUILayout.Toggle("Cutout", isCutout); + if (newA != isCutout) + { + isCutout = newA; + SetShader(); + } + + EditorGUILayout.Space(); + } +#endif + + private void DrawGameObjectInfo(Material targetMaterial) + { + var singleSelection = Selection.objects != null && Selection.objects.Length < 2; + + // Strict Mode + // - texture transforms only for baseColorTexture, is used for all others as well + // - occlusion MUST use UV2 if present + var renderer = ShaderGraphHelpers.GetRendererForMaterialEditor(materialEditor); + var haveDrawnSomething = false; + + if (renderer && !singleSelection) + { + EditorGUI.BeginDisabledGroup(true); + EditorGUI.showMixedValue = true; + EditorGUILayout.ObjectField("Target Mesh", null, typeof(Mesh), true); + EditorGUI.showMixedValue = false; + EditorGUI.EndDisabledGroup(); + EditorGUILayout.HelpBox("Multiple objects selected. Can't show mesh properties.", MessageType.Info); + haveDrawnSomething = true; + } + + currentMaterialInfo.hasColor = true; + currentMaterialInfo.hasUV0 = true; + currentMaterialInfo.hasUV1 = true; + currentMaterialInfo.occlusionTextureTexCoord = targetMaterial.HasProperty("occlusionTextureTexCoord") ? Mathf.RoundToInt(targetMaterial.GetFloat("occlusionTextureTexCoord")) : 0; + currentMaterialInfo.baseColorTextureTexCoord = targetMaterial.HasProperty("baseColorTextureTexCoord") ? Mathf.RoundToInt(targetMaterial.GetFloat("baseColorTextureTexCoord")) : 0; + + if (renderer && singleSelection) + { + var mesh = default(Mesh); + if (renderer is SkinnedMeshRenderer smr) + mesh = smr.sharedMesh; + else if (renderer is MeshRenderer mr && mr.GetComponent()) + mesh = mr.GetComponent()?.sharedMesh; + + if (mesh) + { + currentMaterialInfo.hasColor = mesh.HasVertexAttribute(VertexAttribute.Color); + currentMaterialInfo.hasUV0 = mesh.HasVertexAttribute(VertexAttribute.TexCoord0); + currentMaterialInfo.hasUV1 = mesh.HasVertexAttribute(VertexAttribute.TexCoord1); + + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.ObjectField("Target Mesh", mesh, typeof(Mesh), true); + EditorGUILayout.Toggle("Has Vertex Colors", currentMaterialInfo.hasColor); + EditorGUI.EndDisabledGroup(); + + if (currentMaterialInfo.hasColor != targetMaterial.IsKeywordEnabled("_VERTEX_COLORS_ON")) + { + EditorGUI.indentLevel++; + var msg = ""; + var msgType = MessageType.Info; + if (currentMaterialInfo.hasColor) + { + msg = "Mesh has vertex colors but \"Enable Vertex Colors\" is off. Exported glTF files will look different since vertex color is stored per-mesh, not per-material."; + msgType = MessageType.Warning; + } + // else + // { + // // doesn't really make sense to encourage turning vertex colors OFF - export will have them anyways. + // EditorGUILayout.HelpBox("Mesh has no vertex colors but \"Enable Vertex Colors\" is on.", MessageType.Info); + // } + + if (!string.IsNullOrEmpty(msg)) + { + DrawFixMeBox(msg, msgType, () => + { + if (currentMaterialInfo.hasColor) + { + targetMaterial.EnableKeyword("_VERTEX_COLORS_ON"); + targetMaterial.SetFloat("_VERTEX_COLORS", 1); + } + else + { + targetMaterial.DisableKeyword("_VERTEX_COLORS_ON"); + targetMaterial.SetFloat("_VERTEX_COLORS", 0); + } + }); + } + EditorGUI.indentLevel--; + } + + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.Toggle("Has UV0", currentMaterialInfo.hasUV0); + EditorGUILayout.Toggle("Has UV1", currentMaterialInfo.hasUV1); + EditorGUI.EndDisabledGroup(); + + if (!currentMaterialInfo.hasUV0 && HasAnyTextureAssigned(targetMaterial)) + { + EditorGUI.indentLevel++; + EditorGUILayout.HelpBox("This mesh has no UV coordinates but has textures assigned.", MessageType.Warning); + EditorGUI.indentLevel--; + } + + if (currentMaterialInfo.hasUV1 && targetMaterial.HasProperty("occlusionTexture") && targetMaterial.GetTexture("occlusionTexture")) + { + EditorGUI.indentLevel++; + var texCoord = Mathf.RoundToInt(targetMaterial.GetFloat("occlusionTextureTexCoord")); + if (texCoord != 1) + { + DrawFixMeBox("This mesh has an Occlusion Texture and UV1 vertex data.\nWhen exporting to three.js, UV1 will be used independent of TexCoord setting.", MessageType.Warning, () => + { + Undo.RegisterCompleteObjectUndo(targetMaterial, "Set occlusionTextureTexCoord to 1"); + targetMaterial.SetFloat("occlusionTextureTexCoord", 1); + }); + } + EditorGUI.indentLevel--; + } + + if (!currentMaterialInfo.hasUV1) + { + if (currentMaterialInfo.baseColorTextureTexCoord > 0) + { + DrawFixMeBox("This mesh does not have UV1 vertex data but Base Texture is set to use UV1. This will lead to unexpected results.", MessageType.Warning, () => + { + Undo.RegisterCompleteObjectUndo(targetMaterial, "Set baseColorTextureTexCoord to 0"); + targetMaterial.SetFloat("baseColorTextureTexCoord", 0); + }); + } + if (currentMaterialInfo.occlusionTextureTexCoord > 0) + { + DrawFixMeBox("This mesh does not have UV1 vertex data but Occlusion Texture is set to use UV1. This will lead to unexpected results.", MessageType.Warning, () => + { + Undo.RegisterCompleteObjectUndo(targetMaterial, "Set occlusionTextureTexCoord to 0"); + targetMaterial.SetFloat("occlusionTextureTexCoord", 0); + }); + } + } + + // check if this uses transmission + // TODO we need to expose some kind of interface so that other scripts (e.g. the rough refraction components) + // can attach to this inspector here. + /* + if (targetMaterial.IsKeywordEnabled("_VOLUME_TRANSMISSION_ON")) + { + // requires extra setup for BiRP / URP to render properly + if (!GraphicsSettings.currentRenderPipeline && !Camera.main.gameObject.GetComponent()) + { + // warn + } + else + { + // check if assigned renderer has the rough refraction feature, offer to add it otherwise + Camera.main.gameObject.GetComponent() + } + } + */ + } + haveDrawnSomething = true; + } + + if (targetMaterial.HasProperty("_Surface") && targetMaterial.GetFloat("_Surface") == 0 && + targetMaterial.renderQueue <= (int) RenderQueue.AlphaTest + 50 && + !Mathf.Approximately(targetMaterial.GetColor("baseColorFactor").a, 1)) + { + DrawFixMeBox("Material is opaque but baseColorFactor has an alpha value != 1. This object might render unexpectedly in some viewers that blend results (e.g. AR, Babylon, Stager).", MessageType.Warning, () => + { + Undo.RegisterCompleteObjectUndo(materialEditor.targets, "Set baseColorFactor.a to 1"); + foreach (var t in materialEditor.targets) + { + var mat = (Material)t; + var color = mat.GetColor("baseColorFactor"); + color.a = 1; + mat.SetColor("baseColorFactor", color); + EditorUtility.SetDirty(mat); + } + }); + haveDrawnSomething = true; + } + + if (!renderer && !haveDrawnSomething) + { + EditorGUILayout.HelpBox("Select a Renderer to see additional info", MessageType.None); + } + } + + private static void DrawFixMeBox(string msg, MessageType msgType, Action action) + { +#if HAVE_BUILTIN_SHADERGRAPH && false + CoreEditorUtils.DrawFixMeBox(msg, msgType, action); +#else + EditorGUILayout.HelpBox(msg, msgType); + if (action != null && GUILayout.Button("Fix")) action(); +#endif + } + +#if HAVE_CATEGORIES + protected override void DrawSurfaceInputs(Material mat) => _DrawSurfaceInputs(mat); +#endif + protected void _DrawSurfaceInputs(Material mat) + { + var targetMaterial = materialEditor.target as Material; + if (!targetMaterial) return; + + + materialEditor.SetDefaultGUIWidths(); + + EditorGUI.BeginChangeCheck(); + + DrawProperties(targetMaterial, properties); + + if (EditorGUI.EndChangeCheck()) + { + foreach (var t in materialEditor.targets) + { + if (t is Material material) + GLTFMaterialHelper.ValidateMaterialKeywords(material); + } + } + } + + private static bool HasPropertyButNoTex(Material targetMaterial, string name) + { + return targetMaterial.HasProperty(name) && + #if UNITY_2021_2_OR_NEWER + targetMaterial.HasTexture(name) && + #endif + !targetMaterial.GetTexture(name); + } + + private void DrawProperties(Material targetMaterial, MaterialProperty[] properties) + { + // filter properties based on keywords + var propertyList = properties.ToList(); + if (!targetMaterial.IsKeywordEnabled("_TEXTURE_TRANSFORM_ON")) + { + propertyList.RemoveAll(x => x.name.EndsWith("_ST", StringComparison.Ordinal) || x.name.EndsWith("Rotation", StringComparison.Ordinal)); + } + // want to remove the _ST properties since they are drawn inline already on 2021.2+ + #if UNITY_2021_2_OR_NEWER + { + propertyList.RemoveAll(x => x.name.EndsWith("_ST", StringComparison.Ordinal)); + } + #endif + if (!targetMaterial.IsKeywordEnabled("_VOLUME_TRANSMISSION_ON")) + { + propertyList.RemoveAll(x => x.name.StartsWith("transmission", StringComparison.Ordinal)); + } + if (!targetMaterial.HasProperty("_VOLUME_ON") || !(targetMaterial.GetFloat("_VOLUME_ON") > 0.5f)) + { + propertyList.RemoveAll(x => x.name.StartsWith("thickness", StringComparison.Ordinal) || x.name.StartsWith("attenuation", StringComparison.Ordinal)); + } + if (!targetMaterial.IsKeywordEnabled("_IRIDESCENCE_ON")) + { + propertyList.RemoveAll(x => x.name.StartsWith("iridescence", StringComparison.Ordinal)); + } + if (!targetMaterial.IsKeywordEnabled("_SPECULAR_ON")) + { + propertyList.RemoveAll(x => x.name.StartsWith("specular", StringComparison.Ordinal)); + } + if (!targetMaterial.IsKeywordEnabled("_CLEARCOAT_ON")) + { + propertyList.RemoveAll(x => x.name.StartsWith("clearcoat", StringComparison.Ordinal)); + } + if (HasPropertyButNoTex(targetMaterial, "occlusionTexture")) + { + propertyList.RemoveAll(x => x.name == "occlusionStrength" || (x.name.StartsWith("occlusionTexture", StringComparison.Ordinal) && x.name != "occlusionTexture")); + } + // remove UV-related properties + if (HasPropertyButNoTex(targetMaterial, "baseColorTexture") && HasPropertyButNoTex(targetMaterial,"metallicRoughnessTexture") && HasPropertyButNoTex(targetMaterial,"normalTexture") && HasPropertyButNoTex(targetMaterial,"emissiveTexture")) + { + propertyList.RemoveAll(x => x.name.StartsWith("baseColorTexture", StringComparison.Ordinal) && x.name != "baseColorTexture"); + } + if (HasPropertyButNoTex(targetMaterial,"normalTexture")) + { + propertyList.RemoveAll(x => x.name == "normalScale"); + } + if (!currentMaterialInfo.hasUV0 && !currentMaterialInfo.hasUV1) + { + // hide all texture properties if no UVs + propertyList.RemoveAll(x => x.name.Contains("texture")); + } + if (!currentMaterialInfo.hasUV1 && currentMaterialInfo.occlusionTextureTexCoord == 0 && currentMaterialInfo.baseColorTextureTexCoord == 0) + { + propertyList.RemoveAll(x => x.name.EndsWith("TextureTexCoord", StringComparison.Ordinal)); + } +#if UNITY_2021_1_OR_NEWER + var isBirp = !GraphicsSettings.currentRenderPipeline; + if ((isBirp && !targetMaterial.IsKeywordEnabled("_BUILTIN_ALPHATEST_ON")) || + (!isBirp && !targetMaterial.IsKeywordEnabled("_ALPHATEST_ON"))) +#else + if (targetMaterial.GetFloat("alphaCutoff") < 0) +#endif + { + propertyList.RemoveAll(x => x.name == "alphaCutoff"); + } + // TODO we probably want full manual control, all this internal access is horrible... + // E.g. impossible to render inline texture properties... + ShaderGraphHelpers.DrawShaderGraphGUI(materialEditor, propertyList); + } + + public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader) + { + GLTFMaterialHelper.ConvertMaterialToGLTF(material, oldShader, newShader); + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs.meta new file mode 100644 index 0000000..a96df2a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7fd38ac84daf5a14180dde4bc5949e25 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs new file mode 100644 index 0000000..2c476b8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs @@ -0,0 +1,56 @@ +#if !NO_INTERNALS_ACCESS +#if UNITY_2021_3_OR_NEWER +#define HAVE_CATEGORIES +#endif + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +#if HAVE_CATEGORIES +using UnityEditor.ShaderGraph.Drawing; +#endif +using UnityEngine; +using Object = UnityEngine.Object; + +namespace UnityGLTF +{ + public static class ShaderGraphHelpers + { + public static void DrawShaderGraphGUI(MaterialEditor materialEditor, IEnumerable properties) + { +#if HAVE_CATEGORIES + ShaderGraphPropertyDrawers.DrawShaderGraphGUI(materialEditor, properties); +#else + materialEditor.PropertiesDefaultGUI(properties.ToArray()); +#endif + } + + private static Type propertyView; + private static PropertyInfo propertyViewer; + private static PropertyInfo tracker; + + // matches logic in MaterialEditor.ShouldEditorBeHidden to find the right renderer this material is inspected on. + public static Renderer GetRendererForMaterialEditor(MaterialEditor materialEditor) + { + if (propertyViewer == null) propertyViewer = typeof(Editor).GetProperty(nameof(propertyViewer), BindingFlags.Instance | BindingFlags.NonPublic); + if (propertyView == null) propertyView = typeof(Editor).Assembly.GetType("UnityEditor.IPropertyView"); + if (tracker == null) tracker = propertyView?.GetProperty("tracker", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + + var iPropertyViewer = propertyViewer?.GetValue(materialEditor) as Object; + if (!iPropertyViewer) return null; + + var editorTracker = tracker?.GetValue(iPropertyViewer) as ActiveEditorTracker; + if (editorTracker == null) return null; + + GameObject target = editorTracker.activeEditors[0].target as GameObject; + if (!target) return null; + Renderer c = target.GetComponent(); + if (!c) c = target.GetComponent(); + return c; + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs.meta new file mode 100644 index 0000000..27c4a3a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphHelpers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0a60cd145bbb31542ab7932da93de3f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs new file mode 100644 index 0000000..20b8e94 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs @@ -0,0 +1,105 @@ +#if !NO_INTERNALS_ACCESS && UNITY_2020_1_OR_NEWER + +using System.IO; +using UnityEditor; +using UnityEditor.ShaderGraph; +using UnityEngine; +#if UNITY_2020_2_OR_NEWER +using UnityEditor.AssetImporters; +#else +using UnityEditor.Experimental.AssetImporters; +#endif + +namespace UnityGLTF +{ + [ScriptedImporter(0, ".override-graph", -500)] + internal class ShaderGraphOverrideImporter : ShaderGraphImporter, IUnityGltfShaderUpgradeMeta + { + [HideInInspector] + public Shader sourceShader; + + [HideInInspector] + public Shader upgradeShader; + + public bool forceTransparent = true; + public bool forceDoublesided = false; + public bool hideShader = true; + + public Shader SourceShader => sourceShader; + public bool IsTransparent => forceTransparent; + public bool IsDoublesided => forceDoublesided; + public bool IsUnlit => sourceShader.name.Contains("Unlit"); + + public override void OnImportAsset(AssetImportContext ctx) + { + if (!sourceShader) + return; + +#if UNITY_2021_1_OR_NEWER && false + // we don't need extra shaders on 2021.1+, + // as Shader Graph allows overriding the material properties there. + // but we do want to allow upgrading the materials, so we need to import something and allow upgrading through ShaderGraphUpdater + + var meta = ScriptableObject.CreateInstance(); + meta.name = "Shader Upgrade Meta"; + meta.hideFlags = HideFlags.HideInInspector; + meta.sourceShader = sourceShader; + meta.isTransparent = forceTransparent; + meta.isDoublesided = forceDoublesided; + + const string shaderName = "Hidden/UnityGltf/UpgradeShader"; + var shaderText = File.ReadAllText(AssetDatabase.GetAssetPath(upgradeShader)) + .Replace(shaderName, shaderName + meta.GenerateNameString()); + var shader = ShaderUtil.CreateShaderAsset(ctx, shaderText, true); + ctx.AddObjectToAsset("MainAsset", shader); + ctx.AddObjectToAsset("UpgradeMeta", meta); + ctx.SetMainObject(shader); +#else + // cache write time, we want to reset the file again afterwards + var lastWriteTimeUtc = File.GetLastWriteTimeUtc(ctx.assetPath); + + var path = AssetDatabase.GetAssetPath(sourceShader); + ctx.DependsOnArtifact(AssetDatabase.GUIDFromAssetPath(path)); + var graphData = File.ReadAllText(path); + +#if UNITY_2021_1_OR_NEWER + // disable material overrides on 2021.1+ - we want people to use the proper shader for that + graphData = graphData.Replace("\"m_AllowMaterialOverride\": true", "\"m_AllowMaterialOverride\": false"); +#endif + + // modify: + // switch to transparent + if (forceTransparent) + graphData = graphData.Replace("\"m_SurfaceType\": 0", "\"m_SurfaceType\": 1"); + + // for 2021+ + // if (forceDoublesided) + // graphData = graphData + // .Replace("\"m_RenderFace\": 2", "\"m_RenderFace\": 0") + // .Replace("\"m_RenderFace\": 1", "\"m_RenderFace\": 0"); + + // for 2020+ + if (forceDoublesided && !graphData.Contains("m_TwoSided")) + graphData = graphData + .Replace("\"m_SurfaceType\": 0", "\"m_SurfaceType\": 0" + ",\n" + "\"m_TwoSided\": true") + .Replace("\"m_SurfaceType\": 1", "\"m_SurfaceType\": 1" + ",\n" + "\"m_TwoSided\": true"); + + if (hideShader) + graphData = graphData.Replace("\"m_Path\": \"", "\"m_Path\": \"Hidden/"); + + File.WriteAllText(ctx.assetPath, graphData); + + // run import on the modified shader + base.OnImportAsset(ctx); + + // clean the file on disk again + File.WriteAllText(ctx.assetPath, ""); + + // reset write time to what it was before - avoids AssetDB reload + File.SetLastWriteTimeUtc(ctx.assetPath, lastWriteTimeUtc); +#endif + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs.meta new file mode 100644 index 0000000..0ea1814 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe431e399c52971408121c6c40cde979 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs new file mode 100644 index 0000000..ef9410c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs @@ -0,0 +1,26 @@ +#if !NO_INTERNALS_ACCESS && UNITY_2020_1_OR_NEWER + +using UnityEditor; +#if UNITY_2020_2_OR_NEWER +using UnityEditor.AssetImporters; +#else +using UnityEditor.Experimental.AssetImporters; +#endif + +namespace UnityGLTF +{ + [CustomEditor(typeof(ShaderGraphOverrideImporter))] + class ShaderGraphOverrideImporterEditor : ScriptedImporterEditor + { + public override void OnInspectorGUI() + { +#if UNITY_2021_1_OR_NEWER + EditorGUILayout.HelpBox("Deprecated. Use material overrides on UnityGLTF/PBRGraph and UnityGLTF/UnlitGraph instead of separate shaders.", MessageType.Warning); +#endif + DrawDefaultInspector(); + ApplyRevertGUI(); + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs.meta new file mode 100644 index 0000000..8215707 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/ShaderGraphOverrideImporterEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 511b21f4c3344c54689aed102b11724a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref new file mode 100644 index 0000000..6f5b7c2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref @@ -0,0 +1,3 @@ +{ + "reference": "GUID:be0903cd8e1546f498710afdc59db5eb" +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref.meta new file mode 100644 index 0000000..87c0b66 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalShaderGraph/UnityGLTF.ShaderGraph.Internal.asmref.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d60ff41bbebf9024dac1e4f0dc004a57 +AssemblyDefinitionReferenceImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP.meta new file mode 100644 index 0000000..6cc4398 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9f369a0c649cfa54799cb62645da047f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs new file mode 100644 index 0000000..6415719 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs @@ -0,0 +1,57 @@ +#if !NO_INTERNALS_ACCESS +#if UNITY_2021_3_OR_NEWER +#define HAVE_CATEGORIES +#endif + +using System; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace UnityGLTF +{ + // matches ShaderGraphLitGUI.cs + public class PBRGraphUniversalGUI : PBRGraphGUI + { +#if HAVE_CATEGORIES + private PropertyInfo materialEditorPropertyAccessor; + private ShaderGraphLitGUI litGuiForwarder; + + public override void ValidateMaterial(Material material) + { + if (material == null) throw new ArgumentNullException(nameof(material)); + + base.ValidateMaterial(material); + + var automaticRenderQueue = GetAutomaticQueueControlSetting(material); + BaseShaderGUI.UpdateMaterialSurfaceOptions(material, automaticRenderQueue); + } + + protected override void DrawSurfaceOptions(Material material) + { + if (material == null) throw new ArgumentNullException(nameof(material)); + + // Use default labelWidth + EditorGUIUtility.labelWidth = 0f; + + if (litGuiForwarder == null) litGuiForwarder = new ShaderGraphLitGUI(); + if (materialEditorPropertyAccessor == null) materialEditorPropertyAccessor = typeof(BaseShaderGUI).GetProperty("materialEditor", (BindingFlags) (-1)); + if (materialEditorPropertyAccessor != null) materialEditorPropertyAccessor.SetValue(litGuiForwarder, materialEditor); // forwarder.materialEditor = materialEditor; + + litGuiForwarder.FindProperties(properties); + litGuiForwarder.workflowMode = null; + litGuiForwarder.DrawSurfaceOptions(material); + } + + protected override void DrawAdvancedOptions(Material material) + { + base.DrawAdvancedOptions(material); + + materialEditor.DoubleSidedGIField(); + materialEditor.LightmapEmissionFlagsProperty(0, enabled: true, ignoreEmissionColor: true); + } +#endif + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs.meta new file mode 100644 index 0000000..6a8f990 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/PBRGraphUniversalGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 86a2b51891c425a468a0a4d61f8b2a6a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref new file mode 100644 index 0000000..583b71c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref @@ -0,0 +1,3 @@ +{ + "reference": "GUID:c579267770062bf448e75eb160330b7f" +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref.meta new file mode 100644 index 0000000..0c6e134 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/InternalURP/UnityGLTF.URP.Internal.asmref.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cd3b604407efbd641a4d40520de58a76 +AssemblyDefinitionReferenceImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs new file mode 100644 index 0000000..c3cf737 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs @@ -0,0 +1 @@ +internal class NoCompilationWarning { } diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs.meta new file mode 100644 index 0000000..fa3b0de --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/NoCompilationWarning.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ea8663e2a74bdc4cb6f6d53769532df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs new file mode 100644 index 0000000..7599c88 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs @@ -0,0 +1,240 @@ +using System.Linq; +using GLTF.Schema; +using UnityEngine; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF +{ + public static class ShaderConverters + { + [InitializeOnLoadMethod] + static void InitShaderConverters() + { + GLTFMaterialHelper.RegisterMaterialConversionToGLTF(ConvertStandardAndURPLit); + GLTFMaterialHelper.RegisterMaterialConversionToGLTF(ConvertUnityGLTFGraphs); + } + + private static bool ConvertUnityGLTFGraphs(Material material, Shader oldShader, Shader newShader) + { + // update legacy shaders that didn't have material overrides available + if (oldShader.name.StartsWith("Hidden/UnityGLTF/PBRGraph") || oldShader.name.StartsWith("Hidden/UnityGLTF/UnlitGraph")) + { + material.shader = newShader; + + var meta = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(material.shader)) as IUnityGltfShaderUpgradeMeta; + if (meta != null) + { + // Debug.Log("Updating shader from " + material.shader + " to " + meta.SourceShader + + // " (transparent: " + meta.IsTransparent + ", double sided: " + meta.IsDoublesided + ")"); + + var isUnlit = meta.SourceShader.name.Contains("Unlit"); + material.shader = meta.SourceShader; + + var mapper = isUnlit ? (IUniformMap) new UnlitMap(material) : new PBRGraphMap(material); + if (meta.IsTransparent) + mapper.AlphaMode = AlphaMode.BLEND; + if (meta.IsDoublesided) + mapper.DoubleSided = true; + + EditorUtility.SetDirty(material); + } + + return true; + } + + if (oldShader.name != "UnityGLTF/UnlitGraph" && oldShader.name != "UnityGLTF/PBRGraph") return false; + + material.shader = newShader; + return true; + } + + private static bool ConvertStandardAndURPLit(Material material, Shader oldShader, Shader newShader) + { + // Conversion time! + // convert from + // - "Standard" + // - "URP/Lit" + + if (oldShader.name != StandardShader && oldShader.name != URPLitShader) return false; + + var isStandard = oldShader.name == StandardShader; + var needsEmissiveColorSpaceConversion = isStandard && QualitySettings.activeColorSpace == ColorSpace.Linear; + var colorProp = oldShader.name == StandardShader ? _Color : _BaseColor; + var colorTexProp = oldShader.name == StandardShader ? _MainTex : _BaseMap; + + var color = material.GetColor(colorProp); + var albedo = material.GetTexture(colorTexProp); + var albedoOffset = material.GetTextureOffset(colorTexProp); + var albedoTiling = material.GetTextureScale(colorTexProp); + + var metallic = material.GetFloat(_Metallic); + var smoothness = material.HasProperty(_Smoothness) ? material.GetFloat(_Smoothness) : material.GetFloat(_Glossiness); + var metallicGloss = material.GetTexture(_MetallicGlossMap); + var normal = material.GetTexture(_BumpMap); + var normalStrength = material.GetFloat(_BumpScale); + var occlusion = material.GetTexture(_OcclusionMap); + var occlusionStrength = material.GetFloat(_Strength); + var emission = material.GetTexture(_EmissionMap); + var emissionColor = material.GetColor(_EmissionColor); + var cutoff = material.GetFloat(_Cutoff); + + var isCutoff = material.IsKeywordEnabled("_ALPHATEST_ON") || material.IsKeywordEnabled("_BUILTIN_ALPHATEST_ON"); + + material.shader = newShader; + + material.SetColor(baseColorFactor, color); + material.SetTexture(baseColorTexture, albedo); + material.SetTextureOffset(baseColorTexture, albedoOffset); + material.SetTextureScale(baseColorTexture, albedoTiling); + if (albedoOffset != Vector2.zero || albedoTiling != Vector2.one) + GLTFMaterialHelper.SetKeyword(material, "_TEXTURE_TRANSFORM", true); + + material.SetFloat(metallicFactor, metallic); + material.SetFloat(roughnessFactor, 1 - smoothness); + const string ConversionWarning = "The Metallic (R) Smoothness (A) texture needs to be converted to Roughness (B) Metallic (G). "; +#if UNITY_EDITOR && UNITY_2022_1_OR_NEWER + var importerPath = AssetDatabase.GetAssetPath(metallicGloss); + var importer = AssetImporter.GetAtPath(importerPath) as TextureImporter; + if (importer && importer.swizzleG != TextureImporterSwizzle.OneMinusR) // can't really detect if this has been done on the texture already, this is just a heuristic... + { + if (EditorUtility.DisplayDialog("Texture Conversion", + ConversionWarning + "This is done by swizzling texture channels in the importer. Do you want to proceed?", + "OK", DialogOptOutDecisionType.ForThisSession, nameof(GLTFMaterialHelper) + "_texture_conversion")) + { + importer.swizzleR = TextureImporterSwizzle.B; + importer.swizzleG = TextureImporterSwizzle.OneMinusR; + importer.swizzleB = TextureImporterSwizzle.G; + Undo.RegisterImporterUndo(importerPath, "Texture Swizzles (M__G > _RM_)"); + importer.SaveAndReimport(); + } + } + else + { + Debug.LogWarning(ConversionWarning + "This currently needs to be done manually. Please swap channels in an external software.", material); + } +#else + if (metallicGloss) + Debug.LogWarning(ConversionWarning + "This currently needs to be done manually. Please swap channels in an external software.", material); +#endif + // TODO: convert metallicGloss to metallicRoughnessTexture format: Metallic (R) + Smoothness (A) → Roughness (G) + Metallic (B) + // TODO: when smoothness is not 0 or 1 and there's a texture, need to convert to a texture and set roughness = 1, otherwise the math doesn't match + // TODO: figure out where to put the newly created texture, and how to avoid re-creating it several times when multiple materials may use it. + material.SetTexture(metallicRoughnessTexture, metallicGloss); + material.SetTexture(normalTexture, normal); + material.SetFloat(normalScale, normalStrength); + material.SetTexture(occlusionTexture, occlusion); + material.SetFloat(occlusionStrength1, occlusionStrength); + material.SetTexture(emissiveTexture, emission); + material.SetFloat(alphaCutoff, cutoff); + if (isCutoff) + { + GLTFMaterialHelper.SetKeyword(material, "_ALPHATEST", true); + GLTFMaterialHelper.SetKeyword(material, "_BUILTIN_ALPHATEST", true); + material.EnableKeyword("_BUILTIN_AlphaClip"); + } + + material.SetColor(emissiveFactor, needsEmissiveColorSpaceConversion ? emissionColor.linear : emissionColor); + + // set the flags on conversion, otherwise it's confusing why they're not on - can't easily replicate the magic that Unity does in their inspectors when changing emissive on/off + if (material.globalIlluminationFlags == MaterialGlobalIlluminationFlags.None || material.globalIlluminationFlags == MaterialGlobalIlluminationFlags.EmissiveIsBlack) + material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive; + + // ensure keywords are correctly set after conversion + GLTFMaterialHelper.ValidateMaterialKeywords(material); + + return true; + } + + // ReSharper disable InconsistentNaming + private const string StandardShader = "Standard"; + private const string URPLitShader = "Universal Render Pipeline/Lit"; + + // Standard and URP-Lit property names + private static readonly int _Color = Shader.PropertyToID("_Color"); + private static readonly int _BaseColor = Shader.PropertyToID("_BaseColor"); + private static readonly int _MainTex = Shader.PropertyToID("_MainTex"); + private static readonly int _BaseMap = Shader.PropertyToID("_BaseMap"); + private static readonly int _Metallic = Shader.PropertyToID("_Metallic"); + private static readonly int _Glossiness = Shader.PropertyToID("_Glossiness"); + private static readonly int _Smoothness = Shader.PropertyToID("_Smoothness"); + private static readonly int _MetallicGlossMap = Shader.PropertyToID("_MetallicGlossMap"); + private static readonly int _BumpMap = Shader.PropertyToID("_BumpMap"); + private static readonly int _BumpScale = Shader.PropertyToID("_BumpScale"); + private static readonly int _OcclusionMap = Shader.PropertyToID("_OcclusionMap"); + private static readonly int _Strength = Shader.PropertyToID("_OcclusionStrength"); + private static readonly int _EmissionMap = Shader.PropertyToID("_EmissionMap"); + private static readonly int _EmissionColor = Shader.PropertyToID("_EmissionColor"); + private static readonly int _Cutoff = Shader.PropertyToID("_Cutoff"); + + // glTF property names + private static readonly int baseColorFactor = Shader.PropertyToID("baseColorFactor"); + private static readonly int baseColorTexture = Shader.PropertyToID("baseColorTexture"); + private static readonly int metallicFactor = Shader.PropertyToID("metallicFactor"); + private static readonly int roughnessFactor = Shader.PropertyToID("roughnessFactor"); + private static readonly int metallicRoughnessTexture = Shader.PropertyToID("metallicRoughnessTexture"); + private static readonly int normalTexture = Shader.PropertyToID("normalTexture"); + private static readonly int normalScale = Shader.PropertyToID("normalScale"); + private static readonly int occlusionTexture = Shader.PropertyToID("occlusionTexture"); + private static readonly int occlusionStrength1 = Shader.PropertyToID("occlusionStrength"); + private static readonly int emissiveTexture = Shader.PropertyToID("emissiveTexture"); + private static readonly int emissiveFactor = Shader.PropertyToID("emissiveFactor"); + private static readonly int alphaCutoff = Shader.PropertyToID("alphaCutoff"); + // ReSharper restore InconsistentNaming + + private static readonly string[] emissivePropNames = new[] { "emissiveFactor", "_EmissionColor" }; + + [MenuItem("CONTEXT/Material/UnityGLTF Material Helpers/Convert Emissive Colors > sRGB - weaker, darker")] + private static void ConvertToSRGB(MenuCommand command) + { + if (!(command.context is Material mat)) return; + Undo.RegisterCompleteObjectUndo(mat, "Convert emissive colors to sRGB"); + foreach(var propName in emissivePropNames) + if (mat.HasProperty(propName)) mat.SetColor(propName, mat.GetColor(propName).gamma); + } + + [MenuItem("CONTEXT/Material/UnityGLTF Material Helpers/Convert Emissive Colors > Linear - brighter, stronger")] + private static void ConvertToLinear(MenuCommand command) + { + if (!(command.context is Material mat)) return; + Undo.RegisterCompleteObjectUndo(mat, "Convert emissive colors to sRGB"); + foreach(var propName in emissivePropNames) + if (mat.HasProperty(propName)) mat.SetColor(propName, mat.GetColor(propName).linear); + } + + [MenuItem("CONTEXT/Material/UnityGLTF Material Helpers/ Select all materials with this shader", false, -1000)] + private static void SelectAllMaterialsWithShader(MenuCommand command) + { + if (!(command.context is Material mat)) return; + var allMaterials = AssetDatabase.FindAssets("t:Material") + .Select(AssetDatabase.GUIDToAssetPath) + .Select(AssetDatabase.LoadAssetAtPath) + .Where(x => !AssetDatabase.IsSubAsset(x)) + .Where(x => x.shader == mat.shader) + .Cast() + .ToArray(); + foreach (var obj in allMaterials) + EditorGUIUtility.PingObject(obj); + Selection.objects = allMaterials; + } + + private static bool TryGetMetadataOfType(Shader shader, out T obj) where T : ScriptableObject + { + obj = null; + + var path = AssetDatabase.GetAssetPath(shader); + foreach (var asset in AssetDatabase.LoadAllAssetsAtPath(path)) + { + if (asset is T metadataAsset) + { + obj = metadataAsset; + return true; + } + } + + return false; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs.meta new file mode 100644 index 0000000..042b837 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/ShaderConverters.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 77ad4bb761964b0da3ccf68f6b649aab +timeCreated: 1677764644 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef new file mode 100644 index 0000000..619412b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef @@ -0,0 +1,28 @@ +{ + "name": "UnityGLTF.ShaderGraph", + "rootNamespace": "", + "references": [ + "GUID:be0903cd8e1546f498710afdc59db5eb", + "GUID:18d18f811ba286c49814567a3cfba688", + "GUID:40f39bff7bc9be34182ebe488fcf8228" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_2019_4_OR_NEWER" + ], + "versionDefines": [ + { + "name": "com.unity.modules.imageconversion", + "expression": "0.0.0", + "define": "NO_INTERNALS_ACCESS" + } + ], + "noEngineReferences": false +} diff --git a/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef.meta b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef.meta new file mode 100644 index 0000000..2004548 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/Scripts/ShaderGraph/UnityGLTF.ShaderGraph.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 17181a83a8717a34d8ce050af64edd83 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef b/Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef new file mode 100644 index 0000000..1cae207 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef @@ -0,0 +1,37 @@ +{ + "name": "UnityGLTFEditor", + "rootNamespace": "", + "references": [ + "GLTFSerialization", + "UnityGLTFScripts" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "GLTFSerialization.dll" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.modules.animation", + "expression": "1.0.0", + "define": "UNITY_ANIMATION" + }, + { + "name": "com.unity.modules.imgui", + "expression": "1.0.0", + "define": "UNITY_IMGUI" + }, + { + "name": "com.atteneder.gltfast", + "expression": "3.0.0", + "define": "HAVE_GLTFAST" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef.meta b/Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef.meta new file mode 100644 index 0000000..68e4ef6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Editor/UnityGLTFEditor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1a0324566af4ed544918d6837a1f4e11 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime.meta b/Assets/Plugins/UnityGLTF/Runtime.meta new file mode 100644 index 0000000..8e9b710 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d28d76b6765ee2849a9c1dcf3811d183 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins.meta new file mode 100644 index 0000000..07a3570 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 107a7c058d7ad7c43b3656c44c5364b8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization.meta new file mode 100644 index 0000000..3a4bef2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cf51abc0e087ca4d8fc223141dd9c09 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs new file mode 100644 index 0000000..e9701f4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("UnityGLTFScripts")] diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs.meta new file mode 100644 index 0000000..9844667 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42d7be7539b58434e88dbb233beed600 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs new file mode 100644 index 0000000..3735608 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs @@ -0,0 +1,17 @@ +using GLTF.Schema; + +namespace GLTF +{ + public class AttributeAccessor + { + public AccessorId AccessorId { get; set; } + public NumericArray AccessorContent { get; set; } + public System.IO.Stream Stream { get; set; } + public uint Offset { get; set; } + + public AttributeAccessor() + { + AccessorContent = new NumericArray(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs.meta new file mode 100644 index 0000000..587afe0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/AttributeAccessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05765344adf6fd949b45bc1e4699305a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs new file mode 100644 index 0000000..559f2ae --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs @@ -0,0 +1,40 @@ +using System; + +namespace GLTF +{ + public class GLTFHeaderInvalidException : Exception + { + public GLTFHeaderInvalidException() : base() { } + public GLTFHeaderInvalidException(string message) : base(message) { } + public GLTFHeaderInvalidException(string message, Exception inner) : base(message, inner) { } +#if !WINDOWS_UWP + protected GLTFHeaderInvalidException(System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + { } +#endif + } + + public class GLTFParseException : Exception + { + public GLTFParseException() : base() { } + public GLTFParseException(string message) : base(message) { } + public GLTFParseException(string message, Exception inner) : base(message, inner) { } +#if !WINDOWS_UWP + protected GLTFParseException(System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + { } +#endif + } + + public class GLTFLoadException : Exception + { + public GLTFLoadException() : base() { } + public GLTFLoadException(string message) : base(message) { } + public GLTFLoadException(string message, Exception inner) : base(message, inner) { } +#if !WINDOWS_UWP + protected GLTFLoadException(System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + { } +#endif + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs.meta new file mode 100644 index 0000000..e17c304 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Exceptions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f014046747656547b05fa3774ecf051 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions.meta new file mode 100644 index 0000000..40eee57 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a4214d32c6f922940ba2e0df9e1ff758 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs new file mode 100644 index 0000000..5e3ad5a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs @@ -0,0 +1,29 @@ +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + public class EXT_texture_exr : IExtension + { + public const string EXTENSION_NAME = "EXT_texture_exr"; + public ImageId source; + + public EXT_texture_exr(ImageId source) + { + this.source = source; + } + + public IExtension Clone(GLTFRoot root) + { + return new EXT_texture_exr(source); + } + + public JProperty Serialize() + { + JObject ext = new JObject(); + + ext.Add("source", source.Id); + + return new JProperty(EXTENSION_NAME, ext); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs.meta new file mode 100644 index 0000000..51d1948 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/EXT_texture_exr.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9348b48c4902434e81000a832ca2ef33 +timeCreated: 1662326250 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs new file mode 100644 index 0000000..0be5533 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs @@ -0,0 +1,88 @@ +using System; +using GLTF.Math; +using GLTF.Schema; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + public class ExtTextureTransformExtension : IExtension + { + /// + /// The offset of the UV coordinate origin as a percentage of the texture dimensions. + /// + public Vector2 Offset = new Vector2(0, 0); + public static readonly Vector2 OFFSET_DEFAULT = new Vector2(0, 0); + + /// + /// Rotate the UVs by this many radians counter-clockwise around the origin. This is equivalent + /// to a similar rotation of the image clockwise. + /// + public double Rotation = 0.0f; + public static readonly double ROTATION_DEFAULT = 0.0f; + + /// + /// The scale factor applied to the components of the UV coordinates. + /// + public Vector2 Scale = new Vector2(1, 1); + public static readonly Vector2 SCALE_DEFAULT = new Vector2(1, 1); + + /// + /// Overrides the textureInfo texCoord value if this extension is supported. + /// + public int TexCoord = 0; + public static readonly int TEXCOORD_DEFAULT = 0; + + public ExtTextureTransformExtension(Vector2 offset, double rotation, Vector2 scale, int texCoord) + { + Offset = offset; + Rotation = rotation; + Scale = scale; + TexCoord = texCoord; + } + + public IExtension Clone(GLTFRoot root) + { + return new ExtTextureTransformExtension(Offset, Rotation, Scale, TexCoord); + } + + public JProperty Serialize() + { + JObject ext = new JObject(); + + if (Offset != OFFSET_DEFAULT) + { + ext.Add(new JProperty( + ExtTextureTransformExtensionFactory.OFFSET, + new JArray(Offset.X, Offset.Y) + )); + } + + if (Rotation != ROTATION_DEFAULT) + { + ext.Add(new JProperty( + ExtTextureTransformExtensionFactory.ROTATION, + Rotation + )); + } + + if (Scale != SCALE_DEFAULT) + { + ext.Add(new JProperty( + ExtTextureTransformExtensionFactory.SCALE, + new JArray(Scale.X, Scale.Y) + )); + } + + if (TexCoord != TEXCOORD_DEFAULT) + { + ext.Add(new JProperty( + ExtTextureTransformExtensionFactory.TEXCOORD, + TexCoord + )); + } + + return new JProperty(ExtTextureTransformExtensionFactory.EXTENSION_NAME, ext); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs.meta new file mode 100644 index 0000000..aa84b93 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f80e6282349fec4b81cd78cd8a9aa00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs new file mode 100644 index 0000000..4abcb95 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs @@ -0,0 +1,45 @@ +using Newtonsoft.Json.Linq; +using GLTF.Extensions; +using GLTF.Math; + +namespace GLTF.Schema +{ + public class ExtTextureTransformExtensionFactory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_texture_transform"; + public const string OFFSET = "offset"; + public const string ROTATION = "rotation"; + public const string SCALE = "scale"; + public const string TEXCOORD = "texCoord"; + + public ExtTextureTransformExtensionFactory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + Vector2 offset = new Vector2(ExtTextureTransformExtension.OFFSET_DEFAULT); + double rotation = 0; + Vector2 scale = new Vector2(ExtTextureTransformExtension.SCALE_DEFAULT); + int texCoord = ExtTextureTransformExtension.TEXCOORD_DEFAULT; + + if (extensionToken != null) + { + JToken offsetToken = extensionToken.Value[OFFSET]; + offset = offsetToken != null ? offsetToken.DeserializeAsVector2() : offset; + + JToken rotationToken = extensionToken.Value[ROTATION]; + rotation = rotationToken != null ? rotationToken.DeserializeAsDouble() : rotation; + + JToken scaleToken = extensionToken.Value[SCALE]; + scale = scaleToken != null ? scaleToken.DeserializeAsVector2() : scale; + + JToken texCoordToken = extensionToken.Value[TEXCOORD]; + texCoord = texCoordToken != null ? texCoordToken.DeserializeAsInt() : texCoord; + } + + return new ExtTextureTransformExtension(offset, rotation, scale, texCoord); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs.meta new file mode 100644 index 0000000..01c1891 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/ExtTextureTransformExtensionFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb5582955db3cc947a57a02c5bfe15aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs new file mode 100644 index 0000000..f27766b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs @@ -0,0 +1,412 @@ +using System; +using System.Collections.Generic; +using GLTF.Math; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using GLTF.Schema; + +namespace GLTF.Extensions +{ + public static class JsonReaderExtensions + { + public static List ReadStringList(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid array at: {0}", reader.Path)); + } + + var list = new List(); + + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + list.Add(reader.Value.ToString()); + } + + return list; + } + + public static List ReadDoubleList(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid array at: {0}", reader.Path)); + } + + var list = new List(); + + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + list.Add(double.Parse(reader.Value.ToString())); + } + + return list; + } + + public static List ReadInt32List(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid array at: {0}", reader.Path)); + } + + var list = new List(); + + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + list.Add(int.Parse(reader.Value.ToString())); + } + + return list; + } + + public static List ReadList(this JsonReader reader, Func deserializerFunc) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid array at: {0}", reader.Path)); + } + + var list = new List(); + + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + list.Add(deserializerFunc()); + + // deserializerFunc can advance to EndArray. We need to check for this case as well. + if (reader.TokenType == JsonToken.EndArray) + { + break; + } + } + + return list; + } + + public static TextureInfo DeserializeAsTexture(this JToken token, GLTFRoot root) + { + TextureInfo textureInfo = null; + + if (token != null) + { + JObject textureObject = token as JObject; + if (textureObject == null) + { + throw new Exception("JToken used for Texture deserialization was not a JObject. It was a " + token.Type.ToString()); + } + +#if DEBUG + // Broken on il2cpp. Don't ship debug DLLs there. + System.Diagnostics.Debug.WriteLine("textureObject is " + textureObject.Type + " with a value of: " + textureObject[TextureInfo.INDEX].Type + " " + textureObject.ToString()); +#endif + int indexVal = textureObject[TextureInfo.INDEX].DeserializeAsInt(); + textureInfo = new TextureInfo() + { + Index = new TextureId() + { + Id = indexVal, + Root = root + } + }; + if (textureObject.ContainsKey(TextureInfo.TEXCOORD)) + { + textureInfo.TexCoord = textureObject[TextureInfo.TEXCOORD].DeserializeAsInt(); + } + } + + return textureInfo; + } + + public static NormalTextureInfo DeserializeAsNormalTexture(this JToken token, GLTFRoot root) + { + var tex = DeserializeAsTexture(token, root); + if (tex != null) + { + var normalTex = new NormalTextureInfo() { Index = tex.Index, TexCoord = tex.TexCoord }; + JObject textureObject = token as JObject; + if (textureObject.ContainsKey(NormalTextureInfo.SCALE)) + { + normalTex.Scale = textureObject[NormalTextureInfo.SCALE].DeserializeAsDouble(); + } + + return normalTex; + } + + return null; + } + + public static int DeserializeAsInt(this JToken token) + { + if (token != null) + { + JValue intValue = token as JValue; + if (intValue == null) + { + throw new Exception("JToken used for int deserialization was not a JValue. It was a " + token.Type.ToString()); + } + + return (int)intValue; + } + + return 0; + } + + public static double DeserializeAsDouble(this JToken token) + { + if (token != null) + { + JValue doubleValue = token as JValue; + if (doubleValue == null) + { + throw new Exception("JToken used for double deserialization was not a JValue. It was a " + token.Type.ToString()); + } + + return (double)doubleValue; + } + + return 0d; + } + + public static Color ReadAsRGBAColor(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid color value at: {0}", reader.Path)); + } + + var color = new Color + { + R = (float) reader.ReadAsDouble().Value, + G = (float) reader.ReadAsDouble().Value, + B = (float) reader.ReadAsDouble().Value, + A = (float) reader.ReadAsDouble().Value + }; + + if (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + throw new Exception(string.Format("Invalid color value at: {0}", reader.Path)); + } + + return color; + } + + public static Color DeserializeAsColor(this JToken token) + { + Color color = Color.White; + + if (token != null) + { + JArray colorArray = token as JArray; + if (colorArray == null) + { + throw new Exception("JToken used for Color deserialization was not a JArray. It was a " + token.Type.ToString()); + } + if (colorArray.Count < 3) + { + throw new Exception("JArray used for Color deserialization did have less than 3 entries (needs to be RGB or RGBA). It had " + colorArray.Count); + } + + color = new Color + { + R = (float)colorArray[0].DeserializeAsDouble(), + G = (float)colorArray[1].DeserializeAsDouble(), + B = (float)colorArray[2].DeserializeAsDouble(), + A = (float)(colorArray.Count == 4 ? colorArray[3].DeserializeAsDouble() : 1.0), + }; + } + + return color; + } + + public static Color ReadAsRGBColor(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid vector value at: {0}", reader.Path)); + } + + var color = new Color + { + R = (float) reader.ReadAsDouble().Value, + G = (float) reader.ReadAsDouble().Value, + B = (float) reader.ReadAsDouble().Value, + A = 1.0f + }; + + if (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + throw new Exception(string.Format("Invalid color value at: {0}", reader.Path)); + } + + return color; + } + + public static Vector3 ReadAsVector3(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid vector value at: {0}", reader.Path)); + } + + var vector = new Vector3 + { + X = (float) reader.ReadAsDouble().Value, + Y = (float) reader.ReadAsDouble().Value, + Z = (float) reader.ReadAsDouble().Value + }; + + if (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + throw new Exception(string.Format("Invalid vector value at: {0}", reader.Path)); + } + + return vector; + } + + public static Vector2 DeserializeAsVector2(this JToken token) + { + Vector2 vector = new Vector2(); + + if (token != null) + { + JArray vectorArray = token as JArray; + if (vectorArray == null) + { + throw new Exception("JToken used for Vector2 deserialization was not a JArray. It was a " + token.Type.ToString()); + } + if (vectorArray.Count != 2) + { + throw new Exception("JArray used for Vector2 deserialization did not have 2 entries for XY. It had " + vectorArray.Count); + } + + vector = new Vector2 + { + X = (float)vectorArray[0].DeserializeAsDouble(), + Y = (float)vectorArray[1].DeserializeAsDouble() + }; + } + + return vector; + } + + public static Vector3 DeserializeAsVector3(this JToken token) + { + Vector3 vector = new Vector3(); + + if (token != null) + { + JArray vectorArray = token as JArray; + if (vectorArray == null) + { + throw new Exception("JToken used for Vector3 deserialization was not a JArray. It was a " + token.Type.ToString()); + } + if (vectorArray.Count != 3) + { + throw new Exception("JArray used for Vector3 deserialization did not have 3 entries for XYZ. It had " + vectorArray.Count); + } + + vector = new Vector3 + { + X = (float)vectorArray[0].DeserializeAsDouble(), + Y = (float)vectorArray[1].DeserializeAsDouble(), + Z = (float)vectorArray[2].DeserializeAsDouble() + }; + } + + return vector; + } + + public static Quaternion ReadAsQuaternion(this JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception(string.Format("Invalid vector value at: {0}", reader.Path)); + } + + var quat = new Quaternion + { + X = (float) reader.ReadAsDouble().Value, + Y = (float) reader.ReadAsDouble().Value, + Z = (float) reader.ReadAsDouble().Value, + W = (float) reader.ReadAsDouble().Value + }; + + if (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + throw new Exception(string.Format("Invalid vector value at: {0}", reader.Path)); + } + + return quat; + } + + public static Dictionary ReadAsDictionary(this JsonReader reader, Func deserializerFunc, bool skipStartObjectRead = false) + { + if (!skipStartObjectRead && reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception(string.Format("Dictionary must be an object at: {0}.", reader.Path)); + } + + var dict = new Dictionary(); + + while (reader.Read() && reader.TokenType != JsonToken.EndObject) + { + dict.Add(reader.Value.ToString(), deserializerFunc()); + } + + return dict; + } + + public static Dictionary ReadAsObjectDictionary(this JsonReader reader, bool skipStartObjectRead = false) + { + if (!skipStartObjectRead && reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception(string.Format("Dictionary must be an object at: {0}", reader.Path)); + } + + var dict = new Dictionary(); + + while (reader.Read() && reader.TokenType != JsonToken.EndObject) + { + dict.Add(reader.Value.ToString(), ReadDictionaryValue(reader)); + } + + return dict; + } + + private static object ReadDictionaryValue(JsonReader reader) + { + if (!reader.Read()) + { + return null; + } + + switch (reader.TokenType) + { + case JsonToken.StartArray: + return reader.ReadObjectList(); + case JsonToken.StartObject: + return reader.ReadAsObjectDictionary(true); + default: + return reader.Value; + } + } + + private static List ReadObjectList(this JsonReader reader) + { + + var list = new List(); + + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + list.Add(reader.Value); + } + + return list; + } + + public static T ReadStringEnum(this JsonReader reader) + { + return (T) Enum.Parse(typeof(T), reader.ReadAsString()); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs.meta new file mode 100644 index 0000000..d29d438 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/GLTFJsonExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b39ce55534dbbf4ab3dceec1cec6317 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs new file mode 100644 index 0000000..64f4a20 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs @@ -0,0 +1,392 @@ +using System; +using System.Collections.Generic; +using GLTF.Math; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using GLTF.Extensions; + +namespace GLTF.Schema.KHR_lights_punctual +{ + /// + /// Specifies the light type. + /// + public enum LightType + { + directional, + point, + spot + } + + /// + /// Texture sampler properties for filtering and wrapping modes. + /// + public class Spot + { + private const string PNAME_INNERCONEANGLE = "innerConeAngle"; + private const string PNAME_OUTERCONEANGLE = "outerConeAngle"; + + public static readonly double INNER_DEFAULT = 0d; + public static readonly double OUTER_DEFAULT = 0.7853981633974483d; + /// + /// Angle, in radians, from centre of spotlight where falloff begins. Must be greater than or equal to 0 and less than outerConeAngle. + /// + public double InnerConeAngle = INNER_DEFAULT; + + /// + /// Angle, in radians, from centre of spotlight where falloff ends. Must be greater than innerConeAngle and less than or equal to PI / 2.0. + /// + public double OuterConeAngle = OUTER_DEFAULT; + + public Spot() + { + } + + public static Spot Deserialize(JsonReader reader) + { + var spot = new Spot(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + return spot; + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case PNAME_INNERCONEANGLE: + spot.InnerConeAngle= reader.ReadAsDouble().Value; + break; + case PNAME_OUTERCONEANGLE: + spot.OuterConeAngle= reader.ReadAsDouble().Value; + break; + } + } + + return spot; + } + + public void Serialize(JsonWriter writer) + { + if( InnerConeAngle > OuterConeAngle) + { + throw new Exception("Spot's InnerConeAngle must be less or equal OuterConeAngle"); + } + + if (OuterConeAngle > 1.5707963267948966d ) + { + throw new Exception("Spot's OuterConeAngle must be less or equal Pi/2"); + } + + writer.WriteStartObject(); + + if (InnerConeAngle != INNER_DEFAULT) + { + writer.WritePropertyName(PNAME_INNERCONEANGLE); + writer.WriteValue(InnerConeAngle); + } + + if (OuterConeAngle != OUTER_DEFAULT) + { + writer.WritePropertyName(PNAME_OUTERCONEANGLE); + writer.WriteValue(OuterConeAngle); + } + + writer.WriteEndObject(); + } + } + + public class PunctualLight : GLTFChildOfRootProperty + { + private const string PNAME_TYPE = "type"; + private const string PNAME_COLOR = "color"; + private const string PNAME_INTENSITY = "intensity"; + private const string PNAME_RANGE = "range"; + private const string PNAME_SPOT = "spot"; + + public static readonly Color COLOR_DEFAULT = Color.White; + public static readonly double RANGE_DEFAULT = -1d; + public static readonly double INTENSITY_DEFAULT = 1d; + + /// + /// Specifies the light type. + /// + public LightType Type; + + /// + /// Color of the light source. + /// + public Color Color = COLOR_DEFAULT; + + /// + /// Intensity of the light source. `point` and `spot` lights use luminous intensity in candela (lm/sr) while `directional` lights use illuminance in lux (lm/m^2) + /// + public double Intensity = INTENSITY_DEFAULT; + + /// + /// A distance cutoff at which the light's intensity may be considered to have reached zero. + /// + public double Range = RANGE_DEFAULT; + + /// + /// spot's inner and outer angle, must exist for spot types + /// + public Spot Spot; + + public PunctualLight() + { + + } + + public PunctualLight(PunctualLight light, GLTFRoot gltfRoot) : base(light, gltfRoot) + { + Type = light.Type; + Color = light.Color; + Intensity = light.Intensity; + Range = light.Range; + Spot = light.Spot; + } + + public static PunctualLight Deserialize(GLTFRoot root, JsonReader reader) + { + var light = new PunctualLight(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Light must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case PNAME_TYPE: + light.Type = reader.ReadStringEnum(); + break; + case PNAME_COLOR: + light.Color = reader.ReadAsRGBColor(); + break; + case PNAME_INTENSITY: + light.Intensity = reader.ReadAsDouble().Value; + break; + case PNAME_RANGE: + light.Range = reader.ReadAsDouble().Value; + break; + case PNAME_SPOT: + light.Spot = Spot.Deserialize(reader); + break; + default: + light.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return light; + } + + public static PunctualLight Deserialize(GLTFRoot root, JToken token) + { + using (JsonReader reader = new JTokenReader(token)) + { + return Deserialize(root, reader); + } + } + + override public void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName(PNAME_TYPE); + writer.WriteValue(Type.ToString()); + + + if (Color != COLOR_DEFAULT) + { + writer.WritePropertyName(PNAME_COLOR); + writer.WriteStartArray(); + writer.WriteValue(Color.R); + writer.WriteValue(Color.G); + writer.WriteValue(Color.B); + writer.WriteEndArray(); + } + + if (Intensity != INTENSITY_DEFAULT) + { + writer.WritePropertyName(PNAME_INTENSITY); + writer.WriteValue(Intensity); + } + + if (Range != RANGE_DEFAULT) + { + writer.WritePropertyName(PNAME_RANGE); + writer.WriteValue(Range); + } + + if (Type == LightType.spot) + { + writer.WritePropertyName(PNAME_SPOT); + Spot.Serialize(writer); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + + public JObject Serialize() + { + JTokenWriter writer = new JTokenWriter(); + Serialize(writer); + return (JObject)writer.Token; + } + } + + public class KHR_LightsPunctualRootExtension : IExtension + { + public const string EXTENSION_NAME = "KHR_lights_punctual"; + + public readonly IList lights; + + public KHR_LightsPunctualRootExtension(IList lights) + { + this.lights = lights; + } + + public JProperty Serialize() + { + var obj = new JObject(); + var arr = new JArray(); + obj.Add("lights", arr); + foreach (var light in lights) + { + var lightInfo = new JObject(); + arr.Add(lightInfo); + lightInfo.Add("type", light.type); + if (light.range > 0) lightInfo.Add("range", light.range); + if(System.Math.Abs(light.intensity - 1f) > .0000001) lightInfo.Add("intensity", light.intensity); + lightInfo.Add("name", light.Name ?? light.name); + lightInfo.Add("color", new JArray(light.color.R, light.color.G, light.color.B)); + // TODO why is this not using the specific spotlight serializer/deserializer? + if (light is GLTFSpotLight spotLight) + { + lightInfo.Add("spot", new JObject( + new JProperty(nameof(spotLight.innerConeAngle), spotLight.innerConeAngle), + new JProperty(nameof(spotLight.outerConeAngle), spotLight.outerConeAngle))); + } + } + return new JProperty(EXTENSION_NAME, obj); + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_LightsPunctualRootExtension(lights); + } + } + + public class KHR_LightsPunctualExtension : IExtension + { + public List Lights; + + public KHR_LightsPunctualExtension() + { + Lights = new List(); + } + + public IExtension Clone(GLTFRoot root) + { + var clone = new KHR_LightsPunctualExtension(); + for (int i = 0; i < Lights.Count; i++) + { + clone.Lights.Add(new PunctualLight(Lights[i], root)); + } + return clone; + } + + public JProperty Serialize() + { + return new JProperty(KHR_lights_punctualExtensionFactory.EXTENSION_NAME, + new JObject( + new JProperty(KHR_lights_punctualExtensionFactory.PNAME_LIGHTS, new JArray(Lights)) + ) + ); + } + } + + public class PunctualLightId : GLTFId + { + public PunctualLightId() + { + } + + public PunctualLightId(PunctualLightId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override PunctualLight Value + { + get + { + if (Root.Extensions.TryGetValue(KHR_lights_punctualExtensionFactory.EXTENSION_NAME, out IExtension iextension)) + { + KHR_LightsPunctualExtension extension = iextension as KHR_LightsPunctualExtension; + return extension.Lights[Id]; + } + else + { + throw new Exception("KHR_lights_punctual not found on root object"); + } + } + } + + public static PunctualLightId Deserialize(GLTFRoot root, JsonReader reader) + { + return new PunctualLightId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class KHR_LightsPunctualNodeExtension : IExtension + { + public PunctualLightId LightId; + + public KHR_LightsPunctualNodeExtension() + { + + } + + public KHR_LightsPunctualNodeExtension(PunctualLightId lightId, GLTFRoot gltfRoot) + { + LightId = lightId; + } + + public KHR_LightsPunctualNodeExtension( int lightId, GLTFRoot gltfRoot) + { + LightId = new PunctualLightId + { + Id = lightId, + Root = gltfRoot + }; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_LightsPunctualNodeExtension(LightId.Id, root); + } + + public JProperty Serialize() + { + return new JProperty(KHR_lights_punctualExtensionFactory.EXTENSION_NAME, + new JObject( + new JProperty(KHR_lights_punctualExtensionFactory.PNAME_LIGHT, LightId.Id ) + ) + ); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs.meta new file mode 100644 index 0000000..ac16453 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8451131b54699e840ba8425046aec379 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs new file mode 100644 index 0000000..7475606 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs @@ -0,0 +1,49 @@ + + +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema.KHR_lights_punctual +{ + public class KHR_lights_punctualExtensionFactory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_lights_punctual"; + + + public const string PNAME_LIGHTS = "lights"; + public const string PNAME_LIGHT = "light"; + + public KHR_lights_punctualExtensionFactory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + JToken lightsToken = extensionToken.Value[PNAME_LIGHTS]; + + if (lightsToken != null) + { + var extension = new KHR_LightsPunctualExtension(); + JArray lightsArray = lightsToken as JArray; + foreach( var lightToken in lightsArray.Children()) + { + extension.Lights.Add(PunctualLight.Deserialize(root, lightToken)); + } + return extension; + } + + JToken nodelightToken = extensionToken.Value[PNAME_LIGHT]; + + if (nodelightToken != null) + { + PunctualLightId lightId = PunctualLightId.Deserialize(root, nodelightToken.CreateReader() ); + return new KHR_LightsPunctualNodeExtension( lightId, root ); + } + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs.meta new file mode 100644 index 0000000..1fc5de8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_LightsPunctualExtensionFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f6f51e6a8e36a7641bde14286a98f0d5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs new file mode 100644 index 0000000..eb24521 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs @@ -0,0 +1,38 @@ +using GLTF.Schema; +using Newtonsoft.Json.Linq; + +namespace UnityGLTF.Extensions +{ + + // see https://github.com/KhronosGroup/glTF/pull/2147 + public class KHR_animation_pointer : IExtension + { + public const string EXTENSION_NAME = "KHR_animation_pointer"; + + public object animatedObject; + public string propertyBinding; + public string path; + public AnimationChannelTarget channel; + + // when cloned, the path is late resolved in gltf exporter so the clone path will not be resolved because it wont be registered to the exporter's resolver + private KHR_animation_pointer clonedFrom; + + public JProperty Serialize() + { + if (path == null && clonedFrom != null) path = clonedFrom.path; + return new JProperty(EXTENSION_NAME, new JObject(new JProperty("pointer", path))); + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_animation_pointer + { + animatedObject = animatedObject, + propertyBinding = propertyBinding, + path = path, + channel = channel, + clonedFrom = this + }; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs.meta new file mode 100644 index 0000000..6e7b414 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_animation_pointer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 674db370468f4e2491e20dbadfa2a640 +timeCreated: 1648456390 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs new file mode 100644 index 0000000..06d3f05 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs @@ -0,0 +1,96 @@ +using System; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + // https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md + [Serializable] + public class KHR_materials_clearcoat : IExtension + { + public float clearcoatFactor = 0f; + public TextureInfo clearcoatTexture; // R channel + public float clearcoatRoughnessFactor = 0f; + public TextureInfo clearcoatRoughnessTexture; // G channel + public TextureInfo clearcoatNormalTexture; + + public JProperty Serialize() + { + var jo = new JObject(); + JProperty jProperty = new JProperty(KHR_materials_clearcoat_Factory.EXTENSION_NAME, jo); + + // TODO all these properties should only be added if non-default + + if (clearcoatFactor != 0) + jo.Add(new JProperty(nameof(clearcoatFactor), clearcoatFactor)); + if (clearcoatTexture != null) { + jo.Add(new JProperty(nameof(clearcoatTexture), + new JObject( + new JProperty(TextureInfo.INDEX, clearcoatTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, clearcoatTexture.TexCoord) + ) + ) + ); + } + if (clearcoatRoughnessFactor != 0) + jo.Add(new JProperty(nameof(clearcoatRoughnessFactor), clearcoatRoughnessFactor)); + if (clearcoatRoughnessTexture != null) { + jo.Add(new JProperty(nameof(clearcoatRoughnessTexture), + new JObject( + new JProperty(TextureInfo.INDEX, clearcoatRoughnessTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, clearcoatRoughnessTexture.TexCoord) + ) + ) + ); + } + if (clearcoatNormalTexture != null) { + jo.Add(new JProperty(nameof(clearcoatNormalTexture), + new JObject( + new JProperty(TextureInfo.INDEX, clearcoatNormalTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, clearcoatNormalTexture.TexCoord) + // new JProperty(NormalTextureInfo.SCALE, clearcoatNormalTexture.Scale) // TODO needs better normal scale export, uses only the base normal right now + ) + ) + ); + } + return jProperty; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_materials_clearcoat() + { + clearcoatFactor = clearcoatFactor, clearcoatTexture = clearcoatTexture, + clearcoatRoughnessFactor = clearcoatRoughnessFactor, clearcoatRoughnessTexture = clearcoatRoughnessTexture, + clearcoatNormalTexture = clearcoatNormalTexture, + }; + } + } + + public class KHR_materials_clearcoat_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_clearcoat"; + + public KHR_materials_clearcoat_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + var extension = new KHR_materials_clearcoat(); + extension.clearcoatFactor = extensionToken.Value[nameof(KHR_materials_clearcoat.clearcoatFactor)]?.Value() ?? 0; + extension.clearcoatTexture = extensionToken.Value[nameof(KHR_materials_clearcoat.clearcoatTexture)]?.DeserializeAsTexture(root); + extension.clearcoatRoughnessFactor = extensionToken.Value[nameof(KHR_materials_clearcoat.clearcoatRoughnessFactor)]?.Value() ?? 0; + extension.clearcoatRoughnessTexture = extensionToken.Value[nameof(KHR_materials_clearcoat.clearcoatRoughnessTexture)]?.DeserializeAsTexture(root); + extension.clearcoatNormalTexture = extensionToken.Value[nameof(KHR_materials_clearcoat.clearcoatNormalTexture)]?.DeserializeAsTexture(root); + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs.meta new file mode 100644 index 0000000..d31ab0ca --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_clearcoat.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8427a62b522f4f2d84dda8d98fa76701 +timeCreated: 1673353427 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs new file mode 100644 index 0000000..1de249a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs @@ -0,0 +1,56 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + public class KHR_materials_emissive_strength : GLTFProperty, IExtension + { + public KHR_materials_emissive_strength() { } + + public KHR_materials_emissive_strength(KHR_materials_emissive_strength ext, GLTFRoot root) : base(ext, root) { } + + public IExtension Clone(GLTFRoot gltfRoot) + { + return new KHR_materials_emissive_strength(this, gltfRoot); + } + + public JProperty Serialize() + { + var jo = new JObject(); + JProperty jProperty = new JProperty(KHR_materials_emissive_strength_Factory.EXTENSION_NAME, jo); + + if(emissiveStrength != 1.0f) + jo.Add(new JProperty(nameof(emissiveStrength), emissiveStrength)); + + return jProperty; + } + + public float emissiveStrength = 1.0f; + } + + public class KHR_materials_emissive_strength_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_emissive_strength"; + + public KHR_materials_emissive_strength_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + var extension = new KHR_materials_emissive_strength(); + + JToken strength = extensionToken.Value[nameof(KHR_materials_emissive_strength.emissiveStrength)]; + if (strength != null) + extension.emissiveStrength = strength.Value(); + + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs.meta new file mode 100644 index 0000000..14a20a9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_emissive_strength.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f4a07b6badfb6844e8d34a3a9b15a6f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs new file mode 100644 index 0000000..19209cb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs @@ -0,0 +1,53 @@ +using System; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + // https: //github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_ior + [Serializable] + public class KHR_materials_ior : IExtension + { + public const float DefaultIor = 1.5f; + public float ior = 1.5f; + + public JProperty Serialize() + { + var obj = new JObject(); + if (System.Math.Abs(ior - DefaultIor) > 0.00001f) + obj.Add(new JProperty(nameof(ior), ior)); + JProperty jProperty = new JProperty(KHR_materials_ior_Factory.EXTENSION_NAME, obj); + return jProperty; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_materials_ior() { ior = ior }; + } + } + + public class KHR_materials_ior_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_ior"; + + public KHR_materials_ior_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + JToken strength = extensionToken.Value[nameof(KHR_materials_ior.ior)]; + var extension = new KHR_materials_ior(); + if (strength != null) + { + extension.ior = strength.Value(); + } + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs.meta new file mode 100644 index 0000000..0cf59e0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_ior.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e7620ff271fb4b39934ce610b28e27ef +timeCreated: 1653603717 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs new file mode 100644 index 0000000..0d6b827 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs @@ -0,0 +1,88 @@ +using System; +using GLTF.Extensions; +using Newtonsoft.Json.Linq; +using Color = GLTF.Math.Color; + +namespace GLTF.Schema +{ + // https://github.com/ux3d/glTF/tree/extensions/KHR_materials_iridescence/extensions/2.0/Khronos/KHR_materials_iridescence + [Serializable] + public class KHR_materials_iridescence : IExtension + { + public float iridescenceFactor = 0f; + public TextureInfo iridescenceTexture; // R channel + public float iridescenceIor = 1.3f; + public float iridescenceThicknessMinimum = 100.0f; + public float iridescenceThicknessMaximum = 400.0f; + public TextureInfo iridescenceThicknessTexture; // G channel + + public static readonly Color COLOR_DEFAULT = Color.White; + + public JProperty Serialize() + { + var jo = new JObject(); + JProperty jProperty = new JProperty(KHR_materials_iridescence_Factory.EXTENSION_NAME, jo); + + if (iridescenceFactor != 0) jo.Add(new JProperty(nameof(iridescenceFactor), iridescenceFactor)); + if (iridescenceIor != 1.3f) jo.Add(new JProperty(nameof(iridescenceIor), iridescenceIor)); + if (iridescenceThicknessMinimum != 100.0f) jo.Add(new JProperty(nameof(iridescenceThicknessMinimum), iridescenceThicknessMinimum)); + if (iridescenceThicknessMaximum != 400.0f) jo.Add(new JProperty(nameof(iridescenceThicknessMaximum), iridescenceThicknessMaximum)); + if (iridescenceTexture != null) { + jo.Add(new JProperty(nameof(iridescenceTexture), + new JObject( + new JProperty(TextureInfo.INDEX, iridescenceTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, iridescenceTexture.TexCoord) + ) + ) + ); + } + if (iridescenceThicknessTexture != null) { + jo.Add(new JProperty(nameof(iridescenceThicknessTexture), + new JObject( + new JProperty(TextureInfo.INDEX, iridescenceThicknessTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, iridescenceThicknessTexture.TexCoord) + ) + ) + ); + } + return jProperty; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_materials_iridescence() + { + iridescenceFactor = iridescenceFactor, iridescenceIor = iridescenceIor, + iridescenceThicknessMinimum = iridescenceThicknessMinimum, iridescenceThicknessMaximum = iridescenceThicknessMaximum, + iridescenceTexture = iridescenceTexture, iridescenceThicknessTexture = iridescenceThicknessTexture, + }; + } + } + + public class KHR_materials_iridescence_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_iridescence"; + + public KHR_materials_iridescence_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + var extension = new KHR_materials_iridescence(); + extension.iridescenceFactor = extensionToken.Value[nameof(KHR_materials_iridescence.iridescenceFactor)]?.Value() ?? 0; + extension.iridescenceIor = extensionToken.Value[nameof(KHR_materials_iridescence.iridescenceIor)]?.Value() ?? 1.3f; + extension.iridescenceThicknessMinimum = extensionToken.Value[nameof(KHR_materials_iridescence.iridescenceThicknessMinimum)]?.Value() ?? 100f; + extension.iridescenceThicknessMaximum = extensionToken.Value[nameof(KHR_materials_iridescence.iridescenceThicknessMaximum)]?.Value() ?? 400f; + extension.iridescenceTexture = extensionToken.Value[nameof(KHR_materials_iridescence.iridescenceTexture)]?.DeserializeAsTexture(root); + extension.iridescenceThicknessTexture = extensionToken.Value[nameof(KHR_materials_iridescence.iridescenceThicknessTexture)]?.DeserializeAsTexture(root); + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs.meta new file mode 100644 index 0000000..cb338a7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_iridescence.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0702e45c391babb47b93be6ff38f4e3e +timeCreated: 1653603693 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs new file mode 100644 index 0000000..9c1843c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs @@ -0,0 +1,98 @@ +using GLTF.Math; +using GLTF.Schema; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + /// + /// glTF extension that defines the specular-glossiness + /// material model from Physically-Based Rendering (PBR) methodology. + /// + /// Spec can be found here: + /// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness + /// + public class KHR_materials_pbrSpecularGlossinessExtension : IExtension + { + public static readonly Vector3 SPEC_FACTOR_DEFAULT = new Vector3(1.0f, 1.0f, 1.0f); + public static readonly double GLOSS_FACTOR_DEFAULT = 1.0d; + + /// + /// The RGBA components of the reflected diffuse color of the material. + /// Metals have a diffuse value of [0.0, 0.0, 0.0]. + /// The fourth component (A) is the alpha coverage of the material. + /// The property specifies how alpha is interpreted. + /// The values are linear. + /// + public Color DiffuseFactor = Color.White; + public static readonly Color DIFFUSE_FACTOR_DEFAULT = Color.White; + + /// + /// The diffuse texture. + /// This texture contains RGB(A) components of the reflected diffuse color of the material in sRGB color space. + /// If the fourth component (A) is present, it represents the alpha coverage of the + /// material. Otherwise, an alpha of 1.0 is assumed. + /// The property specifies how alpha is interpreted. + /// The stored texels must not be premultiplied. + /// + public TextureInfo DiffuseTexture; + public static readonly TextureInfo DIFFUSE_TEXTURE_DEFAULT = new TextureInfo(); + + /// + /// The specular RGB color of the material. This value is linear + /// + public Vector3 SpecularFactor = SPEC_FACTOR_DEFAULT; + + /// + /// The glossiness or smoothness of the material. + /// A value of 1.0 means the material has full glossiness or is perfectly smooth. + /// A value of 0.0 means the material has no glossiness or is completely rough. + /// This value is linear. + /// + public double GlossinessFactor = GLOSS_FACTOR_DEFAULT; + + /// + /// The specular-glossiness texture is RGBA texture, containing the specular color of the material (RGB components) and its glossiness (A component). + /// The values are in sRGB space. + /// + public TextureInfo SpecularGlossinessTexture; + public static readonly TextureInfo SPECULAR_GLOSSINESS_TEXTURE_DEFAULT = new TextureInfo(); + + public KHR_materials_pbrSpecularGlossinessExtension(Color diffuseFactor, TextureInfo diffuseTexture, Vector3 specularFactor, double glossinessFactor, TextureInfo specularGlossinessTexture) + { + DiffuseFactor = diffuseFactor; + DiffuseTexture = diffuseTexture; + SpecularFactor = specularFactor; + GlossinessFactor = glossinessFactor; + SpecularGlossinessTexture = specularGlossinessTexture; + } + + public IExtension Clone(GLTFRoot gltfRoot) + { + return new KHR_materials_pbrSpecularGlossinessExtension( + DiffuseFactor, + DiffuseTexture != null ? new TextureInfo(DiffuseTexture, gltfRoot) : null, + SpecularFactor, + GlossinessFactor, + SpecularGlossinessTexture != null ? new TextureInfo(SpecularGlossinessTexture, gltfRoot) : null); + } + + public JProperty Serialize() + { + var jo = new JObject(); + jo.Add(KHR_materials_pbrSpecularGlossinessExtensionFactory.DIFFUSE_FACTOR, new JArray(DiffuseFactor.R, DiffuseFactor.G, DiffuseFactor.B, DiffuseFactor.A)); + if(DiffuseTexture != null && DiffuseTexture.Index != null) + jo.Add(KHR_materials_pbrSpecularGlossinessExtensionFactory.DIFFUSE_TEXTURE, new JObject( + new JProperty(TextureInfo.INDEX, DiffuseTexture.Index.Id))); + jo.Add(KHR_materials_pbrSpecularGlossinessExtensionFactory.SPECULAR_FACTOR, new JArray(SpecularFactor.X, SpecularFactor.Y, SpecularFactor.Z)); + jo.Add(KHR_materials_pbrSpecularGlossinessExtensionFactory.GLOSSINESS_FACTOR, GlossinessFactor); + if(SpecularGlossinessTexture != null && SpecularGlossinessTexture.Index != null) + jo.Add(KHR_materials_pbrSpecularGlossinessExtensionFactory.SPECULAR_GLOSSINESS_TEXTURE, new JObject( + new JProperty(TextureInfo.INDEX, SpecularGlossinessTexture.Index.Id))); + + JProperty jProperty = new JProperty(KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME, jo); + + return jProperty; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs.meta new file mode 100644 index 0000000..597290e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59da86adeec3c394c9ba4e017a23db4a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs new file mode 100644 index 0000000..43cd7f1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs @@ -0,0 +1,51 @@ +using System; +using Newtonsoft.Json.Linq; +using GLTF.Math; +using Newtonsoft.Json; +using GLTF.Extensions; + +namespace GLTF.Schema +{ + public class KHR_materials_pbrSpecularGlossinessExtensionFactory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_pbrSpecularGlossiness"; + public const string DIFFUSE_FACTOR = "diffuseFactor"; + public const string DIFFUSE_TEXTURE = "diffuseTexture"; + public const string SPECULAR_FACTOR = "specularFactor"; + public const string GLOSSINESS_FACTOR = "glossinessFactor"; + public const string SPECULAR_GLOSSINESS_TEXTURE = "specularGlossinessTexture"; + + public KHR_materials_pbrSpecularGlossinessExtensionFactory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + Color diffuseFactor = Color.White; + TextureInfo diffuseTextureInfo = new TextureInfo(); + Vector3 specularFactor = KHR_materials_pbrSpecularGlossinessExtension.SPEC_FACTOR_DEFAULT; + double glossinessFactor = KHR_materials_pbrSpecularGlossinessExtension.GLOSS_FACTOR_DEFAULT; + TextureInfo specularGlossinessTextureInfo = new TextureInfo(); + + if (extensionToken != null) + { +#if DEBUG + // Broken on il2cpp. Don't ship debug DLLs there. + System.Diagnostics.Debug.WriteLine(extensionToken.Value.ToString()); + System.Diagnostics.Debug.WriteLine(extensionToken.Value.Type); +#endif + JToken diffuseFactorToken = extensionToken.Value[DIFFUSE_FACTOR]; + diffuseFactor = diffuseFactorToken != null ? diffuseFactorToken.DeserializeAsColor() : diffuseFactor; + diffuseTextureInfo = extensionToken.Value[DIFFUSE_TEXTURE].DeserializeAsTexture(root); + JToken specularFactorToken = extensionToken.Value[SPECULAR_FACTOR]; + specularFactor = specularFactorToken != null ? specularFactorToken.DeserializeAsVector3() : specularFactor; + JToken glossinessFactorToken = extensionToken.Value[GLOSSINESS_FACTOR]; + glossinessFactor = glossinessFactorToken != null ? glossinessFactorToken.DeserializeAsDouble() : glossinessFactor; + specularGlossinessTextureInfo = extensionToken.Value[SPECULAR_GLOSSINESS_TEXTURE].DeserializeAsTexture(root); + } + + return new KHR_materials_pbrSpecularGlossinessExtension(diffuseFactor, diffuseTextureInfo, specularFactor, glossinessFactor, specularGlossinessTextureInfo); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs.meta new file mode 100644 index 0000000..b21acd7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_pbrSpecularGlossinessExtensionFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2d8808686675fa540b28186541d0b196 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs new file mode 100644 index 0000000..39ac39a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs @@ -0,0 +1,81 @@ +using System; +using GLTF.Extensions; +using Newtonsoft.Json.Linq; +using Color = GLTF.Math.Color; + +namespace GLTF.Schema +{ + // https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_specular/README.md + [Serializable] + public class KHR_materials_specular : IExtension + { + public float specularFactor = 1f; + public TextureInfo specularTexture; // A channel + public Color specularColorFactor = COLOR_DEFAULT; + public TextureInfo specularColorTexture; // RGB channel + + public static readonly Color COLOR_DEFAULT = Color.White; + + public JProperty Serialize() + { + var jo = new JObject(); + JProperty jProperty = new JProperty(KHR_materials_specular_Factory.EXTENSION_NAME, jo); + + if (specularFactor != 1) jo.Add(new JProperty(nameof(specularFactor), specularFactor)); + if (specularColorFactor != COLOR_DEFAULT) jo.Add(new JProperty(nameof(specularColorFactor), new JArray(specularColorFactor.R, specularColorFactor.G, specularColorFactor.B))); + if (specularTexture != null) { + jo.Add(new JProperty(nameof(specularTexture), + new JObject( + new JProperty(TextureInfo.INDEX, specularTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, specularTexture.TexCoord) + ) + ) + ); + } + if (specularColorTexture != null) { + jo.Add(new JProperty(nameof(specularColorTexture), + new JObject( + new JProperty(TextureInfo.INDEX, specularColorTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, specularColorTexture.TexCoord) + ) + ) + ); + } + return jProperty; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_materials_specular() + { + specularFactor = specularFactor, specularTexture = specularTexture, + specularColorFactor = specularColorFactor, specularColorTexture = specularColorTexture, + }; + } + } + + public class KHR_materials_specular_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_specular"; + + public KHR_materials_specular_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + var extension = new KHR_materials_specular(); + extension.specularFactor = extensionToken.Value[nameof(KHR_materials_specular.specularFactor)]?.Value() ?? 1; + extension.specularColorFactor = extensionToken.Value[nameof(KHR_materials_specular.specularColorFactor)]?.DeserializeAsColor() ?? Color.White; + extension.specularTexture = extensionToken.Value[nameof(KHR_materials_specular.specularTexture)]?.DeserializeAsTexture(root); + extension.specularColorTexture = extensionToken.Value[nameof(KHR_materials_specular.specularColorTexture)]?.DeserializeAsTexture(root); + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs.meta new file mode 100644 index 0000000..79ba412 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_specular.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cd1a3f573b7b4639854c977d6826c9b2 +timeCreated: 1653662141 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs new file mode 100644 index 0000000..b9e5ec0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs @@ -0,0 +1,58 @@ +using System; +using GLTF.Extensions; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ +// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_transmission + [Serializable] + public class KHR_materials_transmission : IExtension + { + public float transmissionFactor = 0.0f; + public TextureInfo transmissionTexture; // transmissionTexture // R channel + + public JProperty Serialize() + { + var jo = new JObject(); + if (transmissionFactor != 0) jo.Add(new JProperty(nameof(transmissionFactor), transmissionFactor)); + if (transmissionTexture != null) + jo.Add(new JProperty(nameof(transmissionTexture), + new JObject( + new JProperty(TextureInfo.INDEX, transmissionTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, transmissionTexture.TexCoord) // TODO don't write if default + ) + ) + ); + JProperty jProperty = new JProperty(KHR_materials_transmission_Factory.EXTENSION_NAME, jo); + return jProperty; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_materials_transmission() { transmissionFactor = transmissionFactor, transmissionTexture = transmissionTexture }; + } + } + + public class KHR_materials_transmission_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_transmission"; + + public KHR_materials_transmission_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + var extension = new KHR_materials_transmission(); + extension.transmissionFactor = extensionToken.Value[nameof(KHR_materials_transmission.transmissionFactor)]?.Value() ?? 0; + extension.transmissionTexture = extensionToken.Value[nameof(KHR_materials_transmission.transmissionTexture)]?.DeserializeAsTexture(root); + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs.meta new file mode 100644 index 0000000..5bdac95 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_transmission.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ae9748bb15524941ba2cda5ed4d3dbb4 +timeCreated: 1653603710 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs new file mode 100644 index 0000000..2020d28 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + /// + /// This extension defines an unlit shading model for use in glTF 2.0 materials, as an alternative to the Physically Based Rendering (PBR) shading models provided by the core specification. + /// + /// Spec can be found here: + /// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit + /// + public class KHR_MaterialsUnlitExtension : GLTFProperty, IExtension + { + public KHR_MaterialsUnlitExtension() { } + + public KHR_MaterialsUnlitExtension(KHR_MaterialsUnlitExtension ext, GLTFRoot root) : base(ext, root) { } + + public IExtension Clone(GLTFRoot gltfRoot) + { + return new KHR_MaterialsUnlitExtension(this, gltfRoot); + } + + override public void Serialize(JsonWriter writer) + { + writer.WritePropertyName(KHR_MaterialsUnlitExtensionFactory.EXTENSION_NAME); + writer.WriteStartObject(); + base.Serialize(writer); + writer.WriteEndObject(); + } + + public JProperty Serialize() + { + JTokenWriter writer = new JTokenWriter(); + Serialize(writer); + return (JProperty)writer.Token; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs.meta new file mode 100644 index 0000000..0413934 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebec0fdc2a825ef4d8c526c0a5d8c0b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs new file mode 100644 index 0000000..f0147a6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs @@ -0,0 +1,23 @@ +using System; +using Newtonsoft.Json.Linq; +using GLTF.Math; +using Newtonsoft.Json; +using GLTF.Extensions; + +namespace GLTF.Schema +{ + public class KHR_MaterialsUnlitExtensionFactory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_unlit"; + + public KHR_MaterialsUnlitExtensionFactory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + return new KHR_MaterialsUnlitExtension(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs.meta new file mode 100644 index 0000000..ec7ac58 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_unlitExtensionFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15b8bb59cb9b65e4f92a9cf273cdcf8d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs new file mode 100644 index 0000000..f9035ac --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs @@ -0,0 +1,80 @@ +using System; +using GLTF.Extensions; +using Newtonsoft.Json.Linq; +using Color = GLTF.Math.Color; + +namespace GLTF.Schema +{ + // https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_volume + [Serializable] + public class KHR_materials_volume : IExtension + { + public float thicknessFactor = 0f; + public TextureInfo thicknessTexture;// thicknessTexture // G channel + public float attenuationDistance = float.PositiveInfinity; + public Color attenuationColor = new Color(1, 1, 1, 1); + + public static readonly Color COLOR_DEFAULT = Color.White; + + public JProperty Serialize() + { + var jo = new JObject(); + JProperty jProperty = new JProperty(KHR_materials_volume_Factory.EXTENSION_NAME, jo); + + if (thicknessFactor != 0) jo.Add(new JProperty(nameof(thicknessFactor), thicknessFactor)); + if (!float.IsPositiveInfinity(attenuationDistance)) + { + // 0 not allowed + if (!(attenuationDistance > 0)) + attenuationDistance = 0.0001f; + + jo.Add(new JProperty(nameof(attenuationDistance), attenuationDistance)); + } + if (attenuationColor != COLOR_DEFAULT) jo.Add(new JProperty(nameof(attenuationColor), new JArray(attenuationColor.R, attenuationColor.G, attenuationColor.B))); + if (thicknessTexture != null) { + jo.Add(new JProperty(nameof(thicknessTexture), + new JObject( + new JProperty(TextureInfo.INDEX, thicknessTexture.Index.Id), + new JProperty(TextureInfo.TEXCOORD, thicknessTexture.TexCoord) // TODO don't write if default + ) + ) + ); + } + return jProperty; + } + + public IExtension Clone(GLTFRoot root) + { + return new KHR_materials_volume() + { + thicknessFactor = thicknessFactor, attenuationDistance = attenuationDistance, + attenuationColor = attenuationColor, thicknessTexture = thicknessTexture, + }; + } + } + + public class KHR_materials_volume_Factory : ExtensionFactory + { + public const string EXTENSION_NAME = "KHR_materials_volume"; + + public KHR_materials_volume_Factory() + { + ExtensionName = EXTENSION_NAME; + } + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + if (extensionToken != null) + { + var extension = new KHR_materials_volume(); + extension.thicknessFactor = extensionToken.Value[nameof(KHR_materials_volume.thicknessFactor)]?.Value() ?? 0; + extension.attenuationColor = extensionToken.Value[nameof(KHR_materials_volume.attenuationColor)]?.DeserializeAsColor() ?? Color.White; + extension.attenuationDistance = extensionToken.Value[nameof(KHR_materials_volume.attenuationDistance)]?.Value() ?? float.PositiveInfinity; + extension.thicknessTexture = extensionToken.Value[nameof(KHR_materials_volume.thicknessTexture)]?.DeserializeAsTexture(root); + return extension; + } + + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs.meta new file mode 100644 index 0000000..1983d2e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/KHR_materials_volume.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6581bef44e7949e1ae7cf4a597183d1d +timeCreated: 1653603693 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs new file mode 100644 index 0000000..8d9e7d7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs @@ -0,0 +1,47 @@ +using GLTF.Extensions; +using Newtonsoft.Json.Linq; +using System.Collections.Generic; + +namespace GLTF.Schema +{ + /// + /// glTF extension that defines the LOD + /// + public class MSFT_LODExtension : IExtension + { + + public List NodeIds { get; set; } + public MSFT_LODExtension(List nodeIds) + { + NodeIds = nodeIds; + } + public IExtension Clone(GLTFRoot gltfRoot) + { + return new MSFT_LODExtension(NodeIds); + } + public JProperty Serialize() + { + JProperty jProperty = new JProperty(MSFT_LODExtensionFactory.EXTENSION_NAME, + new JObject( + new JProperty(MSFT_LODExtensionFactory.IDS, new JArray(NodeIds)) + ) + ); + return jProperty; + } + + public List GetLODCoverage(Node node) + { + List lodCoverage = null; + if (node.Extras != null) + { + JToken screenCoverageExtras = node.Extras[MSFT_LODExtensionFactory.SCREEN_COVERAGE_EXTRAS]; + if (screenCoverageExtras != null) + { + lodCoverage = screenCoverageExtras.CreateReader().ReadDoubleList(); + } + } + + return lodCoverage; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs.meta new file mode 100644 index 0000000..fd918f8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5414556e16dc4bc40bb228d17d86ddd8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs new file mode 100644 index 0000000..2bfa1a8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs @@ -0,0 +1,36 @@ +using Newtonsoft.Json.Linq; +using GLTF.Extensions; +using System.Collections.Generic; + +namespace GLTF.Schema +{ + public class MSFT_LODExtensionFactory : ExtensionFactory + { + public const string EXTENSION_NAME = "MSFT_lod"; + public const string SCREEN_COVERAGE_EXTRAS = "MSFT_screencoverage"; + public const string IDS = "ids"; + + public MSFT_LODExtensionFactory() + { + ExtensionName = EXTENSION_NAME; + } + + + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + List meshIds = new List(); + if (extensionToken != null) + { +#if DEBUG + // Broken on il2cpp. Don't ship debug DLLs there. + System.Diagnostics.Debug.WriteLine(extensionToken.Value.ToString()); + System.Diagnostics.Debug.WriteLine(extensionToken.Value.Type); +#endif + JToken meshIdsToken = extensionToken.Value[IDS]; + meshIds = meshIdsToken.CreateReader().ReadInt32List(); + } + + return new MSFT_LODExtension(meshIds); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs.meta new file mode 100644 index 0000000..7601a54 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Extensions/MSFT_LODExtensionFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 879b237aa98612d468a9d18e34c9e9c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs new file mode 100644 index 0000000..cff3f29 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs @@ -0,0 +1,538 @@ +using GLTF; +using GLTF.Schema; +using GLTF.Utilities; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; + +namespace GLTF +{ + // Static class for construction GLB objects. These API's only work with the .NET 4.6 runtime and above. + public static class GLBBuilder + { + /// + /// Turns a glTF file w/ structure into a GLB. Does not currently copy binary data + /// + /// The glTF root to turn into a GLBObject + /// Output stream to write the GLB to + /// Loader for loading external components from GLTFRoot. The loader will receive uris and return the stream to the resource + /// A constructed GLBObject + private static GLBObject ConstructFromGLTF(GLTFRoot root, Stream glbOutStream, Func loader) + { + if (root == null) throw new ArgumentNullException(nameof(root)); + if (glbOutStream == null) throw new ArgumentNullException(nameof(glbOutStream)); + + MemoryStream gltfJsonStream = new MemoryStream(); + using (StreamWriter sw = new StreamWriter(gltfJsonStream)) + { + root.Serialize(sw, true); + sw.Flush(); + + long proposedLength = gltfJsonStream.Length + GLTFParser.HEADER_SIZE + GLTFParser.CHUNK_HEADER_SIZE; + if (gltfJsonStream.Length > uint.MaxValue) + { + throw new ArgumentException("Serialized root cannot exceed uint.maxvalue", nameof(root)); + } + uint proposedLengthAsUint = (uint)proposedLength; + glbOutStream.SetLength(proposedLengthAsUint); + GLBObject glbObject = new GLBObject + { + Header = new GLBHeader + { + FileLength = proposedLengthAsUint, + Version = 2 + }, + Root = root, + Stream = glbOutStream, + JsonChunkInfo = new ChunkInfo + { + Length = (uint)gltfJsonStream.Length, + StartPosition = GLTFParser.HEADER_SIZE, + Type = ChunkFormat.JSON + } + }; + + // write header + WriteHeader(glbOutStream, glbObject.Header, glbObject.StreamStartPosition); + + // write chunk header + WriteChunkHeader(glbOutStream, glbObject.JsonChunkInfo); + + gltfJsonStream.Position = 0; + gltfJsonStream.CopyTo(glbOutStream); + + // todo: implement getting binary data for loader + + return glbObject; + } + } + + /// + /// Turns the GLB data contained in a stream into a GLBObject. Will copy to the outStream if specified + /// + /// The glTF root to turn into a GLBObject + /// The stream the glb came in + /// If outstream is specified, the glb gets copied to it + /// Offset into the buffer that the GLB starts + /// A constructed GLBObject + public static GLBObject ConstructFromGLB(GLTFRoot root, Stream inputGLBStream, Stream outStream = null, + long inputGLBStreamStartPosition = 0) + { + if (outStream != null) + { + inputGLBStream.Position = inputGLBStreamStartPosition; + inputGLBStream.CopyTo(outStream); + } + else + { + outStream = inputGLBStream; + } + + // header information is 4 bytes in, past the magic number + inputGLBStream.Position = 4 + inputGLBStreamStartPosition; + GLBHeader header = GLTFParser.ParseGLBHeader(inputGLBStream); + + inputGLBStream.Position = GLTFParser.HEADER_SIZE + inputGLBStreamStartPosition; + List allChunks = GLTFParser.FindChunks(inputGLBStream); + ChunkInfo jsonChunkInfo = new ChunkInfo + { + Type = ChunkFormat.JSON + }; + ChunkInfo binaryChunkInfo = new ChunkInfo + { + Type = ChunkFormat.BIN + }; + + foreach (ChunkInfo chunkInfo in allChunks) + { + switch (chunkInfo.Type) + { + case ChunkFormat.JSON: + jsonChunkInfo = chunkInfo; + break; + case ChunkFormat.BIN: + binaryChunkInfo = chunkInfo; + break; + } + } + + if (jsonChunkInfo.Length == 0) + { + throw new ArgumentException("JSON chunk must exists for valid GLB", nameof(inputGLBStream)); + } + + // todo: compute the initial bufferview list + return new GLBObject + { + Root = root, + Stream = outStream, + StreamStartPosition = inputGLBStreamStartPosition, + Header = header, + JsonChunkInfo = jsonChunkInfo, + BinaryChunkInfo = binaryChunkInfo + }; + } + + /// + /// Turns a stream that contains glTF or a GLB data into a GLBObject. glTF is not yet supported + /// + /// The stream to turn into a GLB + /// If specified, output stream to write the GLB to + /// Loader for loading external components from GLTFRoot. Loader is required if loading from glTF + /// A constructed GLBObject + public static GLBObject ConstructFromStream(Stream inStream, Stream glbOutStream = null, Func loader = null, + long streamStartPosition = 0, bool removeUndefinedReferences = true) + { + if (inStream == null) throw new ArgumentNullException(nameof(inStream)); + + if (inStream.Length > 0) + { + inStream.Position = streamStartPosition; + + GLTFRoot root; + GLTFParser.ParseJson(inStream, out root, streamStartPosition); + if (removeUndefinedReferences) + { + GLTFHelpers.RemoveUndefinedReferences(root); + } + if (!root.IsGLB) + { + return ConstructFromGLTF(root, glbOutStream, loader); + } + + return ConstructFromGLB(root, inStream, glbOutStream, streamStartPosition); + } + + return _ConstructFromEmptyStream(inStream, streamStartPosition); + } + + private static GLBObject _ConstructFromEmptyStream(Stream inStream, long streamStartPosition) + { + GLBObject glbObject = new GLBObject + { + Stream = inStream, + JsonChunkInfo = new ChunkInfo + { + Length = 0, + StartPosition = GLTFParser.HEADER_SIZE, + Type = ChunkFormat.JSON + }, + BinaryChunkInfo = new ChunkInfo + { + Length = 0, + StartPosition = GLTFParser.HEADER_SIZE + GLTFParser.CHUNK_HEADER_SIZE, + Type = ChunkFormat.BIN + }, + Header = new GLBHeader + { + FileLength = GLTFParser.HEADER_SIZE, + Version = 2 + }, + StreamStartPosition = streamStartPosition + }; + + return glbObject; + } + + /// + /// Saves out the GLBObject to its own stream + /// The GLBObject stream will be updated to be the output stream. Callers are reponsible for handling Stream lifetime + /// + /// The GLB to flush to the output stream and update + /// Optional root to replace the one in the glb + /// A GLBObject that is based upon outStream + public static void UpdateStream(GLBObject glb) + { + if (glb.Root == null) throw new ArgumentException("glb Root and newRoot cannot be null", nameof(glb.Root)); + if (glb.Stream == null) throw new ArgumentException("glb GLBStream property cannot be null", nameof(glb.Stream)); + + MemoryStream gltfJsonStream = new MemoryStream(); + using (StreamWriter sw = new StreamWriter(gltfJsonStream)) + { + glb.Root.Serialize(sw, true); // todo: this could out of memory exception + sw.Flush(); + + if (gltfJsonStream.Length > int.MaxValue) + { + // todo: make this a non generic exception + throw new Exception("JSON chunk of GLB has exceeded maximum allowed size (4 GB)"); + } + + // realloc of out of space + if (glb.JsonChunkInfo.Length < gltfJsonStream.Length) + { + uint proposedJsonChunkLength = (uint)System.Math.Min((long)gltfJsonStream.Length * 2, uint.MaxValue); // allocate double what is required + proposedJsonChunkLength = CalculateAlignment(proposedJsonChunkLength, 4); + + // chunks must be 4 byte aligned + uint amountToAddToFile = proposedJsonChunkLength - glb.JsonChunkInfo.Length; + + // we have not yet initialized a json chunk before + if (glb.JsonChunkInfo.Length == 0) + { + amountToAddToFile += GLTFParser.CHUNK_HEADER_SIZE; + glb.SetJsonChunkStartPosition(GLTFParser.HEADER_SIZE); + } + + // new proposed length = propsoedJsonBufferSize - currentJsonBufferSize + totalFileLength + long proposedLength = amountToAddToFile + glb.Header.FileLength; + if (proposedLength > uint.MaxValue) + { + throw new Exception("GLB has exceeded max allowed size (4 GB)"); + } + + uint proposedLengthAsUint = (uint)proposedLength; + + try + { + glb.Stream.SetLength(proposedLength); + } + catch (IOException e) + { +#if WINDOWS_UWP + Debug.WriteLine(e); +#else + Console.WriteLine(e); +#endif + throw; + } + + long newBinaryChunkStartPosition = + GLTFParser.HEADER_SIZE + GLTFParser.CHUNK_HEADER_SIZE + proposedJsonChunkLength; + + glb.Stream.Position = glb.BinaryChunkInfo.StartPosition; + glb.SetBinaryChunkStartPosition(newBinaryChunkStartPosition); + if (glb.BinaryChunkInfo.Length > 0) + { + uint lengthToCopy = glb.BinaryChunkInfo.Length + GLTFParser.CHUNK_HEADER_SIZE; + + // todo: we need to be able to copy while doing it with smaller buffers. Also int is smaller than uint, so this is not standards compliant. + glb.Stream.CopyToSelf((int)newBinaryChunkStartPosition, + lengthToCopy); + } + + // write out new GLB length + glb.SetFileLength(proposedLengthAsUint); + WriteHeader(glb.Stream, glb.Header, glb.StreamStartPosition); + + // write out new JSON header + glb.SetJsonChunkLength(proposedJsonChunkLength); + WriteChunkHeader(glb.Stream, glb.JsonChunkInfo); + } + + // clear the buffer + glb.Stream.Position = glb.JsonChunkInfo.StartPosition + GLTFParser.CHUNK_HEADER_SIZE; + uint amountToCopy = glb.JsonChunkInfo.Length; + while (amountToCopy != 0) + { + int currAmountToCopy = (int)System.Math.Min(amountToCopy, int.MaxValue); + byte[] filler = + Encoding.ASCII.GetBytes(new string(' ', currAmountToCopy)); + glb.Stream.Write(filler, 0, filler.Length); + amountToCopy -= (uint)currAmountToCopy; + } + + // write new JSON data + gltfJsonStream.Position = 0; + glb.Stream.Position = glb.JsonChunkInfo.StartPosition + GLTFParser.CHUNK_HEADER_SIZE; + gltfJsonStream.CopyTo(glb.Stream); + glb.Stream.Flush(); + } + } + + /// + /// Adds binary data to the GLB + /// + /// The glb to update + /// The binary data to append + /// Whether a buffer view should be created, added to the GLTFRoot, and id returned + /// Start position of stream + /// Root to replace the current one with + /// The location of the added buffer view + public static BufferViewId AddBinaryData(GLBObject glb, Stream binaryData, bool createBufferView = true, long streamStartPosition = 0, string bufferViewName = null) + { + if (glb == null) throw new ArgumentNullException(nameof(glb)); + if(glb.Root == null && bufferViewName == null) throw new ArgumentException("glb Root and new root cannot be null", nameof(glb)); + if(glb.Stream == null) throw new ArgumentException("glb Stream cannot be null", nameof(glb)); + if(binaryData == null) throw new ArgumentNullException(nameof(binaryData)); + if(binaryData.Length > uint.MaxValue) throw new ArgumentException("Stream cannot be larger than uint.MaxValue", nameof(binaryData)); + + return _AddBinaryData(glb, binaryData, createBufferView, streamStartPosition, bufferViewName); + } + + private static BufferViewId _AddBinaryData(GLBObject glb, Stream binaryData, bool createBufferView, long streamStartPosition, string bufferViewName = null) + { + binaryData.Position = streamStartPosition; + + // Append new binary chunk to end + uint blobLengthAsUInt = CalculateAlignment((uint)(binaryData.Length - streamStartPosition), 4); + uint newBinaryBufferSize = glb.BinaryChunkInfo.Length + blobLengthAsUInt; + uint newGLBSize = glb.Header.FileLength + blobLengthAsUInt; + uint blobWritePosition = glb.Header.FileLength; + + // there was an existing file that had no binary chunk info previously + if (glb.BinaryChunkInfo.Length == 0) + { + newGLBSize += GLTFParser.CHUNK_HEADER_SIZE; + blobWritePosition += GLTFParser.CHUNK_HEADER_SIZE; + glb.SetBinaryChunkStartPosition(glb.Header.FileLength); // if 0, then appends chunk info at the end + } + + glb.Stream.SetLength(glb.Header.FileLength + blobLengthAsUInt); + glb.Stream.Position = blobWritePosition; // assuming the end of the file is the end of the binary chunk + binaryData.CopyTo(glb.Stream); // make sure this doesn't supersize it + + glb.SetFileLength(newGLBSize); + glb.SetBinaryChunkLength(newBinaryBufferSize); + + // write glb header past magic number + WriteHeader(glb.Stream, glb.Header, glb.StreamStartPosition); + + WriteChunkHeader(glb.Stream, glb.BinaryChunkInfo); + + if (createBufferView) + { + // Add a new BufferView to the GLTFRoot + BufferView bufferView = new BufferView + { + Buffer = new BufferId + { + Id = 0, + Root = glb.Root + }, + ByteLength = blobLengthAsUInt, // figure out whether glb size is wrong or if documentation is unclear + ByteOffset = glb.BinaryChunkInfo.Length - blobLengthAsUInt, + Name = bufferViewName + }; + + if (glb.Root.BufferViews == null) + { + glb.Root.BufferViews = new List(); + } + + glb.Root.BufferViews.Add(bufferView); + + return new BufferViewId + { + Id = glb.Root.BufferViews.Count - 1, + Root = glb.Root + }; + } + + return null; + } + + /// + /// Merges two glb files together + /// + /// The glb to update + /// The glb to merge from + public static void MergeGLBs(GLBObject mergeTo, GLBObject mergeFrom) + { + if (mergeTo == null) throw new ArgumentNullException(nameof(mergeTo)); + if (mergeFrom == null) throw new ArgumentNullException(nameof(mergeFrom)); + + // 1) merge json + // 2) copy mergefrom binary data to mergeto binary data + // 3) Fix up bufferviews to be the new offset + int previousBufferViewsCount = mergeTo.Root.BufferViews?.Count ?? 0; + uint previousBufferSize = mergeTo.BinaryChunkInfo.Length; + GLTFHelpers.MergeGLTF(mergeTo.Root, mergeFrom.Root); + _AddBinaryData(mergeTo, mergeFrom.Stream, false, mergeFrom.BinaryChunkInfo.StartPosition + GLTFParser.CHUNK_HEADER_SIZE); + uint bufferSizeDiff = + mergeTo.BinaryChunkInfo.Length - + previousBufferSize; // calculate buffer size change to update the byte offsets of the appended buffer views + + if (mergeTo.Root.BufferViews != null) + { + for (int i = previousBufferViewsCount; i < mergeTo.Root.BufferViews.Count; ++i) + { + mergeTo.Root.BufferViews[i].ByteOffset += bufferSizeDiff; + } + } + } + + /// + /// Removes a blob from the GLB at the given BufferView + /// Updates accessors and images to have correct new bufferview index + /// This function can invalidate BufferViewId's returned by previous function + /// + /// The glb to remove from + /// The buffer to remove + public static void RemoveBinaryData(GLBObject glb, BufferViewId bufferViewId) + { + if (glb == null) throw new ArgumentNullException(nameof(glb)); + if (bufferViewId == null) throw new ArgumentNullException(nameof(bufferViewId)); + + BufferView bufferViewToRemove = bufferViewId.Value; + int id = bufferViewId.Id; + if (bufferViewToRemove.ByteOffset + bufferViewToRemove.ByteLength == glb.BinaryChunkInfo.Length) + { + uint bufferViewLengthAsUint = bufferViewToRemove.ByteLength; + glb.SetFileLength(glb.Header.FileLength - bufferViewLengthAsUint); + glb.SetBinaryChunkLength(glb.BinaryChunkInfo.Length - bufferViewLengthAsUint); + if (glb.BinaryChunkInfo.Length == 0) + { + glb.Root.Buffers.RemoveAt(0); + foreach (BufferView bufferView in glb.Root.BufferViews) // other buffers may still exist, and their index has now changed + { + --bufferView.Buffer.Id; + } + + glb.SetFileLength(glb.Header.FileLength - GLTFParser.CHUNK_HEADER_SIZE); + } + else + { + glb.Root.Buffers[0].ByteLength = glb.BinaryChunkInfo.Length; + + // write binary chunk header + WriteChunkHeader(glb.Stream, glb.BinaryChunkInfo); + } + + // trim the end + glb.Stream.SetLength(glb.Header.FileLength); + + // write glb header + WriteHeader(glb.Stream, glb.Header, glb.StreamStartPosition); + } + + glb.Root.BufferViews.RemoveAt(id); + if (glb.Root.Accessors != null) + { + foreach (Accessor accessor in glb.Root.Accessors) // shift over all accessors + { + if (accessor.BufferView != null && accessor.BufferView.Id >= id) + { + --accessor.BufferView.Id; + } + + if (accessor.Sparse != null) + { + if (accessor.Sparse.Indices?.BufferView.Id >= id) + { + --accessor.Sparse.Indices.BufferView.Id; + } + + if (accessor.Sparse.Values?.BufferView.Id >= id) + { + --accessor.Sparse.Values.BufferView.Id; + } + } + } + } + + if (glb.Root.Images != null) + { + foreach (GLTFImage image in glb.Root.Images) + { + if (image.BufferView != null && image.BufferView.Id >= id) + { + --image.BufferView.Id; + } + } + } + } + + /// + /// Added function to set the root + /// + /// GLB to add + /// The new root to update it with + public static void SetRoot(GLBObject glb, GLTFRoot newRoot) + { + if (newRoot != null) + { + glb.Root = newRoot; + } + } + + private static void WriteHeader(Stream stream, GLBHeader header, long streamStartPosition) + { + stream.Position = streamStartPosition; + byte[] magicNumber = BitConverter.GetBytes(GLTFParser.MAGIC_NUMBER); + byte[] version = BitConverter.GetBytes(header.Version); + byte[] length = BitConverter.GetBytes(header.FileLength); + + stream.Write(magicNumber, 0, magicNumber.Length); + stream.Write(version, 0, version.Length); + stream.Write(length, 0, length.Length); + } + + private static void WriteChunkHeader(Stream stream, ChunkInfo chunkInfo) + { + stream.Position = chunkInfo.StartPosition; + byte[] lengthBytes = BitConverter.GetBytes(chunkInfo.Length); + byte[] typeBytes = BitConverter.GetBytes((uint)chunkInfo.Type); + + stream.Write(lengthBytes, 0, lengthBytes.Length); + stream.Write(typeBytes, 0, lengthBytes.Length); + } + + public static uint CalculateAlignment(uint currentSize, uint byteAlignment) + { + return (currentSize + byteAlignment - 1) / byteAlignment * byteAlignment; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs.meta new file mode 100644 index 0000000..0bc1204 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ff8d4b6beb2ca648926a7f0e032a63e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs new file mode 100644 index 0000000..e89f031 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs @@ -0,0 +1,101 @@ +using GLTF.Schema; +using System.Collections.Generic; +using System.IO; + +namespace GLTF +{ + /// + /// Objects containing GLB data and associated parsing information + /// + public class GLBObject : IGLTFObject + { + public GLBObject(GLBObject other) + { + Root = other.Root; + Header = other.Header; + StreamStartPosition = other.StreamStartPosition; + JsonChunkInfo = other.JsonChunkInfo; + BinaryChunkInfo = other.BinaryChunkInfo; + } + + /// + /// Parsed JSON of the GLB + /// + public GLTFRoot Root { get; internal set; } + + /// + /// Read/Write Stream that GLB exists in + /// + public Stream Stream { get; set; } + + /// + /// Header of GLB + /// + public GLBHeader Header { get { return _glbHeader; } internal set { _glbHeader = value; } } + + /// + /// Start position for the GLB stream + /// + public long StreamStartPosition { get; internal set; } + + /// + /// Information on JSON chunk + /// + public ChunkInfo JsonChunkInfo { get { return _jsonChunkInfo; } internal set { _jsonChunkInfo = value; } } + + /// + /// Information on Binary chunk + /// + public ChunkInfo BinaryChunkInfo { get { return _binaryChunkInfo; } internal set { _binaryChunkInfo = value; } } + + private GLBHeader _glbHeader; + private ChunkInfo _jsonChunkInfo; + private ChunkInfo _binaryChunkInfo; + + internal GLBObject() + { + } + + internal void SetFileLength(uint newHeaderLength) + { + _glbHeader.FileLength = newHeaderLength; + } + + internal void SetJsonChunkStartPosition(long startPosition) + { + _jsonChunkInfo.StartPosition = startPosition; + } + + internal void SetJsonChunkLength(uint jsonChunkLength) + { + _jsonChunkInfo.Length = jsonChunkLength; + } + + internal void SetBinaryChunkStartPosition(long startPosition) + { + _binaryChunkInfo.StartPosition = startPosition; + } + + internal void SetBinaryChunkLength(uint binaryChunkLength) + { + _binaryChunkInfo.Length = binaryChunkLength; + if (Root.Buffers == null) + { + Root.Buffers = new List(); + } + + if (Root.Buffers.Count == 0) + { + Root.Buffers.Add(new GLTFBuffer + { + ByteLength = binaryChunkLength + }); + } + else + { + Root.Buffers[0].ByteLength = binaryChunkLength; + } + } + } + +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs.meta new file mode 100644 index 0000000..a9b2f35 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLBObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2ddfd4d551e573949a2644728ae031bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs new file mode 100644 index 0000000..de90e78 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs @@ -0,0 +1,1079 @@ +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using GLTF.Schema; +using System.Linq; + +namespace GLTF +{ + public static class GLTFHelpers + { + private struct PreviousGLTFSizes + { + public int PreviousBufferCount; + public int PreviousBufferViewCount; + public int PreviousAccessorCount; + public int PreviousMeshCount; + public int PreviousNodeCount; + public int PreviousSceneCount; + public int PreviousSkinCount; + public int PreviousAnimationCount; + public int PreviousCameraCount; + public int PreviousMaterialCount; + public int PreviousTextureCount; + public int PreviousImageCount; + public int PreviousSamplerCount; + } + + /// + /// Removes references to indexes that do not exist. + /// + /// The node to clean + public static void RemoveUndefinedReferences(GLTFRoot root) + { + int accessorCount = root.Accessors?.Count ?? 0; + int bufferCount = root.Buffers?.Count ?? 0; + int bufferViewCount = root.BufferViews?.Count ?? 0; + int cameraCount = root.Cameras?.Count ?? 0; + int meshCount = root.Meshes?.Count ?? 0; + int nodeCount = root.Nodes?.Count ?? 0; + int samplersCount = root.Samplers?.Count ?? 0; + int skinCount = root.Skins?.Count ?? 0; + int textureCount = root.Textures?.Count ?? 0; + + if (root.Accessors != null) + { + foreach (Accessor accessor in root.Accessors) + { + if (accessor.BufferView != null && accessor.BufferView.Id >= bufferViewCount) + { + accessor.BufferView = null; + } + } + } + if (root.Animations != null) + { + foreach (GLTFAnimation animation in root.Animations) + { + if (animation.Samplers != null) + { + foreach (AnimationSampler animationSampler in animation.Samplers) + { + if (animationSampler.Input != null && animationSampler.Input.Id >= accessorCount) + { + animationSampler.Input = null; + } + if (animationSampler.Output != null && animationSampler.Output.Id >= accessorCount) + { + animationSampler.Output = null; + } + } + } + } + } + if (root.BufferViews != null) + { + foreach (BufferView bufferView in root.BufferViews) + { + if (bufferView.Buffer != null && bufferView.Buffer.Id >= bufferCount) + { + bufferView.Buffer = null; + } + } + } + if (root.Images != null) + { + foreach (GLTFImage image in root.Images) + { + if (image.BufferView != null && image.BufferView.Id >= bufferViewCount) + { + image.BufferView = null; + } + } + } + if (root.Materials != null) + { + foreach (GLTFMaterial material in root.Materials) + { + if (material.EmissiveTexture?.Index != null && material.EmissiveTexture.Index.Id >= textureCount) + { + material.EmissiveTexture.Index = null; + } + if (material.NormalTexture?.Index != null && material.NormalTexture.Index.Id >= textureCount) + { + material.NormalTexture.Index = null; + } + if (material.OcclusionTexture?.Index != null && material.OcclusionTexture.Index.Id >= textureCount) + { + material.OcclusionTexture.Index = null; + } + if (material.OcclusionTexture?.Index != null && material.OcclusionTexture.Index.Id >= textureCount) + { + material.OcclusionTexture.Index = null; + } + if (material.PbrMetallicRoughness != null) + { + if (material.PbrMetallicRoughness.BaseColorTexture?.Index != null && material.PbrMetallicRoughness.BaseColorTexture.Index.Id >= textureCount) + { + material.PbrMetallicRoughness.BaseColorTexture.Index = null; + } + if (material.PbrMetallicRoughness.MetallicRoughnessTexture?.Index != null && material.PbrMetallicRoughness.MetallicRoughnessTexture.Index.Id >= textureCount) + { + material.PbrMetallicRoughness.MetallicRoughnessTexture.Index = null; + } + } + } + } + if (root.Meshes != null) + { + foreach (GLTFMesh mesh in root.Meshes) + { + if (mesh.Primitives != null) + { + foreach (MeshPrimitive primitive in mesh.Primitives) + { + if (primitive.Indices != null && primitive.Indices.Id >= accessorCount) + { + primitive.Indices = null; + } + if (primitive.Material != null && primitive.Material.Id >= accessorCount) + { + primitive.Material = null; + } + } + } + } + } + if (root.Nodes != null) + { + foreach (Node node in root.Nodes) + { + if (node.Camera != null && node.Camera.Id >= cameraCount) + { + node.Camera = null; + } + if (node.Children != null) + { + for (int i = node.Children.Count - 1; i > 0; i--) + { + if (node.Children[i].Id >= nodeCount) + { + node.Children.RemoveAt(i); + } + } + } + if (node.Mesh != null && node.Mesh.Id >= meshCount) + { + node.Mesh = null; + } + if (node.Skin != null && node.Skin.Id >= skinCount) + { + node.Skin = null; + } + } + } + if (root.Scenes != null) + { + foreach (GLTFScene scene in root.Scenes) + { + if (scene.Nodes != null) + { + for (int i = scene.Nodes.Count - 1; i > 0; i--) + { + if (scene.Nodes[i].Id >= nodeCount) + { + scene.Nodes.RemoveAt(i); + } + } + } + } + } + if (root.Skins != null) + { + foreach (Skin skin in root.Skins) + { + if (skin.Joints != null) + { + for (int i = skin.Joints.Count - 1; i > 0; i--) + { + if (skin.Joints[i].Id >= nodeCount) + { + skin.Joints.RemoveAt(i); + } + } + } + if (skin.Skeleton != null && skin.Skeleton.Id >= nodeCount) + { + skin.Skeleton = null; + } + } + } + if (root.Textures != null) + { + foreach (GLTFTexture texture in root.Textures) + { + if (texture.Sampler != null && texture.Sampler.Id >= samplersCount) + { + texture.Sampler = null; + } + } + } + } + + private static void ApplySparseAccessorsVec3(ref NumericArray resultArray, AttributeAccessor attributeAccessor, AttributeAccessor sparseValues, AttributeAccessor sparseIndices) + { + var sparseArrays = new NumericArray[2]; + + // Values + uint offset1 = LoadBufferView(sparseValues.AccessorId.Value.Sparse.Values.BufferView.Value, sparseValues.Offset, sparseValues.Stream, out byte[] bufferViewCache1); + + // Indices + uint offset2 = LoadBufferView(sparseIndices.AccessorId.Value.Sparse.Indices.BufferView.Value, sparseIndices.Offset, sparseIndices.Stream, out byte[] bufferViewCache2); + + Accessor.AsSparseVector3Array(attributeAccessor.AccessorId.Value, ref sparseArrays[0], bufferViewCache1, offset1); + Accessor.AsSparseUIntArray(attributeAccessor.AccessorId.Value, ref sparseArrays[1], bufferViewCache2, offset2); + + var before = new NumericArray(); + before.AsVec3s = new GLTF.Math.Vector3[resultArray.AsVec3s.Length]; + System.Array.Copy(resultArray.AsVec3s, before.AsVec3s, before.AsVec3s.Length); + + for (int j = 0; j < sparseArrays[1].AsUInts.Length; j++) + before.AsVec3s[sparseArrays[1].AsUInts[j]] = sparseArrays[0].AsVec3s[j]; + + resultArray = before; + } + + /// + /// Uses the accessor to parse the buffer into attributes needed to construct the mesh primitive + /// + /// A dictionary that contains a mapping of attribute name to data needed to parse + /// + /// Uses the accessor to parse the buffer into attributes needed to construct the mesh primitive + /// + /// A dictionary that contains a mapping of attribute name to data needed to parse + public static void BuildMeshAttributes(ref Dictionary attributes, ref Dictionary sparseAccessors) + { + if (attributes.ContainsKey(SemanticProperties.POSITION)) + { + var attributeAccessor = attributes[SemanticProperties.POSITION]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsVertexArray(ref resultArray, bufferViewCache, offset); + + if (sparseAccessors.TryGetValue(SemanticProperties.POSITION, out var sparseData)) + ApplySparseAccessorsVec3(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.INDICES)) + { + var attributeAccessor = attributes[SemanticProperties.INDICES]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsTriangles(ref resultArray, bufferViewCache, offset); + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.NORMAL)) + { + var attributeAccessor = attributes[SemanticProperties.NORMAL]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsNormalArray(ref resultArray, bufferViewCache, offset); + + if (sparseAccessors.TryGetValue(SemanticProperties.NORMAL, out var sparseData)) + ApplySparseAccessorsVec3(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.TexCoord[0])) + { + var attributeAccessor = attributes[SemanticProperties.TexCoord[0]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsTexcoordArray(ref resultArray, bufferViewCache, offset); + + // if (sparseAccessors.TryGetValue(SemanticProperties.TexCoord[0], out var sparseData)) + // ApplySparseAccessorsTexCoord(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.TexCoord[1])) + { + var attributeAccessor = attributes[SemanticProperties.TexCoord[1]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsTexcoordArray(ref resultArray, bufferViewCache, offset); + + // if (sparseAccessors.TryGetValue(SemanticProperties.TexCoord[1], out var sparseData)) + // ApplySparseAccessorsTexCoord(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.TexCoord[2])) + { + var attributeAccessor = attributes[SemanticProperties.TexCoord[2]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsTexcoordArray(ref resultArray, bufferViewCache, offset); + + // if (sparseAccessors.TryGetValue(SemanticProperties.TexCoord[2], out var sparseData)) + // ApplySparseAccessorsTexCoord(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.TexCoord[3])) + { + var attributeAccessor = attributes[SemanticProperties.TexCoord[3]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsTexcoordArray(ref resultArray, bufferViewCache, offset); + + // if (sparseAccessors.TryGetValue(SemanticProperties.TexCoord[3], out var sparseData)) + // ApplySparseAccessorsTexCoord(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.Color[0])) + { + var attributeAccessor = attributes[SemanticProperties.Color[0]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsColorArray(ref resultArray, bufferViewCache, offset); + + // if (sparseAccessors.TryGetValue(SemanticProperties.Color[0], out var sparseData)) + // ApplySparseAccessorsColor(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.TANGENT)) + { + var attributeAccessor = attributes[SemanticProperties.TANGENT]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsTangentArray(ref resultArray, bufferViewCache, offset); + + // if (sparseAccessors.TryGetValue(SemanticProperties.TANGENT, out var sparseData)) + // ApplySparseAccessorsTangent(ref resultArray, attributeAccessor, sparseData.sparseValues, sparseData.sparseIndices); + + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.Weight[0])) + { + var attributeAccessor = attributes[SemanticProperties.Weight[0]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsVector4Array(ref resultArray, bufferViewCache, offset); + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.Weight[1])) + { + var attributeAccessor = attributes[SemanticProperties.Weight[1]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsVector4Array(ref resultArray, bufferViewCache, offset); + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.Joint[0])) + { + var attributeAccessor = attributes[SemanticProperties.Joint[0]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsVector4Array(ref resultArray, bufferViewCache, offset); + attributeAccessor.AccessorContent = resultArray; + } + if (attributes.ContainsKey(SemanticProperties.Joint[1])) + { + var attributeAccessor = attributes[SemanticProperties.Joint[1]]; + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsVector4Array(ref resultArray, bufferViewCache, offset); + attributeAccessor.AccessorContent = resultArray; + } + } + + public static void BuildTargetAttributes(ref Dictionary attributes) + { + foreach (var kvp in attributes) + { + var attributeAccessor = kvp.Value; + NumericArray resultArray = attributeAccessor.AccessorContent; + byte[] bufferViewCache; + uint offset = LoadBufferView(attributeAccessor, out bufferViewCache); + + switch (kvp.Key) + { + case SemanticProperties.POSITION: + case SemanticProperties.NORMAL: + case SemanticProperties.TANGENT: + attributeAccessor.AccessorId.Value.AsVector3Array(ref resultArray, bufferViewCache, offset); + break; + default: + throw new System.Exception($"Unrecognized morph target attribute {kvp.Key}"); + } + + attributeAccessor.AccessorContent = resultArray; + } + } + + public static void BuildBindPoseSamplers(ref AttributeAccessor attributeAccessor) + { + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + attributeAccessor.AccessorId.Value.AsMatrix4x4Array(ref resultArray, bufferViewCache, offset); + attributeAccessor.AccessorContent = resultArray; + } + + /// + /// Uses the accessor to parse the buffer into arrays needed to construct the animation + /// + /// A dictionary mapping AttributeAccessor lists to their target types + public static void BuildAnimationSamplers(ref Dictionary> samplers) + { + foreach (var samplerSet in samplers) + { + foreach (var attributeAccessor in samplerSet.Value) + { + NumericArray resultArray = attributeAccessor.AccessorContent; + uint offset = LoadBufferView(attributeAccessor, out byte[] bufferViewCache); + + switch (samplerSet.Key) + { + case "time": + attributeAccessor.AccessorId.Value.AsFloatArray(ref resultArray, bufferViewCache, offset); + break; + case "translation": + case "scale": + attributeAccessor.AccessorId.Value.AsVector3Array(ref resultArray, bufferViewCache, offset); + break; + case "rotation": + attributeAccessor.AccessorId.Value.AsVector4Array(ref resultArray, bufferViewCache, offset); + break; + case "weights": + attributeAccessor.AccessorId.Value.AsFloatArray(ref resultArray, bufferViewCache, offset); + break; + } + + attributeAccessor.AccessorContent = resultArray; + } + } + } + + /// + /// Merges the right root into the left root + /// This function combines all of the lists of objects on each glTF root together and updates the relative indicies + /// All properties all merged except Asset and Default, which will stay "mergeToRoot"'s value + /// + /// The node to merge into + /// The node to merge from + public static void MergeGLTF(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot) + { + PreviousGLTFSizes previousGLTFSize = new PreviousGLTFSizes() + { + PreviousAccessorCount = mergeToRoot.Accessors?.Count ?? 0, + PreviousBufferCount = mergeToRoot.Buffers?.Count ?? 0, + PreviousAnimationCount = mergeToRoot.Animations?.Count ?? 0, + PreviousBufferViewCount = mergeToRoot.BufferViews?.Count ?? 0, + PreviousCameraCount = mergeToRoot.Cameras?.Count ?? 0, + PreviousImageCount = mergeToRoot.Images?.Count ?? 0, + PreviousMaterialCount = mergeToRoot.Materials?.Count ?? 0, + PreviousMeshCount = mergeToRoot.Meshes?.Count ?? 0, + PreviousNodeCount = mergeToRoot.Nodes?.Count ?? 0, + PreviousSamplerCount = mergeToRoot.Samplers?.Count ?? 0, + PreviousSceneCount = mergeToRoot.Scenes?.Count ?? 0, + PreviousSkinCount = mergeToRoot.Skins?.Count ?? 0, + PreviousTextureCount = mergeToRoot.Textures?.Count ?? 0 + }; + + GLTFRoot mergeFromRootCopy = new GLTFRoot(mergeFromRoot); + + // for each type: + // 1) add the right hand range to the left hand object + // 2) update all ids to be based off of the appended size + + // merge extensions + MergeExtensions(mergeToRoot, mergeFromRootCopy); + + // merge accessors, buffers, and bufferviews + MergeAccessorsBufferViewsAndBuffers(mergeToRoot, mergeFromRootCopy, previousGLTFSize); + + // merge materials, samplers, images, and textures + MergeMaterialsImagesTexturesAndSamplers(mergeToRoot, mergeFromRootCopy, previousGLTFSize); + + // merge meshes + MergeMeshes(mergeToRoot, mergeFromRootCopy, previousGLTFSize); + + // merge cameras + MergeCameras(mergeToRoot, mergeFromRootCopy); + + // merge nodes + MergeNodes(mergeToRoot, mergeFromRootCopy, previousGLTFSize); + + // merge animation, and skin + MergeAnimationsAndSkins(mergeToRoot, mergeFromRootCopy, previousGLTFSize); + + // merge scenes + MergeScenes(mergeToRoot, mergeFromRootCopy, previousGLTFSize); + } + + /// + /// Returns whether the input string is a Base64 uri. Images and buffers can both be encoded this way. + /// + /// The uri to check + /// Whether the input string is base64 encoded + public static bool IsBase64Uri(string uri) + { + const string Base64StringInitializer = "^data:[a-z-]+/[a-z-]+;base64,"; + + Regex regex = new Regex(Base64StringInitializer); + return regex.Match(uri).Success; + } + + private static uint LoadBufferView(AttributeAccessor attributeAccessor, out byte[] bufferViewCache) + { + return LoadBufferView(attributeAccessor.AccessorId.Value.BufferView.Value, attributeAccessor.Offset, attributeAccessor.Stream, out bufferViewCache); + } + + internal static uint LoadBufferView(BufferView bufferView, uint Offset, Stream Stream, out byte[] bufferViewCache) + { + uint totalOffset = bufferView.ByteOffset + Offset; + +#if !NETFX_CORE + if (Stream is System.IO.MemoryStream) + { + MemoryStream memoryStream = (MemoryStream)Stream; +#if NETFX_CORE || NETSTANDARD1_3 + if (memoryStream.TryGetBuffer(out System.ArraySegment arraySegment)) + { + bufferViewCache = arraySegment.Array; + return totalOffset; + } +#else + bufferViewCache = memoryStream.GetBuffer(); + return totalOffset; +#endif + } +#endif + Stream.Position = totalOffset; + bufferViewCache = new byte[bufferView.ByteLength]; + + // stream.Read only accepts int for length + uint remainingSize = bufferView.ByteLength; + while (remainingSize != 0) + { + int sizeToLoad = (int)System.Math.Min(remainingSize, int.MaxValue); + sizeToLoad = Stream.Read(bufferViewCache, (int)(bufferView.ByteLength - remainingSize), sizeToLoad); + remainingSize -= (uint)sizeToLoad; + } + return 0; + } + + private static void MergeExtensions(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot) + { + // avoid duplicates for extension merging + if (mergeFromRoot.ExtensionsUsed != null) + { + if (mergeToRoot.ExtensionsUsed == null) + { + mergeToRoot.ExtensionsUsed = new List(mergeFromRoot.ExtensionsUsed.Count); + } + + foreach (string extensionUsedToAdd in mergeFromRoot.ExtensionsUsed) + { + if (!mergeToRoot.ExtensionsUsed.Contains(extensionUsedToAdd)) + { + mergeToRoot.ExtensionsUsed.Add(extensionUsedToAdd); + } + } + } + + if (mergeFromRoot.ExtensionsRequired != null) + { + if (mergeToRoot.ExtensionsRequired == null) + { + mergeToRoot.ExtensionsRequired = new List(mergeFromRoot.ExtensionsRequired.Count); + } + + foreach (string extensionRequiredToAdd in mergeFromRoot.ExtensionsRequired) + { + if (!mergeToRoot.ExtensionsRequired.Contains(extensionRequiredToAdd)) + { + mergeToRoot.ExtensionsRequired.Add(extensionRequiredToAdd); + } + } + } + } + + private static void MergeAccessorsBufferViewsAndBuffers(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot, PreviousGLTFSizes previousGLTFSizes) + { + bool isGLB = false; + + if (mergeFromRoot.Buffers != null) + { + if (mergeToRoot.Buffers == null) + { + mergeToRoot.Buffers = new List(mergeFromRoot.Buffers.Count); + } + + foreach (GLTFBuffer buffer in mergeFromRoot.Buffers) + { + if (buffer.Uri != null) + { + mergeToRoot.Buffers.Add(buffer); + } + else + { + isGLB = true; // assume glb is a uri is null + } + } + } + + if (mergeFromRoot.BufferViews != null) + { + if (mergeToRoot.BufferViews == null) + { + mergeToRoot.BufferViews = new List(mergeFromRoot.BufferViews.Count); + } + + mergeToRoot.BufferViews.AddRange(mergeFromRoot.BufferViews); + for (int i = previousGLTFSizes.PreviousBufferViewCount; i < mergeToRoot.BufferViews.Count; ++i) + { + GLTFId bufferId = mergeToRoot.BufferViews[i].Buffer; + if (!(isGLB && bufferId.Id == 0)) // if it is pointing a the special glb buffer (index 0 of a glb) then we dont want to adjust the buffer view, otherwise we do + { + // adjusting bufferview id based on merge amount + bufferId.Id += previousGLTFSizes.PreviousBufferCount; + bufferId.Root = mergeToRoot; + } + } + } + + if (mergeFromRoot.Accessors != null) + { + if (mergeToRoot.Accessors == null) + { + mergeToRoot.Accessors = new List(mergeFromRoot.Accessors.Count); + } + + mergeToRoot.Accessors.AddRange(mergeFromRoot.Accessors); + for (int i = previousGLTFSizes.PreviousAccessorCount; i < mergeToRoot.Accessors.Count; ++i) + { + Accessor accessor = mergeToRoot.Accessors[i]; + + if (accessor.BufferView != null) + { + BufferViewId bufferViewId = accessor.BufferView; + bufferViewId.Id += previousGLTFSizes.PreviousBufferViewCount; + bufferViewId.Root = mergeToRoot; + } + + AccessorSparse accessorSparse = accessor.Sparse; + if (accessorSparse != null) + { + BufferViewId indicesId = accessorSparse.Indices.BufferView; + indicesId.Id += previousGLTFSizes.PreviousBufferViewCount; + indicesId.Root = mergeToRoot; + + BufferViewId valuesId = accessorSparse.Values.BufferView; + valuesId.Id += previousGLTFSizes.PreviousBufferViewCount; + valuesId.Root = mergeToRoot; + } + } + } + } + + private static void MergeMaterialsImagesTexturesAndSamplers(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot, PreviousGLTFSizes previousGLTFSizes) + { + if (mergeFromRoot.Samplers != null) + { + if (mergeToRoot.Samplers == null) + { + mergeToRoot.Samplers = new List(mergeFromRoot.Samplers.Count); + } + + mergeToRoot.Samplers.AddRange(mergeFromRoot.Samplers); + } + + if (mergeFromRoot.Images != null) + { + if (mergeToRoot.Images == null) + { + mergeToRoot.Images = new List(mergeFromRoot.Images.Count); + } + + mergeToRoot.Images.AddRange(mergeFromRoot.Images); + for (int i = previousGLTFSizes.PreviousImageCount; i < mergeToRoot.Images.Count; ++i) + { + GLTFImage image = mergeToRoot.Images[i]; + if (image.BufferView != null) + { + BufferViewId bufferViewId = image.BufferView; + bufferViewId.Id += previousGLTFSizes.PreviousBufferViewCount; + bufferViewId.Root = mergeToRoot; + } + } + } + + if (mergeFromRoot.Textures != null) + { + if (mergeToRoot.Textures == null) + { + mergeToRoot.Textures = new List(mergeFromRoot.Textures.Count); + } + + mergeToRoot.Textures.AddRange(mergeFromRoot.Textures); + for (int i = previousGLTFSizes.PreviousTextureCount; i < mergeToRoot.Textures.Count; ++i) + { + GLTFTexture texture = mergeToRoot.Textures[i]; + + if (texture.Sampler != null) + { + SamplerId samplerId = texture.Sampler; + samplerId.Id += previousGLTFSizes.PreviousSamplerCount; + samplerId.Root = mergeToRoot; + } + + if (texture.Source != null) + { + ImageId samplerId = texture.Source; + samplerId.Id += previousGLTFSizes.PreviousImageCount; + samplerId.Root = mergeToRoot; + } + } + } + + if (mergeFromRoot.Materials != null) + { + if (mergeToRoot.Materials == null) + { + mergeToRoot.Materials = new List(mergeFromRoot.Materials.Count); + } + + mergeToRoot.Materials.AddRange(mergeFromRoot.Materials); + for (int i = previousGLTFSizes.PreviousMaterialCount; i < mergeToRoot.Materials.Count; ++i) + { + GLTFMaterial material = mergeToRoot.Materials[i]; + + PbrMetallicRoughness pbrMetallicRoughness = material.PbrMetallicRoughness; + if (pbrMetallicRoughness != null) + { + if (pbrMetallicRoughness.BaseColorTexture != null) + { + TextureId textureId = pbrMetallicRoughness.BaseColorTexture.Index; + textureId.Id += previousGLTFSizes.PreviousTextureCount; + textureId.Root = mergeToRoot; + } + if (pbrMetallicRoughness.MetallicRoughnessTexture != null) + { + TextureId textureId = pbrMetallicRoughness.MetallicRoughnessTexture.Index; + textureId.Id += previousGLTFSizes.PreviousTextureCount; + textureId.Root = mergeToRoot; + } + } + + MaterialCommonConstant commonConstant = material.CommonConstant; + if (commonConstant?.LightmapTexture != null) + { + TextureId textureId = material.CommonConstant.LightmapTexture.Index; + textureId.Id += previousGLTFSizes.PreviousTextureCount; + textureId.Root = mergeToRoot; + } + + if (material.EmissiveTexture != null) + { + TextureId textureId = material.EmissiveTexture.Index; + material.EmissiveTexture.Index.Id += previousGLTFSizes.PreviousTextureCount; + textureId.Root = mergeToRoot; + } + + if (material.NormalTexture != null) + { + TextureId textureId = material.NormalTexture.Index; + textureId.Id += previousGLTFSizes.PreviousTextureCount; + textureId.Root = mergeToRoot; + } + + if (material.OcclusionTexture != null) + { + TextureId textureId = material.OcclusionTexture.Index; + textureId.Id += previousGLTFSizes.PreviousTextureCount; + textureId.Root = mergeToRoot; + } + } + } + } + + private static void MergeMeshes(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot, PreviousGLTFSizes previousGLTFSizes) + { + if (mergeFromRoot.Meshes == null) return; + + if (mergeToRoot.Meshes == null) + { + mergeToRoot.Meshes = new List(mergeFromRoot.Meshes.Count); + } + + mergeToRoot.Meshes.AddRange(mergeFromRoot.Meshes); + for (int i = previousGLTFSizes.PreviousMeshCount; i < mergeToRoot.Meshes.Count; ++i) + { + GLTFMesh mesh = mergeToRoot.Meshes[i]; + if (mesh.Primitives != null) + { + foreach (MeshPrimitive primitive in mesh.Primitives) + { + foreach (var attributeAccessorPair in primitive.Attributes) + { + AccessorId accessorId = attributeAccessorPair.Value; + accessorId.Id += previousGLTFSizes.PreviousAccessorCount; + accessorId.Root = mergeToRoot; + } + + if (primitive.Indices != null) + { + AccessorId accessorId = primitive.Indices; + accessorId.Id += previousGLTFSizes.PreviousAccessorCount; + accessorId.Root = mergeToRoot; + } + + if (primitive.Material != null) + { + MaterialId materialId = primitive.Material; + materialId.Id += previousGLTFSizes.PreviousMaterialCount; + materialId.Root = mergeToRoot; + } + + if (primitive.Targets != null) + { + foreach (Dictionary targetsDictionary in primitive.Targets) + { + foreach (var targetsPair in targetsDictionary) + { + AccessorId accessorId = targetsPair.Value; + accessorId.Id += previousGLTFSizes.PreviousAccessorCount; + accessorId.Root = mergeToRoot; + } + } + } + } + } + } + } + + private static void MergeCameras(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot) + { + if (mergeFromRoot.Cameras == null) return; + if (mergeToRoot.Cameras == null) + { + mergeToRoot.Cameras = new List(mergeFromRoot.Cameras.Count); + } + + mergeToRoot.Cameras.AddRange(mergeFromRoot.Cameras); + } + + private static void MergeNodes(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot, PreviousGLTFSizes previousGLTFSizes) + { + if (mergeFromRoot.Nodes == null) return; + + if (mergeToRoot.Nodes == null) + { + mergeToRoot.Nodes = new List(mergeFromRoot.Nodes.Count); + } + + mergeToRoot.Nodes.AddRange(mergeFromRoot.Nodes); + + for (int i = previousGLTFSizes.PreviousNodeCount; i < mergeToRoot.Nodes.Count; ++i) + { + Node node = mergeToRoot.Nodes[i]; + if (node.Mesh != null) + { + MeshId meshId = node.Mesh; + meshId.Id += previousGLTFSizes.PreviousMeshCount; + node.Mesh.Root = mergeToRoot; + } + + if (node.Camera != null) + { + CameraId cameraId = node.Camera; + cameraId.Id += previousGLTFSizes.PreviousCameraCount; + cameraId.Root = mergeToRoot; + } + + if (node.Children != null) + { + foreach (NodeId child in node.Children) + { + child.Id += previousGLTFSizes.PreviousNodeCount; + child.Root = mergeToRoot; + } + } + + if (node.Skin != null) + { + SkinId skinId = node.Skin; + skinId.Id += previousGLTFSizes.PreviousSkinCount; + skinId.Root = mergeToRoot; + } + } + } + + private static void MergeAnimationsAndSkins(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot, PreviousGLTFSizes previousGLTFSizes) + { + if (mergeFromRoot.Skins != null) + { + if (mergeToRoot.Skins == null) + { + mergeToRoot.Skins = new List(mergeFromRoot.Skins.Count); + } + + mergeToRoot.Skins.AddRange(mergeFromRoot.Skins); + for (int i = previousGLTFSizes.PreviousSkinCount; i < mergeToRoot.Skins.Count; ++i) + { + Skin skin = mergeToRoot.Skins[i]; + if (skin.InverseBindMatrices != null) + { + skin.InverseBindMatrices.Id += previousGLTFSizes.PreviousAccessorCount; + } + + if (skin.Skeleton != null) + { + skin.Skeleton.Id += previousGLTFSizes.PreviousNodeCount; + } + + if (skin.Joints != null) + { + foreach (NodeId joint in skin.Joints) + { + joint.Id += previousGLTFSizes.PreviousNodeCount; + } + } + } + } + + if (mergeFromRoot.Animations != null) + { + if (mergeToRoot.Animations == null) + { + mergeToRoot.Animations = new List(mergeFromRoot.Animations.Count); + } + + mergeToRoot.Animations.AddRange(mergeFromRoot.Animations); + + for (int i = previousGLTFSizes.PreviousAnimationCount; i < mergeToRoot.Animations.Count; ++i) + { + GLTFAnimation animation = mergeToRoot.Animations[i]; + foreach (AnimationSampler sampler in animation.Samplers) + { + AccessorId inputId = sampler.Input; + inputId.Id += previousGLTFSizes.PreviousAccessorCount; + inputId.Root = mergeToRoot; + + AccessorId outputId = sampler.Output; + outputId.Id += previousGLTFSizes.PreviousAccessorCount; + outputId.Root = mergeToRoot; + } + + foreach (AnimationChannel channel in animation.Channels) + { + AnimationSamplerId samplerId = channel.Sampler; + samplerId.Id += previousGLTFSizes.PreviousSamplerCount; + samplerId.Root = mergeToRoot; + + NodeId nodeId = channel.Target.Node; + nodeId.Id += previousGLTFSizes.PreviousNodeCount; + nodeId.Root = mergeToRoot; + } + } + } + } + + private static void MergeScenes(GLTFRoot mergeToRoot, GLTFRoot mergeFromRoot, PreviousGLTFSizes previousGLTFSizes) + { + if (mergeFromRoot.Scenes == null) return; + + if (mergeToRoot.Scenes == null) + { + mergeToRoot.Scenes = new List(mergeFromRoot.Scenes.Count); + } + + mergeToRoot.Scenes.AddRange(mergeFromRoot.Scenes); + for (int i = previousGLTFSizes.PreviousSceneCount; i < mergeToRoot.Scenes.Count; ++i) + { + GLTFScene scene = mergeToRoot.Scenes[i]; + foreach (NodeId nodeId in scene.Nodes) + { + nodeId.Id += previousGLTFSizes.PreviousNodeCount; + nodeId.Root = mergeToRoot; + } + } + } + + private static string UpdateCanonicalPath(string oldPath, string newCanonicalPath) + { + string fileName = Path.GetFileName(oldPath); + return newCanonicalPath + Path.DirectorySeparatorChar + fileName; + } + + public static NodeId FindCommonAncestor(IEnumerable nodes) + { + // build parentage + GLTFRoot root = nodes.First().Root; + Dictionary childToParent = new Dictionary(root.Nodes.Count); + for (int i = 0; i < root.Nodes.Count; i++) + { + if (root.Nodes[i].Children == null) + { + continue; + } + + foreach (NodeId child in root.Nodes[i].Children) + { + childToParent[child.Id] = i; + } + } + + // scan for common ancestor + int? commonAncestorIndex = nodes + .Select(n => n.Id) + .Aggregate((int?)null, (elder, node) => FindCommonAncestor(elder, node)); + + return commonAncestorIndex != null ? new NodeId() { Id = commonAncestorIndex.Value, Root = root } : null; + + int? FindCommonAncestor(int? a, int? b) + { + // trivial cases + if (a == null && b == null) + { + return null; + } + else if (a != null) + { + return a; + } + else if (b != null) + { + return b; + } + else if (AncestorOf(a.Value, b.Value)) + { + return a; + } + else + { + return FindCommonAncestor(childToParent[a.Value], b.Value); + } + } + + bool AncestorOf(int ancestor, int descendant) + { + while (childToParent.ContainsKey(descendant)) + { + if (childToParent[descendant] == ancestor) + { + return true; + } + descendant = childToParent[descendant]; + } + + return false; + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs.meta new file mode 100644 index 0000000..a040695 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFHelpers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 263666854cbd1bc489267c0f2112f5e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs new file mode 100644 index 0000000..16bf4e7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs @@ -0,0 +1,20 @@ +using GLTF.Schema; + +namespace GLTF +{ + /// + /// Represents a glTF file (specifically not GLB) + /// + public class GLTFObject : IGLTFObject + { + public GLTFObject(GLTFRoot root) + { + Root = root; + } + + /// + /// Parsed glTF into a strongly typed C# object + /// + public GLTFRoot Root { get; internal set; } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs.meta new file mode 100644 index 0000000..7d2bd75 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0a76e06d7bdb61347a2118c05b86c181 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs new file mode 100644 index 0000000..a8760bd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs @@ -0,0 +1,175 @@ +using GLTF.Schema; +using System; +using System.Collections.Generic; +using System.IO; + +namespace GLTF +{ + public enum ChunkFormat : uint + { + JSON = 0x4e4f534a, + BIN = 0x004e4942 + } + + /// + /// Information containing parsed GLB Header + /// + public struct GLBHeader + { + public uint Version { get; set; } + public uint FileLength { get; set; } + } + + /// + /// Infomration that contains parsed chunk + /// + public struct ChunkInfo + { + public long StartPosition; + public uint Length; + public ChunkFormat Type; + } + + public class GLTFParser + { + public static readonly uint HEADER_SIZE = 12; + public static readonly uint CHUNK_HEADER_SIZE = 8; + public static readonly uint MAGIC_NUMBER = 0x46546c67; + + public static void ParseJson(Stream stream, out GLTFRoot gltfRoot, long startPosition = 0) + { + stream.Position = startPosition; + bool isGLB = IsGLB(stream); + + // Check for binary format magic bytes + if (isGLB) + { + ParseJsonChunk(stream, startPosition); + } + else + { + stream.Position = startPosition; + } + + gltfRoot = GLTFRoot.Deserialize(new StreamReader(stream)); + gltfRoot.IsGLB = isGLB; + } + + // todo: this needs reimplemented. There is no such thing as a binary chunk index, and the chunk may not be in 0, 1, 2 order + // Moves stream position to binary chunk location + public static ChunkInfo SeekToBinaryChunk(Stream stream, int binaryChunkIndex, long startPosition = 0) + { + stream.Position = startPosition + 4; // start after magic number chunk + GLBHeader header = ParseGLBHeader(stream); + uint chunkOffset = 12; // sizeof(GLBHeader) + magic number + uint chunkLength = 0; + for (int i = 0; i < binaryChunkIndex + 2; ++i) + { + chunkOffset += chunkLength; + stream.Position = chunkOffset; + chunkLength = GetUInt32(stream); + chunkOffset += 8; // to account for chunk length (4 bytes) and type (4 bytes) + } + + // Load Binary Chunk + if (chunkOffset + chunkLength <= header.FileLength) + { + ChunkFormat chunkType = (ChunkFormat)GetUInt32(stream); + if (chunkType != ChunkFormat.BIN) + { + throw new GLTFHeaderInvalidException("Second chunk must be of type BIN if present"); + } + + return new ChunkInfo + { + StartPosition = stream.Position - CHUNK_HEADER_SIZE, + Length = chunkLength, + Type = chunkType + }; + } + + throw new GLTFHeaderInvalidException("File length does not match chunk header."); + } + + public static GLBHeader ParseGLBHeader(Stream stream) + { + uint version = GetUInt32(stream); // 4 + uint length = GetUInt32(stream); // 8 + + return new GLBHeader + { + Version = version, + FileLength = length + }; + } + + public static bool IsGLB(Stream stream) + { + return GetUInt32(stream) == 0x46546c67; // 0 + } + + public static ChunkInfo ParseChunkInfo(Stream stream) + { + ChunkInfo chunkInfo = new ChunkInfo + { + StartPosition = stream.Position + }; + + chunkInfo.Length = GetUInt32(stream); // 12 + chunkInfo.Type = (ChunkFormat)GetUInt32(stream); // 16 + return chunkInfo; + } + + public static List FindChunks(Stream stream, long startPosition = 0) + { + stream.Position = startPosition + 4; // start after magic number bytes (4 bytes past) + ParseGLBHeader(stream); + List allChunks = new List(); + + // we only need to search for top two chunks (the JSON and binary chunks are guarenteed to be the top two chunks) + // other chunks can be in the file but we do not care about them + for (int i = 0; i < 2; ++i) + { + if (stream.Position == stream.Length) + { + break; + } + + ChunkInfo chunkInfo = ParseChunkInfo(stream); + allChunks.Add(chunkInfo); + stream.Position += chunkInfo.Length; + } + + return allChunks; + } + + private static void ParseJsonChunk(Stream stream, long startPosition) + { + GLBHeader header = ParseGLBHeader(stream); // 4, 8 + if (header.Version != 2) + { + throw new GLTFHeaderInvalidException("Unsupported glTF version"); + }; + + if (header.FileLength > (stream.Length - startPosition)) + { + throw new GLTFHeaderInvalidException("File length does not match header."); + } + + ChunkInfo chunkInfo = ParseChunkInfo(stream); + if (chunkInfo.Type != ChunkFormat.JSON) + { + throw new GLTFHeaderInvalidException("First chunk must be of type JSON"); + } + } + + private static uint GetUInt32(Stream stream) + { + var uintSize = sizeof(uint); + byte[] headerBuffer = new byte[uintSize]; + stream.Read(headerBuffer, 0, uintSize); + return BitConverter.ToUInt32(headerBuffer, 0); + } + } +} + diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs.meta new file mode 100644 index 0000000..bb3925b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFParser.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6baa61f5385e65042bc17abb85d5f9b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef new file mode 100644 index 0000000..87926d9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef @@ -0,0 +1,16 @@ +{ + "name": "GLTFSerialization", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": true, + "precompiledReferences": [ + "Newtonsoft.Json.dll" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": true +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef.meta new file mode 100644 index 0000000..1c43097 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/GLTFSerialization.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 40f39bff7bc9be34182ebe488fcf8228 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs new file mode 100644 index 0000000..3911b25 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs @@ -0,0 +1,12 @@ +using GLTF.Schema; + +namespace GLTF +{ + /// + /// Represents a GLTFObject + /// + public interface IGLTFObject + { + GLTFRoot Root { get; } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs.meta new file mode 100644 index 0000000..9072507 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/IGLTFObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d3d653bfec13be4c9e06a22631d3420 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Legacy~/GLTFSerialization.csproj.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Legacy~/GLTFSerialization.csproj.meta new file mode 100644 index 0000000..d75094d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Legacy~/GLTFSerialization.csproj.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0833101f3e32c5849a37072f628efc15 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math.meta new file mode 100644 index 0000000..4d8d0d3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cde5e1bb32bb63047be2e7ef338ffd50 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs new file mode 100644 index 0000000..102af7e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs @@ -0,0 +1,65 @@ +using System; + +namespace GLTF.Math +{ + public struct Color : IEquatable + { + public static Color Black { get { return new Color(0f, 0f, 0f, 1f); } } + public static Color Clear { get { return new Color(0f, 0f, 0f, 0f); } } + public static Color White { get { return new Color(1f, 1f, 1f, 1f); } } + + public float R { get; set; } + public float G { get; set; } + public float B { get; set; } + public float A { get; set; } + + public Color(float r, float g, float b, float a) + { + R = r; + G = g; + B = b; + A = a; + } + + public Color(Color other) + { + R = other.R; + G = other.G; + B = other.B; + A = other.A; + } + + public bool Equals(Color other) + { + return R.Equals(other.R) && G.Equals(other.G) && B.Equals(other.B) && A.Equals(other.A); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is Color && Equals((Color) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = R.GetHashCode(); + hashCode = (hashCode * 397) ^ G.GetHashCode(); + hashCode = (hashCode * 397) ^ B.GetHashCode(); + hashCode = (hashCode * 397) ^ A.GetHashCode(); + return hashCode; + } + } + + public static bool operator ==(Color left, Color right) + { + return left.Equals(right); + } + + public static bool operator !=(Color left, Color right) + { + return !left.Equals(right); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs.meta new file mode 100644 index 0000000..87cb667 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Color.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e7ba942550f634246ac9a798262e498f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs new file mode 100644 index 0000000..230b35b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs @@ -0,0 +1,185 @@ +using System; + +namespace GLTF.Math +{ + // class is naively implemented + public class Matrix4x4 : IEquatable + { + public static readonly Matrix4x4 Identity = new Matrix4x4( + 1f, 0f, 0f, 0f, + 0f, 1f, 0f, 0f, + 0f, 0f, 1f, 0f, + 0f, 0f, 0f, 1f + ); + + /// + /// Matrix is column major ordered + /// + public Matrix4x4(float m11, float m21, float m31, float m41, float m12, float m22, float m32, float m42, float m13, float m23, float m33, float m43, float m14, float m24, float m34, float m44) + { + M11 = m11; + M12 = m12; + M13 = m13; + M14 = m14; + M21 = m21; + M22 = m22; + M23 = m23; + M24 = m24; + M31 = m31; + M32 = m32; + M33 = m33; + M34 = m34; + M41 = m41; + M42 = m42; + M43 = m43; + M44 = m44; + } + + public Matrix4x4(Matrix4x4 other) + { + Array.Copy(other.mat, 0, mat, 0, 16); + } + + private float[] mat = new float[16]; + + public float M11 { get { return mat[0]; } set { mat[0] = value; } } + public float M21 { get { return mat[1]; } set { mat[1] = value; } } + public float M31 { get { return mat[2]; } set { mat[2] = value; } } + public float M41 { get { return mat[3]; } set { mat[3] = value; } } + public float M12 { get { return mat[4]; } set { mat[4] = value; } } + public float M22 { get { return mat[5]; } set { mat[5] = value; } } + public float M32 { get { return mat[6]; } set { mat[6] = value; } } + public float M42 { get { return mat[7]; } set { mat[7] = value; } } + public float M13 { get { return mat[8]; } set { mat[8] = value; } } + public float M23 { get { return mat[9]; } set { mat[9] = value; } } + public float M33 { get { return mat[10]; } set { mat[10] = value; } } + public float M43 { get { return mat[11]; } set { mat[11] = value; } } + public float M14 { get { return mat[12]; } set { mat[12] = value; } } + public float M24 { get { return mat[13]; } set { mat[13] = value; } } + public float M34 { get { return mat[14]; } set { mat[14] = value; } } + public float M44 { get { return mat[15]; } set { mat[15] = value; } } + + public bool Equals(Matrix4x4 other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + + return M11 == other.M11 && M12 == other.M12 && M13 == other.M13 && M14 == other.M14 && + M21 == other.M21 && M22 == other.M22 && M23 == other.M23 && M24 == other.M24 && + M31 == other.M31 && M32 == other.M32 && M33 == other.M33 && M34 == other.M34 && + M41 == other.M41 && M42 == other.M42 && M43 == other.M43 && M44 == other.M44; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((Matrix4x4) obj); + } + + public override int GetHashCode() + { + return (mat != null ? mat.GetHashCode() : 0); + } + + public void SetValue(int index, float value) + { + if(index > mat.Length) + { + throw new IndexOutOfRangeException("Index " + index + " is out of range for a 4x4 matrix."); + } + + mat[index] = value; + } + + public void SetValue(int row, int column, float value) + { + switch(row) + { + case 0: + switch (column) + { + case 0: + M11 = value; + break; + case 1: + M12 = value; + break; + case 2: + M13 = value; + break; + case 3: + M14 = value; + break; + default: + throw new IndexOutOfRangeException("Column " + column + " is out of range for a 4x4 matrix."); + } + + break; + case 1: + switch (column) + { + case 0: + M21 = value; + break; + case 1: + M22 = value; + break; + case 2: + M23 = value; + break; + case 3: + M24 = value; + break; + default: + throw new IndexOutOfRangeException("Column " + column + " is out of range for a 4x4 matrix."); + } + + break; + case 2: + switch (column) + { + case 0: + M31 = value; + break; + case 1: + M32 = value; + break; + case 2: + M33 = value; + break; + case 3: + M34 = value; + break; + default: + throw new IndexOutOfRangeException("Column " + column + " is out of range for a 4x4 matrix."); + } + + break; + case 3: + switch (column) + { + case 0: + M41 = value; + break; + case 1: + M42 = value; + break; + case 2: + M43 = value; + break; + case 3: + M44 = value; + break; + default: + throw new IndexOutOfRangeException("Column " + column + " is out of range for a 4x4 matrix."); + } + + break; + default: + throw new IndexOutOfRangeException("Row " + row + " is out of range for a 4x4 matrix."); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs.meta new file mode 100644 index 0000000..bd587d9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Matrix4x4.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9aeefcfaec31e2945bdd16285de33227 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs new file mode 100644 index 0000000..896f1ed --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs @@ -0,0 +1,76 @@ +using System; + +namespace GLTF.Math +{ + public struct Quaternion : IEquatable + { + public static readonly Quaternion Identity = new Quaternion(0f, 0f, 0f, 1f); + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } + public float W { get; set; } + + public Quaternion(float x, float y, float z, float w) + { + X = x; + Y = y; + Z = z; + W = w; + } + + public Quaternion(Quaternion other) + { + X = other.X; + Y = other.Y; + Z = other.Z; + W = other.W; + } + + public bool Equals(Quaternion other) + { + return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is Quaternion && Equals((Quaternion) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = X.GetHashCode(); + hashCode = (hashCode * 397) ^ Y.GetHashCode(); + hashCode = (hashCode * 397) ^ Z.GetHashCode(); + hashCode = (hashCode * 397) ^ W.GetHashCode(); + return hashCode; + } + } + + public static bool operator ==(Quaternion left, Quaternion right) + { + return left.Equals(right); + } + + public static bool operator !=(Quaternion left, Quaternion right) + { + return !left.Equals(right); + } + + /// First quaternion. + /// Second quaternion. + /// Result of multiplication. + public static Quaternion operator *(Quaternion left, Quaternion right) + { + float x = left.W * right.X + left.X * right.W + left.Y * right.Z - left.Z * right.Y; + float y = left.W * right.Y + left.Y * right.W + left.Z * right.X - left.X * right.Z; + float z = left.W * right.Z + left.Z * right.W + left.X * right.Y - left.Y * right.X; + float w = left.W * right.W - left.X * right.X - left.Y * right.Y - left.Z * right.Z; + Quaternion result = new Quaternion(x, y, z, w); + return result; + + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs.meta new file mode 100644 index 0000000..d20d0ee --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Quaternion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 21f2d9fe5dc7e3c4a873d2f2d5deb404 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs new file mode 100644 index 0000000..3dd1c68 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs @@ -0,0 +1,51 @@ +using System; + +namespace GLTF.Math +{ + public struct Vector2 : IEquatable + { + public float X { get; set; } + public float Y { get; set; } + + public Vector2(float x, float y) + { + X = x; + Y = y; + } + + public Vector2(Vector2 other) + { + X = other.X; + Y = other.Y; + } + + public bool Equals(Vector2 other) + { + return X.Equals(other.X) && Y.Equals(other.Y); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is Vector2 && Equals((Vector2) obj); + } + + public override int GetHashCode() + { + unchecked + { + return (X.GetHashCode() * 397) ^ Y.GetHashCode(); + } + } + + public static bool operator ==(Vector2 left, Vector2 right) + { + return left.Equals(right); + } + + public static bool operator !=(Vector2 left, Vector2 right) + { + return !left.Equals(right); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs.meta new file mode 100644 index 0000000..e3e4491 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ce6455297f415343beeaaec7bddb32d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs new file mode 100644 index 0000000..4ff70ae --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs @@ -0,0 +1,61 @@ +using System; + +namespace GLTF.Math +{ + public struct Vector3 : IEquatable + { + public static readonly Vector3 Zero = new Vector3(0f, 0f, 0f); + public static readonly Vector3 One = new Vector3(1f, 1f, 1f); + + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } + + public Vector3(float x, float y, float z) + { + X = x; + Y = y; + Z = z; + } + + + public Vector3(Vector3 other) + { + X = other.X; + Y = other.Y; + Z = other.Z; + } + + public bool Equals(Vector3 other) + { + return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is Vector3 && Equals((Vector3) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = X.GetHashCode(); + hashCode = (hashCode * 397) ^ Y.GetHashCode(); + hashCode = (hashCode * 397) ^ Z.GetHashCode(); + return hashCode; + } + } + + public static bool operator ==(Vector3 left, Vector3 right) + { + return left.Equals(right); + } + + public static bool operator !=(Vector3 left, Vector3 right) + { + return !left.Equals(right); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs.meta new file mode 100644 index 0000000..299ed98 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector3.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1691a2a5c9edac418814a93b69b2f4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs new file mode 100644 index 0000000..543689c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs @@ -0,0 +1,62 @@ +using System; + +namespace GLTF.Math +{ + public struct Vector4 : IEquatable + { + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } + public float W { get; set; } + + public Vector4(float x, float y, float z, float w) + { + X = x; + Y = y; + Z = z; + W = w; + } + + public Vector4(Vector4 other) + { + X = other.X; + Y = other.Y; + Z = other.Z; + W = other.W; + } + + + public bool Equals(Vector4 other) + { + return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is Vector4 && Equals((Vector4) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = X.GetHashCode(); + hashCode = (hashCode * 397) ^ Y.GetHashCode(); + hashCode = (hashCode * 397) ^ Z.GetHashCode(); + hashCode = (hashCode * 397) ^ W.GetHashCode(); + return hashCode; + } + } + + public static bool operator ==(Vector4 left, Vector4 right) + { + return left.Equals(right); + } + + public static bool operator !=(Vector4 left, Vector4 right) + { + return !left.Equals(right); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs.meta new file mode 100644 index 0000000..d3d30d7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Math/Vector4.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5da6fe3b49e1de94a9ced1f70dd1bf84 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties.meta new file mode 100644 index 0000000..1e4673b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 27196d12847e1f441b0b711ca2ce9ac4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..54caea7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GLTFSerialization")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GLTFSerializer")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("72AC331F-9810-4DE2-8EA3-84559A787218")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs.meta new file mode 100644 index 0000000..39d61d0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Properties/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a9cfc1efa73335948afd6531e3a55ac1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema.meta new file mode 100644 index 0000000..c2d0b74 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc456dd013a8e964abdb43ca81d17b18 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs new file mode 100644 index 0000000..524fadb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs @@ -0,0 +1,874 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; +using System.Runtime.InteropServices; +using GLTF.Utilities; + +namespace GLTF.Schema +{ + public class Accessor : GLTFChildOfRootProperty + { + /// + /// The index of the bufferView. + /// If this is undefined, look in the sparse object for the index and value buffer views. + /// + public BufferViewId BufferView; + + /// + /// The offset relative to the start of the bufferView in bytes. + /// This must be a multiple of the size of the component datatype. + /// 0 + /// + public uint ByteOffset; + + /// + /// The datatype of components in the attribute. + /// All valid values correspond to WebGL enums. + /// The corresponding typed arrays are: `Int8Array`, `Uint8Array`, `Int16Array`, + /// `Uint16Array`, `Uint32Array`, and `Float32Array`, respectively. + /// 5125 (UNSIGNED_INT) is only allowed when the accessor contains indices + /// i.e., the accessor is only referenced by `primitive.indices`. + /// + public GLTFComponentType ComponentType; + + /// + /// Specifies whether integer data values should be normalized + /// (`true`) to [0, 1] (for unsigned types) or [-1, 1] (for signed types), + /// or converted directly (`false`) when they are accessed. + /// Must be `false` when accessor is used for animation data. + /// + public bool Normalized; + + /// + /// The number of attributes referenced by this accessor, not to be confused + /// with the number of bytes or number of components. + /// 1 + /// + public uint Count; + + /// + /// Specifies if the attribute is a scalar, vector, or matrix, + /// and the number of elements in the vector or matrix. + /// + public GLTFAccessorAttributeType Type; + + /// + /// Maximum value of each component in this attribute. + /// Both min and max arrays have the same length. + /// The length is determined by the value of the type property; + /// it can be 1, 2, 3, 4, 9, or 16. + /// + /// When `componentType` is `5126` (FLOAT) each array value must be stored as + /// double-precision JSON number with numerical value which is equal to + /// buffer-stored single-precision value to avoid extra runtime conversions. + /// + /// `normalized` property has no effect on array values: they always correspond + /// to the actual values stored in the buffer. When accessor is sparse, this + /// property must contain max values of accessor data with sparse substitution + /// applied. + /// 1 + /// 16 + /// + public List Max; + + /// + /// Minimum value of each component in this attribute. + /// Both min and max arrays have the same length. The length is determined by + /// the value of the type property; it can be 1, 2, 3, 4, 9, or 16. + /// + /// When `componentType` is `5126` (FLOAT) each array value must be stored as + /// double-precision JSON number with numerical value which is equal to + /// buffer-stored single-precision value to avoid extra runtime conversions. + /// + /// `normalized` property has no effect on array values: they always correspond + /// to the actual values stored in the buffer. When accessor is sparse, this + /// property must contain min values of accessor data with sparse substitution + /// applied. + /// 1 + /// 16 + /// + public List Min; + + /// + /// Sparse storage of attributes that deviate from their initialization value. + /// + public AccessorSparse Sparse; + + public Accessor() + { + } + + public Accessor(Accessor accessor, GLTFRoot gltfRoot) : base(accessor, gltfRoot) + { + if (accessor == null) + { + return; + } + + if (accessor.BufferView != null) + { + BufferView = new BufferViewId(accessor.BufferView, gltfRoot); + } + + ByteOffset = accessor.ByteOffset; + ComponentType = accessor.ComponentType; + Normalized = accessor.Normalized; + Count = accessor.Count; + Type = accessor.Type; + + if (accessor.Max != null) + { + Max = accessor.Max.ToList(); + } + + if (accessor.Min != null) + { + Min = accessor.Min.ToList(); + } + + if (accessor.Sparse != null) + { + Sparse = new AccessorSparse(accessor.Sparse, gltfRoot); + } + } + + public static Accessor Deserialize(GLTFRoot root, JsonReader reader) + { + var accessor = new Accessor(); + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "bufferView": + accessor.BufferView = BufferViewId.Deserialize(root, reader); + break; + case "byteOffset": + accessor.ByteOffset = reader.ReadDoubleAsUInt32(); + break; + case "componentType": + accessor.ComponentType = (GLTFComponentType)reader.ReadAsInt32().Value; + break; + case "normalized": + accessor.Normalized = reader.ReadAsBoolean().Value; + break; + case "count": + accessor.Count = reader.ReadDoubleAsUInt32(); + break; + case "type": + accessor.Type = reader.ReadStringEnum(); + break; + case "max": + accessor.Max = reader.ReadDoubleList(); + break; + case "min": + accessor.Min = reader.ReadDoubleList(); + break; + case "sparse": + accessor.Sparse = AccessorSparse.Deserialize(root, reader); + break; + default: + accessor.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return accessor; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (BufferView != null) + { + writer.WritePropertyName("bufferView"); + writer.WriteValue(BufferView.Id); + } + + if (ByteOffset != 0) + { + writer.WritePropertyName("byteOffset"); + writer.WriteValue(ByteOffset); + } + + writer.WritePropertyName("componentType"); + writer.WriteValue(ComponentType); + + if (Normalized != false) + { + writer.WritePropertyName("normalized"); + writer.WriteValue(true); + } + + writer.WritePropertyName("count"); + writer.WriteValue(Count); + + writer.WritePropertyName("type"); + writer.WriteValue(Type.ToString()); + + bool isMaxNull = Max == null; + bool isMinNull = Min == null; + + if (!isMaxNull) + { + writer.WritePropertyName("max"); + writer.WriteStartArray(); + foreach (var item in Max) + { + writer.WriteValue(item); + } + writer.WriteEndArray(); + } + + if (!isMinNull) + { + writer.WritePropertyName("min"); + writer.WriteStartArray(); + foreach (var item in Min) + { + writer.WriteValue(item); + } + writer.WriteEndArray(); + } + + if (Sparse != null) + { + if (isMinNull || isMaxNull) + { + throw new JsonSerializationException("Min and max attribute cannot be null when attribute is sparse"); + } + + writer.WritePropertyName("sparse"); + Sparse.Serialize(writer); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + + private static sbyte GetByteElement(byte[] buffer, uint byteOffset) + { + return Convert.ToSByte(GetUByteElement(buffer, byteOffset)); + } + + private static byte GetUByteElement(byte[] buffer, uint byteOffset) + { + return buffer[byteOffset]; // should only be byte size long + } + + private static unsafe short GetShortElement(byte[] buffer, uint byteOffset) + { + fixed (byte* offsetBuffer = &buffer[byteOffset]) + { + return *((short*)offsetBuffer); + } + } + + private static unsafe ushort GetUShortElement(byte[] buffer, uint byteOffset) + { + fixed (byte* offsetBuffer = &buffer[byteOffset]) + { + return *((ushort*)offsetBuffer); + } + } + + private static unsafe uint GetUIntElement(byte[] buffer, uint byteOffset) + { + fixed (byte* offsetBuffer = &buffer[byteOffset]) + { + return *((uint*)offsetBuffer); + } + } + + private static unsafe float GetFloatElement(byte[] buffer, uint byteOffset) + { + fixed (byte* offsetBuffer = &buffer[byteOffset]) + { + return *((float*)offsetBuffer); + } + } + + public static GLTF.Math.Vector3[] AsSparseVector3Array(Accessor paraAccessor, ref NumericArray contents, byte[] bufferViewData, uint offset, bool normalizeIntValues = true) + { + var Count = paraAccessor.Sparse.Count; + var ComponentType = paraAccessor.ComponentType; + + var arr = new GLTF.Math.Vector3[paraAccessor.Sparse.Count]; + var totalByteOffset = (uint) paraAccessor.Sparse.Values.ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(paraAccessor.ComponentType, out componentSize, out maxValue); + uint stride = componentSize * 3; + if (normalizeIntValues) maxValue = 1; + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + { + arr[idx].X = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0); + arr[idx].Y = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1); + arr[idx].Z = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2); + } + else + { + arr[idx].X = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0, ComponentType) / maxValue; + arr[idx].Y = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1, ComponentType) / maxValue; + arr[idx].Z = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2, ComponentType) / maxValue; + } + } + contents.AsVec3s = arr; + return arr; + } + + public static uint[] AsSparseUIntArray(Accessor paraAccessor, ref NumericArray contents, byte[] bufferViewData, uint offset) + { + var arr = new uint[paraAccessor.Sparse.Count]; + var totalByteOffset = paraAccessor.Sparse.Indices.ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(paraAccessor.Sparse.Indices.ComponentType, out componentSize, out maxValue); + + uint stride = componentSize; + for (uint idx = 0; idx < paraAccessor.Sparse.Count; idx++) + { + if (stride == 1) + { + arr[idx] = (uint)bufferViewData[(int)(totalByteOffset + idx)]; + } + else + { + arr[idx] = System.BitConverter.ToUInt16(bufferViewData, (int)(totalByteOffset + idx * stride)); + } + } + contents.AsUInts = arr; + return arr; + } + + internal static void GetTypeDetails( + GLTFComponentType type, + out uint componentSize, + out float maxValue) + { + componentSize = 1; + maxValue = byte.MaxValue; + + switch (type) + { + case GLTFComponentType.Byte: + componentSize = sizeof(sbyte); + maxValue = sbyte.MaxValue; + break; + case GLTFComponentType.UnsignedByte: + componentSize = sizeof(byte); + maxValue = byte.MaxValue; + break; + case GLTFComponentType.Short: + componentSize = sizeof(short); + maxValue = short.MaxValue; + break; + case GLTFComponentType.UnsignedShort: + componentSize = sizeof(ushort); + maxValue = ushort.MaxValue; + break; + case GLTFComponentType.UnsignedInt: + componentSize = sizeof(uint); + maxValue = uint.MaxValue; + break; + case GLTFComponentType.Float: + componentSize = sizeof(float); + maxValue = float.MaxValue; + break; + default: + throw new Exception("Unsupported component type."); + } + } + + public uint[] AsUIntArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsUInts != null) + { + return contents.AsUInts; + } + + if (Type != GLTFAccessorAttributeType.SCALAR) + { + return null; + } + + var arr = new uint[Count]; + var totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + uint stride = BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize; + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + arr[idx] = (uint)System.Math.Floor(GetFloatElement(bufferViewData, totalByteOffset + idx * stride)); + else + arr[idx] = GetUnsignedDiscreteElement(bufferViewData, totalByteOffset + idx * stride, ComponentType); + } + + contents.AsUInts = arr; + return arr; + } + + public float[] AsFloatArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsUInts != null) + { + return contents.AsFloats; + } + + if (Type != GLTFAccessorAttributeType.SCALAR) + { + return null; + } + + var arr = new float[Count]; + uint totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + uint stride = BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize; + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + arr[idx] = GetFloatElement(bufferViewData, totalByteOffset + idx * stride); + else + arr[idx] = GetUnsignedDiscreteElement(bufferViewData, totalByteOffset + idx * stride, ComponentType); + } + + contents.AsFloats = arr; + return arr; + } + + public Vector2[] AsVector2Array(ref NumericArray contents, byte[] bufferViewData, uint offset, bool normalizeIntValues = true) + { + if (contents.AsVec2s != null) + { + return contents.AsVec2s; + } + + if (Type != GLTFAccessorAttributeType.VEC2) + { + return null; + } + + if (ComponentType == GLTFComponentType.UnsignedInt) + { + return null; + } + + var arr = new Vector2[Count]; + var totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + uint stride = BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize * 2; + if (normalizeIntValues) maxValue = 1; + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + { + arr[idx].X = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0); + arr[idx].Y = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1); + } + else + { + arr[idx].X = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0, ComponentType) / maxValue; + arr[idx].Y = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1, ComponentType) / maxValue; + } + } + + contents.AsVec2s = arr; + return arr; + } + + public Vector3[] AsVector3Array(ref NumericArray contents, byte[] bufferViewData, uint offset, bool normalizeIntValues = true) + { + if (contents.AsVec3s != null) + { + return contents.AsVec3s; + } + + if (Type != GLTFAccessorAttributeType.VEC3) + { + return null; + } + + var arr = new Vector3[Count]; + var totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + uint stride = BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize * 3; + if (normalizeIntValues) maxValue = 1; + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + { + arr[idx].X = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0); + arr[idx].Y = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1); + arr[idx].Z = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2); + } + else + { + arr[idx].X = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0, ComponentType) / maxValue; + arr[idx].Y = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1, ComponentType) / maxValue; + arr[idx].Z = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2, ComponentType) / maxValue; + } + } + + contents.AsVec3s = arr; + return arr; + } + + public Vector4[] AsVector4Array(ref NumericArray contents, byte[] bufferViewData, uint offset, bool normalizeIntValues = true) + { + if (contents.AsVec4s != null) + { + return contents.AsVec4s; + } + + if (Type != GLTFAccessorAttributeType.VEC4) + { + return null; + } + + if (ComponentType == GLTFComponentType.UnsignedInt) + { + return null; + } + + var arr = new Vector4[Count]; + var totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + uint stride = BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize * 4; + if (normalizeIntValues) maxValue = 1; + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + { + arr[idx].X = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0); + arr[idx].Y = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1); + arr[idx].Z = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2); + arr[idx].W = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 3); + } + else + { + arr[idx].X = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0, ComponentType) / maxValue; + arr[idx].Y = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1, ComponentType) / maxValue; + arr[idx].Z = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2, ComponentType) / maxValue; + arr[idx].W = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 3, ComponentType) / maxValue; + } + } + + contents.AsVec4s = arr; + return arr; + } + + public Color[] AsColorArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsColors != null) + { + return contents.AsColors; + } + + if (Type != GLTFAccessorAttributeType.VEC3 && Type != GLTFAccessorAttributeType.VEC4) + { + return null; + } + + if (ComponentType == GLTFComponentType.UnsignedInt) + { + return null; + } + + var arr = new Color[Count]; + var totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + uint stride = (uint)(BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize * (Type == GLTFAccessorAttributeType.VEC3 ? 3 : 4)); + + for (uint idx = 0; idx < Count; idx++) + { + if (ComponentType == GLTFComponentType.Float) + { + arr[idx].R = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0); + arr[idx].G = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1); + arr[idx].B = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2); + if (Type == GLTFAccessorAttributeType.VEC4) + arr[idx].A = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 3); + else + arr[idx].A = 1; + } + else + { + // todo: can be optimized to get these in a block... + arr[idx].R = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 0, ComponentType) / maxValue; + arr[idx].G = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 1, ComponentType) / maxValue; + arr[idx].B = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 2, ComponentType) / maxValue; + if (Type == GLTFAccessorAttributeType.VEC4) + arr[idx].A = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * 3, ComponentType) / maxValue; + else + arr[idx].A = 1; + } + } + + contents.AsColors = arr; + return arr; + } + + public Vector2[] AsTexcoordArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsTexcoords != null) + { + return contents.AsTexcoords; + } + + contents.AsTexcoords = AsVector2Array(ref contents, bufferViewData, offset); + + return contents.AsTexcoords; + } + + public Vector3[] AsVertexArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsVertices != null) + { + return contents.AsVertices; + } + + contents.AsVertices = AsVector3Array(ref contents, bufferViewData, offset); + + return contents.AsVertices; + } + + public Vector3[] AsNormalArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsNormals != null) + { + return contents.AsNormals; + } + + contents.AsNormals = AsVector3Array(ref contents, bufferViewData, offset); + + return contents.AsNormals; + } + + public Vector4[] AsTangentArray(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsTangents != null) + { + return contents.AsTangents; + } + + contents.AsTangents = AsVector4Array(ref contents, bufferViewData, offset); + + return contents.AsTangents; + } + + public uint[] AsTriangles(ref NumericArray contents, byte[] bufferViewData, uint offset) + { + if (contents.AsTriangles != null) + { + return contents.AsTriangles; + } + + contents.AsTriangles = AsUIntArray(ref contents, bufferViewData, offset); + + return contents.AsTriangles; + } + + public Matrix4x4[] AsMatrix4x4Array(ref NumericArray contents, byte[] bufferViewData, uint offset, bool normalizeIntValues = true) + { + if (contents.AsMatrix4x4s != null) + { + return contents.AsMatrix4x4s; + } + + if (Type != GLTFAccessorAttributeType.MAT4) + { + return null; + } + + Matrix4x4[] arr = new Matrix4x4[Count]; + uint totalByteOffset = ByteOffset + offset; + + uint componentSize; + float maxValue; + GetTypeDetails(ComponentType, out componentSize, out maxValue); + + if (normalizeIntValues) + { + maxValue = 1; + } + + uint stride = (uint)(BufferView.Value.ByteStride > 0 ? BufferView.Value.ByteStride : componentSize * 16); + + for (uint idx = 0; idx < Count; idx++) + { + arr[idx] = new Matrix4x4(Matrix4x4.Identity); + + if (ComponentType == GLTFComponentType.Float) + { + for (uint i = 0; i < 16; i++) + { + float value = GetFloatElement(bufferViewData, totalByteOffset + idx * stride + componentSize * i); + arr[idx].SetValue((int)i, value); + } + } + else + { + for (uint i = 0; i < 16; i++) + { + float value = GetDiscreteElement(bufferViewData, totalByteOffset + idx * stride + componentSize * i, ComponentType) / maxValue; + arr[idx].SetValue((int)i, value); + } + } + } + + contents.AsMatrix4x4s = arr; + return arr; + } + + private static int GetDiscreteElement(byte[] bufferViewData, uint offset, GLTFComponentType type) + { + switch (type) + { + case GLTFComponentType.Byte: + { + return GetByteElement(bufferViewData, offset); + } + case GLTFComponentType.UnsignedByte: + { + return GetUByteElement(bufferViewData, offset); + } + case GLTFComponentType.Short: + { + return GetShortElement(bufferViewData, offset); + } + case GLTFComponentType.UnsignedShort: + { + return GetUShortElement(bufferViewData, offset); + } + default: + { + throw new Exception("Unsupported type passed in: " + type); + } + } + } + + // technically byte and short are not spec compliant for unsigned types, but various files have it + private static uint GetUnsignedDiscreteElement(byte[] bufferViewData, uint offset, GLTFComponentType type) + { + switch (type) + { + case GLTFComponentType.Byte: + { + return (uint)GetByteElement(bufferViewData, offset); + } + case GLTFComponentType.UnsignedByte: + { + return GetUByteElement(bufferViewData, offset); + } + case GLTFComponentType.Short: + { + return (uint)GetShortElement(bufferViewData, offset); + } + case GLTFComponentType.UnsignedShort: + { + return GetUShortElement(bufferViewData, offset); + } + case GLTFComponentType.UnsignedInt: + { + return GetUIntElement(bufferViewData, offset); + } + default: + { + throw new Exception("Unsupported type passed in: " + type); + } + + } + } + } + + public enum GLTFComponentType + { + Byte = 5120, + UnsignedByte = 5121, + Short = 5122, + UnsignedShort = 5123, + UnsignedInt = 5125, + Float = 5126 + } + + public enum GLTFAccessorAttributeType + { + SCALAR, + VEC2, + VEC3, + VEC4, + MAT2, + MAT3, + MAT4 + } + + /// + [StructLayout(LayoutKind.Explicit)] + public struct NumericArray + { + [FieldOffset(0)] + public uint[] AsUInts; + [FieldOffset(0)] + public float[] AsFloats; + [FieldOffset(0)] + public Vector2[] AsVec2s; + [FieldOffset(0)] + public Vector3[] AsVec3s; + [FieldOffset(0)] + public Vector4[] AsVec4s; + [FieldOffset(0)] + public Matrix4x4[] AsMatrix4x4s; + [FieldOffset(0)] + public Color[] AsColors; + [FieldOffset(0)] + public Vector2[] AsTexcoords; + [FieldOffset(0)] + public Vector3[] AsVertices; + [FieldOffset(0)] + public Vector3[] AsNormals; + [FieldOffset(0)] + public Vector4[] AsTangents; + [FieldOffset(0)] + public uint[] AsTriangles; + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs.meta new file mode 100644 index 0000000..2110124 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Accessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9fdb27ce25eaa9e418627129cb42bd53 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs new file mode 100644 index 0000000..4235bb4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs @@ -0,0 +1,91 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class AccessorSparse : GLTFProperty + { + /// + /// Number of entries stored in the sparse array. + /// 1 + /// + public int Count; + + /// + /// Index array of size `count` that points to those accessor attributes that + /// deviate from their initialization value. Indices must strictly increase. + /// + public AccessorSparseIndices Indices; + + /// + /// "Array of size `count` times number of components, storing the displaced + /// accessor attributes pointed by `indices`. Substituted values must have + /// the same `componentType` and number of components as the base accessor. + /// + public AccessorSparseValues Values; + + public AccessorSparse() + { + } + + public AccessorSparse(AccessorSparse accessorSparse, GLTFRoot gltfRoot) : base(accessorSparse) + { + if (accessorSparse == null) return; + + Count = accessorSparse.Count; + Indices = new AccessorSparseIndices(accessorSparse.Indices, gltfRoot); + Values = new AccessorSparseValues(accessorSparse.Values, gltfRoot); + } + + public static AccessorSparse Deserialize(GLTFRoot root, JsonReader reader) + { + var accessorSparse = new AccessorSparse(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "count": + accessorSparse.Count = reader.ReadAsInt32().Value; + break; + case "indices": + accessorSparse.Indices = AccessorSparseIndices.Deserialize(root, reader); + break; + case "values": + accessorSparse.Values = AccessorSparseValues.Deserialize(root, reader); + break; + default: + accessorSparse.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return accessorSparse; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("count"); + writer.WriteValue(Count); + + writer.WritePropertyName("indices"); + Indices.Serialize(writer); + + writer.WritePropertyName("values"); + Values.Serialize(writer); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs.meta new file mode 100644 index 0000000..790a106 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparse.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30350fa0a44956c4084506e37779d503 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs new file mode 100644 index 0000000..8f46939 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs @@ -0,0 +1,95 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class AccessorSparseIndices : GLTFProperty + { + /// + /// The index of the bufferView with sparse indices. + /// Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target. + /// + public BufferViewId BufferView; + + /// + /// The offset relative to the start of the bufferView in bytes. Must be aligned. + /// 0 + /// + public int ByteOffset; + + /// + /// The indices data type. Valid values correspond to WebGL enums: + /// `5121` (UNSIGNED_BYTE) + /// `5123` (UNSIGNED_SHORT) + /// `5125` (UNSIGNED_INT) + /// + public GLTFComponentType ComponentType; + + public AccessorSparseIndices() + { + } + + public AccessorSparseIndices(AccessorSparseIndices accessorSparseIndices, GLTFRoot gltfRoot) : base(accessorSparseIndices) + { + if (accessorSparseIndices == null) return; + + BufferView = new BufferViewId(accessorSparseIndices.BufferView, gltfRoot); + ByteOffset = accessorSparseIndices.ByteOffset; + ComponentType = accessorSparseIndices.ComponentType; + } + + public static AccessorSparseIndices Deserialize(GLTFRoot root, JsonReader reader) + { + var indices = new AccessorSparseIndices(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "bufferView": + indices.BufferView = BufferViewId.Deserialize(root, reader); + break; + case "byteOffset": + indices.ByteOffset = reader.ReadAsInt32().Value; + break; + case "componentType": + indices.ComponentType = (GLTFComponentType) reader.ReadAsInt32().Value; + break; + default: + indices.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return indices; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("bufferView"); + writer.WriteValue(BufferView.Id); + + if (ByteOffset != 0) + { + writer.WritePropertyName("byteOffset"); + writer.WriteValue(ByteOffset); + } + + writer.WritePropertyName("componentType"); + writer.WriteValue((int)ComponentType); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs.meta new file mode 100644 index 0000000..079d9d6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseIndices.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0606e7ff683a71a4098fadddab4663f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs new file mode 100644 index 0000000..f017f17 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs @@ -0,0 +1,80 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class AccessorSparseValues : GLTFProperty + { + /// + /// The index of the bufferView with sparse values. + /// Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target. + /// + public BufferViewId BufferView; + + /// + /// The offset relative to the start of the bufferView in bytes. Must be aligned. + /// 0 + /// + public int ByteOffset = 0; + + public AccessorSparseValues() + { + } + + public AccessorSparseValues(AccessorSparseValues accessorSparseValues, GLTFRoot gltfRoot) : base(accessorSparseValues) + { + if (accessorSparseValues == null) return; + + BufferView = new BufferViewId(accessorSparseValues.BufferView, gltfRoot); + ByteOffset = accessorSparseValues.ByteOffset; + } + + public static AccessorSparseValues Deserialize(GLTFRoot root, JsonReader reader) + { + var values = new AccessorSparseValues(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "bufferView": + values.BufferView = BufferViewId.Deserialize(root, reader); + break; + case "byteOffset": + values.ByteOffset = reader.ReadAsInt32().Value; + break; + default: + values.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return values; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("bufferView"); + writer.WriteValue(BufferView.Id); + + if (ByteOffset != 0) + { + writer.WritePropertyName("byteOffset"); + writer.WriteValue(ByteOffset); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs.meta new file mode 100644 index 0000000..1406cc8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AccessorSparseValues.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d00bc2c09c68ec8408bd7b0069b855d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs new file mode 100644 index 0000000..f4bafb6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs @@ -0,0 +1,73 @@ +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// Targets an animation's sampler at a node's property. + /// + public class AnimationChannel : GLTFProperty + { + /// + /// The index of a sampler in this animation used to compute the value for the + /// target, e.g., a node's translation, rotation, or scale (TRS). + /// + public AnimationSamplerId Sampler; + + /// + /// The index of the node and TRS property to target. + /// + public AnimationChannelTarget Target; + + public AnimationChannel() + { + } + + public AnimationChannel(AnimationChannel animationChannel, GLTFRoot root) : base(animationChannel) + { + if (animationChannel == null) return; + + Sampler = new AnimationSamplerId(animationChannel.Sampler, root); + Target = new AnimationChannelTarget(animationChannel.Target, root); + } + + public static AnimationChannel Deserialize(GLTFRoot root, JsonReader reader, GLTFAnimation anim) + { + var animationChannel = new AnimationChannel(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "sampler": + animationChannel.Sampler = AnimationSamplerId.Deserialize(root, anim, reader); + break; + case "target": + animationChannel.Target = AnimationChannelTarget.Deserialize(root, reader); + break; + default: + animationChannel.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return animationChannel; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("sampler"); + writer.WriteValue(Sampler.Id); + + writer.WritePropertyName("target"); + Target.Serialize(writer); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs.meta new file mode 100644 index 0000000..8b6fbac --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5e7ba1c2598f9aa48a88e0e2730433b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs new file mode 100644 index 0000000..a119b40 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs @@ -0,0 +1,94 @@ +using System; +using GLTF.Extensions; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// The index of the node and TRS property that an animation channel targets. + /// + public class AnimationChannelTarget : GLTFProperty + { + /// + /// The index of the node to target. + /// + public NodeId Node; + + /// + /// The name of the node's TRS property to modify. + /// + public string Path; + + public static AnimationChannelTarget Deserialize(GLTFRoot root, JsonReader reader) + { + var animationChannelTarget = new AnimationChannelTarget(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Animation channel target must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "node": + animationChannelTarget.Node = NodeId.Deserialize(root, reader); + break; + case "path": + animationChannelTarget.Path = reader.ReadAsString();// reader.ReadStringEnum(); + break; + // TODO: add KHR_animation_pointer import + // case "pointer": + // break; + default: + animationChannelTarget.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return animationChannelTarget; + } + + public AnimationChannelTarget() + { + } + + public AnimationChannelTarget(AnimationChannelTarget channelTarget, GLTFRoot gltfRoot) : base(channelTarget) + { + if (channelTarget == null) return; + + Node = channelTarget.Node != null ? new NodeId(channelTarget.Node, gltfRoot) : null; + Path = channelTarget.Path; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + // in KHR_animation2 node might not exist, instead it has an extensions field + if (Node != null) + { + writer.WritePropertyName("node"); + writer.WriteValue(Node.Id); + } + + writer.WritePropertyName("path"); + writer.WriteValue(Path.ToString()); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } + + public enum GLTFAnimationChannelPath + { + translation, + rotation, + scale, + weights + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs.meta new file mode 100644 index 0000000..0ec1b46 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationChannelTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8111941d8c535694480020d2938d7ead +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs new file mode 100644 index 0000000..385bebb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs @@ -0,0 +1,103 @@ +using GLTF.Extensions; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public enum InterpolationType + { + LINEAR, + STEP, + CATMULLROMSPLINE, + CUBICSPLINE + } + + /// + /// Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target). + /// + public class AnimationSampler : GLTFProperty + { + /// + /// The index of an accessor containing keyframe input values, e.G., time. + /// That accessor must have componentType `FLOAT`. The values represent time in + /// seconds with `time[0] >= 0.0`, and strictly increasing values, + /// i.e., `time[n + 1] > time[n]` + /// + public AccessorId Input; + + /// + /// Interpolation algorithm. When an animation targets a node's rotation, + /// and the animation's interpolation is `\"LINEAR\"`, spherical linear + /// interpolation (slerp) should be used to interpolate quaternions. When + /// interpolation is `\"STEP\"`, animated value remains constant to the value + /// of the first point of the timeframe, until the next timeframe. + /// + public InterpolationType Interpolation; + + /// + /// The index of an accessor, containing keyframe output values. Output and input + /// accessors must have the same `count`. When sampler is used with TRS target, + /// output accessor's componentType must be `FLOAT`. + /// + public AccessorId Output; + + public AnimationSampler() + { + } + + public AnimationSampler(AnimationSampler animationSampler, GLTFRoot gltfRoot) : base(animationSampler) + { + if (animationSampler == null) return; + + Input = new AccessorId(animationSampler.Input, gltfRoot); + Interpolation = animationSampler.Interpolation; + Output = new AccessorId(animationSampler.Output, gltfRoot); + } + + public static AnimationSampler Deserialize(GLTFRoot root, JsonReader reader) + { + var animationSampler = new AnimationSampler(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "input": + animationSampler.Input = AccessorId.Deserialize(root, reader); + break; + case "interpolation": + animationSampler.Interpolation = reader.ReadStringEnum(); + break; + case "output": + animationSampler.Output = AccessorId.Deserialize(root, reader); + break; + default: + animationSampler.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return animationSampler; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("input"); + writer.WriteValue(Input.Id); + + // the spec defines "LINEAR" as default, but we need to explicitly export this since there are issues with Google SceneViewer when no interpolation is specified + writer.WritePropertyName("interpolation"); + writer.WriteValue(Interpolation.ToString()); + + writer.WritePropertyName("output"); + writer.WriteValue(Output.Id); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs.meta new file mode 100644 index 0000000..16d77b8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/AnimationSampler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2fda6c6e1290a7b44bfefed8f5d16c5a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs new file mode 100644 index 0000000..f855dc1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs @@ -0,0 +1,105 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// Metadata about the glTF asset. + /// + public class Asset : GLTFProperty + { + /// + /// A copyright message suitable for display to credit the content creator. + /// + public string Copyright; + + /// + /// Tool that generated this glTF model. Useful for debugging. + /// + public string Generator; + + /// + /// The glTF version. + /// + public string Version; + + /// + /// The minimum glTF version that this asset targets. + /// + public string MinVersion; + + public Asset() + { + } + + public Asset(Asset asset) : base(asset) + { + if (asset == null) return; + + Copyright = asset.Copyright; + Generator = asset.Generator; + Version = asset.Version; + MinVersion = asset.MinVersion; + } + + public static Asset Deserialize(GLTFRoot root, JsonReader reader) + { + var asset = new Asset(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "copyright": + asset.Copyright = reader.ReadAsString(); + break; + case "generator": + asset.Generator = reader.ReadAsString(); + break; + case "version": + asset.Version = reader.ReadAsString(); + break; + case "minVersion": + asset.MinVersion = reader.ReadAsString(); + break; + default: + asset.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return asset; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Copyright != null) + { + writer.WritePropertyName("copyright"); + writer.WriteValue(Copyright); + } + + if (Generator != null) + { + writer.WritePropertyName("generator"); + writer.WriteValue(Generator); + } + + writer.WritePropertyName("version"); + writer.WriteValue(Version); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs.meta new file mode 100644 index 0000000..51bb8f3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Asset.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85a3a816df09cc345ab4002fe5a7cf11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs new file mode 100644 index 0000000..10a0bc0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs @@ -0,0 +1,139 @@ +using GLTF.Utilities; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public enum BufferViewTarget + { + /// + /// For animation or + /// + None = 0, + /// + /// For vertex data + /// + ArrayBuffer = 34962, + /// + /// For index data + /// + ElementArrayBuffer = 34963, + } + + /// + /// A view into a buffer generally representing a subset of the buffer. + /// + public class BufferView : GLTFChildOfRootProperty + { + /// + /// The index of the buffer. + /// + public BufferId Buffer; + + /// + /// The offset into the buffer in bytes. + /// 0 + /// + public uint ByteOffset; + + /// + /// The length of the bufferView in bytes. + /// 0 + /// + public uint ByteLength; + + /// + /// The stride, in bytes, between vertex attributes or other interleavable data. + /// When this is zero, data is tightly packed. + /// 0 + /// 255 + /// + public uint ByteStride; + + /// + /// The target that the WebGL buffer should be bound to. + /// All valid values correspond to WebGL enums. + /// When this is not provided, the bufferView contains animation or skin data. + /// + public BufferViewTarget Target = BufferViewTarget.None; + + public BufferView() + { + } + + public BufferView(BufferView bufferView, GLTFRoot gltfRoot) : base(bufferView, gltfRoot) + { + Buffer = new BufferId(bufferView.Buffer, gltfRoot); + ByteOffset = bufferView.ByteOffset; + ByteLength = bufferView.ByteLength; + ByteStride = bufferView.ByteStride; + Target = bufferView.Target; + } + + public static BufferView Deserialize(GLTFRoot root, JsonReader reader) + { + var bufferView = new BufferView(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "buffer": + bufferView.Buffer = BufferId.Deserialize(root, reader); + break; + case "byteOffset": + bufferView.ByteOffset = reader.ReadDoubleAsUInt32(); + break; + case "byteLength": + bufferView.ByteLength = reader.ReadDoubleAsUInt32(); + break; + case "byteStride": + bufferView.ByteStride = reader.ReadDoubleAsUInt32(); + break; + case "target": + bufferView.Target = (BufferViewTarget)reader.ReadAsInt32().Value; + break; + default: + bufferView.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return bufferView; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("buffer"); + writer.WriteValue(Buffer.Id); + + if (ByteOffset != 0) + { + writer.WritePropertyName("byteOffset"); + writer.WriteValue(ByteOffset); + } + + writer.WritePropertyName("byteLength"); + writer.WriteValue(ByteLength); + + if (ByteStride != 0) + { + writer.WritePropertyName("byteStride"); + writer.WriteValue(ByteStride); + } + + if (Target != BufferViewTarget.None) + { + writer.WritePropertyName("target"); + writer.WriteValue((int)Target); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs.meta new file mode 100644 index 0000000..818203e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/BufferView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d729c33bb2a00cc4d9b1dfb86a5328e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs new file mode 100644 index 0000000..d0b969c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs @@ -0,0 +1,101 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// An orthographic camera containing properties to create an orthographic + /// projection matrix. + /// + public class CameraOrthographic : GLTFProperty + { + /// + /// The floating-point horizontal magnification of the view. + /// + public double XMag; + + /// + /// The floating-point vertical magnification of the view. + /// + public double YMag; + + /// + /// The floating-point distance to the far clipping plane. + /// + public double ZFar; + + /// + /// The floating-point distance to the near clipping plane. + /// + public double ZNear; + + public CameraOrthographic() + { + } + + public CameraOrthographic(CameraOrthographic cameraOrthographic) : base(cameraOrthographic) + { + XMag = cameraOrthographic.XMag; + YMag = cameraOrthographic.YMag; + ZFar = cameraOrthographic.ZFar; + ZNear = cameraOrthographic.ZNear; + } + + public static CameraOrthographic Deserialize(GLTFRoot root, JsonReader reader) + { + var cameraOrthographic = new CameraOrthographic(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Orthographic camera must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "xmag": + cameraOrthographic.XMag = reader.ReadAsDouble().Value; + break; + case "ymag": + cameraOrthographic.YMag = reader.ReadAsDouble().Value; + break; + case "zfar": + cameraOrthographic.ZFar = reader.ReadAsDouble().Value; + break; + case "znear": + cameraOrthographic.ZNear = reader.ReadAsDouble().Value; + break; + default: + cameraOrthographic.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return cameraOrthographic; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("xmag"); + writer.WriteValue(XMag); + + writer.WritePropertyName("ymag"); + writer.WriteValue(YMag); + + writer.WritePropertyName("zfar"); + writer.WriteValue(ZFar); + + writer.WritePropertyName("znear"); + writer.WriteValue(ZNear); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs.meta new file mode 100644 index 0000000..e4088cf --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraOrthographic.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6454a44f211e034fbb296317a54bc1c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs new file mode 100644 index 0000000..96fda1f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs @@ -0,0 +1,116 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A perspective camera containing properties to create a perspective projection + /// matrix. + /// + public class CameraPerspective : GLTFProperty + { + /// + /// The floating-point aspect ratio of the field of view. + /// When this is undefined, the aspect ratio of the canvas is used. + /// 0.0 + /// + public double AspectRatio; + + /// + /// The floating-point vertical field of view in radians. + /// 0.0 + /// + public double YFov; + + /// + /// The floating-point distance to the far clipping plane. When defined, + /// `zfar` must be greater than `znear`. + /// If `zfar` is undefined, runtime must use infinite projection matrix. + /// 0.0 + /// + public double ZFar = double.PositiveInfinity; + + /// + /// The floating-point distance to the near clipping plane. + /// 0.0 + /// + public double ZNear; + + public CameraPerspective() + { + } + + public CameraPerspective(CameraPerspective cameraPerspective) : base(cameraPerspective) + { + if (cameraPerspective == null) return; + + AspectRatio = cameraPerspective.AspectRatio; + YFov = cameraPerspective.YFov; + ZFar = cameraPerspective.ZFar; + ZNear = cameraPerspective.ZNear; + } + + public static CameraPerspective Deserialize(GLTFRoot root, JsonReader reader) + { + var cameraPerspective = new CameraPerspective(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Perspective camera must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "aspectRatio": + cameraPerspective.AspectRatio = reader.ReadAsDouble().Value; + break; + case "yfov": + cameraPerspective.YFov = reader.ReadAsDouble().Value; + break; + case "zfar": + cameraPerspective.ZFar = reader.ReadAsDouble().Value; + break; + case "znear": + cameraPerspective.ZNear = reader.ReadAsDouble().Value; + break; + default: + cameraPerspective.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return cameraPerspective; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (AspectRatio != 0) + { + writer.WritePropertyName("aspectRatio"); + writer.WriteValue(AspectRatio); + } + + writer.WritePropertyName("yfov"); + writer.WriteValue(YFov); + + if (ZFar != double.PositiveInfinity) + { + writer.WritePropertyName("zfar"); + writer.WriteValue(ZFar); + } + + writer.WritePropertyName("znear"); + writer.WriteValue(ZNear); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs.meta new file mode 100644 index 0000000..1fb2a95 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/CameraPerspective.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf6fe265120bc154ea4bb0c11a7ab8a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs new file mode 100644 index 0000000..a1838f1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs @@ -0,0 +1,96 @@ +using System.Collections.Generic; +using GLTF.Extensions; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A keyframe animation. + /// + public class GLTFAnimation : GLTFChildOfRootProperty + { + /// + /// An array of channels, each of which targets an animation's sampler at a + /// node's property. Different channels of the same animation can't have equal + /// targets. + /// + public List Channels; + + /// + /// An array of samplers that combines input and output accessors with an + /// interpolation algorithm to define a keyframe graph (but not its target). + /// + public List Samplers; + + public static GLTFAnimation Deserialize(GLTFRoot root, JsonReader reader) + { + var animation = new GLTFAnimation(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "channels": + animation.Channels = reader.ReadList(() => AnimationChannel.Deserialize(root, reader, animation)); + break; + case "samplers": + animation.Samplers = reader.ReadList(() => AnimationSampler.Deserialize(root, reader)); + break; + default: + animation.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return animation; + } + + public GLTFAnimation() + { + Channels = new List(); + Samplers = new List(); + } + + public GLTFAnimation(GLTFAnimation animation, GLTFRoot gltfRoot) : base(animation, gltfRoot) + { + Channels = new List(animation.Channels.Count); + foreach (AnimationChannel channel in animation.Channels) + { + Channels.Add(new AnimationChannel(channel, gltfRoot)); + } + + Samplers = new List(animation.Samplers.Count); + foreach (AnimationSampler sampler in animation.Samplers) + { + Samplers.Add(new AnimationSampler(sampler, gltfRoot)); + } + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("channels"); + writer.WriteStartArray(); + foreach (var channel in Channels) + { + channel.Serialize(writer); + } + writer.WriteEndArray(); + + writer.WritePropertyName("samplers"); + writer.WriteStartArray(); + foreach (var sampler in Samplers) + { + sampler.Serialize(writer); + } + writer.WriteEndArray(); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs.meta new file mode 100644 index 0000000..9fc1149 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27b34af664d9b4d45bf9d8b43a109eab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs new file mode 100644 index 0000000..01af2a0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs @@ -0,0 +1,78 @@ +using GLTF.Utilities; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A buffer points to binary geometry, animation, or skins. + /// + public class GLTFBuffer : GLTFChildOfRootProperty + { + /// + /// The uri of the buffer. + /// Relative paths are relative to the .gltf file. + /// Instead of referencing an external file, the uri can also be a data-uri. + /// + public string Uri; + + /// + /// The length of the buffer in bytes. + /// 0 + /// + public uint ByteLength; + + public GLTFBuffer() + { + } + + public GLTFBuffer(GLTFBuffer buffer, GLTFRoot gltfRoot) : base(buffer, gltfRoot) + { + if (buffer == null) return; + Uri = buffer.Uri; + ByteLength = buffer.ByteLength; + } + + public static GLTFBuffer Deserialize(GLTFRoot root, JsonReader reader) + { + var buffer = new GLTFBuffer(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "uri": + buffer.Uri = reader.ReadAsString(); + break; + case "byteLength": + buffer.ByteLength = reader.ReadDoubleAsUInt32(); + break; + default: + buffer.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return buffer; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Uri != null) + { + writer.WritePropertyName("uri"); + writer.WriteValue(Uri); + } + + writer.WritePropertyName("byteLength"); + writer.WriteValue(ByteLength); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs.meta new file mode 100644 index 0000000..a1d45a1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFBuffer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c36ff96bc8f31054f9d2c15607ad7d3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs new file mode 100644 index 0000000..2dd7bbc --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs @@ -0,0 +1,106 @@ +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A camera's projection. A node can reference a camera to apply a transform + /// to place the camera in the scene + /// + public class GLTFCamera : GLTFChildOfRootProperty + { + /// + /// An orthographic camera containing properties to create an orthographic + /// projection matrix. + /// + public CameraOrthographic Orthographic; + + /// + /// A perspective camera containing properties to create a perspective + /// projection matrix. + /// + public CameraPerspective Perspective; + + /// + /// Specifies if the camera uses a perspective or orthographic projection. + /// Based on this, either the camera's `perspective` or `orthographic` property + /// will be defined. + /// + public CameraType Type; + + public GLTFCamera() + { + } + + public GLTFCamera(GLTFCamera camera, GLTFRoot gltfRoot) : base(camera, gltfRoot) + { + if (camera == null) return; + + if (camera.Orthographic != null) + { + Orthographic = new CameraOrthographic(camera.Orthographic); + } + + if (camera.Perspective != null) + { + Perspective = new CameraPerspective(camera.Perspective); + } + + Type = camera.Type; + } + + public static GLTFCamera Deserialize(GLTFRoot root, JsonReader reader) + { + var camera = new GLTFCamera(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "orthographic": + camera.Orthographic = CameraOrthographic.Deserialize(root, reader); + break; + case "perspective": + camera.Perspective = CameraPerspective.Deserialize(root, reader); + break; + default: + camera.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return camera; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Orthographic != null) + { + writer.WritePropertyName("orthographic"); + Orthographic.Serialize(writer); + } + + if (Perspective != null) + { + writer.WritePropertyName("perspective"); + Perspective.Serialize(writer); + } + + writer.WritePropertyName("type"); + writer.WriteValue(Type.ToString()); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } + + public enum CameraType + { + perspective, + orthographic + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs.meta new file mode 100644 index 0000000..280ca91 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFCamera.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eebe17975598da0458e2f068665cae53 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs new file mode 100644 index 0000000..69cc5a7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs @@ -0,0 +1,50 @@ +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class GLTFChildOfRootProperty : GLTFProperty + { + /// + /// The user-defined name of this object. + /// This is not necessarily unique, e.g., an accessor and a buffer could have the same name, + /// or two accessors could even have the same name. + /// + public string Name; + + public GLTFChildOfRootProperty() + { + } + + public GLTFChildOfRootProperty(GLTFChildOfRootProperty childOfRootProperty, GLTFRoot gltfRoot) : base(childOfRootProperty, gltfRoot) + { + if (childOfRootProperty == null) return; + + Name = childOfRootProperty.Name; + } + + public new void DefaultPropertyDeserializer(GLTFRoot root, JsonReader reader) + { + switch (reader.Value.ToString()) + { + case "name": + Name = reader.ReadAsString(); + break; + default: + base.DefaultPropertyDeserializer(root, reader); + break; + } + } + + public override void Serialize(JsonWriter writer) + { + + if (Name != null) + { + writer.WritePropertyName("name"); + writer.WriteValue(Name); + } + + base.Serialize(writer); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs.meta new file mode 100644 index 0000000..70c6a0a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFChildOfRootProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ffc3c1d1c490aaf4f98df999eb0429ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs.meta new file mode 100644 index 0000000..4ca5958 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 31f6e4fa1022c1c44905eca2de16e943 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs new file mode 100644 index 0000000..ead4194 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs @@ -0,0 +1,424 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + + /// + /// Abstract class that stores a reference to the root GLTF object and an id + /// of an object of type T inside it. + /// + /// The value type returned by the GLTFId reference. + public abstract class GLTFId + { + public int Id; + public GLTFRoot Root; + public abstract T Value { get; } + + protected GLTFId() + { + } + + public GLTFId(GLTFId gltfId, GLTFRoot newRoot) + { + Id = gltfId.Id; + Root = newRoot; + } + + public void Serialize(JsonWriter writer) + { + writer.WriteValue(Id); + } + } + + public class AccessorId : GLTFId + { + public AccessorId() + { + } + + public AccessorId(AccessorId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override Accessor Value + { + get { return Root.Accessors[Id]; } + } + + public static AccessorId Deserialize(GLTFRoot root, JsonReader reader) + { + return new AccessorId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class BufferId : GLTFId + { + public BufferId() + { + } + + public BufferId(BufferId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override GLTFBuffer Value + { + get { return Root.Buffers[Id]; } + } + + public static BufferId Deserialize(GLTFRoot root, JsonReader reader) + { + return new BufferId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class BufferViewId : GLTFId + { + public BufferViewId() + { + } + + public BufferViewId(BufferViewId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override BufferView Value + { + get { return Root.BufferViews[Id]; } + } + + public static BufferViewId Deserialize(GLTFRoot root, JsonReader reader) + { + return new BufferViewId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class CameraId : GLTFId + { + public CameraId() + { + } + + public CameraId(CameraId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override GLTFCamera Value + { + get { return Root.Cameras[Id]; } + } + + public static CameraId Deserialize(GLTFRoot root, JsonReader reader) + { + return new CameraId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class ImageId : GLTFId + { + public ImageId() + { + } + + public ImageId(ImageId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + + public override GLTFImage Value + { + get { return Root.Images[Id]; } + } + + public static ImageId Deserialize(GLTFRoot root, JsonReader reader) + { + return new ImageId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class MaterialId : GLTFId + { + public MaterialId() + { + } + + public MaterialId(MaterialId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override GLTFMaterial Value + { + get { return Root.Materials[Id]; } + } + + public static MaterialId Deserialize(GLTFRoot root, JsonReader reader) + { + return new MaterialId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class MeshId : GLTFId + { + public MeshId() + { + } + + public MeshId(MeshId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override GLTFMesh Value + { + get { return Root.Meshes[Id]; } + } + + public static MeshId Deserialize(GLTFRoot root, JsonReader reader) + { + return new MeshId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class NodeId : GLTFId + { + public NodeId() + { + } + + public NodeId(NodeId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override Node Value + { + get { return Root.Nodes[Id]; } + } + + public static NodeId Deserialize(GLTFRoot root, JsonReader reader) + { + return new NodeId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + + public static List ReadList(GLTFRoot root, JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartArray) + { + throw new Exception("Invalid array."); + } + + var list = new List(); + + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + var node = new NodeId + { + Id = int.Parse(reader.Value.ToString()), + Root = root + }; + + list.Add(node); + } + + return list; + } + } + + public class SamplerId : GLTFId + { + public SamplerId() + { + } + + public SamplerId(SamplerId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override Sampler Value + { + get { return Root.Samplers[Id]; } + } + + public static SamplerId Deserialize(GLTFRoot root, JsonReader reader) + { + return new SamplerId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class AnimationSamplerId : GLTFId + { + public GLTFAnimation GLTFAnimation; + public override AnimationSampler Value + { + get { return GLTFAnimation.Samplers[Id]; } + } + + public AnimationSamplerId () + { + + } + public AnimationSamplerId (AnimationSamplerId sampler, GLTFRoot root) + { + Id = sampler.Id; + GLTFAnimation = sampler.GLTFAnimation; + Root = root; + } + + + public static AnimationSamplerId Deserialize(GLTFRoot root, GLTFAnimation anim, JsonReader reader) + { + return new AnimationSamplerId + { + Id = reader.ReadAsInt32().Value, + GLTFAnimation = anim, + Root = root + }; + } + } + + public class SceneId : GLTFId + { + public SceneId() + { + } + + public SceneId(SceneId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + + public override GLTFScene Value + { + get { return Root.Scenes[Id]; } + } + + public static SceneId Deserialize(GLTFRoot root, JsonReader reader) + { + return new SceneId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class SkinId : GLTFId + { + public SkinId() + { + } + + public SkinId(SkinId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override Skin Value + { + get { return Root.Skins[Id]; } + } + + public static SkinId Deserialize(GLTFRoot root, JsonReader reader) + { + return new SkinId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } + + public class TextureId : GLTFId + { + public TextureId() + { + } + + public TextureId(TextureId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override GLTFTexture Value + { + get { return Root.Textures[Id]; } + } + + public static TextureId Deserialize(GLTFRoot root, JsonReader reader) + { + return new TextureId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + public static TextureId Deserialize(GLTFRoot root, JProperty jProperty) + { + return new TextureId + { + Id = (int)jProperty.Value, + Root = root + }; + } + } + + public class LightId : GLTFId + { + public LightId() + { + } + + public LightId(LightId id, GLTFRoot newRoot) : base(id, newRoot) + { + } + + public override GLTFLight Value + { + get { return Root.Lights[Id]; } //should be extensions? + } + + public static LightId Deserialize(GLTFRoot root, JsonReader reader) + { + return new LightId + { + Id = reader.ReadAsInt32().Value, + Root = root + }; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs.meta new file mode 100644 index 0000000..71e40a9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFId.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 53002b1acd71031408f61b758ec5ef2d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs new file mode 100644 index 0000000..775021e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs @@ -0,0 +1,102 @@ +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// Image data used to create a texture. Image can be referenced by URI or + /// `bufferView` index. `mimeType` is required in the latter case. + /// + public class GLTFImage : GLTFChildOfRootProperty + { + /// + /// The uri of the image. Relative paths are relative to the .gltf file. + /// Instead of referencing an external file, the uri can also be a data-uri. + /// The image format must be jpg, png, bmp, or gif. + /// + public string Uri; + + /// + /// The image's MIME type. + /// 1 + /// + public string MimeType; + + /// + /// The index of the bufferView that contains the image. + /// Use this instead of the image's uri property. + /// + public BufferViewId BufferView; + + public GLTFImage() + { + } + + public GLTFImage(GLTFImage image, GLTFRoot gltfRoot) : base(image, gltfRoot) + { + if (image == null) return; + + Uri = image.Uri; + MimeType = image.MimeType; + + if (image.BufferView != null) + { + BufferView = new BufferViewId(image.BufferView, gltfRoot); + } + } + + public static GLTFImage Deserialize(GLTFRoot root, JsonReader reader) + { + var image = new GLTFImage(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "uri": + image.Uri = reader.ReadAsString(); + break; + case "mimeType": + image.MimeType = reader.ReadAsString(); + break; + case "bufferView": + image.BufferView = BufferViewId.Deserialize(root, reader); + break; + default: + image.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return image; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Uri != null) + { + writer.WritePropertyName("uri"); + writer.WriteValue(Uri); + } + + if (MimeType != null) + { + writer.WritePropertyName("mimeType"); + writer.WriteValue(Newtonsoft.Json.Linq.JValue.CreateString(MimeType).ToString()); + } + + if (BufferView != null) + { + writer.WritePropertyName("bufferView"); + writer.WriteValue(BufferView.Id); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs.meta new file mode 100644 index 0000000..69ad341 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFImage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2c8ec880230ff84fb20ff6dd04548c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs new file mode 100644 index 0000000..bb3dffe --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs @@ -0,0 +1,243 @@ +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// The material appearance of a primitive. + /// + public class GLTFMaterial : GLTFChildOfRootProperty + { + /// + /// A set of parameter values that are used to define the metallic-roughness + /// material model from Physically-Based Rendering (PBR) methodology. + /// + public PbrMetallicRoughness PbrMetallicRoughness; + + /// + /// A set of parameter values used to light flat-shaded materials + /// + public MaterialCommonConstant CommonConstant; + + /// + /// A tangent space normal map. Each texel represents the XYZ components of a + /// normal vector in tangent space. + /// + public NormalTextureInfo NormalTexture; + + /// + /// The occlusion map is a greyscale texture, with white indicating areas that + /// should receive full indirect lighting and black indicating no indirect + /// lighting. + /// + public OcclusionTextureInfo OcclusionTexture; + + /// + /// The emissive map controls the color and intensity of the light being emitted + /// by the material. This texture contains RGB components in sRGB color space. + /// If a fourth component (A) is present, it is ignored. + /// + public TextureInfo EmissiveTexture; + + /// + /// The RGB components of the emissive color of the material. + /// If an emissiveTexture is specified, this value is multiplied with the texel + /// values. + /// + /// 0.0 + /// 1.0 + /// + /// 3 + /// 3 + /// + public Color EmissiveFactor = Color.Clear; + + /// + /// The material's alpha rendering mode enumeration specifying the interpretation of the + /// alpha value of the main factor and texture. In `OPAQUE` mode, the alpha value is + /// ignored and the rendered output is fully opaque. In `MASK` mode, the rendered output + /// is either fully opaque or fully transparent depending on the alpha value and the + /// specified alpha cutoff value. In `BLEND` mode, the alpha value is used to composite + /// the source and destination areas. The rendered output is combined with the background + /// using the normal painting operation (i.e. the Porter and Duff over operator). + /// + public AlphaMode AlphaMode = AlphaMode.OPAQUE; + + /// + /// Specifies the cutoff threshold when in `MASK` mode. If the alpha value is greater than + /// or equal to this value then it is rendered as fully opaque, otherwise, it is rendered + /// as fully transparent. This value is ignored for other modes. + /// + public double AlphaCutoff = 0.5; + + /// + /// Specifies whether the material is double sided. When this value is false, back-face + /// culling is enabled. When this value is true, back-face culling is disabled and double + /// sided lighting is enabled. The back-face must have its normals reversed before the + /// lighting equation is evaluated. + /// + public bool DoubleSided; + + public GLTFMaterial() + { + } + + public GLTFMaterial(GLTFMaterial material, GLTFRoot gltfRoot) : base(material, gltfRoot) + { + if (material == null) return; + + if (material.PbrMetallicRoughness != null) + { + PbrMetallicRoughness = new PbrMetallicRoughness(material.PbrMetallicRoughness, gltfRoot); + } + + if (material.CommonConstant != null) + { + CommonConstant = new MaterialCommonConstant(material.CommonConstant, gltfRoot); + } + + if (material.NormalTexture != null) + { + NormalTexture = new NormalTextureInfo(material.NormalTexture, gltfRoot); + } + + if (material.OcclusionTexture != null) + { + OcclusionTexture = new OcclusionTextureInfo(material.OcclusionTexture, gltfRoot); + } + + if (material.EmissiveTexture != null) + { + EmissiveTexture = new TextureInfo(material.EmissiveTexture, gltfRoot); + } + + EmissiveFactor = material.EmissiveFactor; + AlphaMode = material.AlphaMode; + AlphaCutoff = material.AlphaCutoff; + DoubleSided = material.DoubleSided; + } + + public static GLTFMaterial Deserialize(GLTFRoot root, JsonReader reader) + { + var material = new GLTFMaterial(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "pbrMetallicRoughness": + material.PbrMetallicRoughness = PbrMetallicRoughness.Deserialize(root, reader); + break; + case "commonConstant": + material.CommonConstant = MaterialCommonConstant.Deserialize(root, reader); + break; + case "normalTexture": + material.NormalTexture = NormalTextureInfo.Deserialize(root, reader); + break; + case "occlusionTexture": + material.OcclusionTexture = OcclusionTextureInfo.Deserialize(root, reader); + break; + case "emissiveTexture": + material.EmissiveTexture = TextureInfo.Deserialize(root, reader); + break; + case "emissiveFactor": + var emissiveColor = reader.ReadAsRGBColor(); + emissiveColor.A = 0; + material.EmissiveFactor = emissiveColor; + break; + case "alphaMode": + material.AlphaMode = reader.ReadStringEnum(); + break; + case "alphaCutoff": + material.AlphaCutoff = reader.ReadAsDouble().Value; + break; + case "doubleSided": + material.DoubleSided = reader.ReadAsBoolean().Value; + break; + default: + material.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return material; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (PbrMetallicRoughness != null) + { + writer.WritePropertyName("pbrMetallicRoughness"); + PbrMetallicRoughness.Serialize(writer); + } + + if (CommonConstant != null) + { + writer.WritePropertyName("commonConstant"); + CommonConstant.Serialize(writer); + } + + if (NormalTexture != null) + { + writer.WritePropertyName("normalTexture"); + NormalTexture.Serialize(writer); + } + + if (OcclusionTexture != null) + { + writer.WritePropertyName("occlusionTexture"); + OcclusionTexture.Serialize(writer); + } + + if (EmissiveTexture != null) + { + writer.WritePropertyName("emissiveTexture"); + EmissiveTexture.Serialize(writer); + } + + if (EmissiveFactor != Color.Clear && !(EmissiveFactor.R == 0 && EmissiveFactor.G == 0 && EmissiveFactor.B == 0)) + { + writer.WritePropertyName("emissiveFactor"); + writer.WriteStartArray(); + writer.WriteValue(EmissiveFactor.R); + writer.WriteValue(EmissiveFactor.G); + writer.WriteValue(EmissiveFactor.B); + writer.WriteEndArray(); + } + + if (AlphaMode != AlphaMode.OPAQUE) + { + writer.WritePropertyName("alphaMode"); + writer.WriteValue(AlphaMode.ToString()); + } + + if (AlphaCutoff != 0.5) + { + writer.WritePropertyName("alphaCutoff"); + writer.WriteValue(AlphaCutoff); + } + + if (DoubleSided) + { + writer.WritePropertyName("doubleSided"); + writer.WriteValue(true); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } + + public enum AlphaMode + { + OPAQUE, + MASK, + BLEND + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs.meta new file mode 100644 index 0000000..faf3359 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aca48cfee1de3af49b4f3aca770e3828 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs new file mode 100644 index 0000000..ba35dcd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs @@ -0,0 +1,143 @@ +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A set of primitives to be rendered. A node can contain one or more meshes. + /// A node's transform places the mesh in the scene. + /// + public class GLTFMesh : GLTFChildOfRootProperty + { + /// + /// An array of primitives, each defining geometry to be rendered with + /// a material. + /// 1 + /// + public List Primitives; + + /// + /// Array of weights to be applied to the Morph Targets. + /// 0 + /// + public List Weights; + + public List TargetNames; + + public GLTFMesh() + { + } + + public GLTFMesh(GLTFMesh mesh, GLTFRoot gltfRoot) : base(mesh, gltfRoot) + { + if (mesh == null) return; + + if (mesh.Primitives != null) + { + Primitives = new List(mesh.Primitives.Count); + + foreach (MeshPrimitive primitive in mesh.Primitives) + { + Primitives.Add(new MeshPrimitive(primitive, gltfRoot)); + } + } + + if (mesh.Weights != null) + { + Weights = mesh.Weights.ToList(); + } + } + + + public static GLTFMesh Deserialize(GLTFRoot root, JsonReader reader) + { + var mesh = new GLTFMesh(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "primitives": + mesh.Primitives = reader.ReadList(() => MeshPrimitive.Deserialize(root, reader)); + break; + case "weights": + mesh.Weights = reader.ReadDoubleList(); + break; + default: + mesh.DefaultPropertyDeserializer(root, reader); + break; + } + } + + // GLTF does not support morph target names, serialize in extras for now + // https://github.com/KhronosGroup/glTF/issues/1036 + if (mesh.Extras != null) + { + var extrasReader = mesh.Extras.CreateReader(); + extrasReader.Read(); + + while (extrasReader.Read() && extrasReader.TokenType == JsonToken.PropertyName) + { + var extraProperty = extrasReader.Value.ToString(); + switch (extraProperty) + { + case "targetNames": + mesh.TargetNames = extrasReader.ReadStringList(); + break; + default: + extrasReader.Skip(); + break; + } + } + + extrasReader.Close(); + + if (mesh.Primitives != null && mesh.TargetNames != null && mesh.TargetNames.Count > 0) + { + foreach (MeshPrimitive mp in mesh.Primitives) + { + if (mp == null) continue; + mp.TargetNames = mesh.TargetNames; + } + } + } + + return mesh; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Primitives != null && Primitives.Count > 0) + { + writer.WritePropertyName("primitives"); + writer.WriteStartArray(); + foreach (var primitive in Primitives) + { + primitive.Serialize(writer); + } + writer.WriteEndArray(); + } + + if (Weights != null && Weights.Count > 0) + { + writer.WritePropertyName("weights"); + writer.WriteStartArray(); + foreach (var weight in Weights) + { + writer.WriteValue(weight); + } + writer.WriteEndArray(); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs.meta new file mode 100644 index 0000000..d0c08a9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFMesh.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ad352271728bac40af6a9287b2d0d78 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs new file mode 100644 index 0000000..ad72735 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs @@ -0,0 +1,240 @@ +using System; +using System.Collections.Generic; +using GLTF.Schema.KHR_lights_punctual; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + public class GLTFProperty + { + private static Dictionary _extensionRegistry = new Dictionary() + { + { ExtTextureTransformExtensionFactory.EXTENSION_NAME, new ExtTextureTransformExtensionFactory() }, + { KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME, new KHR_materials_pbrSpecularGlossinessExtensionFactory() }, + { KHR_MaterialsUnlitExtensionFactory.EXTENSION_NAME, new KHR_MaterialsUnlitExtensionFactory() }, + { KHR_lights_punctualExtensionFactory.EXTENSION_NAME, new KHR_lights_punctualExtensionFactory() }, + { KHR_materials_emissive_strength_Factory.EXTENSION_NAME, new KHR_materials_emissive_strength_Factory() }, + { KHR_materials_transmission_Factory.EXTENSION_NAME, new KHR_materials_transmission_Factory() }, + { KHR_materials_volume_Factory.EXTENSION_NAME, new KHR_materials_volume_Factory() }, + { KHR_materials_ior_Factory.EXTENSION_NAME, new KHR_materials_ior_Factory() }, + { KHR_materials_iridescence_Factory.EXTENSION_NAME, new KHR_materials_iridescence_Factory() }, + { KHR_materials_specular_Factory.EXTENSION_NAME, new KHR_materials_specular_Factory() }, + { KHR_materials_clearcoat_Factory.EXTENSION_NAME, new KHR_materials_clearcoat_Factory() }, + { MSFT_LODExtensionFactory.EXTENSION_NAME, new MSFT_LODExtensionFactory() } + }; + + private static DefaultExtensionFactory _defaultExtensionFactory = new DefaultExtensionFactory(); + + public static bool IsExtensionRegistered(string extensionName) + { + lock (_extensionRegistry) + { + return _extensionRegistry.ContainsKey(extensionName); + } + } + + public static void RegisterExtension(ExtensionFactory extensionFactory) + { + lock (_extensionRegistry) + { + _extensionRegistry[extensionFactory.ExtensionName] = extensionFactory; + } + } + + public static ExtensionFactory TryGetExtension(string extensionName) + { + lock (_extensionRegistry) + { + ExtensionFactory result; + if (_extensionRegistry.TryGetValue(extensionName, out result)) + { + return result; + } + return null; + } + } + + public static IExtension CreateEmptyExtension(string extensionName) + { + return TryGetExtension(extensionName)?.Deserialize(null, new JProperty(extensionName, new JObject())); + } + + public static bool TryRegisterExtension(ExtensionFactory extensionFactory) + { + lock (_extensionRegistry) + { + if (_extensionRegistry.ContainsKey(extensionFactory.ExtensionName)) + { + return false; + } + _extensionRegistry.Add(extensionFactory.ExtensionName, extensionFactory); + return true; + } + } + + public Dictionary Extensions; + public JToken Extras; + + public GLTFProperty() + { + } + + public GLTFProperty(GLTFProperty property, GLTFRoot gltfRoot = null) + { + if (property == null) return; + + if (property.Extensions != null) + { + Extensions = new Dictionary(property.Extensions.Count); + foreach (KeyValuePair extensionKeyValuePair in property.Extensions) + { + Extensions.Add(extensionKeyValuePair.Key, extensionKeyValuePair.Value.Clone(gltfRoot)); + } + } + + if (property.Extras != null) + { + Extras = property.Extras.DeepClone(); + } + } + + public void DefaultPropertyDeserializer(GLTFRoot root, JsonReader reader) + { + switch (reader.Value.ToString()) + { + case "extensions": + Extensions = DeserializeExtensions(root, reader); + break; + case "extras": + // advance to property value + reader.Read(); + if (reader.TokenType != JsonToken.StartObject) + throw new Exception(string.Format("extras must be an object at: {0}", reader.Path)); + Extras = JToken.ReadFrom(reader); + break; + default: + SkipValue(reader); + break; + } + } + + public void AddExtension(string extname, IExtension extension) + { + if (Extensions == null) + { + Extensions = new Dictionary(); + } + if (Extensions.ContainsKey(extname)) + { + throw new Exception($"Extension {extname} already exist on GLTFProperty"); + } + Extensions.Add(extname, extension); + } + + private void SkipValue(JsonReader reader) + { + if (!reader.Read()) + { + throw new Exception("No value found."); + } + + if (reader.TokenType == JsonToken.StartObject) + { + SkipObject(reader); + } + else if (reader.TokenType == JsonToken.StartArray) + { + SkipArray(reader); + } + } + + private void SkipObject(JsonReader reader) + { + while (reader.Read() && reader.TokenType != JsonToken.EndObject) + { + if (reader.TokenType == JsonToken.StartArray) + { + SkipArray(reader); + } + else if (reader.TokenType == JsonToken.StartObject) + { + SkipObject(reader); + } + } + } + + private void SkipArray(JsonReader reader) + { + while (reader.Read() && reader.TokenType != JsonToken.EndArray) + { + if (reader.TokenType == JsonToken.StartArray) + { + SkipArray(reader); + } + else if (reader.TokenType == JsonToken.StartObject) + { + SkipObject(reader); + } + } + } + + private Dictionary DeserializeExtensions(GLTFRoot root, JsonReader reader) + { + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new GLTFParseException("GLTF extensions must be an object"); + } + + JObject extensions = (JObject)JToken.ReadFrom(reader); + var extensionsCollection = new Dictionary(); + + foreach(JToken child in extensions.Children()) + { + if (child.Type != JTokenType.Property) + { + throw new GLTFParseException("Children token of extensions should be properties"); + } + + JProperty childAsJProperty = (JProperty) child; + string extensionName = childAsJProperty.Name; + ExtensionFactory extensionFactory; + + lock (_extensionRegistry) + { + if (_extensionRegistry.TryGetValue(extensionName, out extensionFactory)) + { + extensionsCollection.Add(extensionName, extensionFactory.Deserialize(root, childAsJProperty)); + } + else + { + extensionsCollection.Add(extensionName, _defaultExtensionFactory.Deserialize(root, childAsJProperty)); + } + } + } + + return extensionsCollection; + } + + public virtual void Serialize(JsonWriter writer) + { + if (Extensions != null && Extensions.Count > 0) + { + writer.WritePropertyName("extensions"); + writer.WriteStartObject(); + foreach (var extension in Extensions) + { + JToken extensionToken = extension.Value.Serialize(); + extensionToken.WriteTo(writer); + } + writer.WriteEndObject(); + } + + if(Extras != null) + { + writer.WritePropertyName("extras"); + Extras.WriteTo(writer); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs.meta new file mode 100644 index 0000000..7832fa7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5209123bd4cc0c341b4acc610846c177 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs new file mode 100644 index 0000000..073aa6e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs @@ -0,0 +1,566 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using GLTF.Extensions; +using GLTF.Schema.KHR_lights_punctual; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// The root object for a glTF asset. + /// + public class GLTFRoot : GLTFProperty + { + /// + /// Names of glTF extensions used somewhere in this asset. + /// + public List ExtensionsUsed; + + /// + /// Names of glTF extensions required to properly load this asset. + /// + public List ExtensionsRequired; + + /// + /// An array of accessors. An accessor is a typed view into a bufferView. + /// + public List Accessors; + + /// + /// An array of keyframe animations. + /// + public List Animations; + + /// + /// Metadata about the glTF asset. + /// + public Asset Asset; + + /// + /// An array of buffers. A buffer points to binary geometry, animation, or skins. + /// + public List Buffers; + + /// + /// An array of bufferViews. + /// A bufferView is a view into a buffer generally representing a subset of the buffer. + /// + public List BufferViews; + + /// + /// An array of cameras. A camera defines a projection matrix. + /// + public List Cameras; + + /// + /// An array of images. An image defines data used to create a texture. + /// + public List Images; + + /// + /// An array of materials. A material defines the appearance of a primitive. + /// + public List Materials; + + /// + /// An array of meshes. A mesh is a set of primitives to be rendered. + /// + public List Meshes; + + /// + /// An array of nodes. + /// + public List Nodes; + + /// + /// An array of samplers. A sampler contains properties for texture filtering and wrapping modes. + /// + public List Samplers; + + /// + /// The index of the default scene. + /// + public SceneId Scene; + + /// + /// An array of scenes. + /// + public List Scenes; + + /// + /// An array of skins. A skin is defined by joints and matrices. + /// + public List Skins; + + /// + /// An array of textures. + /// + public List Textures; + + public List Lights; + + public GLTFRoot() + { + } + + public GLTFRoot(GLTFRoot gltfRoot) : base(gltfRoot) + { + if (gltfRoot.ExtensionsUsed != null) + { + ExtensionsUsed = gltfRoot.ExtensionsUsed.ToList(); + } + + if (gltfRoot.ExtensionsRequired != null) + { + ExtensionsRequired = gltfRoot.ExtensionsRequired.ToList(); + } + + if (gltfRoot.Accessors != null) + { + Accessors = new List(gltfRoot.Accessors.Count); + foreach (Accessor accessor in gltfRoot.Accessors) + { + Accessors.Add(new Accessor(accessor, this)); + } + } + + if (gltfRoot.Animations != null) + { + Animations = new List(gltfRoot.Animations.Count); + foreach (GLTFAnimation animation in gltfRoot.Animations) + { + Animations.Add(new GLTFAnimation(animation, this)); + } + } + + if (gltfRoot.Asset != null) + { + Asset = new Asset(gltfRoot.Asset); + } + + if (gltfRoot.Buffers != null) + { + Buffers = new List(gltfRoot.Buffers.Count); + foreach (GLTFBuffer buffer in gltfRoot.Buffers) + { + Buffers.Add(new GLTFBuffer(buffer, this)); + } + } + + if (gltfRoot.BufferViews != null) + { + BufferViews = new List(gltfRoot.BufferViews.Count); + foreach (BufferView bufferView in gltfRoot.BufferViews) + { + BufferViews.Add(new BufferView(bufferView, this)); + } + } + + if (gltfRoot.Cameras != null) + { + Cameras = new List(gltfRoot.Cameras.Count); + foreach (GLTFCamera camera in gltfRoot.Cameras) + { + Cameras.Add(new GLTFCamera(camera, this)); + } + } + + if (gltfRoot.Images != null) + { + Images = new List(gltfRoot.Images.Count); + foreach (GLTFImage image in gltfRoot.Images) + { + Images.Add(new GLTFImage(image, this)); + } + } + + if (gltfRoot.Materials != null) + { + Materials = new List(gltfRoot.Materials.Count); + foreach (GLTFMaterial material in gltfRoot.Materials) + { + Materials.Add(new GLTFMaterial(material, this)); + } + } + + if (gltfRoot.Meshes != null) + { + Meshes = new List(gltfRoot.Meshes.Count); + foreach (GLTFMesh mesh in gltfRoot.Meshes) + { + Meshes.Add(new GLTFMesh(mesh, this)); + } + } + + if (gltfRoot.Nodes != null) + { + Nodes = new List(gltfRoot.Nodes.Count); + foreach (Node node in gltfRoot.Nodes) + { + Nodes.Add(new Node(node, this)); + } + } + + if (gltfRoot.Samplers != null) + { + Samplers = new List(gltfRoot.Samplers.Count); + foreach (Sampler sampler in gltfRoot.Samplers) + { + Samplers.Add(new Sampler(sampler, this)); + } + } + + if (gltfRoot.Scene != null) + { + Scene = new SceneId(gltfRoot.Scene, this); + } + + if (gltfRoot.Scenes != null) + { + Scenes = new List(gltfRoot.Scenes.Count); + foreach (GLTFScene scene in gltfRoot.Scenes) + { + Scenes.Add(new GLTFScene(scene, this)); + } + } + + if (gltfRoot.Skins != null) + { + Skins = new List(gltfRoot.Skins.Count); + foreach (Skin skin in gltfRoot.Skins) + { + Skins.Add(new Skin(skin, this)); + } + } + + if (gltfRoot.Textures != null) + { + Textures = new List(gltfRoot.Textures.Count); + foreach (GLTFTexture texture in gltfRoot.Textures) + { + Textures.Add(new GLTFTexture(texture, this)); + } + } + + + if (gltfRoot.Lights != null) + { + Lights = new List(gltfRoot.Lights.Count); + foreach (GLTFLight light in gltfRoot.Lights) + { + Lights.Add(new GLTFLight(light, this)); + } + } + } + + /// + /// Whether this object is a GLB + /// + public bool IsGLB; + + /// + /// Return the default scene. When scene is null, scene of index 0 will be returned. + /// When scenes list is null or empty, returns null. + /// + public GLTFScene GetDefaultScene() + { + if (Scene != null) + { + return Scene.Value; + } + + if (Scenes?.Count > 0) + { + return Scenes[0]; + } + + return null; + } + + public static GLTFRoot Deserialize(TextReader textReader) + { + var jsonReader = new JsonTextReader(textReader); + var root = new GLTFRoot(); + + if (jsonReader.Read() && jsonReader.TokenType != JsonToken.StartObject) + { + throw new Exception("gltf json must be an object"); + } + + while (jsonReader.Read() && jsonReader.TokenType == JsonToken.PropertyName) + { + var curProp = jsonReader.Value.ToString(); + + switch (curProp) + { + case "extensionsUsed": + root.ExtensionsUsed = jsonReader.ReadStringList(); + break; + case "extensionsRequired": + root.ExtensionsRequired = jsonReader.ReadStringList(); + break; + case "accessors": + root.Accessors = jsonReader.ReadList(() => Accessor.Deserialize(root, jsonReader)); + break; + case "animations": + root.Animations = jsonReader.ReadList(() => GLTFAnimation.Deserialize(root, jsonReader)); + break; + case "asset": + root.Asset = Asset.Deserialize(root, jsonReader); + break; + case "buffers": + root.Buffers = jsonReader.ReadList(() => GLTFBuffer.Deserialize(root, jsonReader)); + break; + case "bufferViews": + root.BufferViews = jsonReader.ReadList(() => BufferView.Deserialize(root, jsonReader)); + break; + case "cameras": + root.Cameras = jsonReader.ReadList(() => GLTFCamera.Deserialize(root, jsonReader)); + break; + case "images": + root.Images = jsonReader.ReadList(() => GLTFImage.Deserialize(root, jsonReader)); + break; + case "materials": + root.Materials = jsonReader.ReadList(() => GLTFMaterial.Deserialize(root, jsonReader)); + break; + case "meshes": + root.Meshes = jsonReader.ReadList(() => GLTFMesh.Deserialize(root, jsonReader)); + break; + case "nodes": + root.Nodes = jsonReader.ReadList(() => Node.Deserialize(root, jsonReader)); + break; + case "samplers": + root.Samplers = jsonReader.ReadList(() => Sampler.Deserialize(root, jsonReader)); + break; + case "scene": + root.Scene = SceneId.Deserialize(root, jsonReader); + break; + case "scenes": + root.Scenes = jsonReader.ReadList(() => GLTF.Schema.GLTFScene.Deserialize(root, jsonReader)); + break; + case "skins": + root.Skins = jsonReader.ReadList(() => Skin.Deserialize(root, jsonReader)); + break; + case "textures": + root.Textures = jsonReader.ReadList(() => GLTFTexture.Deserialize(root, jsonReader)); + break; + //case "lights": + // root.Lights = jsonReader.ReadList(() => GLTFLight.Deserialize(root, jsonReader)); + // break; + default: + root.DefaultPropertyDeserializer(root, jsonReader); + break; + } + } + + return root; + } + + public void Serialize(TextWriter textWriter, bool isGLB = false) + { + JsonWriter jsonWriter = new JsonTextWriter(textWriter); + if (isGLB) + { + jsonWriter.Formatting = Formatting.None; + } + else + { + jsonWriter.Formatting = Formatting.Indented; + } + + jsonWriter.WriteStartObject(); + + jsonWriter.WritePropertyName("asset"); + Asset.Serialize(jsonWriter); + + if (ExtensionsUsed != null && ExtensionsUsed.Count > 0) + { + jsonWriter.WritePropertyName("extensionsUsed"); + jsonWriter.WriteStartArray(); + foreach (var extension in ExtensionsUsed) + { + jsonWriter.WriteValue(extension); + } + jsonWriter.WriteEndArray(); + } + + if (ExtensionsRequired != null && ExtensionsRequired.Count > 0) + { + jsonWriter.WritePropertyName("extensionsRequired"); + jsonWriter.WriteStartArray(); + foreach (var extension in ExtensionsRequired) + { + jsonWriter.WriteValue(extension); + } + jsonWriter.WriteEndArray(); + } + + if (Scene != null) + { + jsonWriter.WritePropertyName("scene"); + Scene.Serialize(jsonWriter); + } + + if (Scenes != null && Scenes.Count > 0) + { + jsonWriter.WritePropertyName("scenes"); + jsonWriter.WriteStartArray(); + foreach (var scene in Scenes) + { + scene.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Accessors != null && Accessors.Count > 0) + { + jsonWriter.WritePropertyName("accessors"); + jsonWriter.WriteStartArray(); + foreach (var accessor in Accessors) + { + accessor.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Animations != null && Animations.Count > 0) + { + jsonWriter.WritePropertyName("animations"); + jsonWriter.WriteStartArray(); + foreach (var animation in Animations) + { + animation.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Buffers != null && Buffers.Count > 0) + { + jsonWriter.WritePropertyName("buffers"); + jsonWriter.WriteStartArray(); + foreach (var buffer in Buffers) + { + buffer.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (BufferViews != null && BufferViews.Count > 0) + { + jsonWriter.WritePropertyName("bufferViews"); + jsonWriter.WriteStartArray(); + foreach (var bufferView in BufferViews) + { + bufferView.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Cameras != null && Cameras.Count > 0) + { + jsonWriter.WritePropertyName("cameras"); + jsonWriter.WriteStartArray(); + foreach (var camera in Cameras) + { + camera.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Images != null && Images.Count > 0) + { + jsonWriter.WritePropertyName("images"); + jsonWriter.WriteStartArray(); + foreach (var image in Images) + { + image.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Materials != null && Materials.Count > 0) + { + jsonWriter.WritePropertyName("materials"); + jsonWriter.WriteStartArray(); + foreach (var material in Materials) + { + material.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Meshes != null && Meshes.Count > 0) + { + jsonWriter.WritePropertyName("meshes"); + jsonWriter.WriteStartArray(); + foreach (var mesh in Meshes) + { + mesh.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Nodes != null && Nodes.Count > 0) + { + jsonWriter.WritePropertyName("nodes"); + jsonWriter.WriteStartArray(); + foreach (var node in Nodes) + { + if (node.Light != null) + { + var khrLightPunctual = new KHR_LightsPunctualNodeExtension(node.Light.Id, this); + node.AddExtension(KHR_lights_punctualExtensionFactory.EXTENSION_NAME, khrLightPunctual); + } + + node.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Samplers != null && Samplers.Count > 0) + { + jsonWriter.WritePropertyName("samplers"); + jsonWriter.WriteStartArray(); + foreach (var sampler in Samplers) + { + sampler.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Skins != null && Skins.Count > 0) + { + jsonWriter.WritePropertyName("skins"); + jsonWriter.WriteStartArray(); + foreach (var skin in Skins) + { + skin.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Textures != null && Textures.Count > 0) + { + jsonWriter.WritePropertyName("textures"); + jsonWriter.WriteStartArray(); + foreach (var texture in Textures) + { + texture.Serialize(jsonWriter); + } + jsonWriter.WriteEndArray(); + } + + if (Lights != null) + { + var ext = new KHR_LightsPunctualRootExtension(Lights); + this.AddExtension(KHR_LightsPunctualRootExtension.EXTENSION_NAME, ext); + } + + base.Serialize(jsonWriter); + + jsonWriter.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs.meta new file mode 100644 index 0000000..e6142cd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFRoot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: edc6a3756446b834caf021ac90cab9b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs new file mode 100644 index 0000000..e0b95ed --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// The root nodes of a scene. + /// + public class GLTFScene : GLTFChildOfRootProperty + { + /// + /// The indices of each root node. + /// + public List Nodes; + + public GLTFScene() + { + } + + public GLTFScene(GLTFScene scene, GLTFRoot gltfRoot) : base(scene, gltfRoot) + { + if (scene == null) return; + + if (scene.Nodes != null) + { + Nodes = new List(scene.Nodes.Count); + foreach (NodeId node in scene.Nodes) + { + Nodes.Add(new NodeId(node, gltfRoot)); + } + } + } + + public static GLTFScene Deserialize(GLTFRoot root, JsonReader reader) + { + var scene = new GLTFScene(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "nodes": + scene.Nodes = NodeId.ReadList(root, reader); + break; + default: + scene.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return scene; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Nodes != null && Nodes.Count > 0) + { + writer.WritePropertyName("nodes"); + writer.WriteStartArray(); + foreach (var node in Nodes) + { + writer.WriteValue(node.Id); + } + writer.WriteEndArray(); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs.meta new file mode 100644 index 0000000..0a43bdd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFScene.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f337f9fa42d223d478aafeaedfd8fb68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs new file mode 100644 index 0000000..8963f67 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs @@ -0,0 +1,85 @@ +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A texture and its sampler. + /// + public class GLTFTexture : GLTFChildOfRootProperty + { + /// + /// The index of the sampler used by this texture. + /// + public SamplerId Sampler; + + /// + /// The index of the image used by this texture. + /// + public ImageId Source; + + public GLTFTexture() + { + } + + public GLTFTexture(GLTFTexture texture, GLTFRoot gltfRoot) : base(texture, gltfRoot) + { + if (texture == null) return; + + if (texture.Sampler != null) + { + Sampler = new SamplerId(texture.Sampler, gltfRoot); + } + + if (texture.Source != null) + { + Source = new ImageId(texture.Source, gltfRoot); + } + } + + public static GLTFTexture Deserialize(GLTFRoot root, JsonReader reader) + { + var texture = new GLTFTexture(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "sampler": + texture.Sampler = SamplerId.Deserialize(root, reader); + break; + case "source": + texture.Source = ImageId.Deserialize(root, reader); + break; + default: + texture.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return texture; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Sampler != null) + { + writer.WritePropertyName("sampler"); + writer.WriteValue(Sampler.Id); + } + + if (Source != null) + { + writer.WritePropertyName("source"); + writer.WriteValue(Source.Id); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs.meta new file mode 100644 index 0000000..c23d1bb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTFTexture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c65a34c3cbf08664d83fbde6d15da516 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs new file mode 100644 index 0000000..67cb1fb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A node in the node hierarchy. + /// When the node contains `skin`, all `mesh.primitives` must contain `JOINT` + /// and `WEIGHT` attributes. A node can have either a `matrix` or any combination + /// of `translation`/`rotation`/`scale` (TRS) properties. + /// TRS properties are converted to matrices and postmultiplied in + /// the `T * R * S` order to compose the transformation matrix; + /// first the scale is applied to the vertices, then the rotation, and then + /// the translation. If none are provided, the transform is the Identity. + /// When a node is targeted for animation + /// (referenced by an animation.channel.target), only TRS properties may be present; + /// `matrix` will not be present. + /// + public class GLTFDirectionalLight : GLTFLight + { + + public GLTFDirectionalLight() + { + } + + public GLTFDirectionalLight(GLTFDirectionalLight node, GLTFRoot gltfRoot) : base(node, gltfRoot) + { + if (node == null) return; + } + + public new static GLTFDirectionalLight Deserialize(GLTFRoot root, JsonReader reader) + { + var node = new GLTFDirectionalLight(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "type": + node.type = reader.ReadAsString(); + break; + case "color": + node.color = reader.ReadAsRGBAColor(); + break; + case "range": + node.range = (float)reader.ReadAsDouble(); + break; + case "intensity": + node.intensity = (float)reader.ReadAsDouble(); + break; + case "name": + node.name = reader.ReadAsString(); + break; + } + } + + return node; + } + + public override void Serialize(JsonWriter writer) + { + //writer.WriteStartObject(); + // + //writer.WritePropertyName("type"); + //writer.WriteValue(type); + // + //if (range > 0) + //{ + // writer.WritePropertyName("range"); + // writer.WriteValue(range); + //} + // + //if (intensity != 1.0f) + //{ + // writer.WritePropertyName("intensity"); + // writer.WriteValue(intensity); + //} + //if (!string.IsNullOrEmpty(name)) + //{ + // writer.WritePropertyName("name"); + // writer.WriteValue(name); + //} + // + //writer.WritePropertyName("color"); + //writer.WriteStartArray(); + //writer.WriteValue(color.R); + //writer.WriteValue(color.G); + //writer.WriteValue(color.B); + //writer.WriteValue(color.A); + //writer.WriteEndArray(); + // + base.Serialize(writer); + // + //writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs.meta new file mode 100644 index 0000000..c94245e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_DirectionalLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7ba89d77222428478d2712c6c970732 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs new file mode 100644 index 0000000..96cdd8f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs @@ -0,0 +1,98 @@ +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class GLTFLight : GLTFChildOfRootProperty + { + public string name; + public Color color; + public string type; + public float intensity; + public float range; + + public GLTFLight() + { + } + + public GLTFLight(GLTFLight light, GLTFRoot gltfRoot) : base(light, gltfRoot) + { + if (light == null) return; + + color = light.color; + type = light.type; + name = ""; + intensity = 1.0f; + } + + public static GLTFLight Deserialize(GLTFRoot root, JsonReader reader) + { + var node = new GLTFLight(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "type": + node.type = reader.ReadAsString(); + break; + case "color": + node.color = reader.ReadAsRGBAColor(); + break; + case "range": + node.range = (float)reader.ReadAsDouble(); + break; + case "intensity": + node.intensity = (float)reader.ReadAsDouble(); + break; + case "name": + node.name = reader.ReadAsString(); + break; + } + } + + return node; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("type"); + writer.WriteValue(type); + + if (range > 0) + { + writer.WritePropertyName("range"); + writer.WriteValue(range); + } + + if (intensity != 1.0f) + { + writer.WritePropertyName("intensity"); + writer.WriteValue(intensity); + } + if (!string.IsNullOrEmpty(name)) + { + writer.WritePropertyName("name"); + writer.WriteValue(name); + } + + writer.WritePropertyName("color"); + writer.WriteStartArray(); + writer.WriteValue(color.R); + writer.WriteValue(color.G); + writer.WriteValue(color.B); + writer.WriteEndArray(); + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs.meta new file mode 100644 index 0000000..c9282d6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_Light.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56f461ee5cb371843b46aae5b9e0b7a5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs new file mode 100644 index 0000000..beb708d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class GLTFPointLight : GLTFLight + { + + public GLTFPointLight() + { + } + + public GLTFPointLight(GLTFPointLight node, GLTFRoot gltfRoot) : base(node, gltfRoot) + { + if (node == null) return; + } + + public new static GLTFPointLight Deserialize(GLTFRoot root, JsonReader reader) + { + var node = new GLTFPointLight(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "type": + node.type = reader.ReadAsString(); + break; + case "color": + node.color = reader.ReadAsRGBAColor(); + break; + case "range": + node.range = (float)reader.ReadAsDouble(); + break; + case "intensity": + node.intensity = (float)reader.ReadAsDouble(); + break; + case "name": + node.name = reader.ReadAsString(); + break; + } + } + + return node; + } + + public override void Serialize(JsonWriter writer) + { + base.Serialize(writer); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs.meta new file mode 100644 index 0000000..634edbe --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_PointLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 802c7ccb6de792f47bd97fcbbb57b036 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs new file mode 100644 index 0000000..6aa758f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs @@ -0,0 +1,119 @@ +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using GLTF.Math; +using GLTF.Schema.KHR_lights_punctual; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class GLTFSpotLight : GLTFLight + { + public float innerConeAngle = 0; + public float outerConeAngle = (float)(System.Math.PI / 4.0); + + public GLTFSpotLight() + { + } + + public GLTFSpotLight(GLTFSpotLight node, GLTFRoot gltfRoot) : base(node, gltfRoot) + { + if (node == null) return; + + innerConeAngle = node.innerConeAngle; + outerConeAngle = node.outerConeAngle; + } + + public new static GLTFSpotLight Deserialize(GLTFRoot root, JsonReader reader) + { + var node = new GLTFSpotLight(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "type": + node.type = reader.ReadAsString(); + break; + case "color": + node.color = reader.ReadAsRGBAColor(); + break; + case "range": + node.range = (float)reader.ReadAsDouble(); + break; + case "intensity": + node.intensity = (float)reader.ReadAsDouble(); + break; + case "name": + node.name = reader.ReadAsString(); + break; + case "spot": + var spot = Spot.Deserialize(reader); + node.innerConeAngle = (float) spot.InnerConeAngle; + node.outerConeAngle = (float) spot.OuterConeAngle; + break; + } + } + + return node; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("type"); + writer.WriteValue(type); + + if (range > 0) + { + writer.WritePropertyName("range"); + writer.WriteValue(range); + } + + if (intensity != 1.0f) + { + writer.WritePropertyName("intensity"); + writer.WriteValue(intensity); + } + if (!string.IsNullOrEmpty(name)) + { + writer.WritePropertyName("name"); + writer.WriteValue(name); + } + + writer.WritePropertyName("spot"); + writer.WriteStartObject(); + if(innerConeAngle != 0) + { + writer.WritePropertyName("innerConeAngle"); + writer.WriteValue(innerConeAngle); + } + // if (outerConeAngle != PI / 4) + { + writer.WritePropertyName("outerConeAngle"); + writer.WriteValue(outerConeAngle); + } + writer.WriteEndObject(); + + // //write raw json + // writer.WriteRaw(",\"spot\":{\"innerConeAngle\":" + innerConeAngle.ToString(System.Globalization.CultureInfo.InvariantCulture)); + // writer.WriteRaw(",\"outerConeAngle\":" + outerConeAngle.ToString(System.Globalization.CultureInfo.InvariantCulture)); + // writer.WriteRaw("}"); + + writer.WritePropertyName("color"); + writer.WriteStartArray(); + writer.WriteValue(color.R); + writer.WriteValue(color.G); + writer.WriteValue(color.B); + //writer.WriteValue(color.A); + writer.WriteEndArray(); + + //base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs.meta new file mode 100644 index 0000000..c36eded --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/GLTF_SpotLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1174c79e1671fb943990d2b52eab704a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs new file mode 100644 index 0000000..90425ac --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs @@ -0,0 +1,80 @@ +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + /// + /// General interface for extensions + /// + public interface IExtension + { + /// + /// Serializes the extension to a property + /// + /// JProperty of extension + JProperty Serialize(); + + /// + /// Clones the extension. When implementing note that root can be null if the extension is not attached to a GLTFChildOfRootProperty + /// + /// GLTFRoot is availible + /// Cloned version of the extension + IExtension Clone(GLTFRoot root); + } + + /// + /// Abstract class for factory which creates an extension. + /// + public abstract class ExtensionFactory + { + /// + /// Name of the extension being created + /// + public string ExtensionName; + + /// + /// Deserializes the input token + /// + /// Root node if needed for deserailization + /// The token data + /// + public abstract IExtension Deserialize(GLTFRoot root, JProperty extensionToken); + } + + /// + /// Default implementation of extension in order to preserve any non explicitly overriden extension in the JSON + /// + public class DefaultExtension : IExtension + { + /// + /// Extenion data as a JProperty + /// + public JProperty ExtensionData { get; internal set; } + + public IExtension Clone(GLTFRoot root) + { + return new DefaultExtension + { + ExtensionData = new JProperty(ExtensionData) + }; + } + + public JProperty Serialize() + { + return ExtensionData; + } + } + + /// + /// Default implementation of ExtensionFactory to keep around any extensions not directly referenced + /// + public class DefaultExtensionFactory : ExtensionFactory + { + public override IExtension Deserialize(GLTFRoot root, JProperty extensionToken) + { + return new DefaultExtension + { + ExtensionData = extensionToken + }; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs.meta new file mode 100644 index 0000000..26a0958 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/IExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 75612d2ea4aa44c4ab737749e6395401 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs new file mode 100644 index 0000000..de6fe2a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs @@ -0,0 +1,106 @@ +using System; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class MaterialCommonConstant : GLTFProperty + { + /// + /// Used to scale the ambient light contributions to this material + /// + public Color AmbientFactor = Color.White; + + /// + /// Texture used to store pre-computed direct lighting + /// + public TextureInfo LightmapTexture; + + /// + /// Scale factor for the lightmap texture + /// + public Color LightmapFactor = Color.White; + + public MaterialCommonConstant() + { + } + + public MaterialCommonConstant(MaterialCommonConstant materialCommonConstant, GLTFRoot gltfRoot) : base(materialCommonConstant) + { + if (materialCommonConstant == null) return; + + AmbientFactor = materialCommonConstant.AmbientFactor; + LightmapTexture = new TextureInfo(materialCommonConstant.LightmapTexture, gltfRoot); + LightmapFactor = materialCommonConstant.LightmapFactor; + } + + public static MaterialCommonConstant Deserialize(GLTFRoot root, JsonReader reader) + { + var commonConstant = new MaterialCommonConstant(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "ambientFactor": + commonConstant.AmbientFactor = reader.ReadAsRGBColor(); + break; + case "lightmapTexture": + commonConstant.LightmapTexture = TextureInfo.Deserialize(root, reader); + break; + case "lightmapFactor": + commonConstant.LightmapFactor = reader.ReadAsRGBColor(); + break; + default: + commonConstant.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return commonConstant; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (AmbientFactor != Color.White) + { + writer.WritePropertyName("ambientFactor"); + writer.WriteStartArray(); + writer.WriteValue(AmbientFactor.R); + writer.WriteValue(AmbientFactor.G); + writer.WriteValue(AmbientFactor.B); + writer.WriteEndArray(); + } + + if (LightmapTexture != null) + { + writer.WritePropertyName("lightmapTexture"); + LightmapTexture.Serialize(writer); + } + + if (LightmapFactor != Color.White) + { + writer.WritePropertyName("lightmapFactor"); + writer.WriteStartArray(); + writer.WriteValue(LightmapFactor.R); + writer.WriteValue(LightmapFactor.G); + writer.WriteValue(LightmapFactor.B); + writer.WriteEndArray(); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs.meta new file mode 100644 index 0000000..7f2fe48 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialCommonConstant.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0c9f9ed6cc5d864ab86f662ca671226 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs new file mode 100644 index 0000000..85f87ff --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs @@ -0,0 +1,76 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class NormalTextureInfo : TextureInfo + { + public const string SCALE = "scale"; + + /// + /// The scalar multiplier applied to each normal vector of the texture. + /// This value is ignored if normalTexture is not specified. + /// This value is linear. + /// + public double Scale = 1.0f; + + public NormalTextureInfo() + { + } + + public NormalTextureInfo(NormalTextureInfo normalTextureInfo, GLTFRoot gltfRoot) : base(normalTextureInfo, gltfRoot) + { + Scale = normalTextureInfo.Scale; + } + + public static new NormalTextureInfo Deserialize(GLTFRoot root, JsonReader reader) + { + var textureInfo = new NormalTextureInfo(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case INDEX: + textureInfo.Index = TextureId.Deserialize(root, reader); + break; + case TEXCOORD: + textureInfo.TexCoord = reader.ReadAsInt32().Value; + break; + case SCALE: + textureInfo.Scale = reader.ReadAsDouble().Value; + break; + default: + textureInfo.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return textureInfo; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Scale != 1.0f) + { + writer.WritePropertyName("scale"); + writer.WriteValue(Scale); + } + + // Write the parent class' properties only. + // Don't accidentally call write start/end object. + base.SerializeProperties(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs.meta new file mode 100644 index 0000000..a257c90 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialNormalTextureInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc1cb3319141e8d4abc855bea912734f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs new file mode 100644 index 0000000..51b6696 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs @@ -0,0 +1,80 @@ +using System; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + public class OcclusionTextureInfo : TextureInfo + { + public const string STRENGTH = "strength"; + + /// + /// A scalar multiplier controlling the amount of occlusion applied. + /// A value of 0.0 means no occlusion. + /// A value of 1.0 means full occlusion. + /// This value is ignored if the corresponding texture is not specified. + /// This value is linear. + /// 0.0 + /// 1.0 + /// + public double Strength = 1.0f; + + public OcclusionTextureInfo() + { + } + + public OcclusionTextureInfo(OcclusionTextureInfo occulisionTextureInfo, GLTFRoot gltfRoot) : base(occulisionTextureInfo, gltfRoot) + { + Strength = occulisionTextureInfo.Strength; + } + + public static new OcclusionTextureInfo Deserialize(GLTFRoot root, JsonReader reader) + { + var textureInfo = new OcclusionTextureInfo(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case INDEX: + textureInfo.Index = TextureId.Deserialize(root, reader); + break; + case TEXCOORD: + textureInfo.TexCoord = reader.ReadAsInt32().Value; + break; + case STRENGTH: + textureInfo.Strength = reader.ReadAsDouble().Value; + break; + default: + textureInfo.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return textureInfo; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Strength != 1.0f) + { + writer.WritePropertyName("strength"); + writer.WriteValue(Strength); + } + + // Write the parent class' properties only. + // Don't accidentally call write start/end object. + base.SerializeProperties(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs.meta new file mode 100644 index 0000000..aa5da55 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialOcclusionTextureInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 407f0eb80f575c54bbd18b139e6cb511 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs new file mode 100644 index 0000000..131d557 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs @@ -0,0 +1,168 @@ +using System; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A set of parameter values that are used to define the metallic-roughness + /// material model from Physically-Based Rendering (PBR) methodology. + /// + public class PbrMetallicRoughness : GLTFProperty + { + /// + /// The RGBA components of the base color of the material. + /// The fourth component (A) is the opacity of the material. + /// These values are linear. + /// + public Color BaseColorFactor = Color.White; + + /// + /// The base color texture. + /// This texture contains RGB(A) components in sRGB color space. + /// The first three components (RGB) specify the base color of the material. + /// If the fourth component (A) is present, it represents the opacity of the + /// material. Otherwise, an opacity of 1.0 is assumed. + /// + public TextureInfo BaseColorTexture; + + /// + /// The metalness of the material. + /// A value of 1.0 means the material is a metal. + /// A value of 0.0 means the material is a dielectric. + /// Values in between are for blending between metals and dielectrics such as + /// dirty metallic surfaces. + /// This value is linear. + /// + public double MetallicFactor = 1; + + /// + /// The roughness of the material. + /// A value of 1.0 means the material is completely rough. + /// A value of 0.0 means the material is completely smooth. + /// This value is linear. + /// + public double RoughnessFactor = 1; + + /// + /// The metallic-roughness texture has two components. + /// The first component (R) contains the metallic-ness of the material. + /// The second component (G) contains the roughness of the material. + /// These values are linear. + /// If the third component (B) and/or the fourth component (A) are present, + /// they are ignored. + /// + public TextureInfo MetallicRoughnessTexture; + + public PbrMetallicRoughness() + { + } + + public PbrMetallicRoughness(PbrMetallicRoughness pbrMetallicRoughness, GLTFRoot gltfRoot) : base(pbrMetallicRoughness) + { + if(pbrMetallicRoughness == null) + { + return; + } + + BaseColorFactor = pbrMetallicRoughness.BaseColorFactor; + + if (pbrMetallicRoughness.BaseColorTexture != null) + { + BaseColorTexture = new TextureInfo(pbrMetallicRoughness.BaseColorTexture, gltfRoot); + } + + MetallicFactor = pbrMetallicRoughness.MetallicFactor; + RoughnessFactor = pbrMetallicRoughness.RoughnessFactor; + + if (pbrMetallicRoughness.MetallicRoughnessTexture != null) + { + MetallicRoughnessTexture = new TextureInfo(pbrMetallicRoughness.MetallicRoughnessTexture, gltfRoot); + } + } + + public static PbrMetallicRoughness Deserialize(GLTFRoot root, JsonReader reader) + { + var metallicRoughness = new PbrMetallicRoughness(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "baseColorFactor": + metallicRoughness.BaseColorFactor = reader.ReadAsRGBAColor(); + break; + case "baseColorTexture": + metallicRoughness.BaseColorTexture = TextureInfo.Deserialize(root, reader); + break; + case "metallicFactor": + metallicRoughness.MetallicFactor = reader.ReadAsDouble().Value; + break; + case "roughnessFactor": + metallicRoughness.RoughnessFactor = reader.ReadAsDouble().Value; + break; + case "metallicRoughnessTexture": + metallicRoughness.MetallicRoughnessTexture = TextureInfo.Deserialize(root, reader); + break; + default: + metallicRoughness.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return metallicRoughness; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (BaseColorFactor != Color.White) + { + writer.WritePropertyName("baseColorFactor"); + writer.WriteStartArray(); + writer.WriteValue(BaseColorFactor.R); + writer.WriteValue(BaseColorFactor.G); + writer.WriteValue(BaseColorFactor.B); + writer.WriteValue(BaseColorFactor.A); + writer.WriteEndArray(); + } + + if (BaseColorTexture != null) + { + writer.WritePropertyName("baseColorTexture"); + BaseColorTexture.Serialize(writer); + } + + if (MetallicFactor != 1.0f) + { + writer.WritePropertyName("metallicFactor"); + writer.WriteValue(MetallicFactor); + } + + if (RoughnessFactor != 1.0f) + { + writer.WritePropertyName("roughnessFactor"); + writer.WriteValue(RoughnessFactor); + } + + if (MetallicRoughnessTexture != null) + { + writer.WritePropertyName("metallicRoughnessTexture"); + MetallicRoughnessTexture.Serialize(writer); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs.meta new file mode 100644 index 0000000..536fd0d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MaterialPBRMetallicRoughness.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3154ff5377a58a145b6250c4b0f7d27f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs new file mode 100644 index 0000000..59f1960 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs @@ -0,0 +1,381 @@ +using System.Collections.Generic; +using GLTF.Extensions; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// Geometry to be rendered with the given material. + /// + public class MeshPrimitive : GLTFProperty + { + /// + /// A dictionary object, where each key corresponds to mesh attribute semantic + /// and each value is the index of the accessor containing attribute's data. + /// + public Dictionary Attributes = new Dictionary(); + + /// + /// The index of the accessor that contains mesh indices. + /// When this is not defined, the primitives should be rendered without indices + /// using `drawArrays()`. When defined, the accessor must contain indices: + /// the `bufferView` referenced by the accessor must have a `target` equal + /// to 34963 (ELEMENT_ARRAY_BUFFER); a `byteStride` that is tightly packed, + /// i.e., 0 or the byte size of `componentType` in bytes; + /// `componentType` must be 5121 (UNSIGNED_BYTE), 5123 (UNSIGNED_SHORT) + /// or 5125 (UNSIGNED_INT), the latter is only allowed + /// when `OES_element_index_uint` extension is used; `type` must be `\"SCALAR\"`. + /// + public AccessorId Indices; + + /// + /// The index of the material to apply to this primitive when rendering. + /// + public MaterialId Material; + + /// + /// The type of primitives to render. All valid values correspond to WebGL enums. + /// + public DrawMode Mode = DrawMode.Triangles; + + /// + /// An array of Morph Targets, each Morph Target is a dictionary mapping + /// attributes (only "POSITION" and "NORMAL" supported) to their deviations + /// in the Morph Target (index of the accessor containing the attribute + /// displacements' data). + /// + /// TODO: Make dictionary key enums? + public List> Targets; + + public List TargetNames; + + public MeshPrimitive() + { + } + + public MeshPrimitive(MeshPrimitive meshPrimitive, GLTFRoot gltfRoot) : base(meshPrimitive) + { + if (meshPrimitive == null) return; + + if (meshPrimitive.Attributes != null) + { + Attributes = new Dictionary(meshPrimitive.Attributes.Count); + foreach (KeyValuePair attributeKeyValuePair in meshPrimitive.Attributes) + { + Attributes[attributeKeyValuePair.Key] = new AccessorId(attributeKeyValuePair.Value, gltfRoot); + } + } + + if (meshPrimitive.Indices != null) + { + Indices = new AccessorId(meshPrimitive.Indices, gltfRoot); + } + + if (meshPrimitive.Material != null) + { + Material = new MaterialId(meshPrimitive.Material, gltfRoot); + } + + Mode = meshPrimitive.Mode; + + if (meshPrimitive.Targets != null) + { + Targets = new List>(meshPrimitive.Targets.Count); + foreach (Dictionary targetToCopy in meshPrimitive.Targets) + { + Dictionary target = new Dictionary(targetToCopy.Count); + foreach (KeyValuePair targetKeyValuePair in targetToCopy) + { + target[targetKeyValuePair.Key] = new AccessorId(targetKeyValuePair.Value, gltfRoot); + } + Targets.Add(target); + } + } + + if (meshPrimitive.TargetNames != null) + { + TargetNames = new List(meshPrimitive.TargetNames); + } + } + + public static int[] GenerateTriangles(int vertCount) + { + var arr = new int[vertCount]; + for (var i = 0; i < vertCount; i+=3) + { + arr[i] = i + 2; + arr[i + 1] = i + 1; + arr[i + 2] = i; + } + + return arr; + } + + // Taken from: http://answers.unity3d.com/comments/190515/view.html + // Official support for Mesh.RecalculateTangents should be coming in 5.6 + // https://feedback.unity3d.com/suggestions/recalculatetangents + /*private MeshPrimitiveAttributes CalculateAndSetTangents(MeshPrimitiveAttributes attributes) + { + var triangleCount = attributes.Triangles.Length; + var vertexCount = attributes.Vertices.Length; + + var tan1 = new Vector3[vertexCount]; + var tan2 = new Vector3[vertexCount]; + + attributes.Tangents = new Vector4[vertexCount]; + + for (long a = 0; a < triangleCount; a += 3) + { + long i1 = attributes.Triangles[a + 0]; + long i2 = attributes.Triangles[a + 1]; + long i3 = attributes.Triangles[a + 2]; + + var v1 = attributes.Vertices[i1]; + var v2 = attributes.Vertices[i2]; + var v3 = attributes.Vertices[i3]; + + var w1 = attributes.Uv[i1]; + var w2 = attributes.Uv[i2]; + var w3 = attributes.Uv[i3]; + + var x1 = v2.X - v1.X; + var x2 = v3.X - v1.X; + var y1 = v2.Y - v1.Y; + var y2 = v3.Y - v1.Y; + var z1 = v2.Z - v1.Z; + var z2 = v3.Z - v1.Z; + + var s1 = w2.X - w1.X; + var s2 = w3.X - w1.X; + var t1 = w2.Y - w1.Y; + var t2 = w3.Y - w1.Y; + + var r = 1.0f / (s1 * t2 - s2 * t1); + + var sdir = new Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r); + var tdir = new Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r); + + tan1[i1] += sdir; + tan1[i2] += sdir; + tan1[i3] += sdir; + + tan2[i1] += tdir; + tan2[i2] += tdir; + tan2[i3] += tdir; + } + + + for (long a = 0; a < vertexCount; ++a) + { + var n = attributes.Normals[a]; + var t = tan1[a]; + + Vector3.OrthoNormalize(ref n, ref t); + + attributes.Tangents[a].X = t.X; + attributes.Tangents[a].Y = t.Y; + attributes.Tangents[a].Z = t.Z; + + attributes.Tangents[a].W = (Vector3.Dot(Vector3.Cross(n, t), tan2[a]) < 0.0f) ? -1.0f : 1.0f; + } + + return attributes; + }*/ + + public static MeshPrimitive Deserialize(GLTFRoot root, JsonReader reader) + { + var primitive = new MeshPrimitive(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "attributes": + primitive.Attributes = reader.ReadAsDictionary(() => new AccessorId + { + Id = reader.ReadAsInt32().Value, + Root = root + }); + break; + case "indices": + primitive.Indices = AccessorId.Deserialize(root, reader); + break; + case "material": + primitive.Material = MaterialId.Deserialize(root, reader); + break; + case "mode": + primitive.Mode = (DrawMode)reader.ReadAsInt32().Value; + break; + case "targets": + primitive.Targets = reader.ReadList(() => + { + return reader.ReadAsDictionary(() => new AccessorId + { + Id = reader.ReadAsInt32().Value, + Root = root + }, + skipStartObjectRead: true); + }); + break; + case "extras": + // GLTF does not support morph target names, serialize in extras for now + // https://github.com/KhronosGroup/glTF/issues/1036 + if (reader.Read() && reader.TokenType == JsonToken.StartObject) + { + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var extraProperty = reader.Value.ToString(); + switch (extraProperty) + { + case "targetNames": + primitive.TargetNames = reader.ReadStringList(); + break; + } + } + } + + break; + default: + primitive.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return primitive; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + writer.WritePropertyName("attributes"); + writer.WriteStartObject(); + foreach (var attribute in Attributes) + { + writer.WritePropertyName(attribute.Key); + writer.WriteValue(attribute.Value.Id); + } + writer.WriteEndObject(); + + if (Indices != null) + { + writer.WritePropertyName("indices"); + writer.WriteValue(Indices.Id); + } + + if (Material != null) + { + writer.WritePropertyName("material"); + writer.WriteValue(Material.Id); + } + + if (Mode != DrawMode.Triangles) + { + writer.WritePropertyName("mode"); + writer.WriteValue((int)Mode); + } + + if (Targets != null && Targets.Count > 0) + { + writer.WritePropertyName("targets"); + writer.WriteStartArray(); + foreach (var target in Targets) + { + writer.WriteStartObject(); + + foreach (var attribute in target) + { + writer.WritePropertyName(attribute.Key); + writer.WriteValue(attribute.Value.Id); + } + + writer.WriteEndObject(); + } + writer.WriteEndArray(); + } + // GLTF does not support morph target names, serialize in extras for now + // https://github.com/KhronosGroup/glTF/issues/1036 + if (TargetNames != null && TargetNames.Count > 0) + { + writer.WritePropertyName("extras"); + writer.WriteStartObject(); + writer.WritePropertyName("targetNames"); + writer.WriteStartArray(); + foreach (var targetName in TargetNames) + { + writer.WriteValue(targetName); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } + + public static class SemanticProperties + { + public const string POSITION = "POSITION"; + public const string NORMAL = "NORMAL"; + public const string JOINT = "JOINT"; + public const string WEIGHT = "WEIGHT"; + public const string TANGENT = "TANGENT"; + public const string INDICES = "INDICES"; + + public const string TEXCOORD_0 = "TEXCOORD_0"; + public const string TEXCOORD_1 = "TEXCOORD_1"; + public const string TEXCOORD_2 = "TEXCOORD_2"; + public const string TEXCOORD_3 = "TEXCOORD_3"; + public static readonly string[] TexCoord = { TEXCOORD_0, TEXCOORD_1, TEXCOORD_2, TEXCOORD_3 }; + + public const string COLOR_0 = "COLOR_0"; + public static readonly string[] Color = { COLOR_0 }; + + public const string WEIGHTS_0 = "WEIGHTS_0"; + public const string WEIGHTS_1 = "WEIGHTS_1"; + public static readonly string[] Weight = { WEIGHTS_0, WEIGHTS_1 }; + + public const string JOINTS_0 = "JOINTS_0"; + public const string JOINTS_1 = "JOINTS_1"; + public static readonly string[] Joint = { JOINTS_0, JOINTS_1 }; + + /// + /// Parse out the index of a given semantic property. + /// + /// Semantic property to parse + /// Parsed index to assign + /// + public static bool ParsePropertyIndex(string property, out int index) + { + index = -1; + var parts = property.Split('_'); + + if (parts.Length != 2) + { + return false; + } + + if (!int.TryParse(parts[1], out index)) + { + return false; + } + + return true; + } + } + + public enum DrawMode + { + Points = 0, + Lines = 1, + LineLoop = 2, + LineStrip = 3, + Triangles = 4, + TriangleStrip = 5, + TriangleFan = 6 + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs.meta new file mode 100644 index 0000000..cbba556 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/MeshPrimitive.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 22062a4fc434af14f80728e7e3b39069 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs new file mode 100644 index 0000000..71938ef --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs @@ -0,0 +1,281 @@ +using System.Collections.Generic; +using System.Linq; +using GLTF.Extensions; +using GLTF.Math; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// A node in the node hierarchy. + /// When the node contains `skin`, all `mesh.primitives` must contain `JOINT` + /// and `WEIGHT` attributes. A node can have either a `matrix` or any combination + /// of `translation`/`rotation`/`scale` (TRS) properties. + /// TRS properties are converted to matrices and postmultiplied in + /// the `T * R * S` order to compose the transformation matrix; + /// first the scale is applied to the vertices, then the rotation, and then + /// the translation. If none are provided, the transform is the Identity. + /// When a node is targeted for animation + /// (referenced by an animation.channel.target), only TRS properties may be present; + /// `matrix` will not be present. + /// + public class Node : GLTFChildOfRootProperty + { + /// + /// If true, extracts transform, rotation, scale values from the Matrix4x4. Otherwise uses the Transform, Rotate, Scale directly as specified by by the node. + /// + public bool UseTRS; + + /// + /// The index of the camera referenced by this node. + /// + public CameraId Camera; + + /// + /// The indices of this node's children. + /// + public List Children; + + /// + /// The index of the skin referenced by this node. + /// + public SkinId Skin; + + /// + /// A floating-point 4x4 transformation matrix stored in column-major order. + /// + public Matrix4x4 Matrix = Matrix4x4.Identity; + + /// + /// The index of the mesh in this node. + /// + public MeshId Mesh; + + /// + /// The node's unit quaternion rotation in the order (x, y, z, w), + /// where w is the scalar. + /// + public Quaternion Rotation = new Quaternion(0, 0, 0, 1); + + /// + /// The node's non-uniform scale. + /// + public Vector3 Scale = Vector3.One; + + /// + /// The node's translation. + /// + public Vector3 Translation = Vector3.Zero; + + /// + /// The weights of the instantiated Morph Target. + /// Number of elements must match number of Morph Targets of used mesh. + /// + public List Weights; + + public LightId Light; + + public Node() + { + } + + public Node(Node node, GLTFRoot gltfRoot) : base(node, gltfRoot) + { + if (node == null) return; + + UseTRS = node.UseTRS; + + if (node.Camera != null) + { + Camera = new CameraId(node.Camera, gltfRoot); + } + + if (node.Children != null) + { + Children = new List(node.Children.Count); + foreach (NodeId child in node.Children) + { + Children.Add(new NodeId(child, gltfRoot)); + } + } + + if (node.Skin != null) + { + Skin = new SkinId(node.Skin, gltfRoot); + } + + if (node.Matrix != null) + { + Matrix = new Matrix4x4(node.Matrix); + } + + if (node.Mesh != null) + { + Mesh = new MeshId(node.Mesh, gltfRoot); + } + + Rotation = node.Rotation; + + Scale = node.Scale; + + Translation = node.Translation; + + if (node.Weights != null) + { + Weights = node.Weights.ToList(); + } + + if (node.Light != null) + { + Light = node.Light; + } + } + + public static Node Deserialize(GLTFRoot root, JsonReader reader) + { + var node = new Node(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "camera": + node.Camera = CameraId.Deserialize(root, reader); + break; + case "children": + node.Children = NodeId.ReadList(root, reader); + break; + case "skin": + node.Skin = SkinId.Deserialize(root, reader); + break; + case "matrix": + var list = reader.ReadDoubleList(); + // gltf has column ordered matricies + var mat = new Matrix4x4( + (float)list[0], (float)list[1], (float)list[2], (float)list[3], (float)list[4], (float)list[5], (float)list[6], (float)list[7], + (float)list[8], (float)list[9], (float)list[10], (float)list[11], (float)list[12], (float)list[13], (float)list[14], (float)list[15] + ); + + node.Matrix = mat; + break; + case "mesh": + node.Mesh = MeshId.Deserialize(root, reader); + break; + case "rotation": + node.UseTRS = true; + node.Rotation = reader.ReadAsQuaternion(); + break; + case "scale": + node.UseTRS = true; + node.Scale = reader.ReadAsVector3(); + break; + case "translation": + node.UseTRS = true; + node.Translation = reader.ReadAsVector3(); + break; + case "weights": + node.Weights = reader.ReadDoubleList(); + break; + default: + node.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return node; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (Camera != null) + { + writer.WritePropertyName("camera"); + writer.WriteValue(Camera.Id); + } + + if (Children != null && Children.Count > 0) + { + writer.WritePropertyName("children"); + writer.WriteStartArray(); + foreach (var child in Children) + { + writer.WriteValue(child.Id); + } + writer.WriteEndArray(); + } + + if (Skin != null) + { + writer.WritePropertyName("skin"); + writer.WriteValue(Skin.Id); + } + + if (Matrix != Matrix4x4.Identity) + { + writer.WritePropertyName("matrix"); + writer.WriteStartArray(); + writer.WriteValue(Matrix.M11); writer.WriteValue(Matrix.M21); writer.WriteValue(Matrix.M31); writer.WriteValue(Matrix.M41); + writer.WriteValue(Matrix.M12); writer.WriteValue(Matrix.M22); writer.WriteValue(Matrix.M32); writer.WriteValue(Matrix.M42); + writer.WriteValue(Matrix.M13); writer.WriteValue(Matrix.M23); writer.WriteValue(Matrix.M33); writer.WriteValue(Matrix.M43); + writer.WriteValue(Matrix.M14); writer.WriteValue(Matrix.M24); writer.WriteValue(Matrix.M34); writer.WriteValue(Matrix.M44); + writer.WriteEndArray(); + } + + if (Mesh != null) + { + writer.WritePropertyName("mesh"); + writer.WriteValue(Mesh.Id); + } + + if (Rotation != Quaternion.Identity) + { + writer.WritePropertyName("rotation"); + writer.WriteStartArray(); + writer.WriteValue(Rotation.X); + writer.WriteValue(Rotation.Y); + writer.WriteValue(Rotation.Z); + writer.WriteValue(Rotation.W); + writer.WriteEndArray(); + } + + if (Scale != Vector3.One) + { + writer.WritePropertyName("scale"); + writer.WriteStartArray(); + writer.WriteValue(Scale.X); + writer.WriteValue(Scale.Y); + writer.WriteValue(Scale.Z); + writer.WriteEndArray(); + } + + if (Translation != Vector3.Zero) + { + writer.WritePropertyName("translation"); + writer.WriteStartArray(); + writer.WriteValue(Translation.X); + writer.WriteValue(Translation.Y); + writer.WriteValue(Translation.Z); + writer.WriteEndArray(); + } + + if (Weights != null && Weights.Count > 0) + { + writer.WritePropertyName("weights"); + writer.WriteStartArray(); + foreach (var weight in Weights) + { + writer.WriteValue(weight); + } + writer.WriteEndArray(); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs.meta new file mode 100644 index 0000000..07b9d35 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Node.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91eca59d86fe98c4097a0a5a1dcaba28 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs new file mode 100644 index 0000000..cccf53c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs @@ -0,0 +1,144 @@ +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// Texture sampler properties for filtering and wrapping modes. + /// + public class Sampler : GLTFChildOfRootProperty + { + /// + /// Magnification filter. + /// Valid values correspond to WebGL enums: `9728` (NEAREST) and `9729` (LINEAR). + /// + public MagFilterMode MagFilter = MagFilterMode.Linear; + + /// + /// Minification filter. All valid values correspond to WebGL enums. + /// + public MinFilterMode MinFilter = MinFilterMode.NearestMipmapLinear; + + /// + /// s wrapping mode. All valid values correspond to WebGL enums. + /// + public WrapMode WrapS = WrapMode.Repeat; + + /// + /// t wrapping mode. All valid values correspond to WebGL enums. + /// + public WrapMode WrapT = WrapMode.Repeat; + + public Sampler() + { + } + + public Sampler(Sampler sampler, GLTFRoot gltfRoot) : base(sampler, gltfRoot) + { + if (sampler == null) return; + + MagFilter = sampler.MagFilter; + MinFilter = sampler.MinFilter; + WrapS = sampler.WrapS; + WrapT = sampler.WrapT; + } + + public static Sampler Deserialize(GLTFRoot root, JsonReader reader) + { + var sampler = new Sampler(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "magFilter": + sampler.MagFilter = (MagFilterMode)reader.ReadAsInt32(); + break; + case "minFilter": + sampler.MinFilter = (MinFilterMode)reader.ReadAsInt32(); + break; + case "wrapS": + sampler.WrapS = (WrapMode)reader.ReadAsInt32(); + break; + case "wrapT": + sampler.WrapT = (WrapMode)reader.ReadAsInt32(); + break; + default: + sampler.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return sampler; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (MagFilter != MagFilterMode.Linear && MagFilter != MagFilterMode.None) + { + writer.WritePropertyName("magFilter"); + writer.WriteValue((int)MagFilter); + } + + if (MinFilter != MinFilterMode.NearestMipmapLinear && MinFilter != MinFilterMode.None) + { + writer.WritePropertyName("minFilter"); + writer.WriteValue((int)MinFilter); + } + + if (WrapS != WrapMode.Repeat) + { + writer.WritePropertyName("wrapS"); + writer.WriteValue((int)WrapS); + } + + if (WrapT != WrapMode.Repeat) + { + writer.WritePropertyName("wrapT"); + writer.WriteValue((int)WrapT); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } + + /// + /// Magnification filter mode. + /// + public enum MagFilterMode + { + None = 0, + Nearest = 9728, + Linear = 9729, + } + + /// + /// Minification filter mode. + /// + public enum MinFilterMode + { + None = 0, + Nearest = 9728, + Linear = 9729, + NearestMipmapNearest = 9984, + LinearMipmapNearest = 9985, + NearestMipmapLinear = 9986, + LinearMipmapLinear = 9987 + } + + /// + /// Texture wrap mode. + /// + public enum WrapMode + { + None = 0, + ClampToEdge = 33071, + MirroredRepeat = 33648, + Repeat = 10497 + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs.meta new file mode 100644 index 0000000..39db29a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Sampler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5360cd93389152e4399f96bef4f7d5b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs new file mode 100644 index 0000000..34974b3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs @@ -0,0 +1,129 @@ +using System.Collections.Generic; +using GLTF.Extensions; +using Newtonsoft.Json; + +namespace GLTF.Schema +{ + /// + /// Joints and matrices defining a skin. + /// + public class Skin : GLTFChildOfRootProperty + { + /// + /// The index of the accessor containing the floating-point 4x4 inverse-bind matrices. + /// The default is that each matrix is a 4x4 Identity matrix, which implies that inverse-bind + /// matrices were pre-applied. + /// + public AccessorId InverseBindMatrices; + + /// + /// The index of the node used as a skeleton root. + /// When undefined, joints transforms resolve to scene root. + /// + public NodeId Skeleton; + + /// + /// Indices of skeleton nodes, used as joints in this skin. The array length must be the + // same as the `count` property of the `inverseBindMatrices` accessor (when defined). + /// + public List Joints; + + public Skin() + { + Joints = new List(); + } + + public Skin(Skin skin, GLTFRoot gltfRoot) : base(skin, gltfRoot) + { + if (skin == null) return; + + if (skin.InverseBindMatrices != null) + { + InverseBindMatrices = new AccessorId(skin.InverseBindMatrices, gltfRoot); + } + + if (skin.Skeleton != null) + { + Skeleton = new NodeId(skin.Skeleton, gltfRoot); + } + + if (skin.Joints != null) + { + Joints = new List(skin.Joints.Count); + foreach (NodeId joint in skin.Joints) + { + Joints.Add(new NodeId(joint, gltfRoot)); + } + } + } + + public static Skin Deserialize(GLTFRoot root, JsonReader reader) + { + var skin = new Skin(); + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case "inverseBindMatrices": + skin.InverseBindMatrices = AccessorId.Deserialize(root, reader); + break; + case "skeleton": + skin.Skeleton = NodeId.Deserialize(root, reader); + break; + case "joints": + skin.Joints = new List(); + List ids = reader.ReadInt32List(); + for (int i = 0; i < ids.Count; i++) + { + skin.Joints.Add(new NodeId() + { + Id = ids[i], + Root = root + }); + } + break; + default: + skin.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return skin; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + if (InverseBindMatrices != null) + { + writer.WritePropertyName("inverseBindMatrices"); + writer.WriteValue(InverseBindMatrices.Id); + } + + if (Skeleton != null) + { + writer.WritePropertyName("skeleton"); + writer.WriteValue(Skeleton.Id); + } + + if (Joints != null && Joints.Count > 0) + { + writer.WritePropertyName("joints"); + writer.WriteStartArray(); + foreach (var joint in Joints) + { + writer.WriteValue(joint.Id); + } + writer.WriteEndArray(); + } + + base.Serialize(writer); + + writer.WriteEndObject(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs.meta new file mode 100644 index 0000000..9b1b906 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/Skin.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5de7dba147dab814ea285ea8f0e29f2e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs new file mode 100644 index 0000000..8ab1b36 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs @@ -0,0 +1,120 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace GLTF.Schema +{ + /// + /// Reference to a texture. + /// + public class TextureInfo : GLTFProperty + { + public const string INDEX = "index"; + public const string TEXCOORD = "texCoord"; + + /// + /// The index of the texture. + /// + public TextureId Index; + + /// + /// This integer value is used to construct a string in the format + /// TEXCOORD_ which is a reference to a key in + /// mesh.primitives.attributes (e.g. A value of 0 corresponds to TEXCOORD_0). + /// + public int TexCoord = 0; + + public TextureInfo() + { + } + + public TextureInfo(TextureInfo textureInfo, GLTFRoot gltfRoot) : base(textureInfo) + { + if (textureInfo == null) return; + + Index = new TextureId(textureInfo.Index, gltfRoot); + TexCoord = textureInfo.TexCoord; + } + + public static TextureInfo Deserialize(GLTFRoot root, JsonReader reader) + { + var textureInfo = new TextureInfo(); + + if (reader.Read() && reader.TokenType != JsonToken.StartObject) + { + throw new Exception("Asset must be an object."); + } + + while (reader.Read() && reader.TokenType == JsonToken.PropertyName) + { + var curProp = reader.Value.ToString(); + + switch (curProp) + { + case INDEX: + textureInfo.Index = TextureId.Deserialize(root, reader); + break; + case TEXCOORD: + textureInfo.TexCoord = reader.ReadAsInt32().Value; + break; + default: + textureInfo.DefaultPropertyDeserializer(root, reader); + break; + } + } + + return textureInfo; + } + + public static TextureInfo Deserialize(GLTFRoot root, JProperty jProperty) + { + var textureInfo = new TextureInfo(); + + foreach (JToken child in jProperty.Children()) + { + if(child is JProperty) + { + JProperty childAsJProperty = child as JProperty; + switch(childAsJProperty.Name) + { + case "index": + textureInfo.Index = TextureId.Deserialize(root, childAsJProperty); + break; + case "texCoord": + textureInfo.TexCoord = (int)childAsJProperty.Value; + break; + default: + // todo: implement + //textureInfo.DefaultPropertyDeserializer(root, childAsJProperty); + break; + } + } + } + + return textureInfo; + } + + public override void Serialize(JsonWriter writer) + { + writer.WriteStartObject(); + + SerializeProperties(writer); + + writer.WriteEndObject(); + } + + public void SerializeProperties(JsonWriter writer) + { + writer.WritePropertyName(INDEX); + writer.WriteValue(Index.Id); + + if (TexCoord != 0) + { + writer.WritePropertyName(TEXCOORD); + writer.WriteValue(TexCoord); + } + + base.Serialize(writer); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs.meta new file mode 100644 index 0000000..e61e07c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Schema/TextureInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1d647d19b3479834f9763fb7f53f0b99 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities.meta new file mode 100644 index 0000000..43dc789 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ae0e6abadf8de44db06715064bd7938 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs new file mode 100644 index 0000000..c08acef --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; + +namespace GLTF.Utilities +{ + internal static class JsonReaderExtensions + { + public static uint ReadDoubleAsUInt32(this JsonReader reader) + { + return (uint)System.Math.Round(reader.ReadAsDouble().Value); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs.meta new file mode 100644 index 0000000..4ac9a77 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/JsonReaderExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f4ec7ce58a8f26d44bfd5cde279a594f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs new file mode 100644 index 0000000..1a661ec --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs @@ -0,0 +1,65 @@ +namespace System.IO +{ + /// + /// Adding .NET CopyTo as extension method for .NET 3.5 support + /// + internal static class StreamExtensions + { + // We pick a value that is the largest multiple of 4096 that is still smaller than the large object heap threshold (85K). + // The CopyTo/CopyToAsync buffer is short-lived and is likely to be collected at Gen0, and it offers a significant + // improvement in Copy performance. + private const int _DefaultCopyBufferSize = 81920; + private static readonly byte[] _CopyBuffer = new byte[_DefaultCopyBufferSize]; + +#if !NETFX_CORE + public static void CopyTo(this Stream source, Stream destination) + { + int highwaterMark = 0; + try + { + int read; + while ((read = source.Read(_CopyBuffer, 0, _CopyBuffer.Length)) != 0) + { + if (read > highwaterMark) highwaterMark = read; + destination.Write(_CopyBuffer, 0, read); + } + } + finally + { + Array.Clear(_CopyBuffer, 0, highwaterMark); // clear only the most we used + } + } +#endif + + /// + /// Implementation to copy a fixed amount of data to self in stream + /// + /// The stream to modify + /// Offset into stream to copy + /// Amount of stream to copy + /// Size of array to use for each copy + public static void CopyToSelf(this Stream source, int destinationOffset, uint amountToCopy) + { + if (destinationOffset <= source.Position) throw new NotImplementedException("desintation offset must be larger than source offset"); + + int highwaterMark = 0; + long initialOffset = source.Position; + try + { + int read; + int amountToRead; + while ((source.Position = initialOffset + amountToCopy - (amountToRead = (int)Math.Min(_CopyBuffer.Length, amountToCopy))) >= 0 && (read = source.Read(_CopyBuffer, 0, amountToRead)) != 0) + { + if (read > highwaterMark) highwaterMark = read; + source.Position = destinationOffset + amountToCopy - read; + source.Write(_CopyBuffer, 0, read); + amountToCopy -= (uint)read; + } + } + finally + { + Array.Clear(_CopyBuffer, 0, highwaterMark); // clear only the most we used + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs.meta new file mode 100644 index 0000000..fc01c82 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/StreamExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1cef435e4865e234ca0f479df0676ba3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs new file mode 100644 index 0000000..b9d4524 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs @@ -0,0 +1,131 @@ +/// +/// Implementation from: https://social.msdn.microsoft.com/Forums/vstudio/en-US/c409b63b-37df-40ca-9322-458ffe06ea48/how-to-access-part-of-a-filestream-or-memorystream?forum=netfxbcl +/// + +using System; +using System.IO; + +namespace GLTF.Utilities +{ + /// + /// Allows only part of a stream to be accessed + /// Prevents reading of the stream past the desired length + /// SubStream start is based on input position + /// + public class SubStream : Stream + { + private Stream _baseStream; + private readonly long _length; + private long _position; + + public override bool CanRead + { + get + { + CheckDisposed(); + return _baseStream.CanRead; + } + } + + public override bool CanSeek + { + get + { + CheckDisposed(); + return false; + } + } + + public override bool CanWrite + { + get + { + CheckDisposed(); + return false; + } + } + + public override long Length + { + get + { + CheckDisposed(); + return _length; + } + } + + public override long Position + { + get + { + CheckDisposed(); + return _position; + } + set + { + throw new NotImplementedException(); + } + } + + public SubStream(Stream baseStream, long offset, long length) + { + if (baseStream == null) throw new ArgumentNullException(nameof(baseStream)); + if (!baseStream.CanRead) throw new ArgumentException("cannot read base stream"); + if (offset < 0) throw new ArgumentOutOfRangeException(nameof(offset)); + if (!baseStream.CanSeek) throw new ArgumentException("cannot seek on base stream"); + + _length = length; + _baseStream = baseStream; + _baseStream.Seek(offset, SeekOrigin.Current); + } + + public override void Flush() + { + CheckDisposed(); + _baseStream.Flush(); + } + + public override long Seek(long offset, SeekOrigin origin) + { + CheckDisposed(); + return _baseStream.Seek(offset, origin); + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + CheckDisposed(); + long remaining = _length - _position; + if (remaining <= 0) + { + return 0; + } + + if (remaining < count) + { + count = (int)remaining; + } + + int read = _baseStream.Read(buffer, offset, count); + _position += read; + return read; + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotImplementedException(); + } + + private void CheckDisposed() + { + if (_baseStream == null) + { + throw new ObjectDisposedException(GetType().Name); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs.meta new file mode 100644 index 0000000..a6d823c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/GLTFSerialization/Utilities/SubStream.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 655fa8eee650c064aa123b5754cb5df0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization.meta new file mode 100644 index 0000000..601826f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eccbe01f8cce2cb498ea33635d5ac1ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs new file mode 100644 index 0000000..e9701f4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("UnityGLTFScripts")] diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs.meta new file mode 100644 index 0000000..4fc48c7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f6e7dc425f2f1a45a0148a80a14220d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs new file mode 100644 index 0000000..a064d82 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs @@ -0,0 +1,293 @@ +using System; +using System.IO; +using UnityEngine; + +namespace UnityGLTF +{ + // It seems that BinaryWriter creates a ton of garbage: the implementation allocates a byte[4] for every float write. (and for double as well) + // foreach (var v in arr) + // { + // _bufferWriter.Write(v); // this will allocate 36B per call + // } + // For large accessors, this adds up to hundreds of megabytes of garbage. + // This class adds special implementations that skip BitConverterLE and instead convert with the same logic, + // differentiating between LittleEndian and BigEndian. + + // Following https://github.com/mono/mono/blob/4a5ffcabd58d6439e60126f46e0063bcf30e7a47/mcs/class/referencesource/mscorlib/system/io/binarywriter.cs#L381 + // Here's the 4-byte allocation we're seeing: https://github.com/mono/mono/blob/4a5ffcabd58d6439e60126f46e0063bcf30e7a47/mcs/class/System.ServiceModel/Mono.Security.Protocol.Ntlm/BitConverterLE.cs#L127 + // Another discussion of this problem: https://forum.unity.com/threads/binarywriter-floats.1108478/ + // The implementations here pull BitConverter.IsLittleEndian out of the loop and directly write converted bytes into the BinaryWriter. + internal class BinaryWriterWithLessAllocations : BinaryWriter + { + private static readonly byte[] _buffer = new byte[16]; // temp space for writing primitives to. + + public BinaryWriterWithLessAllocations(Stream binStream) : base(binStream) { } + + public unsafe void Write(float[] value) + { + if (BitConverter.IsLittleEndian) + { + foreach (var v in value) + { + uint tmpValue = *(uint *)&v; + _buffer[0] = (byte) (tmpValue); + _buffer[1] = (byte) (tmpValue >> 8); + _buffer[2] = (byte) (tmpValue >> 16); + _buffer[3] = (byte) (tmpValue >> 24); + Write(_buffer, 0, 4); + } + } + else + { + foreach (var v in value) + { + uint tmpValue = *(uint *)&v; + _buffer[0] = (byte) (tmpValue >> 24); + _buffer[1] = (byte) (tmpValue >> 16); + _buffer[2] = (byte) (tmpValue >> 8); + _buffer[3] = (byte) (tmpValue); + Write(_buffer, 0, 4); + } + } + } + + public override unsafe void Write(float value) + { + if (BitConverter.IsLittleEndian) + { + uint tmpValue = *(uint *)&value; + _buffer[0] = (byte) (tmpValue); + _buffer[1] = (byte) (tmpValue >> 8); + _buffer[2] = (byte) (tmpValue >> 16); + _buffer[3] = (byte) (tmpValue >> 24); + Write(_buffer, 0, 4); + } + else + { + uint tmpValue = *(uint *)&value; + _buffer[0] = (byte) (tmpValue >> 24); + _buffer[1] = (byte) (tmpValue >> 16); + _buffer[2] = (byte) (tmpValue >> 8); + _buffer[3] = (byte) (tmpValue); + Write(_buffer, 0, 4); + } + } + + public unsafe void Write(Vector4[] arr) + { + if (BitConverter.IsLittleEndian) + { + foreach (var v0 in arr) + { + float vx = v0.x; + float vy = v0.y; + float vz = v0.z; + float vw = v0.w; + + uint tmpValue = *(uint *)&vx; + _buffer[ 0] = (byte) (tmpValue); + _buffer[ 1] = (byte) (tmpValue >> 8); + _buffer[ 2] = (byte) (tmpValue >> 16); + _buffer[ 3] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vy; + _buffer[ 4] = (byte) (tmpValue); + _buffer[ 5] = (byte) (tmpValue >> 8); + _buffer[ 6] = (byte) (tmpValue >> 16); + _buffer[ 7] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vz; + _buffer[ 8] = (byte) (tmpValue); + _buffer[ 9] = (byte) (tmpValue >> 8); + _buffer[10] = (byte) (tmpValue >> 16); + _buffer[11] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vw; + _buffer[12] = (byte) (tmpValue); + _buffer[13] = (byte) (tmpValue >> 8); + _buffer[14] = (byte) (tmpValue >> 16); + _buffer[15] = (byte) (tmpValue >> 24); + + + Write(_buffer, 0, 16); + } + } + else + { + foreach (var v0 in arr) + { + float vx = v0.x; + float vy = v0.y; + float vz = v0.z; + float vw = v0.w; + + uint tmpValue = *(uint *)&vx; + _buffer[ 0] = (byte) (tmpValue >> 24); + _buffer[ 1] = (byte) (tmpValue >> 16); + _buffer[ 2] = (byte) (tmpValue >> 8); + _buffer[ 3] = (byte) (tmpValue); + + tmpValue = *(uint *)&vy; + _buffer[ 4] = (byte) (tmpValue >> 24); + _buffer[ 5] = (byte) (tmpValue >> 16); + _buffer[ 6] = (byte) (tmpValue >> 8); + _buffer[ 7] = (byte) (tmpValue); + + tmpValue = *(uint *)&vz; + _buffer[ 8] = (byte) (tmpValue >> 24); + _buffer[ 9] = (byte) (tmpValue >> 16); + _buffer[10] = (byte) (tmpValue >> 8); + _buffer[11] = (byte) (tmpValue); + + tmpValue = *(uint *)&vw; + _buffer[12] = (byte) (tmpValue >> 24); + _buffer[13] = (byte) (tmpValue >> 16); + _buffer[14] = (byte) (tmpValue >> 8); + _buffer[15] = (byte) (tmpValue); + + + Write(_buffer, 0, 16); + } + } + } + + public unsafe void Write(Vector3[] arr) + { + if (BitConverter.IsLittleEndian) + { + foreach (var v0 in arr) + { + float vx = v0.x; + float vy = v0.y; + float vz = v0.z; + + uint tmpValue = *(uint *)&vx; + _buffer[ 0] = (byte) (tmpValue); + _buffer[ 1] = (byte) (tmpValue >> 8); + _buffer[ 2] = (byte) (tmpValue >> 16); + _buffer[ 3] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vy; + _buffer[ 4] = (byte) (tmpValue); + _buffer[ 5] = (byte) (tmpValue >> 8); + _buffer[ 6] = (byte) (tmpValue >> 16); + _buffer[ 7] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vz; + _buffer[ 8] = (byte) (tmpValue); + _buffer[ 9] = (byte) (tmpValue >> 8); + _buffer[10] = (byte) (tmpValue >> 16); + _buffer[11] = (byte) (tmpValue >> 24); + + + Write(_buffer, 0, 12); + } + } + else + { + foreach (var v0 in arr) + { + float vx = v0.x; + float vy = v0.y; + float vz = v0.z; + + uint tmpValue = *(uint *)&vx; + _buffer[ 0] = (byte) (tmpValue >> 24); + _buffer[ 1] = (byte) (tmpValue >> 16); + _buffer[ 2] = (byte) (tmpValue >> 8); + _buffer[ 3] = (byte) (tmpValue); + + tmpValue = *(uint *)&vy; + _buffer[ 4] = (byte) (tmpValue >> 24); + _buffer[ 5] = (byte) (tmpValue >> 16); + _buffer[ 6] = (byte) (tmpValue >> 8); + _buffer[ 7] = (byte) (tmpValue); + + tmpValue = *(uint *)&vz; + _buffer[ 8] = (byte) (tmpValue >> 24); + _buffer[ 9] = (byte) (tmpValue >> 16); + _buffer[10] = (byte) (tmpValue >> 8); + _buffer[11] = (byte) (tmpValue); + + Write(_buffer, 0, 12); + } + } + } + + public unsafe void Write(Quaternion[] arr) + { + if (BitConverter.IsLittleEndian) + { + foreach (var v0 in arr) + { + float vx = v0.x; + float vy = v0.y; + float vz = v0.z; + float vw = v0.w; + + uint tmpValue = *(uint *)&vx; + _buffer[ 0] = (byte) (tmpValue); + _buffer[ 1] = (byte) (tmpValue >> 8); + _buffer[ 2] = (byte) (tmpValue >> 16); + _buffer[ 3] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vy; + _buffer[ 4] = (byte) (tmpValue); + _buffer[ 5] = (byte) (tmpValue >> 8); + _buffer[ 6] = (byte) (tmpValue >> 16); + _buffer[ 7] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vz; + _buffer[ 8] = (byte) (tmpValue); + _buffer[ 9] = (byte) (tmpValue >> 8); + _buffer[10] = (byte) (tmpValue >> 16); + _buffer[11] = (byte) (tmpValue >> 24); + + tmpValue = *(uint *)&vw; + _buffer[12] = (byte) (tmpValue); + _buffer[13] = (byte) (tmpValue >> 8); + _buffer[14] = (byte) (tmpValue >> 16); + _buffer[15] = (byte) (tmpValue >> 24); + + Write(_buffer, 0, 16); + } + } + else + { + foreach (var v0 in arr) + { + float vx = v0.x; + float vy = v0.y; + float vz = v0.z; + float vw = v0.w; + + uint tmpValue = *(uint *)&vx; + _buffer[ 0] = (byte) (tmpValue >> 24); + _buffer[ 1] = (byte) (tmpValue >> 16); + _buffer[ 2] = (byte) (tmpValue >> 8); + _buffer[ 3] = (byte) (tmpValue); + + tmpValue = *(uint *)&vy; + _buffer[ 4] = (byte) (tmpValue >> 24); + _buffer[ 5] = (byte) (tmpValue >> 16); + _buffer[ 6] = (byte) (tmpValue >> 8); + _buffer[ 7] = (byte) (tmpValue); + + tmpValue = *(uint *)&vz; + _buffer[ 8] = (byte) (tmpValue >> 24); + _buffer[ 9] = (byte) (tmpValue >> 16); + _buffer[10] = (byte) (tmpValue >> 8); + _buffer[11] = (byte) (tmpValue); + + tmpValue = *(uint *)&vw; + _buffer[12] = (byte) (tmpValue >> 24); + _buffer[13] = (byte) (tmpValue >> 16); + _buffer[14] = (byte) (tmpValue >> 8); + _buffer[15] = (byte) (tmpValue); + + Write(_buffer, 0, 16); + } + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs.meta new file mode 100644 index 0000000..69a75c1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/BinaryWriterWithLessAllocations.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cb8524c06641ea041996dd207ba02996 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef new file mode 100644 index 0000000..ba894c5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef @@ -0,0 +1,14 @@ +{ + "name": "UnityGLTF.Helpers", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": true, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef.meta b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef.meta new file mode 100644 index 0000000..63c59d7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Plugins/Optimization/UnityGLTF.Helpers.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d58a4b8a1f92baa4f8100941944470f7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Prefabs.meta b/Assets/Plugins/UnityGLTF/Runtime/Prefabs.meta new file mode 100644 index 0000000..75064c2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a03e64c2c3aba94eaecf31ffe847f86 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab b/Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab new file mode 100644 index 0000000..9aab860 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab @@ -0,0 +1,59 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1000013594771676 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4000011406631220} + - component: {fileID: 114000010638385648} + m_Layer: 0 + m_Name: GLTF + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4000011406631220 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1000013594771676} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 70, y: 70, z: 70} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114000010638385648 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1000013594771676} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9087a95f22bcee64ebc45f6deec08714, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUri: + Multithreaded: 1 + UseStream: 0 + AppendStreamingAssets: 1 + PlayAnimationOnLoad: 1 + Factory: {fileID: 0} + loadOnStart: 1 + MaterialsOnly: 0 + RetryCount: 10 + RetryTimeout: 2 + MaximumLod: 300 + Timeout: 8 + Collider: 0 + shaderOverride: {fileID: 0} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab.meta b/Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab.meta new file mode 100644 index 0000000..aa0c25a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Prefabs/GLTF.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5255039e40b37b14fbcc0b72a30fc62e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources.meta new file mode 100644 index 0000000..539869e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 12b3ed547e9b67745b2e8eebb01655c3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader b/Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader new file mode 100644 index 0000000..f0b86da --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader @@ -0,0 +1,70 @@ +Shader "Hidden/MetalGlossChannelSwap" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + _SmoothnessMultiplier ("Smoothness Multiplier", float) = 1 + } + SubShader + { + // No culling or depth + Cull Off ZWrite Off ZTest Always + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + return o; + } + + sampler2D _MainTex; + float _SmoothnessMultiplier; + + float4 frag (v2f i) : SV_Target + { + float4 col = tex2D(_MainTex, i.uv); + // From the GLTF 2.0 spec + // The metallic-roughness texture. The metalness values are sampled from the B channel. + // The roughness values are sampled from the G channel. These values are linear. + // If other channels are present (R or A), they are ignored for metallic-roughness calculations. + // + // Unity, by default, puts metallic in R channel and glossiness in A channel. + // Unity uses a metallic-gloss texture so we need to invert the value in the g channel. + // + // Conversion Summary + // Unity R channel goes into B channel + // Unity A channel goes into G channel, then inverted + float4 result = float4(0, 1 - (col.a * _SmoothnessMultiplier), col.r, 1); + #ifdef UNITY_COLORSPACE_GAMMA + #else + // hack for linear color space, need to figure out + // right way to sample textures. + result.xyz = GammaToLinearSpace(result.xyz); + #endif + return result; + } + ENDCG + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader.meta new file mode 100644 index 0000000..b59de13 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/MetalGlossChannelSwap.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 200d9689f5dda4633867345ba978a8dd +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader b/Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader new file mode 100644 index 0000000..957f290 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader @@ -0,0 +1,66 @@ +Shader "Hidden/NormalChannel" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + } + SubShader + { + // No culling or depth + Cull Off ZWrite Off ZTest Always + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = v.uv; + return o; + } + + sampler2D _MainTex; + + // fixed4 frag (v2f i) : SV_Target + // { + // float4 col = tex2D(_MainTex, i.uv); + // float4 res = float4(col.a, col.g, 1, 1); + // //res = float4(0.5,0.5,1,1); + // //res.xyz = GammaToLinearSpaceExact(res.xyz); + // // If a texture is marked as a normal map + // // the values are stored in the A and G channel. + // return res; + // } + + float4 frag (v2f i) : SV_Target + { + float4 col = tex2D(_MainTex, i.uv); + // If a texture is marked as a normal map + // the values are stored in the A and G channel. + float3 unpacked = UnpackNormal(col); + float4 result = float4(unpacked * 0.5f + 0.5f, 1); + return result; + } + + ENDCG + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader.meta new file mode 100644 index 0000000..36e083f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/NormalChannel.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 12e0e6f24241d4f38811bfce257ae65d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt b/Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt new file mode 100644 index 0000000..d31ab0cd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt @@ -0,0 +1,23 @@ +Notes on Standard (Specular setup).mat and Standard (Specular setup).shadervariants +----------------------------------------------------------------------------------- + +The Unity Standard and Standard (Specular setup) shaders have some extra requirements if you want to modify Materials at runtime, because - behind the scenes - it is actually many different shaders rolled into one. If you use scripting to change a Material that would cause it to use a different variant of the Standard Shader, you must enable that variant by using the Material.EnableKeyword function. + +When you use Material.EnableKeyword at runtime, the editor will compile the respective shader variant on the fly, so you will see the correct shading displayed. +When you build a standalone player however, Unity will only compile the shaders that are referenced by objects in your scene. So in case you don't already have a material either in your Scene or in the Resources folder that uses a particular shader variant, your code will call for a shader that hasn't been compiled and you'll see incorrect shading. + +GLTFSceneImporter.cs makes heavy use of Material.EnableKeyword, since based on the data in the GLTF file, different features like normal maps, emmission, or alpha modes must be turned on or off in the shader at runtime. The nature of building an importer that can load *any* GLTF file that is unknown at compile-time means that we cannot anticipate which shader features will be used, and therefore must enable the variants manually. + +This can be done in one of 2 ways: +1. Through the use of the ShaderVariantCollection (and add the keywords you need) +2. By adding a material to the Assets/Resources folder (and add textures to the texture fields, change Colors to be anything other than black, and change floats to anything other than 0 -you don't need to use the material on anything because as long as it's in the Resources folder Unity will presume it's going to be needed) + +Both methods will cause the compiler to deliver the necessary shader variants for the standalone player. + + +Links: +------ +https://docs.unity3d.com/Manual/MaterialsAccessingViaScript.html +https://docs.unity3d.com/ScriptReference/ShaderVariantCollection.html +https://docs.unity3d.com/ScriptReference/Material.EnableKeyword.html +http://answers.unity3d.com/questions/970290/emission-at-run-time-works-in-editor-but-not-in-bu.html \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt.meta new file mode 100644 index 0000000..ee0c194 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/README.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f3bf00dab702a054fb2572323e59feff +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat new file mode 100644 index 0000000..7ea1746 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Standard (Specular setup) + m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _EMISSION _SPECGLOSSMAP + m_LightmapFlags: 1 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat.meta new file mode 100644 index 0000000..b02eb23 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 250d45d62e6ce1c48a49ed3015b523eb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants new file mode 100644 index 0000000..f24dbd7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!200 &20000000 +ShaderVariantCollection: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Standard (Specular setup) + m_Shaders: + - first: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants.meta new file mode 100644 index 0000000..5f1a754 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/Standard (Specular setup).shadervariants.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad96276ecf34f304cae080332f7f9051 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 20000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab b/Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab new file mode 100644 index 0000000..914e89b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab @@ -0,0 +1,313 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1002552911756402 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4053236427204222} + - component: {fileID: 114843937143698750} + - component: {fileID: 1294434418350029168} + m_Layer: 0 + m_Name: GLTF + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4053236427204222 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1002552911756402} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4225727463385260} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114843937143698750 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1002552911756402} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9087a95f22bcee64ebc45f6deec08714, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUri: + Multithreaded: 0 + UseStream: 1 + AppendStreamingAssets: 0 + PlayAnimationOnLoad: 1 + Factory: {fileID: 0} + loadOnStart: 0 + MaterialsOnly: 0 + RetryCount: 10 + RetryTimeout: 2 + MaximumLod: 300 + Timeout: 8 + Collider: 0 + shaderOverride: {fileID: 0} +--- !u!215 &1294434418350029168 +ReflectionProbe: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1002552911756402} + m_Enabled: 1 + serializedVersion: 2 + m_Type: 0 + m_Mode: 1 + m_RefreshMode: 0 + m_TimeSlicingMode: 0 + m_Resolution: 128 + m_UpdateFrequency: 0 + m_BoxSize: {x: 10, y: 10, z: 10} + m_BoxOffset: {x: 0, y: 0, z: 0} + m_NearClip: 0.1 + m_FarClip: 1000 + m_ShadowDistance: 100 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_IntensityMultiplier: 0.4 + m_BlendDistance: 1 + m_HDR: 1 + m_BoxProjection: 0 + m_RenderDynamicObjects: 0 + m_UseOcclusionCulling: 1 + m_Importance: 1 + m_CustomBakedTexture: {fileID: 0} +--- !u!1 &1034827199715104 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4225727463385260} + - component: {fileID: 45916004938725370} + m_Layer: 0 + m_Name: TestScenePrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4225727463385260 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1034827199715104} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4095513381898270} + - {fileID: 4053236427204222} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!45 &45916004938725370 +Skybox: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1034827199715104} + m_Enabled: 1 + m_CustomSkybox: {fileID: 2100000, guid: b4101f3a635a9cd4187c92cf274d68ce, type: 2} +--- !u!1 &1191679913451980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4698259391897058} + - component: {fileID: 108668277531277172} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &4698259391897058 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1191679913451980} + m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258} + m_LocalPosition: {x: 0, y: 5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4095513381898270} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0} +--- !u!108 &108668277531277172 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1191679913451980} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &1478240168550960 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4095513381898270} + - component: {fileID: 20961921853974160} + - component: {fileID: 3629069418977858857} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4095513381898270 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478240168550960} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 1.3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4698259391897058} + m_Father: {fileID: 4225727463385260} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &20961921853974160 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478240168550960} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.1 + far clip plane: 1000 + field of view: 45.84 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!45 &3629069418977858857 +Skybox: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478240168550960} + m_Enabled: 1 + m_CustomSkybox: {fileID: 2100000, guid: ab1d3ce216922394fa9b7b0bcf303df6, type: 2} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab.meta b/Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab.meta new file mode 100644 index 0000000..dcfbd8e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Resources/TestScenePrefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 426ae0d14f1f31f48af072147ac6abe9 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts.meta new file mode 100644 index 0000000..853ca06 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9711e44b963e5074b96a9268c12345bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async.meta new file mode 100644 index 0000000..d2bbd26 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad85f72cb68a7854d8bd33e064340c2b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs new file mode 100644 index 0000000..30230d1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; + +namespace UnityGLTF +{ + public class AsyncCoroutineHelper : MonoBehaviour + { + public float BudgetPerFrameInSeconds = 0.01f; + + private WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame(); + private float _timeout; + + public async Task YieldOnTimeout() + { + if (Time.realtimeSinceStartup > _timeout) + { + await Task.Yield(); + _timeout = Time.realtimeSinceStartup + BudgetPerFrameInSeconds; + } + } + + private void Start() + { + _timeout = Time.realtimeSinceStartup + BudgetPerFrameInSeconds; + + StartCoroutine(ResetFrameTimeout()); + } + + private IEnumerator ResetFrameTimeout() + { + while (true) + { + yield return _waitForEndOfFrame; + _timeout = Time.realtimeSinceStartup + BudgetPerFrameInSeconds; + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs.meta new file mode 100644 index 0000000..92c6633 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/AsyncCoroutineHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f51ceb82926c0a44394654b191b00336 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs new file mode 100644 index 0000000..9b811a5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs @@ -0,0 +1,18 @@ +#if UNITY_2017_1_OR_NEWER +using System.Collections; +using System.Threading.Tasks; + +namespace UnityGLTF +{ + public static class TaskExtensions + { + public static IEnumerator AsCoroutine(this Task task) + { + while (!task.IsCompleted) + { + yield return null; + } + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs.meta new file mode 100644 index 0000000..b7d22c7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Async/TaskExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7305b2a914e83c142b612e9994f1b483 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache.meta new file mode 100644 index 0000000..5a73feb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6ce40bec54ad382449f80ef0e1028101 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs new file mode 100644 index 0000000..57672aa --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs @@ -0,0 +1,27 @@ +#if UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER + +using GLTF; +using GLTF.Schema; + +namespace UnityGLTF.Cache +{ + public struct AnimationSamplerCacheData + { + public AttributeAccessor Input; + public AttributeAccessor Output; + public InterpolationType Interpolation; + } + + public class AnimationCacheData + { + public UnityEngine.AnimationClip LoadedAnimationClip { get; set; } + public AnimationSamplerCacheData[] Samplers { get; set; } + + public AnimationCacheData(int samplerCount) + { + Samplers = new AnimationSamplerCacheData[samplerCount]; + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs.meta new file mode 100644 index 0000000..f644119 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AnimationCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5eb5ec69ffa30384786436879a3167a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs new file mode 100644 index 0000000..54666cd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using System.IO; +using GLTF.Schema; + +namespace UnityGLTF.Cache +{ + /// + /// Caches data in order to construct a unity object + /// + public class AssetCache : IDisposable + { + /// + /// Streams to the images to be loaded + /// + public Stream[] ImageStreamCache { get; private set; } + + /// + /// Loaded raw texture data + /// + public Texture2D[] ImageCache { get; private set; } + + /// + /// Textures to be used for assets. Textures from image cache with samplers applied + /// + public TextureCacheData[] TextureCache { get; private set; } + + /// + /// Cache for materials to be applied to the meshes + /// + public MaterialCacheData[] MaterialCache { get; private set; } + + /// + /// Byte buffers that represent the binary contents that get parsed + /// + public BufferCacheData[] BufferCache { get; private set; } + + /// + /// Cache of loaded meshes + /// + public MeshCacheData[] MeshCache { get; private set; } + +#if UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER + /// + /// Cache of loaded animations + /// + public AnimationCacheData[] AnimationCache { get; private set; } +#endif + + /// + /// Cache of loaded node objects + /// + public GameObject[] NodeCache { get; private set; } + + /// + /// Creates an asset cache which caches objects used in scene + /// + /// A glTF root whose assets will eventually be cached here + public AssetCache(GLTFRoot root) + { + ImageCache = new Texture2D[root.Images?.Count ?? 0]; + ImageStreamCache = new Stream[ImageCache.Length]; + TextureCache = new TextureCacheData[root.Textures?.Count ?? 0]; + MaterialCache = new MaterialCacheData[root.Materials?.Count ?? 0]; + BufferCache = new BufferCacheData[root.Buffers?.Count ?? 0]; + MeshCache = new MeshCacheData[root.Meshes?.Count ?? 0]; + + NodeCache = new GameObject[root.Nodes?.Count ?? 0]; +#if UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER + AnimationCache = new AnimationCacheData[root.Animations?.Count ?? 0]; +#endif + } + + public void Dispose() + { + if (ImageStreamCache != null) + { + foreach (var stream in ImageStreamCache) + { + stream?.Dispose(); + } + + ImageStreamCache = null; + } + + ImageCache = null; + TextureCache = null; + MaterialCache = null; + if (BufferCache != null) + { + foreach (BufferCacheData bufferCacheData in BufferCache) + { + if (bufferCacheData != null) + { + if (bufferCacheData.Stream != null) + { +#if !WINDOWS_UWP + bufferCacheData.Stream.Close(); +#else + bufferCacheData.Stream.Dispose(); +#endif + } + + bufferCacheData.Dispose(); + } + } + BufferCache = null; + } + + MeshCache = null; +#if UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER + AnimationCache = null; +#endif + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs.meta new file mode 100644 index 0000000..1adf895 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/AssetCache.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1bb782a30ee69ac43949c7b27404bb0a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs new file mode 100644 index 0000000..306f1ce --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs @@ -0,0 +1,19 @@ +using System; + +namespace UnityGLTF.Cache +{ + public class BufferCacheData : IDisposable + { + public uint ChunkOffset { get; set; } + public System.IO.Stream Stream { get; set; } + + public void Dispose() + { + if (Stream != null) + { + Stream.Dispose(); + Stream = null; + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs.meta new file mode 100644 index 0000000..59a7e70 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/BufferCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ede042e9106e314a9c2fc3727c636af +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs new file mode 100644 index 0000000..48ae132 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs @@ -0,0 +1,110 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace UnityGLTF.Cache +{ + internal static class ExportCache + { + public const int DefaultCacheSize = 1024; +#if UNITY_EDITOR + [InitializeOnLoadMethod] + private static void Init() + { + // Keep some files in cache that were last exported + EditorApplication.quitting += () => Shrink(DefaultCacheSize); + } + + public static void OpenCacheDirectory() + { + var dir = CacheDirectory; + if(Directory.Exists(dir)) EditorUtility.RevealInFinder(dir); + else Debug.LogWarning($"Cache directory does not exist: {dir}"); + } +#endif + + public static string CacheDirectory + { + get + { + var tempDirectory = Path.Combine(Application.temporaryCachePath, "UnityGLTF"); + return tempDirectory; + } + } + + public static bool TryGetBytes(Object asset, string seed, out byte[] bytes) + { +#if UNITY_EDITOR + var path = CacheDirectory + "/" + GlobalObjectId.GetGlobalObjectIdSlow(asset) + seed; + if (File.Exists(path)) + { + bytes = File.ReadAllBytes(path); + return true; + } +#endif + + bytes = null; + return false; + } + + public static void AddBytes(Object asset, string seed, byte[] bytes) + { +#if UNITY_EDITOR + var dir = CacheDirectory; + Directory.CreateDirectory(dir); + var path = dir + "/" + GlobalObjectId.GetGlobalObjectIdSlow(asset) + seed; + // Debug.Log($"Writing {bytes.Length} bytes to cache: {path}"); + File.WriteAllBytes(path, bytes); +#endif + } + + public static void Clear() + { + var dir = CacheDirectory; + if (Directory.Exists(dir)) + { + Directory.Delete(dir, true); + } + } + + public static void Shrink(int maxCacheSizeInMB) + { + if (maxCacheSizeInMB <= 0) + { + Clear(); + return; + } + + var maxCacheSize = maxCacheSizeInMB * 1024 * 1024; + var files = new List(); + var currentSize = CalculateCacheSize(files); + if(currentSize <= maxCacheSizeInMB) + return; + var filesSortedByLastAccess = files.OrderBy(f => f.LastAccessTimeUtc).ToList(); + foreach (var file in filesSortedByLastAccess) + { + file.Delete(); + currentSize -= (int)file.Length; + if (currentSize <= maxCacheSize) + break; + } + } + + public static long CalculateCacheSize(ICollection files = null) + { + var dir = CacheDirectory; + if (!Directory.Exists(dir)) return 0; + var filePaths = Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories); + long size = 0; + foreach (var file in filePaths) + { + var info = new FileInfo(file); + files?.Add(info); + size += (long) info.Length; + } + return size; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs.meta new file mode 100644 index 0000000..7df8d91 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/ExportCache.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b67adc482fa84697bf30de7918e7d995 +timeCreated: 1672777985 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs new file mode 100644 index 0000000..ff90831 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs @@ -0,0 +1,36 @@ +using GLTF.Schema; +using System; +using UnityEngine; + +namespace UnityGLTF.Cache +{ + public class MaterialCacheData : IDisposable + { + public Material UnityMaterial { get; set; } + public Material UnityMaterialWithVertexColor { get; set; } + public GLTFMaterial GLTFMaterial { get; set; } + + public Material GetContents(bool useVertexColors) + { + return useVertexColors ? UnityMaterialWithVertexColor : UnityMaterial; + } + + /// + /// Unloads the materials in this cache. + /// + public void Dispose() + { + if (UnityMaterial != null) + { + UnityEngine.Object.Destroy(UnityMaterial); + UnityMaterial = null; + } + + if (UnityMaterialWithVertexColor != null) + { + UnityEngine.Object.Destroy(UnityMaterialWithVertexColor); + UnityMaterialWithVertexColor = null; + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs.meta new file mode 100644 index 0000000..595bc90 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MaterialCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3046febe680d4eb44b6851e256d7feca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs new file mode 100644 index 0000000..1119607 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs @@ -0,0 +1,31 @@ +using GLTF; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace UnityGLTF.Cache +{ + public class MeshCacheData : IDisposable + { + public class PrimitiveCacheData + { + public Dictionary Attributes = new Dictionary(4); + public List> Targets = new List>(4); + } + + public List Primitives = new List(5); + public Mesh LoadedMesh { get; set; } + + /// + /// Unloads the meshes in this cache. + /// + public void Dispose() + { + if (LoadedMesh != null) + { + UnityEngine.Object.Destroy(LoadedMesh); + LoadedMesh = null; + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs.meta new file mode 100644 index 0000000..0ac29f1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/MeshCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7356479b6b440d943adc853e80ead936 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs new file mode 100644 index 0000000..674e29d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace UnityGLTF.Cache +{ + /// + /// A ref-counted cache data object containing lists of Unity objects that were created for the sake of a GLTF scene/node. + /// This supports counting the amount of refcounts that will dispose of itself + /// + public class RefCountedCacheData + { + private bool _isDisposed = false; + + /// + /// Ref count for this cache data. + /// + /// + /// Initialized to 0. When assigning the cache data to an instantiated GLTF + /// object the count will increase. + /// + private int _refCount = 0; + private readonly object _refCountLock = new object(); + + /// + /// Meshes used by this GLTF node. + /// + public MeshCacheData[] MeshCache { get; private set; } + + /// + /// Materials used by this GLTF node. + /// + public MaterialCacheData[] MaterialCache { get; private set; } + + /// + /// Textures used by this GLTF node. + /// + public TextureCacheData[] TextureCache { get; private set; } + + /// + /// Textures from the AssetCache that might need to be cleaned up + /// + public Texture2D[] ImageCache { get; private set; } + + public RefCountedCacheData(MaterialCacheData[] materialCache, MeshCacheData[] meshCache, TextureCacheData[] textureCache, Texture2D[] imageCache) + { + MaterialCache = materialCache; + MeshCache = meshCache; + TextureCache = textureCache; + ImageCache = imageCache; + } + + public void IncreaseRefCount() + { + if (_isDisposed) + { + throw new InvalidOperationException("Cannot inscrease the ref count on disposed cache data."); + } + + lock (_refCountLock) + { + _refCount++; + } + } + + public void DecreaseRefCount() + { + if (_isDisposed) + { + throw new InvalidOperationException("Cannot decrease the ref count on disposed cache data."); + } + + lock (_refCountLock) + { + if (_refCount <= 0) + { + throw new InvalidOperationException("Cannot decrease the cache data ref count below zero."); + } + + _refCount--; + } + + if (_refCount <= 0) + { + DestroyCachedData(); + } + } + + private void DestroyCachedData() + { + // Destroy the cached meshes + for (int i = 0; i < MeshCache.Length; i++) + { + MeshCache[i]?.Dispose(); + MeshCache[i] = null; + } + + // Destroy the cached textures + for (int i = 0; i < TextureCache.Length; i++) + { + TextureCache[i]?.Dispose(); + TextureCache[i] = null; + } + + // Destroy the cached materials + for (int i = 0; i < MaterialCache.Length; i++) + { + MaterialCache[i]?.Dispose(); + MaterialCache[i] = null; + } + + // Destroy the cached images + for (int i = 0; i < ImageCache.Length; i++) + { + if (ImageCache[i] != null) + { + UnityEngine.Object.Destroy(ImageCache[i]); + ImageCache[i] = null; + } + } + + _isDisposed = true; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs.meta new file mode 100644 index 0000000..dd60a6e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/RefCountedCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6acba157038c72d4db902024947d8f94 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs new file mode 100644 index 0000000..75b2ed2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs @@ -0,0 +1,25 @@ +using GLTF.Schema; +using System; +using UnityEngine; + +namespace UnityGLTF.Cache +{ + public class TextureCacheData : IDisposable + { + public GLTFTexture TextureDefinition; + public Texture2D Texture; + public bool IsLinear; + + /// + /// Unloads the textures in this cache. + /// + public void Dispose() + { + if (Texture != null) + { + UnityEngine.Object.Destroy(Texture); + Texture = null; + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs.meta new file mode 100644 index 0000000..5005ce3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Cache/TextureCacheData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2d62214ca8670eb49aa365a9c8a3abd2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs new file mode 100644 index 0000000..6ce50fa --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs @@ -0,0 +1,41 @@ +using System; + +namespace UnityGLTF +{ + [Serializable()] + public class WebRequestException : Exception + { + public WebRequestException() : base() { } + public WebRequestException(string message) : base(message) { } + public WebRequestException(string message, Exception inner) : base(message, inner) { } +#if UNITY_WEBREQUEST + public WebRequestException(UnityEngine.Networking.UnityWebRequest www) : base(string.Format("Error: {0} when requesting: {1}", www.responseCode, www.url)) { } +#endif +#if !WINDOWS_UWP + protected WebRequestException(System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) { } +#endif + } + + [Serializable()] + public class ShaderNotFoundException : Exception + { + public ShaderNotFoundException() : base() { } + public ShaderNotFoundException(string message) : base(message) { } + public ShaderNotFoundException(string message, Exception inner) : base(message, inner) { } +#if !WINDOWS_UWP + protected ShaderNotFoundException(System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + { } +#endif + } + + /// + /// GLTFLoad exceptions occur during runtime errors through use of the GLTFSceneImporter + /// + public class GLTFLoadException : Exception + { + public GLTFLoadException() : base() { } + public GLTFLoadException(string message) : base(message) { } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs.meta new file mode 100644 index 0000000..1f3d3f8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Exceptions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8d34b5101f1055e429abecbc93c31f69 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions.meta new file mode 100644 index 0000000..4a62dd4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ec62698f7fefc548b07a91ea9bb447a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs new file mode 100644 index 0000000..c5b6216 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; +using Unity.Profiling; +using UnityEngine; + +namespace UnityGLTF.Extensions +{ + public class KHR_animation_pointer_Resolver + { + private readonly List registered = new List(); + private static readonly ProfilerMarker animationPointerResolverMarker = new ProfilerMarker("Resolve Animation Pointer"); + + public void Add(KHR_animation_pointer anim) + { + registered.Add(anim); + } + + // private struct MaterialMapping + // { + // public string propertyName; + // public string exportName; + // } + // + // private readonly Dictionary> mappings = new Dictionary>(); + // + // // TODO: should we use a static switch instead? + // public void RegisterMapping(Material mat, string propertyName, string exportedPropertyName) + // { + // if (!mappings.ContainsKey(mat)) + // { + // mappings.Add(mat, new List()); + // } + // mappings[mat].Add(new MaterialMapping() { propertyName = propertyName, exportName = exportedPropertyName }); + // } + + public void Resolve(GLTFSceneExporter exporter) + { + foreach (var reg in registered) + { + animationPointerResolverMarker.Begin(); + int id = exporter.GetIndex(reg.animatedObject); + switch (reg.animatedObject) + { + case Light light: + reg.path = "/extensions/KHR_lights_punctual/lights/" + id + "/" + reg.propertyBinding; + break; + case Camera camera: + reg.path = "/cameras/" + id + "/" + reg.propertyBinding; + break; + case SkinnedMeshRenderer smr: + if (smr && reg.propertyBinding == "weights") + { + reg.path = "/nodes/" + id + "/" + reg.propertyBinding; + break; + } + goto ResolveComponent; + case Component comp: + case GameObject g: + ResolveComponent: + reg.path = "/nodes/" + id + "/" + reg.propertyBinding; + var componentPath = reg.path; + + var anyOtherResolverWasAbleToResolve = false; + foreach (var res in exporter.pointerResolvers) + { + if (res.TryResolve(reg.animatedObject, ref componentPath)) + { + reg.path = componentPath; + anyOtherResolverWasAbleToResolve = true; + break; + } + } + if (exporter.pointerResolvers.Count > 0 && !anyOtherResolverWasAbleToResolve) + { + // we don't need to warn for regular transforms that are not RectTransforms, + // but we want to warn for everything else that may be animated. + if (!(reg.animatedObject is Transform && !(reg.animatedObject is RectTransform))) + Debug.LogWarning("Wasn't able to resolve animation pointer for " + reg.animatedObject + " at " + componentPath + ". You can attach custom resolvers to animate properties in extensions.", reg.animatedObject as Object); + } + else if (!anyOtherResolverWasAbleToResolve) + { + // we don't need to warn for regular transforms that are not RectTransforms, + // but we want to warn for everything else that may be animated. + if (!(reg.animatedObject is Transform && !(reg.animatedObject is RectTransform))) + Debug.LogWarning("Wasn't able to resolve animation pointer for " + reg.animatedObject + " at " + componentPath + ". You can attach custom resolvers to animate properties in extensions.", reg.animatedObject as Object); + } + break; + case Material mat: + reg.path = "/materials/" + id + "/" + reg.propertyBinding; + break; + } + animationPointerResolverMarker.End(); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs.meta new file mode 100644 index 0000000..12f8399 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/KHR_animation_pointer_Resolver.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 23086a9473b049b3ab8e64001d13a28b +timeCreated: 1648544951 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs new file mode 100644 index 0000000..fcacee4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs @@ -0,0 +1,201 @@ +using System.Collections.Generic; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Extensions; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF +{ + public static class MaterialExtensions + { +#if UNITY_EDITOR + [InitializeOnLoadMethod] +#endif + [RuntimeInitializeOnLoadMethod] + static void InitExt() + { + GLTFSceneExporter.AfterMaterialExport += GLTFSceneExporterOnAfterMaterialExport; + } + + private static readonly int thicknessTexture = Shader.PropertyToID("thicknessTexture"); + private static readonly int thicknessFactor = Shader.PropertyToID("thicknessFactor"); + private static readonly int attenuationDistance = Shader.PropertyToID("attenuationDistance"); + private static readonly int attenuationColor = Shader.PropertyToID("attenuationColor"); + private static readonly int ior = Shader.PropertyToID("ior"); + private static readonly int transmissionFactor = Shader.PropertyToID("transmissionFactor"); + private static readonly int transmissionTexture = Shader.PropertyToID("transmissionTexture"); + + private static readonly int iridescenceFactor = Shader.PropertyToID("iridescenceFactor"); + private static readonly int iridescenceIor = Shader.PropertyToID("iridescenceIor"); + private static readonly int iridescenceThicknessMinimum = Shader.PropertyToID("iridescenceThicknessMinimum"); + private static readonly int iridescenceThicknessMaximum = Shader.PropertyToID("iridescenceThicknessMaximum"); + private static readonly int iridescenceTexture = Shader.PropertyToID("iridescenceTexture"); + private static readonly int iridescenceThicknessTexture = Shader.PropertyToID("iridescenceThicknessTexture"); + + private static readonly int specularFactor = Shader.PropertyToID("specularFactor"); + private static readonly int specularColorFactor = Shader.PropertyToID("specularColorFactor"); + private static readonly int specularTexture = Shader.PropertyToID("specularTexture"); + private static readonly int specularColorTexture = Shader.PropertyToID("specularColorTexture"); + + private static readonly int clearcoatFactor = Shader.PropertyToID("clearcoatFactor"); + private static readonly int clearcoatTexture = Shader.PropertyToID("clearcoatTexture"); + private static readonly int clearcoatRoughnessFactor = Shader.PropertyToID("clearcoatRoughnessFactor"); + private static readonly int clearcoatRoughnessTexture = Shader.PropertyToID("clearcoatRoughnessTexture"); + private static readonly int clearcoatNormalTexture = Shader.PropertyToID("clearcoatNormalTexture"); + + + private static void GLTFSceneExporterOnAfterMaterialExport(GLTFSceneExporter exporter, GLTFRoot gltfroot, Material material, GLTFMaterial materialnode) + { + if (!material) return; + + var usesTransmission = material.IsKeywordEnabled("_VOLUME_TRANSMISSION_ON"); + var usesVolume = material.HasProperty("_VOLUME_ON") && material.GetFloat("_VOLUME_ON") > 0.5f; + var hasIor = material.HasProperty(ior) && !Mathf.Approximately(material.GetFloat(ior), KHR_materials_ior.DefaultIor); + + if (hasIor) + { + if (materialnode.Extensions == null) + materialnode.Extensions = new Dictionary(); + + var vi = new KHR_materials_ior(); + if (materialnode.Extensions.TryGetValue(KHR_materials_ior_Factory.EXTENSION_NAME, out var vv1)) + vi = (KHR_materials_ior) vv1; + else + materialnode.Extensions.Add(KHR_materials_ior_Factory.EXTENSION_NAME, vi); + + exporter.DeclareExtensionUsage(KHR_materials_ior_Factory.EXTENSION_NAME, false); + + if (material.HasProperty(ior)) + vi.ior = material.GetFloat(ior); + } + + if (usesTransmission) + { + if (materialnode.Extensions == null) + materialnode.Extensions = new Dictionary(); + + exporter.DeclareExtensionUsage(KHR_materials_transmission_Factory.EXTENSION_NAME, false); + + // if the material already has an extension, we should get and modify that + var vt = new KHR_materials_transmission(); + + if (materialnode.Extensions.TryGetValue(KHR_materials_transmission_Factory.EXTENSION_NAME, out var vv2)) + vt = (KHR_materials_transmission) vv2; + else + materialnode.Extensions.Add(KHR_materials_transmission_Factory.EXTENSION_NAME, vt); + + if (material.HasProperty(transmissionFactor)) + vt.transmissionFactor = material.GetFloat(transmissionFactor); + if (material.HasProperty(transmissionTexture) && material.GetTexture(transmissionTexture)) + vt.transmissionTexture = exporter.ExportTextureInfo(material.GetTexture(transmissionTexture), nameof(transmissionTexture)); + } + + if (usesVolume) + { + if (materialnode.Extensions == null) + materialnode.Extensions = new Dictionary(); + + exporter.DeclareExtensionUsage(KHR_materials_volume_Factory.EXTENSION_NAME, false); + + // if the material already has an extension, we should get and modify that + var ve = new KHR_materials_volume(); + + if (materialnode.Extensions.TryGetValue(KHR_materials_volume_Factory.EXTENSION_NAME, out var vv0)) + ve = (KHR_materials_volume)vv0; + else + materialnode.Extensions.Add(KHR_materials_volume_Factory.EXTENSION_NAME, ve); + + if (material.HasProperty(thicknessFactor)) + ve.thicknessFactor = material.GetFloat(thicknessFactor); + if (material.HasProperty(thicknessTexture) && material.GetTexture(thicknessTexture)) + ve.thicknessTexture = exporter.ExportTextureInfo(material.GetTexture(thicknessTexture), nameof(thicknessTexture)); + if (material.HasProperty(attenuationDistance)) + ve.attenuationDistance = material.GetFloat(attenuationDistance); + if (material.HasProperty(attenuationColor)) + ve.attenuationColor = material.GetColor(attenuationColor).ToNumericsColorRaw(); + } + + if (material.IsKeywordEnabled("_IRIDESCENCE_ON")) + { + exporter.DeclareExtensionUsage(KHR_materials_iridescence_Factory.EXTENSION_NAME, false); + + if (materialnode.Extensions == null) + materialnode.Extensions = new Dictionary(); + + var vir = new KHR_materials_iridescence(); + + if (materialnode.Extensions.TryGetValue(KHR_materials_iridescence_Factory.EXTENSION_NAME, out var vv0)) + vir = (KHR_materials_iridescence) vv0; + else + materialnode.Extensions.Add(KHR_materials_iridescence_Factory.EXTENSION_NAME, vir); + + if (material.HasProperty(iridescenceFactor)) + vir.iridescenceFactor = material.GetFloat(iridescenceFactor); + if (material.HasProperty(iridescenceIor)) + vir.iridescenceIor = material.GetFloat(iridescenceIor); + if (material.HasProperty(iridescenceThicknessMinimum)) + vir.iridescenceThicknessMinimum = material.GetFloat(iridescenceThicknessMinimum); + if (material.HasProperty(iridescenceThicknessMaximum)) + vir.iridescenceThicknessMaximum = material.GetFloat(iridescenceThicknessMaximum); + if (material.HasProperty(iridescenceTexture) && material.GetTexture(iridescenceTexture)) + vir.iridescenceTexture = exporter.ExportTextureInfo(material.GetTexture(iridescenceTexture), nameof(iridescenceTexture)); + if (material.HasProperty(iridescenceThicknessTexture) && material.GetTexture(iridescenceThicknessTexture)) + vir.iridescenceThicknessTexture = exporter.ExportTextureInfo(material.GetTexture(iridescenceThicknessTexture), nameof(iridescenceThicknessTexture)); + } + + if (material.IsKeywordEnabled("_SPECULAR_ON")) + { + exporter.DeclareExtensionUsage(KHR_materials_specular_Factory.EXTENSION_NAME, false); + + if (materialnode.Extensions == null) + materialnode.Extensions = new Dictionary(); + + var vir = new KHR_materials_specular(); + + if (materialnode.Extensions.TryGetValue(KHR_materials_specular_Factory.EXTENSION_NAME, out var vv0)) + vir = (KHR_materials_specular) vv0; + else + materialnode.Extensions.Add(KHR_materials_specular_Factory.EXTENSION_NAME, vir); + + if (material.HasProperty(specularFactor)) + vir.specularFactor = material.GetFloat(specularFactor); + if (material.HasProperty(specularColorFactor)) + vir.specularColorFactor = material.GetColor(specularColorFactor).ToNumericsColorRaw(); + if (material.HasProperty(specularTexture) && material.GetTexture(specularTexture)) + vir.specularTexture = exporter.ExportTextureInfo(material.GetTexture(specularTexture), nameof(specularTexture)); + if (material.HasProperty(specularColorTexture) && material.GetTexture(specularColorTexture)) + vir.specularColorTexture = exporter.ExportTextureInfo(material.GetTexture(specularColorTexture), nameof(specularColorTexture)); + } + + if (material.IsKeywordEnabled("_CLEARCOAT_ON")) + { + exporter.DeclareExtensionUsage(KHR_materials_clearcoat_Factory.EXTENSION_NAME, false); + + if (materialnode.Extensions == null) + materialnode.Extensions = new Dictionary(); + + var cc = new KHR_materials_clearcoat(); + + if (materialnode.Extensions.TryGetValue(KHR_materials_clearcoat_Factory.EXTENSION_NAME, out var vv0)) + cc = (KHR_materials_clearcoat) vv0; + else + materialnode.Extensions.Add(KHR_materials_clearcoat_Factory.EXTENSION_NAME, cc); + + if (material.HasProperty(clearcoatFactor)) + cc.clearcoatFactor = material.GetFloat(clearcoatFactor); + if (material.HasProperty(clearcoatTexture)) + cc.clearcoatTexture = exporter.ExportTextureInfo(material.GetTexture(clearcoatTexture), nameof(clearcoatTexture)); + if (material.HasProperty(clearcoatRoughnessFactor)) + cc.clearcoatRoughnessFactor = material.GetFloat(clearcoatRoughnessFactor); + if (material.HasProperty(clearcoatRoughnessTexture)) + cc.clearcoatRoughnessTexture = exporter.ExportTextureInfo(material.GetTexture(clearcoatRoughnessTexture), nameof(clearcoatRoughnessTexture)); + if (material.HasProperty(clearcoatNormalTexture)) + cc.clearcoatNormalTexture = exporter.ExportTextureInfo(material.GetTexture(clearcoatNormalTexture), nameof(clearcoatNormalTexture)); + + + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs.meta new file mode 100644 index 0000000..8ac78b5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/MaterialExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5152940c6ada2f3449baca5def38ea64 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs new file mode 100644 index 0000000..d96d893 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs @@ -0,0 +1,606 @@ +using GLTF; +using GLTF.Schema; +using UnityEngine; + +namespace UnityGLTF.Extensions +{ + public static class SchemaExtensions + { + /// + /// Define the transformation between Unity coordinate space and glTF. + /// glTF is a right-handed coordinate system, where the 'right' direction is -X relative to + /// Unity's coordinate system. + /// glTF matrix: column vectors, column-major storage, +Y up, +Z forward, -X right, right-handed + /// unity matrix: column vectors, column-major storage, +Y up, +Z forward, +X right, left-handed + /// multiply by a negative X scale to convert handedness + /// + public static readonly GLTF.Math.Vector3 CoordinateSpaceConversionScale = new GLTF.Math.Vector3(-1, 1, 1); + + /// + /// Define whether the coordinate space scale conversion above means we have a change in handedness. + /// This is used when determining the conventional direction of rotation - the right-hand rule states + /// that rotations are clockwise in left-handed systems and counter-clockwise in right-handed systems. + /// Reversing the direction of one or three axes of reverses the handedness. + /// + public static bool CoordinateSpaceConversionRequiresHandednessFlip + { + get + { + return CoordinateSpaceConversionScale.X * CoordinateSpaceConversionScale.Y * CoordinateSpaceConversionScale.Z < 0.0f; + } + } + + public static readonly GLTF.Math.Vector4 TangentSpaceConversionScale = new GLTF.Math.Vector4(-1, 1, 1, -1); + + /// + /// Get the converted unity translation, rotation, and scale from a gltf node + /// + /// gltf node + /// unity translation vector + /// unity rotation quaternion + /// unity scale vector + public static void GetUnityTRSProperties(this Node node, out Vector3 position, out Quaternion rotation, + out Vector3 scale) + { + if (!node.UseTRS) + { + Matrix4x4 unityMat = node.Matrix.ToUnityMatrix4x4Convert(); + unityMat.GetTRSProperties(out position, out rotation, out scale); + } + else + { + position = node.Translation.ToUnityVector3Convert(); + rotation = node.Rotation.ToUnityQuaternionConvert(); + scale = node.Scale.ToUnityVector3Raw(); + } + } + + internal static readonly Quaternion InvertDirection = new Quaternion(0, -1, 0, 0); + + /// + /// Set a gltf node's converted translation, rotation, and scale from a unity transform + /// + /// gltf node to modify + /// unity transform to convert + /// invert look direction (e.g. for lights and cameras) + public static void SetUnityTransform(this Node node, Transform transform, bool invertLookDirection) + { + node.Translation = transform.localPosition.ToGltfVector3Convert(); + node.Rotation = (transform.localRotation * (invertLookDirection ? InvertDirection : Quaternion.identity)).ToGltfQuaternionConvert(); + node.Scale = transform.localScale.ToGltfVector3Raw(); + } + + // todo: move to utility class + /// + /// Get unity translation, rotation, and scale from a unity matrix + /// + /// unity matrix to get properties from + /// unity translation vector + /// unity rotation quaternion + /// unity scale vector + public static void GetTRSProperties(this Matrix4x4 mat, out Vector3 position, out Quaternion rotation, + out Vector3 scale) + { + position = mat.GetColumn(3); + + Vector3 x = mat.GetColumn(0); + Vector3 y = mat.GetColumn(1); + Vector3 z = mat.GetColumn(2); + Vector3 calculatedZ = Vector3.Cross(x, y); + bool mirrored = Vector3.Dot(calculatedZ, z) < 0.0f; + + scale = new Vector3(x.magnitude * (mirrored ? -1.0f : 1.0f), y.magnitude, z.magnitude); + + rotation = Quaternion.LookRotation(mat.GetColumn(2), mat.GetColumn(1)); + } + + /// + /// Get converted unity translation, rotation, and scale from a gltf matrix + /// + /// gltf matrix to get and convert properties from + /// unity translation vector + /// unity rotation quaternion + /// unity scale vector + public static void GetTRSProperties(this GLTF.Math.Matrix4x4 gltfMat, out Vector3 position, out Quaternion rotation, + out Vector3 scale) + { + gltfMat.ToUnityMatrix4x4Convert().GetTRSProperties(out position, out rotation, out scale); + } + + /// + /// Get a gltf column vector from a gltf matrix + /// + /// gltf matrix + /// the specified column vector from the matrix + /// + public static GLTF.Math.Vector4 GetColumn(this GLTF.Math.Matrix4x4 mat, uint columnNum) + { + switch (columnNum) + { + case 0: + { + return new GLTF.Math.Vector4(mat.M11, mat.M21, mat.M31, mat.M41); + } + case 1: + { + return new GLTF.Math.Vector4(mat.M12, mat.M22, mat.M32, mat.M42); + } + case 2: + { + return new GLTF.Math.Vector4(mat.M13, mat.M23, mat.M33, mat.M43); + } + case 3: + { + return new GLTF.Math.Vector4(mat.M14, mat.M24, mat.M34, mat.M44); + } + default: + throw new System.Exception("column num is out of bounds"); + } + } + + /// + /// Convert gltf quaternion to a unity quaternion + /// + /// gltf quaternion + /// unity quaternion + public static Quaternion ToUnityQuaternionConvert(this GLTF.Math.Quaternion gltfQuat) + { + Vector3 fromAxisOfRotation = new Vector3(gltfQuat.X, gltfQuat.Y, gltfQuat.Z); + float axisFlipScale = CoordinateSpaceConversionRequiresHandednessFlip ? -1.0f : 1.0f; + Vector3 toAxisOfRotation = axisFlipScale * Vector3.Scale(fromAxisOfRotation, CoordinateSpaceConversionScale.ToUnityVector3Raw()); + + return new Quaternion(toAxisOfRotation.x, toAxisOfRotation.y, toAxisOfRotation.z, gltfQuat.W); + } + + /// + /// Convert unity quaternion to a gltf quaternion + /// + /// unity quaternion + /// gltf quaternion + public static GLTF.Math.Quaternion ToGltfQuaternionConvert(this Quaternion unityQuat) + { + Vector3 fromAxisOfRotation = new Vector3(unityQuat.x, unityQuat.y, unityQuat.z); + float axisFlipScale = CoordinateSpaceConversionRequiresHandednessFlip ? -1.0f : 1.0f; + Vector3 toAxisOfRotation = axisFlipScale * Vector3.Scale(fromAxisOfRotation, CoordinateSpaceConversionScale.ToUnityVector3Raw()); + + return new GLTF.Math.Quaternion(toAxisOfRotation.x, toAxisOfRotation.y, toAxisOfRotation.z, unityQuat.w); + } + + /// + /// Convert gltf matrix to a unity matrix + /// + /// gltf matrix + /// unity matrix + public static Matrix4x4 ToUnityMatrix4x4Convert(this GLTF.Math.Matrix4x4 gltfMat) + { + Matrix4x4 rawUnityMat = gltfMat.ToUnityMatrix4x4Raw(); + Vector3 coordinateSpaceConversionScale = CoordinateSpaceConversionScale.ToUnityVector3Raw(); + Matrix4x4 convert = Matrix4x4.Scale(coordinateSpaceConversionScale); + Matrix4x4 unityMat = convert * rawUnityMat * convert; + return unityMat; + } + + /// + /// Convert gltf matrix to a unity matrix + /// + /// unity matrix + /// gltf matrix + public static GLTF.Math.Matrix4x4 ToGltfMatrix4x4Convert(this Matrix4x4 unityMat) + { + Vector3 coordinateSpaceConversionScale = CoordinateSpaceConversionScale.ToUnityVector3Raw(); + Matrix4x4 convert = Matrix4x4.Scale(coordinateSpaceConversionScale); + GLTF.Math.Matrix4x4 gltfMat = (convert * unityMat * convert).ToGltfMatrix4x4Raw(); + return gltfMat; + } + + /// + /// Convert gltf Vector3 to unity Vector3 + /// + /// gltf vector3 + /// unity vector3 + public static Vector3 ToUnityVector3Convert(this GLTF.Math.Vector3 gltfVec3) + { + Vector3 coordinateSpaceConversionScale = CoordinateSpaceConversionScale.ToUnityVector3Raw(); + Vector3 unityVec3 = Vector3.Scale(gltfVec3.ToUnityVector3Raw(), coordinateSpaceConversionScale); + return unityVec3; + } + + /// + /// Convert unity Vector3 to gltf Vector3 + /// + /// unity Vector3 + /// gltf Vector3 + public static GLTF.Math.Vector3 ToGltfVector3Convert(this Vector3 unityVec3) + { + Vector3 coordinateSpaceConversionScale = CoordinateSpaceConversionScale.ToUnityVector3Raw(); + GLTF.Math.Vector3 gltfVec3 = Vector3.Scale(unityVec3, coordinateSpaceConversionScale).ToGltfVector3Raw(); + return gltfVec3; + } + + public static GLTF.Math.Vector3 ToGltfVector3Raw(this Vector3 unityVec3) + { + GLTF.Math.Vector3 gltfVec3 = new GLTF.Math.Vector3(unityVec3.x, unityVec3.y, unityVec3.z); + return gltfVec3; + } + + public static GLTF.Math.Vector4 ToGltfVector4Raw(this Vector4 unityVec4) + { + GLTF.Math.Vector4 gltfVec4 = new GLTF.Math.Vector4(unityVec4.x, unityVec4.y, unityVec4.z, unityVec4.w); + return gltfVec4; + } + + public static Matrix4x4 ToUnityMatrix4x4Raw(this GLTF.Math.Matrix4x4 gltfMat) + { + Vector4 rawUnityCol0 = gltfMat.GetColumn(0).ToUnityVector4Raw(); + Vector4 rawUnityCol1 = gltfMat.GetColumn(1).ToUnityVector4Raw(); + Vector4 rawUnityCol2 = gltfMat.GetColumn(2).ToUnityVector4Raw(); + Vector4 rawUnityCol3 = gltfMat.GetColumn(3).ToUnityVector4Raw(); + Matrix4x4 rawUnityMat = new UnityEngine.Matrix4x4(); + rawUnityMat.SetColumn(0, rawUnityCol0); + rawUnityMat.SetColumn(1, rawUnityCol1); + rawUnityMat.SetColumn(2, rawUnityCol2); + rawUnityMat.SetColumn(3, rawUnityCol3); + + return rawUnityMat; + } + + public static GLTF.Math.Matrix4x4 ToGltfMatrix4x4Raw(this Matrix4x4 unityMat) + { + GLTF.Math.Vector4 c0 = unityMat.GetColumn(0).ToGltfVector4Raw(); + GLTF.Math.Vector4 c1 = unityMat.GetColumn(1).ToGltfVector4Raw(); + GLTF.Math.Vector4 c2 = unityMat.GetColumn(2).ToGltfVector4Raw(); + GLTF.Math.Vector4 c3 = unityMat.GetColumn(3).ToGltfVector4Raw(); + GLTF.Math.Matrix4x4 rawGltfMat = new GLTF.Math.Matrix4x4(c0.X, c0.Y, c0.Z, c0.W, c1.X, c1.Y, c1.Z, c1.W, c2.X, c2.Y, c2.Z, c2.W, c3.X, c3.Y, c3.Z, c3.W); + return rawGltfMat; + } + + public static Vector2 ToUnityVector2Raw(this GLTF.Math.Vector2 vec2) + { + return new Vector2(vec2.X, vec2.Y); + } + + public static Vector2[] ToUnityVector2Raw(this GLTF.Math.Vector2[] inVecArr) + { + Vector2[] outVecArr = new Vector2[inVecArr.Length]; + for (int i = 0; i < inVecArr.Length; ++i) + { + outVecArr[i] = inVecArr[i].ToUnityVector2Raw(); + } + return outVecArr; + } + + public static void ToUnityVector2Raw(this GLTF.Math.Vector2[] inArr, Vector2[] outArr, int offset = 0) + { + for (int i = 0; i < inArr.Length; i++) + { + outArr[offset + i] = inArr[i].ToUnityVector2Raw(); + } + } + + public static Vector3 ToUnityVector3Raw(this GLTF.Math.Vector3 vec3) + { + return new Vector3(vec3.X, vec3.Y, vec3.Z); + } + + public static Vector3[] ToUnityVector3Raw(this GLTF.Math.Vector3[] inVecArr) + { + Vector3[] outVecArr = new Vector3[inVecArr.Length]; + for (int i = 0; i < inVecArr.Length; ++i) + { + outVecArr[i] = inVecArr[i].ToUnityVector3Raw(); + } + return outVecArr; + } + + public static void ToUnityVector3Raw(this GLTF.Math.Vector3[] inArr, Vector3[] outArr, int offset = 0) + { + for (int i = 0; i < inArr.Length; i++) + { + outArr[offset + i] = inArr[i].ToUnityVector3Raw(); + } + } + + public static Vector4 ToUnityVector4Raw(this GLTF.Math.Vector4 vec4) + { + return new Vector4(vec4.X, vec4.Y, vec4.Z, vec4.W); + } + + public static Vector4[] ToUnityVector4Raw(this GLTF.Math.Vector4[] inVecArr) + { + Vector4[] outVecArr = new Vector4[inVecArr.Length]; + for (int i = 0; i < inVecArr.Length; ++i) + { + outVecArr[i] = inVecArr[i].ToUnityVector4Raw(); + } + return outVecArr; + } + + public static void ToUnityVector4Raw(this GLTF.Math.Vector4[] inArr, Vector4[] outArr, int offset = 0) + { + for (int i = 0; i < inArr.Length; i++) + { + outArr[offset + i] = inArr[i].ToUnityVector4Raw(); + } + } + + public static UnityEngine.Color ToUnityColorRaw(this GLTF.Math.Color color) + { + var c = new UnityEngine.Color(color.R, color.G, color.B, color.A).gamma; + return c; + } + + public static UnityEngine.Color ToUnityColorLinear(this GLTF.Math.Color color) + { + var c = new UnityEngine.Color(color.R, color.G, color.B, color.A); + return c; + } + + public static GLTF.Math.Color ToNumericsColorRaw(this UnityEngine.Color color) + { + var c = color; + return new GLTF.Math.Color(c.r, c.g, c.b, c.a); + } + + public static GLTF.Math.Color ToNumericsColorLinear(this UnityEngine.Color color) + { + var lc = color.linear; + return new GLTF.Math.Color(lc.r, lc.g, lc.b, lc.a); + } + + public static GLTF.Math.Color[] ToNumericsColorLinear(this UnityEngine.Color[] inColorArr) + { + GLTF.Math.Color[] outColorArr = new GLTF.Math.Color[inColorArr.Length]; + for (int i = 0; i < inColorArr.Length; ++i) + { + outColorArr[i] = inColorArr[i].ToNumericsColorLinear(); + } + return outColorArr; + } + + public static UnityEngine.Color[] ToUnityColorRaw(this GLTF.Math.Color[] inColorArr) + { + UnityEngine.Color[] outColorArr = new UnityEngine.Color[inColorArr.Length]; + for (int i = 0; i < inColorArr.Length; ++i) + { + outColorArr[i] = inColorArr[i].ToUnityColorRaw(); + } + return outColorArr; + } + + public static UnityEngine.Color[] ToLinear(this UnityEngine.Color[] inColorArr) + { + UnityEngine.Color[] outColorArr = new UnityEngine.Color[inColorArr.Length]; + for (int i = 0; i < inColorArr.Length; ++i) + { + outColorArr[i] = inColorArr[i].linear; + } + return outColorArr; + } + + public static void ToUnityColorRaw(this GLTF.Math.Color[] inArr, Color[] outArr, int offset = 0) + { + for (int i = 0; i < inArr.Length; i++) + { + outArr[offset + i] = inArr[i].ToUnityColorRaw(); + } + } + + public static void ToUnityColorLinear(this GLTF.Math.Color[] inArr, Color[] outArr, int offset = 0) + { + for (int i = 0; i < inArr.Length; i++) + { + outArr[offset + i] = inArr[i].ToUnityColorLinear(); + } + } + + public static int[] ToIntArrayRaw(this uint[] uintArr) + { + int[] intArr = new int[uintArr.Length]; + for (int i = 0; i < uintArr.Length; ++i) + { + uint uintVal = uintArr[i]; + Debug.Assert(uintVal <= int.MaxValue); + intArr[i] = (int)uintVal; + } + + return intArr; + } + + public static GLTF.Math.Quaternion ToGltfQuaternionRaw(this Quaternion unityQuat) + { + return new GLTF.Math.Quaternion(unityQuat.x, unityQuat.y, unityQuat.z, unityQuat.w); + } + + public static Quaternion ToUnityQuaternionRaw(this GLTF.Math.Quaternion quaternion) + { + return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); + } + + /// + /// Flips the V component of the UV (1-V) to put from glTF into Unity space + /// + /// The attribute accessor to modify + public static void FlipTexCoordArrayV(ref AttributeAccessor attributeAccessor) + { + for (var i = 0; i < attributeAccessor.AccessorContent.AsVec2s.Length; i++) + { + attributeAccessor.AccessorContent.AsVec2s[i].Y = 1.0f - attributeAccessor.AccessorContent.AsVec2s[i].Y; + } + } + + /// + /// Flip the V component of the UV (1-V) + /// + /// The array to copy from and modify + /// Copied Vector2 with coordinates in glTF space + public static UnityEngine.Vector2[] FlipTexCoordArrayVAndCopy(UnityEngine.Vector2[] array) + { + var returnArray = new UnityEngine.Vector2[array.Length]; + + for (var i = 0; i < array.Length; i++) + { + returnArray[i].x = array[i].x; + returnArray[i].y = 1.0f - array[i].y; + } + + return returnArray; + } + + /// + /// Converts vector3 to specified coordinate space + /// + /// The attribute accessor to modify + /// The coordinate space to move into + public static void ConvertVector3CoordinateSpace(ref AttributeAccessor attributeAccessor, GLTF.Math.Vector3 coordinateSpaceCoordinateScale) + { + for (int i = 0; i < attributeAccessor.AccessorContent.AsVertices.Length; i++) + { + attributeAccessor.AccessorContent.AsVertices[i].X *= coordinateSpaceCoordinateScale.X; + attributeAccessor.AccessorContent.AsVertices[i].Y *= coordinateSpaceCoordinateScale.Y; + attributeAccessor.AccessorContent.AsVertices[i].Z *= coordinateSpaceCoordinateScale.Z; + } + } + + /// + /// Converts and copies based on the specified coordinate scale + /// + /// The array to convert and copy + /// The specified coordinate space + /// The copied and converted coordinate space + public static UnityEngine.Vector3[] ConvertVector3CoordinateSpaceAndCopy(Vector3[] array, GLTF.Math.Vector3 coordinateSpaceCoordinateScale) + { + var returnArray = new UnityEngine.Vector3[array.Length]; + var coordinateScale = coordinateSpaceCoordinateScale.ToUnityVector3Raw(); + + for (int i = 0; i < array.Length; i++) + { + returnArray[i] = array[i]; + returnArray[i].Scale(coordinateScale); + } + + return returnArray; + } + + /// + /// Converts vector4 to specified coordinate space + /// + /// The attribute accessor to modify + /// The coordinate space to move into + public static void ConvertVector4CoordinateSpace(ref AttributeAccessor attributeAccessor, GLTF.Math.Vector4 coordinateSpaceCoordinateScale) + { + for (int i = 0; i < attributeAccessor.AccessorContent.AsVec4s.Length; i++) + { + attributeAccessor.AccessorContent.AsVec4s[i].X *= coordinateSpaceCoordinateScale.X; + attributeAccessor.AccessorContent.AsVec4s[i].Y *= coordinateSpaceCoordinateScale.Y; + attributeAccessor.AccessorContent.AsVec4s[i].Z *= coordinateSpaceCoordinateScale.Z; + attributeAccessor.AccessorContent.AsVec4s[i].W *= coordinateSpaceCoordinateScale.W; + } + } + + /// + /// Converts and copies based on the specified coordinate scale + /// + /// The array to convert and copy + /// The specified coordinate space + /// The copied and converted coordinate space + public static Vector4[] ConvertVector4CoordinateSpaceAndCopy(Vector4[] array, GLTF.Math.Vector4 coordinateSpaceCoordinateScale) + { + var returnArray = new Vector4[array.Length]; + var coordinateScale = coordinateSpaceCoordinateScale.ToUnityVector4Raw(); + + for (var i = 0; i < array.Length; i++) + { + returnArray[i] = array[i]; + returnArray[i].Scale(coordinateScale); + } + + return returnArray; + } + + /// + /// Rewinds the indicies into Unity coordinate space from glTF space + /// + /// The attribute accessor to modify + public static void FlipTriangleFaces(int[] indices) + { + for (int i = 0; i < indices.Length; i += 3) + { + int temp = indices[i]; + indices[i] = indices[i + 2]; + indices[i + 2] = temp; + } + } + + public static Matrix4x4 ToUnityMatrix4x4(this GLTF.Math.Matrix4x4 matrix) + { + return new Matrix4x4() + { + m00 = matrix.M11, + m01 = matrix.M12, + m02 = matrix.M13, + m03 = matrix.M14, + m10 = matrix.M21, + m11 = matrix.M22, + m12 = matrix.M23, + m13 = matrix.M24, + m20 = matrix.M31, + m21 = matrix.M32, + m22 = matrix.M33, + m23 = matrix.M34, + m30 = matrix.M41, + m31 = matrix.M42, + m32 = matrix.M43, + m33 = matrix.M44 + }; + } + + public static Matrix4x4[] ToUnityMatrix4x4(this GLTF.Math.Matrix4x4[] inMatrixArr) + { + Matrix4x4[] outMatrixArr = new Matrix4x4[inMatrixArr.Length]; + for (int i = 0; i < inMatrixArr.Length; ++i) + { + outMatrixArr[i] = inMatrixArr[i].ToUnityMatrix4x4(); + } + return outMatrixArr; + } + + public static Quaternion SwitchHandedness(this Quaternion input) + { + return new Quaternion(-input.x, input.y, input.z, -input.w); + } + + /* + public static Vector4 SwitchHandedness(this Vector4 input) + { + return new Vector4(-input.x, input.y, input.z, -input.w); + } + + public static Matrix4x4 SwitchHandedness(this Matrix4x4 matrix) + { + Vector3 position = matrix.GetColumn(3).SwitchHandedness(); + Quaternion rotation = Quaternion.LookRotation(matrix.GetColumn(2), matrix.GetColumn(1)).SwitchHandedness(); + Vector3 scale = new Vector3(matrix.GetColumn(0).magnitude, matrix.GetColumn(1).magnitude, matrix.GetColumn(2).magnitude); + + float epsilon = 0.00001f; + + // Some issues can occurs with non uniform scales + if (Mathf.Abs(scale.x - scale.y) > epsilon || Mathf.Abs(scale.y - scale.z) > epsilon || Mathf.Abs(scale.x - scale.z) > epsilon) + { + Debug.LogWarning("A matrix with non uniform scale is being converted from left to right handed system. This code is not working correctly in this case"); + } + + // Handle negative scale component in matrix decomposition + if (Matrix4x4.Determinant(matrix) < 0) + { + Quaternion rot = Quaternion.LookRotation(matrix.GetColumn(2), matrix.GetColumn(1)); + Matrix4x4 corr = Matrix4x4.TRS(matrix.GetColumn(3), rot, Vector3.one).inverse; + Matrix4x4 extractedScale = corr * matrix; + scale = new Vector3(extractedScale.m00, extractedScale.m11, extractedScale.m22); + } + + // convert transform values from left handed to right handed + return Matrix4x4.TRS(position, rotation, scale); + } + */ + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs.meta new file mode 100644 index 0000000..d5c7152 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/SchemaExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3a3c8e7f1cdae14fa835ee3580e292f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs new file mode 100644 index 0000000..7ff00a7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Extensions; + +namespace UnityGLTF +{ + public static class TextMeshExport + { +#if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] +#else + [RuntimeInitializeOnLoadMethod] +#endif + static void Init() + { + GLTFSceneExporter.BeforeMaterialExport += BeforeMaterialExport; + GLTFSceneExporter.AfterSceneExport += CleanUpRenderTextureCache; + } + + private static void CleanUpRenderTextureCache(GLTFSceneExporter _, GLTFRoot __) + { + if (rtCache == null) return; + foreach (var kvp in rtCache) + kvp.Value.Release(); + rtCache.Clear(); + } + + private static Material tempMat; + private static Dictionary rtCache; + + private static bool BeforeMaterialExport(GLTFSceneExporter exporter, GLTFRoot gltfRoot, Material material, GLTFMaterial materialNode) + { + if (material.shader.name.Contains("TextMeshPro")) // seems to only work for TextMeshPro/Mobile/ right now (SDFAA_HINTED?) + { + var s = material.shader; + // TODO figure out how to properly use the non-mobile shaders + var newS = Shader.Find("TestMeshPro/Mobile/Distance Field"); +#if UNITY_EDITOR + if (!newS) + { + newS = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath("fe393ace9b354375a9cb14cdbbc28be4")); // same as above + } +#endif + material.shader = newS; + + if (!tempMat) tempMat = new Material(Shader.Find("Unlit/Transparent Cutout")); + + var existingTex = material.mainTexture; + if (rtCache == null) rtCache = new Dictionary(); + if (!rtCache.ContainsKey(existingTex)) + { + var rt = new RenderTexture(existingTex.width, existingTex.height, 0, RenderTextureFormat.ARGB32); + if (material.HasProperty("_OutlineSoftness")) + material.SetFloat("_OutlineSoftness", 0); + // TODO figure out how to get this more smooth + Graphics.Blit(existingTex, rt, material); + rtCache[existingTex] = rt; + rt.anisoLevel = 9; + rt.filterMode = FilterMode.Bilinear; + } + + tempMat.mainTexture = rtCache[existingTex]; + + + exporter.ExportUnlit(materialNode, tempMat); + + // export material + // alternative: double sided, alpha clipping, white RGB + TMPro mainTex R channel as alpha + materialNode.DoubleSided = false; + materialNode.PbrMetallicRoughness.BaseColorFactor = Color.white.ToNumericsColorLinear(); + materialNode.AlphaMode = AlphaMode.BLEND; + + material.shader = s; +#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER + UnityEditor.EditorUtility.ClearDirty(material); +#endif + + return true; + } + + return false; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs.meta new file mode 100644 index 0000000..594aebe --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Extensions/TextMeshExport.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5dd4c08c7d6d71f4ca7d83fb653d4f9b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories.meta new file mode 100644 index 0000000..9203440 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5ecddf923e46d4e4a8a472349578948c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs new file mode 100644 index 0000000..18a2c1f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs @@ -0,0 +1,18 @@ +using UnityEngine; +using UnityGLTF.Loader; + +namespace UnityGLTF +{ + public abstract class ImporterFactory : ScriptableObject + { + public abstract GLTFSceneImporter CreateSceneImporter(string gltfFileName, ImportOptions options); + } + + public class DefaultImporterFactory : ImporterFactory + { + public override GLTFSceneImporter CreateSceneImporter(string gltfFileName, ImportOptions options) + { + return new GLTFSceneImporter(gltfFileName, options); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs.meta new file mode 100644 index 0000000..7d2aabe --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Factories/ImporterFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26465c5482163224486cdb865e3a0838 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs new file mode 100644 index 0000000..ccab27a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Runtime.ExceptionServices; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.Events; +using UnityGLTF.Loader; + +namespace UnityGLTF +{ + /// + /// Component to load a GLTF scene with + /// + public class GLTFComponent : MonoBehaviour + { + public string GLTFUri = null; + public bool Multithreaded = true; + public bool UseStream = false; + public bool AppendStreamingAssets = true; + public bool PlayAnimationOnLoad = true; + public ImporterFactory Factory = null; + public UnityAction onLoadComplete; + +#if UNITY_ANIMATION + public IEnumerable Animations { get; private set; } +#endif + + [SerializeField] + private bool loadOnStart = true; + + [SerializeField] private int RetryCount = 10; + [SerializeField] private float RetryTimeout = 2.0f; + private int numRetries = 0; + + + public int MaximumLod = 300; + public int Timeout = 8; + public GLTFSceneImporter.ColliderType Collider = GLTFSceneImporter.ColliderType.None; + public GameObject LastLoadedScene { get; private set; } = null; + + [SerializeField] + private Shader shaderOverride = null; + + private async void Start() + { + if (!loadOnStart) return; + + try + { + await Load(); + } +#if WINDOWS_UWP + catch (Exception) +#else + catch (HttpRequestException) +#endif + { + if (numRetries++ >= RetryCount) + throw; + + Debug.LogWarning("Load failed, retrying"); + await Task.Delay((int)(RetryTimeout * 1000)); + Start(); + } + } + + public async Task Load() + { + var importOptions = new ImportOptions + { + AsyncCoroutineHelper = gameObject.GetComponent() ?? gameObject.AddComponent() + }; + + GLTFSceneImporter sceneImporter = null; + try + { + Factory = Factory ?? ScriptableObject.CreateInstance(); + + // UseStream is currently not supported... + string fullPath; + if (AppendStreamingAssets) + fullPath = Path.Combine(Application.streamingAssetsPath, GLTFUri.TrimStart(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar })); + else + fullPath = GLTFUri; + + string dir = URIHelper.GetDirectoryName(fullPath); + importOptions.DataLoader = new UnityWebRequestLoader(dir); + sceneImporter = Factory.CreateSceneImporter( + Path.GetFileName(fullPath), + importOptions + ); + + sceneImporter.SceneParent = gameObject.transform; + sceneImporter.Collider = Collider; + sceneImporter.MaximumLod = MaximumLod; + sceneImporter.Timeout = Timeout; + sceneImporter.IsMultithreaded = Multithreaded; + sceneImporter.CustomShaderName = shaderOverride ? shaderOverride.name : null; + + // for logging progress + await sceneImporter.LoadSceneAsync( + onLoadComplete:LoadCompleteAction + // ,progress: new Progress( + // p => + // { + // Debug.Log("Progress: " + p); + // }) + ); + + // Override the shaders on all materials if a shader is provided + if (shaderOverride != null) + { + Renderer[] renderers = gameObject.GetComponentsInChildren(); + foreach (Renderer renderer in renderers) + { + renderer.sharedMaterial.shader = shaderOverride; + } + } + + LastLoadedScene = sceneImporter.LastLoadedScene; + +#if UNITY_ANIMATION + Animations = sceneImporter.LastLoadedScene.GetComponents(); + + if (PlayAnimationOnLoad && Animations.Any()) + { + Animations.First().Play(); + } +#endif + } + finally + { + if(importOptions.DataLoader != null) + { + sceneImporter?.Dispose(); + sceneImporter = null; + importOptions.DataLoader = null; + } + } + } + + private void LoadCompleteAction(GameObject obj, ExceptionDispatchInfo exceptionDispatchInfo) + { + onLoadComplete?.Invoke(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs.meta new file mode 100644 index 0000000..b5f201f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9087a95f22bcee64ebc45f6deec08714 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 200 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs new file mode 100644 index 0000000..f0ee6a1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs @@ -0,0 +1,141 @@ +#if ENABLE_INPUT_SYSTEM && HAVE_INPUTSYSTEM +#define NEW_INPUT +#endif + +using System.Collections; +using UnityEngine; +using UnityEngine.Events; +#if NEW_INPUT +using UnityEngine.InputSystem; +#endif +using UnityGLTF.Timeline; + +namespace UnityGLTF +{ + public class GLTFRecorderComponent : MonoBehaviour + { + public string outputFile = "Assets/Recordings/Recorded_.glb"; + public Transform exportRoot; + public bool recordBlendShapes = true; + public bool recordRootInWorldSpace = true; + public bool recordAnimationPointer = false; + +#if NEW_INPUT + public InputAction recordingKey = new InputAction(binding: "/F11"); +#else + public KeyCode recordingKey = KeyCode.F11; +#endif + + public bool IsRecording => recorder?.IsRecording ?? false; + protected GLTFRecorder recorder; + + public UnityEvent recordingStarted; + public UnityEvent recordingEnded; + + private double CurrentTime => +#if UNITY_2020_1_OR_NEWER + Time.timeAsDouble; +#else + Time.time; +#endif + + [ContextMenu("Start Recording")] + public virtual void StartRecording() + { + if (!isActiveAndEnabled) return; + + var settings = GLTFSettings.GetOrCreateSettings(); + var shouldRecordBlendShapes = recordBlendShapes; + if (settings.BlendShapeExportProperties == GLTFSettings.BlendShapeExportPropertyFlags.None && recordBlendShapes) + { + Debug.LogWarning("Attempting to record blend shapes but export is disabled in ProjectSettings/UnityGLTF. Set BlendShapeExportProperties to something other than \"None\" if you want to export them."); + shouldRecordBlendShapes = false; + } + + var shouldUseAnimationPointer = recordAnimationPointer; + if (!settings.UseAnimationPointer && recordAnimationPointer) + { + Debug.LogWarning("Attempting to record KHR_animation_pointer but that is disabled in ProjectSettings/UnityGLTF. Please enable it."); + shouldUseAnimationPointer = false; + } + + recorder = new GLTFRecorder(exportRoot, shouldRecordBlendShapes, recordRootInWorldSpace, shouldUseAnimationPointer); + recorder.StartRecording(CurrentTime); + recordingStarted?.Invoke(); + + StartCoroutine(_UpdateRecording()); + } + + [ContextMenu("Stop Recording")] + public virtual void StopRecording() + { + var filename = outputFile.Replace("", System.DateTime.Now.ToString("yyyyMMdd-HHmmss")); + recorder.EndRecording(filename); + recordingEnded?.Invoke(filename); + } + + private void ToggleRecording() + { + if (!exportRoot || string.IsNullOrEmpty(outputFile)) + { + Debug.LogError($"[GLTFRecorderComponent] Can't record, please assign exportRoot and outputFile on {nameof(GLTFRecorderComponent)}", this); + return; + } + + if(IsRecording) + { + StopRecording(); + Debug.Log("Recording Stopped", this); + } + else { + StartRecording(); + Debug.Log("Recording Started", this); + } + } + +#if NEW_INPUT + private void Start() + { + recordingKey.performed += _ => ToggleRecording(); + } + + private void OnEnable() + { + recordingKey.Enable(); + } +#else + protected virtual void Update() + { + if(Input.GetKeyDown(recordingKey)) + ToggleRecording(); + } +#endif + + protected virtual void OnDisable() + { + if(IsRecording) + StopRecording(); +#if NEW_INPUT + recordingKey.Disable(); +#endif + } + + protected virtual void UpdateRecording() + { + if(CurrentTime > recorder.LastRecordedTime) + recorder.UpdateRecording(CurrentTime); + } + + private IEnumerator _UpdateRecording() + { + while (true) + { + yield return new WaitForEndOfFrame(); + if (!IsRecording) + yield break; + + UpdateRecording(); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs.meta new file mode 100644 index 0000000..a9602fc --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFRecorderComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e76d60ddbac22cd4ba183f725ba62c5c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs new file mode 100644 index 0000000..a7f7978 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs @@ -0,0 +1,1164 @@ +#if UNITY_EDITOR +#define ANIMATION_EXPORT_SUPPORTED +#endif + +#if ANIMATION_EXPORT_SUPPORTED && (UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER) +#define ANIMATION_SUPPORTED +#endif + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using GLTF.Schema; +using Unity.Profiling; +using UnityEngine; +using UnityGLTF.Extensions; +using WrapMode = GLTF.Schema.WrapMode; + +namespace UnityGLTF +{ + public class ExportOptions + { + public bool TreatEmptyRootAsScene = false; + public bool MergeClipsWithMatchingNames = false; + public LayerMask ExportLayers = -1; + public ILogger logger; + internal readonly GLTFSettings settings; + + public ExportOptions() : this(GLTFSettings.GetOrCreateSettings()) { } + + public ExportOptions(GLTFSettings settings) + { + if (!settings) settings = GLTFSettings.GetOrCreateSettings(); + if (settings.UseMainCameraVisibility) + ExportLayers = Camera.main ? Camera.main.cullingMask : -1; + this.settings = settings; + } + + public GLTFSceneExporter.RetrieveTexturePathDelegate TexturePathRetriever = (texture) => texture.name; + public GLTFSceneExporter.AfterSceneExportDelegate AfterSceneExport; + public GLTFSceneExporter.BeforeSceneExportDelegate BeforeSceneExport; + public GLTFSceneExporter.AfterNodeExportDelegate AfterNodeExport; + public GLTFSceneExporter.BeforeMaterialExportDelegate BeforeMaterialExport; + public GLTFSceneExporter.AfterMaterialExportDelegate AfterMaterialExport; + public GLTFSceneExporter.BeforeTextureExportDelegate BeforeTextureExport; + public GLTFSceneExporter.AfterTextureExportDelegate AfterTextureExport; + public GLTFSceneExporter.AfterPrimitiveExportDelegate AfterPrimitiveExport; + + } + + public partial class GLTFSceneExporter + { + // Available export callbacks. + // Callbacks can be either set statically (for exporters that register themselves) + // or added in the ExportOptions. + public delegate string RetrieveTexturePathDelegate(Texture texture); + public delegate void BeforeSceneExportDelegate(GLTFSceneExporter exporter, GLTFRoot gltfRoot); + public delegate void AfterSceneExportDelegate(GLTFSceneExporter exporter, GLTFRoot gltfRoot); + public delegate void AfterNodeExportDelegate(GLTFSceneExporter exporter, GLTFRoot gltfRoot, Transform transform, Node node); + public delegate void BeforeTextureExportDelegate(GLTFSceneExporter exporter, ref UniqueTexture texture, string textureSlot); + public delegate void AfterTextureExportDelegate(GLTFSceneExporter exporter, UniqueTexture texture, int index, GLTFTexture tex); + public delegate void AfterPrimitiveExportDelegate(GLTFSceneExporter exporter, Mesh mesh, MeshPrimitive primitive, int index); + + private static ILogger Debug = UnityEngine.Debug.unityLogger; + + public struct TextureMapType + { + public const string BaseColor = "baseColorTexture"; + [Obsolete("Use BaseColor instead")] public const string Main = BaseColor; + public const string Emissive = "emissiveTexture"; + [Obsolete("Use Emissive instead")] public const string Emission = Emissive; + + public const string Normal = "normalTexture"; + [Obsolete("Use Normal instead")] public const string Bump = Normal; + public const string MetallicGloss = "metallicGloss"; + public const string MetallicRoughness = "metallicRoughnessTexture"; + public const string SpecGloss = "specularGlossinessTexture"; // not really supported anymore + public const string Light = Linear; + public const string Occlusion = "occlusionTexture"; + + public const string Linear = "linear"; + public const string sRGB = "sRGB"; + public const string Custom_Unknown = "linearWithAlpha"; + public const string Custom_HDR = "hdr"; + + [Obsolete("Use Linear or the right texture slot instead")] public const string MetallicGloss_DontConvert = Linear; + + } + + public struct TextureExportSettings + { + public bool isValid; + + // does the texture need a channel conversion when exporting + public Conversion conversion; + // do we know something about the alpha channel of this texture + public AlphaMode alphaMode; + // is the texture linear or sRGB + public bool linear; + // required for metallic-smoothness conversion + public float smoothnessMultiplier; + + public TextureExportSettings(TextureExportSettings source) + { + conversion = source.conversion; + alphaMode = source.alphaMode; + linear = source.linear; + smoothnessMultiplier = source.smoothnessMultiplier; + isValid = true; + } + + public enum Conversion + { + None, + MetalGlossChannelSwap, + NormalChannel, + } + + public enum AlphaMode + { + Never = 0, + Always = 1, + Heuristic = 2, + } + + public static bool operator ==(TextureExportSettings lhs, TextureExportSettings rhs) + { + return lhs.Equals(rhs); + } + + public static bool operator !=(TextureExportSettings lhs, TextureExportSettings rhs) + { + return !(lhs == rhs); + } + + public bool Equals(TextureExportSettings other) + { + return + conversion == other.conversion && + alphaMode == other.alphaMode && + linear == other.linear && + Mathf.Approximately(smoothnessMultiplier, other.smoothnessMultiplier); + } + + public override bool Equals(object obj) + { + return obj is TextureExportSettings other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (int)conversion; + hashCode = (hashCode * 397) ^ (int)alphaMode; + hashCode = (hashCode * 397) ^ linear.GetHashCode(); + hashCode = (hashCode * 397) ^ smoothnessMultiplier.GetHashCode(); + return hashCode; + } + } + } + + public TextureExportSettings GetExportSettingsForSlot(string textureSlot) + { + var exportSettings = new TextureExportSettings(); + exportSettings.isValid = true; + + switch (textureSlot) + { + case TextureMapType.BaseColor: // Main = new TextureExportSettings() { alphaMode = AlphaMode.Heuristic }; + exportSettings.linear = false; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Heuristic; + return exportSettings; + case TextureMapType.Emissive: // Emission = new TextureExportSettings() { alphaMode = AlphaMode.Heuristic }; + exportSettings.linear = false; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Never; + return exportSettings; + case TextureMapType.Normal: // Bump = new TextureExportSettings() { alphaMode = AlphaMode.Never, conversion = Conversion.NormalChannel }; + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Never; + exportSettings.conversion = TextureExportSettings.Conversion.NormalChannel; + return exportSettings; + case TextureMapType.MetallicGloss: // MetallicGloss = new TextureExportSettings() { alphaMode = AlphaMode.Never, conversion = Conversion.MetalGlossChannelSwap, smoothnessMultiplier = 1f}; + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Never; + exportSettings.conversion = TextureExportSettings.Conversion.MetalGlossChannelSwap; + return exportSettings; + case TextureMapType.MetallicRoughness: + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Never; + return exportSettings; + + case TextureMapType.SpecGloss: // SpecGloss = MetallicGloss; // not really supported anymore + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Never; + exportSettings.conversion = TextureExportSettings.Conversion.MetalGlossChannelSwap; + return exportSettings; + case TextureMapType.Occlusion: // Occlusion = Linear; + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Never; + return exportSettings; + + // custom slot types that allow us to export more arbitrary textures + case TextureMapType.Linear: // MetallicGloss_DontConvert = Linear; + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Heuristic; + return exportSettings; + case TextureMapType.sRGB: // MetallicGloss_DontConvert = Linear; + exportSettings.linear = false; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Heuristic; + return exportSettings; + case TextureMapType.Custom_Unknown: + case "rgbm": // Custom_Unknown = new TextureExportSettings() { linear = true, alphaMode = AlphaMode.Always }; + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Always; + return exportSettings; + case TextureMapType.Custom_HDR: // Custom_HDR = new TextureExportSettings() { alphaMode = AlphaMode.Always }; + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Always; + return exportSettings; + } + + // assume unknown linear + exportSettings.linear = true; + exportSettings.alphaMode = TextureExportSettings.AlphaMode.Heuristic; + return exportSettings; + } + + private Material GetConversionMaterial(TextureExportSettings textureMapType) + { + switch (textureMapType.conversion) + { + case TextureExportSettings.Conversion.NormalChannel: + return _normalChannelMaterial; + case TextureExportSettings.Conversion.MetalGlossChannelSwap: + return _metalGlossChannelSwapMaterial; + default: + return null; + } + } + + private struct ImageInfo + { + public Texture2D texture; + public TextureExportSettings textureMapType; + public string outputPath; + public bool canBeExportedFromDisk; + } + + public IReadOnlyList RootTransforms => _rootTransforms; + + private Transform[] _rootTransforms; + private GLTFRoot _root; + private BufferId _bufferId; + private GLTFBuffer _buffer; + private List _imageInfos; + private List _textures; + private Dictionary _exportedMaterials; +#if ANIMATION_SUPPORTED + private List<(Transform tr, AnimationClip clip)> _animationClips; +#endif + private bool _shouldUseInternalBufferForImages; + private Dictionary _exportedTransforms; + private List _animatedNodes; + + private int _exportLayerMask; + private ExportOptions _exportOptions; + + private Material _metalGlossChannelSwapMaterial; + private Material _normalChannelMaterial; + + private const uint MagicGLTF = 0x46546C67; + private const uint Version = 2; + private const uint MagicJson = 0x4E4F534A; + private const uint MagicBin = 0x004E4942; + private const int GLTFHeaderSize = 12; + private const int SectionHeaderSize = 8; + + public struct UniqueTexture : IEquatable + { + public Texture Texture; + public int MaxSize; + // additional settings that make exporting a texture unique + public TextureExportSettings ExportSettings; + + public int GetWidth() => Mathf.Min(MaxSize, Texture.width); + public int GetHeight() => Mathf.Min(MaxSize, Texture.height); + + public UniqueTexture(Texture tex, string textureSlot, GLTFSceneExporter exporter) + { + Texture = tex; + ExportSettings = exporter.GetExportSettingsForSlot(textureSlot); + MaxSize = Mathf.Max(tex.width, tex.height); + } + + public UniqueTexture(Texture tex, TextureExportSettings exportSettings) + { + Texture = tex; + ExportSettings = exportSettings; + MaxSize = Mathf.Max(tex.width, tex.height); + } + + public bool Equals(UniqueTexture other) + { + return Equals(Texture, other.Texture) && MaxSize == other.MaxSize && ExportSettings == other.ExportSettings; + } + + public override bool Equals(object obj) + { + return obj is UniqueTexture other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + // We dont want to use GetHashCode() for the texture here since it will change the hash after restarting the editor + #if UNITY_EDITOR + var hashCode = Texture ? Texture.imageContentsHash.GetHashCode() : 0; + #else + var hashCode = Texture ? Texture.GetHashCode() : 0; + #endif + hashCode = (hashCode * 397) ^ ExportSettings.GetHashCode(); + hashCode = (hashCode * 397) ^ MaxSize; + return hashCode; + } + } + } + + /// + /// A Primitive is a combination of Mesh + Material(s). It also contains a reference to the original SkinnedMeshRenderer, + /// if any, since that's the only way to get the actual current weights to export a blend shape primitive. + /// + public struct UniquePrimitive + { + public bool Equals(UniquePrimitive other) + { + if (!Equals(Mesh, other.Mesh)) return false; + if (Materials == null && other.Materials == null) return true; + if (!Equals(SkinnedMeshRenderer, other.SkinnedMeshRenderer)) return false; + if (!(Materials != null && other.Materials != null)) return false; + if (!Equals(Materials.Length, other.Materials.Length)) return false; + for (var i = 0; i < Materials.Length; i++) + { + if (!Equals(Materials[i], other.Materials[i])) return false; + } + + return true; + } + + public override bool Equals(object obj) + { + return obj is UniquePrimitive other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + var code = (Mesh != null ? Mesh.GetHashCode() : 0) * 397; + if (SkinnedMeshRenderer != null) + { + code = code ^ SkinnedMeshRenderer.GetHashCode() * 397; + } + if (Materials != null) + { + code = code ^ Materials.Length.GetHashCode() * 397; + foreach (var mat in Materials) + code = (code ^ (mat != null ? mat.GetHashCode() : 0)) * 397; + } + + return code; + } + } + + public Mesh Mesh; + public Material[] Materials; + public SkinnedMeshRenderer SkinnedMeshRenderer; // needed for BlendShape export, since Unity stores the actually used blend shape weights on the renderer. see ExporterMeshes.ExportBlendShapes + } + + private readonly Dictionary _primOwner = new Dictionary(); + + #region Settings + + private GLTFSettings settings => _exportOptions.settings; + private bool ExportNames => settings.ExportNames; + private bool RequireExtensions => settings.RequireExtensions; + private bool ExportAnimations => settings.ExportAnimations; + + #endregion + +#region Profiler Markers + // ReSharper disable InconsistentNaming + private static ProfilerMarker exportGltfMarker = new ProfilerMarker("Export glTF"); + private static ProfilerMarker gltfSerializationMarker = new ProfilerMarker("Serialize exported data"); + private static ProfilerMarker exportMeshMarker = new ProfilerMarker("Export Mesh"); + private static ProfilerMarker exportPrimitiveMarker = new ProfilerMarker("Export Primitive"); + private static ProfilerMarker exportBlendShapeMarker = new ProfilerMarker("Export BlendShape"); + private static ProfilerMarker exportSkinFromNodeMarker = new ProfilerMarker("Export Skin"); + private static ProfilerMarker exportSparseAccessorMarker = new ProfilerMarker("Export Sparse Accessor"); + private static ProfilerMarker exportNodeMarker = new ProfilerMarker("Export Node"); + private static ProfilerMarker afterNodeExportMarker = new ProfilerMarker("After Node Export (Callback)"); + private static ProfilerMarker exportAnimationFromNodeMarker = new ProfilerMarker("Export Animation from Node"); + private static ProfilerMarker convertClipToGLTFAnimationMarker = new ProfilerMarker("Convert Clip to GLTF Animation"); + private static ProfilerMarker beforeSceneExportMarker = new ProfilerMarker("Before Scene Export (Callback)"); + private static ProfilerMarker exportSceneMarker = new ProfilerMarker("Export Scene"); + private static ProfilerMarker afterMaterialExportMarker = new ProfilerMarker("After Material Export (Callback)"); + private static ProfilerMarker exportMaterialMarker = new ProfilerMarker("Export Material"); + private static ProfilerMarker beforeMaterialExportMarker = new ProfilerMarker("Before Material Export (Callback)"); + private static ProfilerMarker writeImageToDiskMarker = new ProfilerMarker("Export Image - Write to Disk"); + private static ProfilerMarker afterSceneExportMarker = new ProfilerMarker("After Scene Export (Callback)"); + + private static ProfilerMarker exportAccessorMarker = new ProfilerMarker("Export Accessor"); + private static ProfilerMarker exportAccessorMatrix4x4ArrayMarker = new ProfilerMarker("Matrix4x4[]"); + private static ProfilerMarker exportAccessorVector4ArrayMarker = new ProfilerMarker("Vector4[]"); + private static ProfilerMarker exportAccessorUintArrayMarker = new ProfilerMarker("Uint[]"); + private static ProfilerMarker exportAccessorColorArrayMarker = new ProfilerMarker("Color[]"); + private static ProfilerMarker exportAccessorVector3ArrayMarker = new ProfilerMarker("Vector3[]"); + private static ProfilerMarker exportAccessorVector2ArrayMarker = new ProfilerMarker("Vector2[]"); + private static ProfilerMarker exportAccessorIntArrayIndicesMarker = new ProfilerMarker("int[] (Indices)"); + private static ProfilerMarker exportAccessorIntArrayMarker = new ProfilerMarker("int[]"); + private static ProfilerMarker exportAccessorFloatArrayMarker = new ProfilerMarker("float[]"); + private static ProfilerMarker exportAccessorByteArrayMarker = new ProfilerMarker("byte[]"); + + private static ProfilerMarker exportAccessorMinMaxMarker = new ProfilerMarker("Calculate min/max"); + private static ProfilerMarker exportAccessorBufferWriteMarker = new ProfilerMarker("Buffer.Write"); + + private static ProfilerMarker exportGltfInitMarker = new ProfilerMarker("Init glTF Export"); + private static ProfilerMarker gltfWriteOutMarker = new ProfilerMarker("Write glTF"); + private static ProfilerMarker gltfWriteJsonStreamMarker = new ProfilerMarker("Write JSON stream"); + private static ProfilerMarker gltfWriteBinaryStreamMarker = new ProfilerMarker("Write binary stream"); + + private static ProfilerMarker addAnimationDataMarker = new ProfilerMarker("Add animation data to glTF"); + private static ProfilerMarker exportRotationAnimationDataMarker = new ProfilerMarker("Rotation Keyframes"); + private static ProfilerMarker exportPositionAnimationDataMarker = new ProfilerMarker("Position Keyframes"); + private static ProfilerMarker exportScaleAnimationDataMarker = new ProfilerMarker("Scale Keyframes"); + private static ProfilerMarker exportWeightsAnimationDataMarker = new ProfilerMarker("Weights Keyframes"); + private static ProfilerMarker removeAnimationUnneededKeyframesMarker = new ProfilerMarker("Simplify Keyframes"); + private static ProfilerMarker removeAnimationUnneededKeyframesInitMarker = new ProfilerMarker("Init"); + private static ProfilerMarker removeAnimationUnneededKeyframesCheckIdenticalMarker = new ProfilerMarker("Check Identical"); + private static ProfilerMarker removeAnimationUnneededKeyframesCheckIdenticalKeepMarker = new ProfilerMarker("Keep Keyframe"); + private static ProfilerMarker removeAnimationUnneededKeyframesFinalizeMarker = new ProfilerMarker("Finalize"); + // ReSharper restore InconsistentNaming +#endregion + + /// + /// Create a GLTFExporter that exports out a transform + /// + /// Root transform of object to export + [Obsolete("Please switch to GLTFSceneExporter(Transform[] rootTransforms, ExportOptions options). This constructor is deprecated and will be removed in a future release.")] + public GLTFSceneExporter(Transform[] rootTransforms, RetrieveTexturePathDelegate texturePathRetriever) + : this(rootTransforms, new ExportOptions { TexturePathRetriever = texturePathRetriever }) + { + } + + public GLTFSceneExporter(Transform rootTransform, ExportOptions options) : this(new [] { rootTransform }, options) + { + } + + /// + /// Create a GLTFExporter that exports out a transform + /// + /// Root transform of object to export + /// Export Settings + public GLTFSceneExporter(Transform[] rootTransforms, ExportOptions options) + { + _exportOptions = options; + if (options.logger != null) + Debug = options.logger; + else + Debug = UnityEngine.Debug.unityLogger; + + _exportLayerMask = _exportOptions.ExportLayers; + + var metalGlossChannelSwapShader = Resources.Load("MetalGlossChannelSwap", typeof(Shader)) as Shader; + _metalGlossChannelSwapMaterial = new Material(metalGlossChannelSwapShader); + + var normalChannelShader = Resources.Load("NormalChannel", typeof(Shader)) as Shader; + _normalChannelMaterial = new Material(normalChannelShader); + + _rootTransforms = rootTransforms; + + _exportedTransforms = new Dictionary(); + _exportedCameras = new Dictionary(); + _exportedLights = new Dictionary(); + _animatedNodes = new List(); + _skinnedNodes = new List(); + _bakedMeshes = new Dictionary(); + + _root = new GLTFRoot + { + Accessors = new List(), + Animations = new List(), + Asset = new Asset + { + Version = "2.0", + Generator = "UnityGLTF" + }, + Buffers = new List(), + BufferViews = new List(), + Cameras = new List(), + Images = new List(), + Materials = new List(), + Meshes = new List(), + Nodes = new List(), + Samplers = new List(), + Scenes = new List(), + Skins = new List(), + Textures = new List() + }; + + _imageInfos = new List(); + _exportedMaterials = new Dictionary(); + _textures = new List(); +#if ANIMATION_SUPPORTED + _animationClips = new List<(Transform, AnimationClip)>(); +#endif + + _buffer = new GLTFBuffer(); + _bufferId = new BufferId + { + Id = _root.Buffers.Count, + Root = _root + }; + _root.Buffers.Add(_buffer); + } + + /// + /// Gets the root object of the exported GLTF + /// + /// Root parsed GLTF Json + public GLTFRoot GetRoot() + { + return _root; + } + + /// + /// Writes a binary GLB file with filename at path. + /// + /// File path for saving the binary file + /// The name of the GLTF file + public void SaveGLB(string path, string fileName) + { + var fullPath = GetFileName(path, fileName, ".glb"); + var dirName = Path.GetDirectoryName(fullPath); + if (dirName != null && !Directory.Exists(dirName)) + Directory.CreateDirectory(dirName); + _shouldUseInternalBufferForImages = true; + + using (FileStream glbFile = new FileStream(fullPath, FileMode.Create)) + { + SaveGLBToStream(glbFile, fileName); + } + + if (!_shouldUseInternalBufferForImages) + { + ExportImages(path); + } + } + + /// + /// In-memory GLB creation helper. Useful for platforms where no filesystem is available (e.g. WebGL). + /// + /// + /// + public byte[] SaveGLBToByteArray(string sceneName) + { + _shouldUseInternalBufferForImages = true; + using (var stream = new MemoryStream()) + { + SaveGLBToStream(stream, sceneName); + return stream.ToArray(); + } + } + + /// + /// Writes a binary GLB file into a stream (memory stream, filestream, ...) + /// + /// File path for saving the binary file + /// The name of the GLTF file + public void SaveGLBToStream(Stream stream, string sceneName) + { + exportGltfMarker.Begin(); + + exportGltfInitMarker.Begin(); + Stream binStream = new MemoryStream(); + Stream jsonStream = new MemoryStream(); + _shouldUseInternalBufferForImages = true; + + _bufferWriter = new BinaryWriterWithLessAllocations(binStream); + + TextWriter jsonWriter = new StreamWriter(jsonStream, new UTF8Encoding(false)); + exportGltfInitMarker.End(); + + beforeSceneExportMarker.Begin(); + _exportOptions.BeforeSceneExport?.Invoke(this, _root); + BeforeSceneExport?.Invoke(this, _root); + beforeSceneExportMarker.End(); + + _root.Scene = ExportScene(sceneName, _rootTransforms); + + if (ExportAnimations) + { + ExportAnimation(); + } + + // Export skins + for (int i = 0; i < _skinnedNodes.Count; ++i) + { + Transform t = _skinnedNodes[i]; + ExportSkinFromNode(t); + } + + afterSceneExportMarker.Begin(); + if (_exportOptions.AfterSceneExport != null) + _exportOptions.AfterSceneExport(this, _root); + + if (AfterSceneExport != null) + AfterSceneExport.Invoke(this, _root); + afterSceneExportMarker.End(); + + animationPointerResolver?.Resolve(this); + + _buffer.ByteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Length, 4); + + gltfSerializationMarker.Begin(); + _root.Serialize(jsonWriter, true); + gltfSerializationMarker.End(); + + gltfWriteOutMarker.Begin(); + _bufferWriter.Flush(); + jsonWriter.Flush(); + + // align to 4-byte boundary to comply with spec. + AlignToBoundary(jsonStream); + AlignToBoundary(binStream, 0x00); + + int glbLength = (int)(GLTFHeaderSize + SectionHeaderSize + + jsonStream.Length + SectionHeaderSize + binStream.Length); + + BinaryWriter writer = new BinaryWriter(stream); + + // write header + writer.Write(MagicGLTF); + writer.Write(Version); + writer.Write(glbLength); + + gltfWriteJsonStreamMarker.Begin(); + // write JSON chunk header. + writer.Write((int)jsonStream.Length); + writer.Write(MagicJson); + + jsonStream.Position = 0; + CopyStream(jsonStream, writer); + gltfWriteJsonStreamMarker.End(); + + gltfWriteBinaryStreamMarker.Begin(); + writer.Write((int)binStream.Length); + writer.Write(MagicBin); + + binStream.Position = 0; + CopyStream(binStream, writer); + gltfWriteBinaryStreamMarker.End(); + + writer.Flush(); + + gltfWriteOutMarker.End(); + exportGltfMarker.End(); + } + + /// + /// Specifies the path and filename for the GLTF Json and binary + /// + /// File path for saving the GLTF and binary files + /// The name of the GLTF file + public void SaveGLTFandBin(string path, string fileName) + { + exportGltfMarker.Begin(); + + exportGltfInitMarker.Begin(); + _shouldUseInternalBufferForImages = false; + var toLower = fileName.ToLowerInvariant(); + if (toLower.EndsWith(".gltf")) + fileName = fileName.Substring(0, fileName.Length - 5); + if (toLower.EndsWith(".bin")) + fileName = fileName.Substring(0, fileName.Length - 4); + var fullPath = GetFileName(path, fileName, ".bin"); + var dirName = Path.GetDirectoryName(fullPath); + if (dirName != null && !Directory.Exists(dirName)) + Directory.CreateDirectory(dirName); + + // sanitized file path can differ + fileName = Path.GetFileNameWithoutExtension(fullPath); + var binFile = File.Create(fullPath); + + _bufferWriter = new BinaryWriterWithLessAllocations(binFile); + exportGltfInitMarker.End(); + + beforeSceneExportMarker.Begin(); + _exportOptions.BeforeSceneExport?.Invoke(this, _root); + BeforeSceneExport?.Invoke(this, _root); + beforeSceneExportMarker.End(); + + _root.Scene = ExportScene(fileName, _rootTransforms); + + if (ExportAnimations) + { + ExportAnimation(); + } + + // Export skins + for (int i = 0; i < _skinnedNodes.Count; ++i) + { + Transform t = _skinnedNodes[i]; + ExportSkinFromNode(t); + + // updateProgress(EXPORT_STEP.SKINNING, i, _skinnedNodes.Count); + } + + afterSceneExportMarker.Begin(); + if (_exportOptions.AfterSceneExport != null) + _exportOptions.AfterSceneExport(this, _root); + + if (AfterSceneExport != null) + AfterSceneExport.Invoke(this, _root); + afterSceneExportMarker.End(); + + animationPointerResolver?.Resolve(this); + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + _buffer.Uri = fileName + ".bin"; + _buffer.ByteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Length, 4); + + var gltfFile = File.CreateText(Path.ChangeExtension(fullPath, ".gltf")); + gltfSerializationMarker.Begin(); + _root.Serialize(gltfFile); + gltfSerializationMarker.End(); + + gltfWriteOutMarker.Begin(); +#if WINDOWS_UWP + gltfFile.Dispose(); + binFile.Dispose(); +#else + gltfFile.Close(); + binFile.Close(); +#endif + ExportImages(path); + gltfWriteOutMarker.End(); + + exportGltfMarker.End(); + } + + /// + /// Ensures a specific file extension from an absolute path that may or may not already have that extension. + /// + /// Absolute path that may or may not already have the required extension + /// The extension to ensure, with leading dot + /// An absolute path that has the required extension + public static string GetFileName(string directory, string fileNameThatMayHaveExtension, string requiredExtension) + { + var absolutePathThatMayHaveExtension = Path.Combine(directory, EnsureValidFileName(fileNameThatMayHaveExtension)); + + if (!requiredExtension.StartsWith(".", StringComparison.Ordinal)) + requiredExtension = "." + requiredExtension; + + if (!Path.GetExtension(absolutePathThatMayHaveExtension).Equals(requiredExtension, StringComparison.OrdinalIgnoreCase)) + return absolutePathThatMayHaveExtension + requiredExtension; + + return absolutePathThatMayHaveExtension; + } + + /// + /// Strip illegal chars and reserved words from a candidate filename (should not include the directory path) + /// + /// + /// http://stackoverflow.com/questions/309485/c-sharp-sanitize-file-name + /// + private static string EnsureValidFileName(string filename) + { + var invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars())); + var invalidReStr = string.Format(@"[{0}]+", invalidChars); + + var reservedWords = new [] + { + "CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", + "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", + "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" + }; + + var sanitisedNamePart = Regex.Replace(filename, invalidReStr, "_"); + foreach (var reservedWord in reservedWords) + { + var reservedWordPattern = string.Format("^{0}\\.", reservedWord); + sanitisedNamePart = Regex.Replace(sanitisedNamePart, reservedWordPattern, "_reservedWord_.", RegexOptions.IgnoreCase); + } + + return sanitisedNamePart; + } + + public void DeclareExtensionUsage(string extension, bool isRequired=false) + { + if( _root.ExtensionsUsed == null ){ + _root.ExtensionsUsed = new List(); + } + if(!_root.ExtensionsUsed.Contains(extension)) + { + _root.ExtensionsUsed.Add(extension); + } + + if(isRequired){ + + if( _root.ExtensionsRequired == null ){ + _root.ExtensionsRequired = new List(); + } + if( !_root.ExtensionsRequired.Contains(extension)) + { + _root.ExtensionsRequired.Add(extension); + } + } + } + + private bool ShouldExportTransform(Transform transform) + { + if (!settings.ExportDisabledGameObjects && !transform.gameObject.activeSelf) return false; + if (settings.UseMainCameraVisibility && (_exportLayerMask >= 0 && _exportLayerMask != (_exportLayerMask | 1 << transform.gameObject.layer))) return false; + if (transform.CompareTag("EditorOnly")) return false; + return true; + } + + private SceneId ExportScene(string name, Transform[] rootObjTransforms) + { + exportSceneMarker.Begin(); + + var scene = new GLTFScene(); + + if (ExportNames) + { + scene.Name = name; + } + + if(_exportOptions.TreatEmptyRootAsScene) + { + // if we're exporting with a single object selected, that object can be the scene root, no need for an extra root node. + if (rootObjTransforms.Length == 1 && rootObjTransforms[0].GetComponents().Length == 1) // single root with a single transform + { + var firstRoot = rootObjTransforms[0]; + var newRoots = new Transform[firstRoot.childCount]; + for (int i = 0; i < firstRoot.childCount; i++) + newRoots[i] = firstRoot.GetChild(i); + rootObjTransforms = newRoots; + } + } + + scene.Nodes = new List(rootObjTransforms.Length); + foreach (var transform in rootObjTransforms) + { + // if(!ShouldExportTransform(transform)) continue; + scene.Nodes.Add(ExportNode(transform)); + } + + _root.Scenes.Add(scene); + + exportSceneMarker.End(); + + return new SceneId + { + Id = _root.Scenes.Count - 1, + Root = _root + }; + } + + private NodeId ExportNode(Transform nodeTransform) + { + if (_exportedTransforms.TryGetValue(nodeTransform.GetInstanceID(), out var existingNodeId)) + return new NodeId() { Id = existingNodeId, Root = _root }; + + exportNodeMarker.Begin(); + + var node = new Node(); + + if (ExportNames) + { + node.Name = nodeTransform.name; + } + +#if ANIMATION_SUPPORTED + if (nodeTransform.GetComponent() || nodeTransform.GetComponent()) + { + _animatedNodes.Add(nodeTransform); + } +#endif + if (nodeTransform.GetComponent() && ContainsValidRenderer(nodeTransform.gameObject, settings.ExportDisabledGameObjects)) + { + _skinnedNodes.Add(nodeTransform); + } + + // export camera attached to node + Camera unityCamera = nodeTransform.GetComponent(); + if (unityCamera != null && unityCamera.enabled) + { + node.Camera = ExportCamera(unityCamera); + } + + Light unityLight = nodeTransform.GetComponent(); + if (unityLight != null && unityLight.enabled) + { + node.Light = ExportLight(unityLight); + } + + var needsInvertedLookDirection = unityLight || unityCamera; + if (needsInvertedLookDirection) + { + node.SetUnityTransform(nodeTransform, true); + } + else + { + node.SetUnityTransform(nodeTransform, false); + } + + var id = new NodeId + { + Id = _root.Nodes.Count, + Root = _root + }; + + // Register nodes for animation parsing (could be disabled if animation is disabled) + _exportedTransforms.Add(nodeTransform.GetInstanceID(), _root.Nodes.Count); + + _root.Nodes.Add(node); + + // children that are primitives get put in a mesh + FilterPrimitives(nodeTransform, out GameObject[] primitives, out GameObject[] nonPrimitives); + if (primitives.Length > 0) + { + var uniquePrimitives = GetUniquePrimitivesFromGameObjects(primitives); + if (uniquePrimitives != null) + { + node.Mesh = ExportMesh(nodeTransform.name, uniquePrimitives); + RegisterPrimitivesWithNode(node, uniquePrimitives); + } + } + + exportNodeMarker.End(); + + // children that are not primitives get added as child nodes + if (nonPrimitives.Length > 0) + { + var parentOfChilds = node; + + // when we're exporting a light or camera, we add an implicit node as first child of the camera/light node. + // this ensures that child objects and animations etc. "just work". + if (needsInvertedLookDirection) + { + var inbetween = new Node(); + + if (ExportNames) + { + inbetween.Name = nodeTransform.name + "-flipped"; + } + + inbetween.Rotation = Quaternion.Inverse(SchemaExtensions.InvertDirection).ToGltfQuaternionConvert(); + + var inbetweenId = new NodeId + { + Id = _root.Nodes.Count, + Root = _root + }; + + _root.Nodes.Add(inbetween); + + node.Children = new List(1); + node.Children.Add(inbetweenId); + + parentOfChilds = inbetween; + } + + parentOfChilds.Children = new List(nonPrimitives.Length); + foreach (var child in nonPrimitives) + { + if(!ShouldExportTransform(child.transform)) continue; + parentOfChilds.Children.Add(ExportNode(child.transform)); + } + } + + // node export callback + afterNodeExportMarker.Begin(); + _exportOptions.AfterNodeExport?.Invoke(this, _root, nodeTransform, node); + AfterNodeExport?.Invoke(this, _root, nodeTransform, node); + afterNodeExportMarker.End(); + + return id; + } + + private static bool ContainsValidRenderer(GameObject gameObject, bool exportDisabledGameObjects) + { + if (!gameObject) return false; + var meshRenderer = gameObject.GetComponent(); + var meshFilter = gameObject.GetComponent(); + var skinnedMeshRender = gameObject.GetComponent(); + var materials = meshRenderer ? meshRenderer.sharedMaterials : skinnedMeshRender ? skinnedMeshRender.sharedMaterials : null; + var anyMaterialIsNonNull = false; + if (materials != null) + for (int i = 0; i < materials.Length; i++) + anyMaterialIsNonNull |= materials[i]; + return (meshFilter && meshRenderer && (meshRenderer.enabled || exportDisabledGameObjects)) || (skinnedMeshRender && (skinnedMeshRender.enabled || exportDisabledGameObjects)) && anyMaterialIsNonNull; + } + + private void FilterPrimitives(Transform transform, out GameObject[] primitives, out GameObject[] nonPrimitives) + { + var childCount = transform.childCount; + var prims = new List(childCount + 1); + var nonPrims = new List(childCount); + + // add another primitive if the root object also has a mesh + if (transform.gameObject.activeSelf || settings.ExportDisabledGameObjects) + { + if (ContainsValidRenderer(transform.gameObject, settings.ExportDisabledGameObjects)) + { + prims.Add(transform.gameObject); + } + } + for (var i = 0; i < childCount; i++) + { + var go = transform.GetChild(i).gameObject; + + // This seems to be a performance optimization but results in transforms that are detected as "primitives" not being animated + // if (IsPrimitive(go)) + // prims.Add(go); + // else + nonPrims.Add(go); + } + + primitives = prims.ToArray(); + nonPrimitives = nonPrims.ToArray(); + } + + // This seems to be a performance optimization but results in transforms that are detected as "primitives" not being animated + // private static bool IsPrimitive(GameObject gameObject) + // { + // /* + // * Primitives have the following properties: + // * - have no children + // * - have no non-default local transform properties + // * - have MeshFilter and MeshRenderer components OR has SkinnedMeshRenderer component + // */ + // return gameObject.transform.childCount == 0 + // && gameObject.transform.localPosition == Vector3.zero + // && gameObject.transform.localRotation == Quaternion.identity + // && gameObject.transform.localScale == Vector3.one + // && ContainsValidRenderer(gameObject); + // } + + private void ExportAnimation() + { + for (int i = 0; i < _animatedNodes.Count; ++i) + { + Transform t = _animatedNodes[i]; + ExportAnimationFromNode(ref t); + } + } + +#region Public API +#if ANIMATION_SUPPORTED + + public int GetAnimationId(AnimationClip clip, Transform transform) + { + for (var i = 0; i < _animationClips.Count; i++) + { + var entry = _animationClips[i]; + if (entry.tr == transform && entry.clip == clip) return i; + } + return -1; + } +#endif + + public MaterialId GetMaterialId(GLTFRoot root, Material materialObj) + { + var materialKey = 0; + if (materialObj == DefaultMaterial) + materialKey = 0; + else if (materialObj) + materialKey = materialObj.GetInstanceID(); + + if (_exportedMaterials.TryGetValue(materialKey, out var id)) + { + return new MaterialId + { + Id = id, + Root = root + }; + } + + return null; + } + + public TextureId GetTextureId(GLTFRoot root, Texture textureObj) + { + for (var i = 0; i < _textures.Count; i++) + { + if (_textures[i].Texture == textureObj) + { + return new TextureId + { + Id = i, + Root = root + }; + } + } + return null; + } + + public TextureId GetTextureId(GLTFRoot root, UniqueTexture textureObj) + { + for (var i = 0; i < _textures.Count; i++) + { + if (_textures[i].Equals(textureObj)) + { + return new TextureId + { + Id = i, + Root = root + }; + } + } + return null; + } + + public ImageId GetImageId(GLTFRoot root, Texture imageObj, TextureExportSettings textureMapType) + { + for (var i = 0; i < _imageInfos.Count; i++) + { + if (_imageInfos[i].texture == imageObj && _imageInfos[i].textureMapType == textureMapType) + { + return new ImageId + { + Id = i, + Root = root + }; + } + } + + return null; + } + + public SamplerId GetSamplerId(GLTFRoot root, Texture textureObj) + { + if (_textureSettingsToSamplerIndices.TryGetValue(new SamplerRelevantTextureData(textureObj), out var samplerId)) + { + return new SamplerId + { + Id = samplerId, + Root = root + }; + } + + return null; + } + + public Texture GetTexture(int id) => _textures[id].Texture; + + #endregion + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs.meta new file mode 100644 index 0000000..2d097c8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 99a6a54edfc45604ab2a687a161f520b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs new file mode 100644 index 0000000..dba3d4f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs @@ -0,0 +1,1075 @@ +using GLTF; +using GLTF.Schema; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.ExceptionServices; +using System.Threading; +using System.Threading.Tasks; +using UnityEngine; +using UnityGLTF.Cache; +using UnityGLTF.Extensions; +using UnityGLTF.Loader; +using Quaternion = UnityEngine.Quaternion; +using Vector2 = UnityEngine.Vector2; +using Vector3 = UnityEngine.Vector3; +using Vector4 = UnityEngine.Vector4; +#if !WINDOWS_UWP && !UNITY_WEBGL +using ThreadPriority = System.Threading.ThreadPriority; +#endif +using WrapMode = UnityEngine.WrapMode; + +namespace UnityGLTF +{ + public class ImportOptions + { +#pragma warning disable CS0618 // Type or member is obsolete + public ILoader ExternalDataLoader = null; +#pragma warning restore CS0618 // Type or member is obsolete + + /// + /// Optional for loading references from the GLTF to external streams. May also optionally implement . + /// + public IDataLoader DataLoader = null; + public AsyncCoroutineHelper AsyncCoroutineHelper = null; + public bool ThrowOnLowMemory = true; + public AnimationMethod AnimationMethod = AnimationMethod.Mecanim; + public bool AnimationLoopTime = true; + public bool AnimationLoopPose = false; + + [NonSerialized] + public ILogger logger; + } + + public enum AnimationMethod + { + None, + Legacy, + Mecanim, + MecanimHumanoid, + } + + public class UnityMeshData + { + public Vector3[] Vertices; + public Vector3[] Normals; + public Vector4[] Tangents; + public Vector2[] Uv1; + public Vector2[] Uv2; + public Vector2[] Uv3; + public Vector2[] Uv4; + public Color[] Colors; + public BoneWeight[] BoneWeights; + + public Vector3[][] MorphTargetVertices; + public Vector3[][] MorphTargetNormals; + public Vector3[][] MorphTargetTangents; + + public MeshTopology[] Topology; + public int[][] Indices; + } + + public struct ImportProgress + { + public bool IsDownloaded; + + public int NodeTotal; + public int NodeLoaded; + + public int TextureTotal; + public int TextureLoaded; + + public int BuffersTotal; + public int BuffersLoaded; + + public float Progress + { + get + { + int total = NodeTotal + TextureTotal + BuffersTotal; + int loaded = NodeLoaded + TextureLoaded + BuffersLoaded; + if (total > 0) + { + return (float)loaded / total; + } + else + { + return 0.0f; + } + } + } + + public override string ToString() + { + return $"{(Progress * 100.0):F2}% (Buffers: {BuffersLoaded}/{BuffersTotal}, Nodes: {NodeLoaded}/{NodeTotal}, Texs: {TextureLoaded}/{TextureTotal})"; + } + } + + public struct ImportStatistics + { + public long TriangleCount; + public long VertexCount; + } + + /// + /// Converts gltf animation data to unity + /// + public delegate float[] ValuesConvertion(NumericArray data, int frame); + + public partial class GLTFSceneImporter : IDisposable + { + public enum ColliderType + { + None, + Box, + Mesh, + MeshConvex + } + + protected struct GLBStream + { + public Stream Stream; + public long StartPosition; + } + + /// + /// Maximum LOD + /// + public int MaximumLod = 300; + + /// + /// Timeout for certain threading operations + /// + public int Timeout = 8; + + private bool _isMultithreaded; + + /// + /// Use Multithreading or not. + /// In editor, this is always false. This is to prevent a freeze in editor (noticed in Unity versions 2017.x and 2018.x) + /// + public bool IsMultithreaded + { + get + { + return (Application.isEditor || Application.platform == RuntimePlatform.WebGLPlayer) ? false : _isMultithreaded; + } + set + { + _isMultithreaded = value; + } + } + + /// + /// The parent transform for the created GameObject + /// + public Transform SceneParent { get; set; } + + /// + /// The last created object + /// + public GameObject CreatedObject { get; private set; } + + /// + /// All created animation clips + /// + public AnimationClip[] CreatedAnimationClips { get; private set; } + + /// + /// Adds colliders to primitive objects when created + /// + public ColliderType Collider { get; set; } + + /// + /// Override for the shader to use on created materials + /// + public string CustomShaderName { get; set; } + + public GameObject LastLoadedScene + { + get { return _lastLoadedScene; } + } + + public TextureCacheData[] TextureCache => _assetCache.TextureCache; + + /// + /// Whether to keep a CPU-side copy of the mesh after upload to GPU (for example, in case normals/tangents need recalculation) + /// + public bool KeepCPUCopyOfMesh = true; + + /// + /// Whether to keep a CPU-side copy of the texture after upload to GPU + /// + /// + /// This is is necessary when a texture is used with different sampler states, as Unity doesn't allow setting + /// of filter and wrap modes separately form the texture object. Setting this to false will omit making a copy + /// of a texture in that case and use the original texture's sampler state wherever it's referenced; this is + /// appropriate in cases such as the filter and wrap modes being specified in the shader instead + /// + public bool KeepCPUCopyOfTexture = true; + + /// + /// Specifies whether the MipMap chain should be generated for model textures + /// + public bool GenerateMipMapsForTextures = true; + + /// + /// When screen coverage is above threshold and no LOD mesh, cull the object + /// + public bool CullFarLOD = false; + + /// + /// Statistics from the scene + /// + public ImportStatistics Statistics; + + protected ImportOptions _options; + protected MemoryChecker _memoryChecker; + + protected GameObject _lastLoadedScene; + protected readonly GLTFMaterial DefaultMaterial = new GLTFMaterial(); + protected MaterialCacheData _defaultLoadedMaterial = null; + + protected string _gltfFileName; + protected GLBStream _gltfStream; + protected GLTFRoot _gltfRoot; + protected AssetCache _assetCache; + protected bool _isRunning = false; + + protected ImportProgress progressStatus = default(ImportProgress); + protected IProgress progress = null; + + private static ILogger Debug = UnityEngine.Debug.unityLogger; + + public GLTFSceneImporter(string gltfFileName, ImportOptions options) + { + _gltfFileName = gltfFileName; + _options = options; + + if (options.logger != null) + Debug = options.logger; + else + Debug = UnityEngine.Debug.unityLogger; + + if (_options.DataLoader == null) + { + _options.DataLoader = LegacyLoaderWrapper.Wrap(_options.ExternalDataLoader); + } + } + + public GLTFSceneImporter(GLTFRoot rootNode, Stream gltfStream, ImportOptions options) + { + _gltfRoot = rootNode; + + if (gltfStream != null) + { + _gltfStream = new GLBStream { Stream = gltfStream, StartPosition = gltfStream.Position }; + } + + _options = options; + if (_options.DataLoader == null) + { + _options.DataLoader = LegacyLoaderWrapper.Wrap(_options.ExternalDataLoader); + } + } + + /// + /// Creates a GLTFSceneBuilder object which will be able to construct a scene based off a url + /// + /// glTF file relative to data loader path + /// Loader to load external data references + /// Helper to load coroutines on a seperate thread + [Obsolete("Please switch to GLTFSceneImporter(string gltfFileName, ImportOptions options). This constructor is deprecated and will be removed in a future release.")] + public GLTFSceneImporter(string gltfFileName, ILoader externalDataLoader, AsyncCoroutineHelper asyncCoroutineHelper) + : this(externalDataLoader, asyncCoroutineHelper) + { + _gltfFileName = gltfFileName; + } + + [Obsolete("Please switch to GLTFSceneImporter(GLTFRoot rootNode, Stream gltfStream, ImportOptions options). This constructor is deprecated and will be removed in a future release.")] + public GLTFSceneImporter(GLTFRoot rootNode, ILoader externalDataLoader, AsyncCoroutineHelper asyncCoroutineHelper, Stream gltfStream = null) + : this(externalDataLoader, asyncCoroutineHelper) + { + _gltfRoot = rootNode; + + if (gltfStream != null) + { + _gltfStream = new GLBStream { Stream = gltfStream, StartPosition = gltfStream.Position }; + } + } + + [Obsolete("Only called by obsolete public constructors. This will be removed when those obsolete constructors are removed.")] + private GLTFSceneImporter(ILoader externalDataLoader, AsyncCoroutineHelper asyncCoroutineHelper) + { + _options = new ImportOptions + { + DataLoader = LegacyLoaderWrapper.Wrap(externalDataLoader), + AsyncCoroutineHelper = asyncCoroutineHelper + }; + } + + public void Dispose() + { + Cleanup(); + } + + /// + /// Loads a glTF Scene into the LastLoadedScene field + /// + /// The scene to load, If the index isn't specified, we use the default index in the file. Failing that we load index 0. + /// + /// Callback function for when load is completed + /// Cancellation token for loading + /// + public async Task LoadSceneAsync(int sceneIndex = -1, bool showSceneObj = true, Action onLoadComplete = null, CancellationToken cancellationToken = default(CancellationToken), IProgress progress = null) + { + try + { + lock (this) + { + if (_isRunning) + { + throw new GLTFLoadException("Cannot call LoadScene while GLTFSceneImporter is already running"); + } + + _isRunning = true; + } + + if (_options.ThrowOnLowMemory) + { + _memoryChecker = new MemoryChecker(); + } + + this.progressStatus = new ImportProgress(); + this.progress = progress; + + Statistics = new ImportStatistics(); + progress?.Report(progressStatus); + + if (_gltfRoot == null) + { + await LoadJson(_gltfFileName); + progressStatus.IsDownloaded = true; + } + + cancellationToken.ThrowIfCancellationRequested(); + + if (_gltfRoot.ExtensionsRequired != null && _gltfRoot.ExtensionsRequired.Contains("KHR_draco_mesh_compression")) + throw new NotSupportedException("Draco compression (using KHR_draco_mesh_compression) isn't currently supported. Use glTFast instead for loading meshes that use Draco compression."); + + if (_assetCache == null) + { + _assetCache = new AssetCache(_gltfRoot); + } + + await _LoadScene(sceneIndex, showSceneObj, cancellationToken); + } + catch (Exception ex) + { + Cleanup(); + + onLoadComplete?.Invoke(null, ExceptionDispatchInfo.Capture(ex)); + throw; + } + finally + { + lock (this) + { + _isRunning = false; + } + } + + if (progressStatus.NodeLoaded != progressStatus.NodeTotal) Debug.Log(LogType.Error, $"Nodes loaded ({progressStatus.NodeLoaded}) does not match node total in the scene ({progressStatus.NodeTotal})"); + if (progressStatus.TextureLoaded > progressStatus.TextureTotal) Debug.Log(LogType.Error, $"Textures loaded ({progressStatus.TextureLoaded}) is larger than texture total in the scene ({progressStatus.TextureTotal})"); + + onLoadComplete?.Invoke(LastLoadedScene, null); + } + + public IEnumerator LoadScene(int sceneIndex = -1, bool showSceneObj = true, Action onLoadComplete = null) + { + return LoadSceneAsync(sceneIndex, showSceneObj, onLoadComplete).AsCoroutine(); + } + + /// + /// Loads a node tree from a glTF file into the LastLoadedScene field + /// + /// The node index to load from the glTF + /// + public async Task LoadNodeAsync(int nodeIndex, CancellationToken cancellationToken) + { + await SetupLoad(async () => + { + CreatedObject = await GetNode(nodeIndex, cancellationToken); + InitializeGltfTopLevelObject(); + }); + } + + /// + /// Load a Material from the glTF by index + /// + /// + /// + public virtual async Task LoadMaterialAsync(int materialIndex) + { + await SetupLoad(async () => + { + if (materialIndex < 0 || materialIndex >= _gltfRoot.Materials.Count) + { + throw new ArgumentException($"There is no material for index {materialIndex}"); + } + + if (_assetCache.MaterialCache[materialIndex] == null) + { + var def = _gltfRoot.Materials[materialIndex]; + await ConstructMaterialImageBuffers(def); + await ConstructMaterial(def, materialIndex); + } + }); + return _assetCache.MaterialCache[materialIndex].UnityMaterialWithVertexColor; + } + + /// + /// Load a Mesh from the glTF by index + /// + /// + /// + public virtual async Task LoadMeshAsync(int meshIndex, CancellationToken cancellationToken) + { + await SetupLoad(async () => + { + if (meshIndex < 0 || meshIndex >= _gltfRoot.Meshes.Count) + { + throw new ArgumentException($"There is no mesh for index {meshIndex}"); + } + + if (_assetCache.MeshCache[meshIndex] == null) + { + var def = _gltfRoot.Meshes[meshIndex]; + await ConstructMeshAttributes(def, new MeshId() { Id = meshIndex, Root = _gltfRoot }); + await ConstructMesh(def, meshIndex, cancellationToken); + } + }); + return _assetCache.MeshCache[meshIndex].LoadedMesh; + } + + private async Task LoadJson(string jsonFilePath) + { +#if !WINDOWS_UWP && !UNITY_WEBGL + var dataLoader2 = _options.DataLoader as IDataLoader2; + if (IsMultithreaded && dataLoader2 != null) + { + Thread loadThread = new Thread(() => _gltfStream.Stream = dataLoader2.LoadStream(jsonFilePath)); + loadThread.Priority = ThreadPriority.Highest; + loadThread.Start(); + RunCoroutineSync(WaitUntilEnum(new WaitUntil(() => !loadThread.IsAlive))); + } + else +#endif + { + _gltfStream.Stream = await _options.DataLoader.LoadStreamAsync(jsonFilePath); + } + + _gltfStream.StartPosition = 0; + +#if !WINDOWS_UWP && !UNITY_WEBGL + if (IsMultithreaded) + { + Thread parseJsonThread = new Thread(() => GLTFParser.ParseJson(_gltfStream.Stream, out _gltfRoot, _gltfStream.StartPosition)); + parseJsonThread.Priority = ThreadPriority.Highest; + parseJsonThread.Start(); + RunCoroutineSync(WaitUntilEnum(new WaitUntil(() => !parseJsonThread.IsAlive))); + if (_gltfRoot == null) + { + throw new GLTFLoadException("Failed to parse glTF"); + } + } + else +#endif + { + GLTFParser.ParseJson(_gltfStream.Stream, out _gltfRoot, _gltfStream.StartPosition); + } + } + + /// + /// Initializes the top-level created node by adding an instantiated GLTF object component to it, + /// so that it can cleanup after itself properly when destroyed + /// + private void InitializeGltfTopLevelObject() + { + InstantiatedGLTFObject instantiatedGltfObject = CreatedObject.AddComponent(); + instantiatedGltfObject.CachedData = new RefCountedCacheData + ( + _assetCache.MaterialCache, + _assetCache.MeshCache, + _assetCache.TextureCache, + _assetCache.ImageCache + ); + } + + /// + /// Creates a scene based off loaded JSON. Includes loading in binary and image data to construct the meshes required. + /// + /// The bufferIndex of scene in gltf file to load + /// + protected async Task _LoadScene(int sceneIndex = -1, bool showSceneObj = true, CancellationToken cancellationToken = default(CancellationToken)) + { + GLTFScene scene; + + if (sceneIndex >= 0 && sceneIndex < _gltfRoot.Scenes.Count) + { + scene = _gltfRoot.Scenes[sceneIndex]; + } + else + { + scene = _gltfRoot.GetDefaultScene(); + } + + if (scene == null) + { + throw new GLTFLoadException("No default scene in gltf file."); + } + + GetGtlfContentTotals(scene); + + await ConstructScene(scene, showSceneObj, cancellationToken); + + if (SceneParent != null) + { + CreatedObject.transform.SetParent(SceneParent, false); + } + + _lastLoadedScene = CreatedObject; + } + + private void GetGtlfContentTotals(GLTFScene scene) + { + // Count Nodes + Queue nodeQueue = new Queue(); + + // Add scene nodes + if (scene.Nodes != null) + { + for (int i = 0; i < scene.Nodes.Count; ++i) + { + nodeQueue.Enqueue(scene.Nodes[i]); + } + } + + // BFS of nodes + while (nodeQueue.Count > 0) + { + var cur = nodeQueue.Dequeue(); + progressStatus.NodeTotal++; + + if (cur.Value.Children != null) + { + for (int i = 0; i < cur.Value.Children.Count; ++i) + { + nodeQueue.Enqueue(cur.Value.Children[i]); + } + } + } + + // Total textures + progressStatus.TextureTotal += _gltfRoot.Textures?.Count ?? 0; + + // Total buffers + progressStatus.BuffersTotal += _gltfRoot.Buffers?.Count ?? 0; + + // Send report + progress?.Report(progressStatus); + } + + private async Task GetBufferData(BufferId bufferId) + { + if (_assetCache.BufferCache[bufferId.Id] == null) + { + await ConstructBuffer(bufferId.Value, bufferId.Id); + } + + return _assetCache.BufferCache[bufferId.Id]; + } + + private float GetLodCoverage(List lodCoverageExtras, int lodIndex) + { + if (lodCoverageExtras != null && lodIndex < lodCoverageExtras.Count) + { + return (float)lodCoverageExtras[lodIndex]; + } + else + { + return 1.0f / (lodIndex + 2); + } + } + + private async Task GetNode(int nodeId, CancellationToken cancellationToken) + { + try + { + if (_assetCache.NodeCache[nodeId] == null) + { + if (nodeId >= _gltfRoot.Nodes.Count) + { + throw new ArgumentException("nodeIndex is out of range"); + } + + var node = _gltfRoot.Nodes[nodeId]; + + cancellationToken.ThrowIfCancellationRequested(); + if (!IsMultithreaded) + { + await ConstructBufferData(node, cancellationToken); + } + else + { + await Task.Run(() => ConstructBufferData(node, cancellationToken)); + } + + await ConstructNode(node, nodeId, cancellationToken); + + // HACK belongs in an extension, but we don't have Importer callbacks yet + const string msft_LODExtName = MSFT_LODExtensionFactory.EXTENSION_NAME; + if (_gltfRoot.ExtensionsUsed != null + && _gltfRoot.ExtensionsUsed.Contains(msft_LODExtName) + && node.Extensions != null + && node.Extensions.ContainsKey(msft_LODExtName)) + { + var lodsExtension = node.Extensions[msft_LODExtName] as MSFT_LODExtension; + if (lodsExtension != null && lodsExtension.NodeIds.Count > 0) + { + for (int i = 0; i < lodsExtension.NodeIds.Count; i++) + { + int lodNodeId = lodsExtension.NodeIds[i]; + await GetNode(lodNodeId, cancellationToken); + } + } + } + } + + return _assetCache.NodeCache[nodeId]; + } + catch (Exception ex) + { + // If some failure occured during loading, remove the node + + if (_assetCache.NodeCache[nodeId] != null) + { + GameObject.DestroyImmediate(_assetCache.NodeCache[nodeId]); + _assetCache.NodeCache[nodeId] = null; + } + + if (ex is OutOfMemoryException) + { + Resources.UnloadUnusedAssets(); + } + + throw; + } + } + + protected virtual async Task ConstructNode(Node node, int nodeIndex, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + if (_assetCache.NodeCache[nodeIndex] != null) + { + return; + } + + var nodeObj = new GameObject(string.IsNullOrEmpty(node.Name) ? ("GLTFNode" + nodeIndex) : node.Name); + // If we're creating a really large node, we need it to not be visible in partial stages. So we hide it while we create it + nodeObj.SetActive(false); + + Vector3 position; + Quaternion rotation; + Vector3 scale; + node.GetUnityTRSProperties(out position, out rotation, out scale); + nodeObj.transform.localPosition = position; + nodeObj.transform.localRotation = rotation; + nodeObj.transform.localScale = scale; + _assetCache.NodeCache[nodeIndex] = nodeObj; + + if (node.Children != null) + { + foreach (var child in node.Children) + { + GameObject childObj = await GetNode(child.Id, cancellationToken); + childObj.transform.SetParent(nodeObj.transform, false); + } + } + + if (node.Mesh != null) + { + var mesh = node.Mesh.Value; + await ConstructMesh(mesh, node.Mesh.Id, cancellationToken); + var unityMesh = _assetCache.MeshCache[node.Mesh.Id].LoadedMesh; + var materials = node.Mesh.Value.Primitives.Select(p => + p.Material != null ? + _assetCache.MaterialCache[p.Material.Id].UnityMaterialWithVertexColor : + _defaultLoadedMaterial.UnityMaterialWithVertexColor + ).ToArray(); + + var morphTargets = mesh.Primitives[0].Targets; + var weights = node.Weights ?? mesh.Weights ?? + (morphTargets != null ? new List(morphTargets.Select(mt => 0.0)) : null); + if (node.Skin != null || weights != null) + { + var renderer = nodeObj.AddComponent(); + renderer.sharedMesh = unityMesh; + renderer.sharedMaterials = materials; + renderer.quality = SkinQuality.Auto; + + if (node.Skin != null) + await SetupBones(node.Skin.Value, renderer, cancellationToken); + + // morph target weights + if (weights != null) + { + for (int i = 0; i < weights.Count; ++i) + { + // GLTF weights are [0, 1] range; Unity weights must match the frame weight + renderer.SetBlendShapeWeight(i, (float)(weights[i] * 1f)); + } + } + } + else + { + var filter = nodeObj.AddComponent(); + filter.sharedMesh = unityMesh; + var renderer = nodeObj.AddComponent(); + renderer.sharedMaterials = materials; + } + +#if UNITY_PHYSICS + switch (Collider) + { + case ColliderType.Box: + var boxCollider = nodeObj.AddComponent(); + boxCollider.center = unityMesh.bounds.center; + boxCollider.size = unityMesh.bounds.size; + break; + case ColliderType.Mesh: + var meshCollider = nodeObj.AddComponent(); + meshCollider.sharedMesh = unityMesh; + break; + case ColliderType.MeshConvex: + var meshConvexCollider = nodeObj.AddComponent(); + meshConvexCollider.sharedMesh = unityMesh; + meshConvexCollider.convex = true; + break; + } +#endif + } + + await ConstructLods(_gltfRoot, nodeObj, node, nodeIndex, cancellationToken); + + /* TODO: implement camera (probably a flag to disable for VR as well) + if (camera != null) + { + GameObject cameraObj = camera.Value.Create(); + cameraObj.transform.parent = nodeObj.transform; + } + */ + + ConstructLights(nodeObj, node); + + nodeObj.SetActive(true); + + progressStatus.NodeLoaded++; + progress?.Report(progressStatus); + } + + private async Task ConstructBufferData(Node node, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + MeshId mesh = node.Mesh; + if (mesh != null) + { + if (mesh.Value.Primitives != null) + { + await ConstructMeshAttributes(mesh.Value, mesh); + } + } + + if (node.Children != null) + { + foreach (NodeId child in node.Children) + { + await ConstructBufferData(child.Value, cancellationToken); + } + } + } + + protected async Task ConstructBuffer(GLTFBuffer buffer, int bufferIndex) + { + if (buffer.Uri == null) + { + if (_assetCache.BufferCache[bufferIndex] != null) Debug.Log(LogType.Error, "_assetCache.BufferCache[bufferIndex] != null;"); + _assetCache.BufferCache[bufferIndex] = ConstructBufferFromGLB(bufferIndex); + + progressStatus.BuffersLoaded++; + progress?.Report(progressStatus); + } + else + { + Stream bufferDataStream = null; + var uri = buffer.Uri; + + byte[] bufferData; + URIHelper.TryParseBase64(uri, out bufferData); + if (bufferData != null) + { + bufferDataStream = new MemoryStream(bufferData, 0, bufferData.Length, false, true); + } + else + { + bufferDataStream = await _options.DataLoader.LoadStreamAsync(buffer.Uri); + } + + if (_assetCache.BufferCache[bufferIndex] != null) Debug.Log(LogType.Error, "_assetCache.BufferCache[bufferIndex] != null;"); + _assetCache.BufferCache[bufferIndex] = new BufferCacheData + { + Stream = bufferDataStream + }; + + progressStatus.BuffersLoaded++; + progress?.Report(progressStatus); + } + } + + protected virtual async Task ConstructScene(GLTFScene scene, bool showSceneObj, CancellationToken cancellationToken) + { + var sceneObj = new GameObject(string.IsNullOrEmpty(scene.Name) ? ("Scene") : scene.Name); + + try + { + sceneObj.SetActive(showSceneObj); + + Transform[] nodeTransforms = new Transform[scene.Nodes.Count]; + for (int i = 0; i < scene.Nodes.Count; ++i) + { + NodeId node = scene.Nodes[i]; + GameObject nodeObj = await GetNode(node.Id, cancellationToken); + nodeObj.transform.SetParent(sceneObj.transform, false); + nodeTransforms[i] = nodeObj.transform; + } + + if (_options.AnimationMethod != AnimationMethod.None) + { + if (_gltfRoot.Animations != null && _gltfRoot.Animations.Count > 0) + { +#if UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER + // create the AnimationClip that will contain animation data + var constructedClips = new List(); + for (int i = 0; i < _gltfRoot.Animations.Count; ++i) + { + AnimationClip clip = await ConstructClip(sceneObj.transform, i, cancellationToken); + + clip.wrapMode = WrapMode.Loop; +#if UNITY_EDITOR + var settings = UnityEditor.AnimationUtility.GetAnimationClipSettings(clip); + settings.loopTime = _options.AnimationLoopTime; + settings.loopBlend = _options.AnimationLoopPose; + UnityEditor.AnimationUtility.SetAnimationClipSettings(clip, settings); +#endif + constructedClips.Add(clip); + } + + if (_options.AnimationMethod == AnimationMethod.Legacy) + { + Animation animation = sceneObj.AddComponent(); + for (int i = 0; i < constructedClips.Count; i++) + { + var clip = constructedClips[i]; + animation.AddClip(clip, clip.name); + if (i == 0) + { + animation.clip = clip; + } + } + } + else if (_options.AnimationMethod == AnimationMethod.Mecanim || _options.AnimationMethod == AnimationMethod.MecanimHumanoid) + { + Animator animator = sceneObj.AddComponent(); +#if UNITY_EDITOR + // TODO there's no good way to construct an AnimatorController on import it seems, needs to be a SubAsset etc. + var controller = new UnityEditor.Animations.AnimatorController(); + controller.name = "AnimatorController"; + controller.AddLayer("Base Layer"); + var baseLayer = controller.layers[0]; + for (int i = 0; i < constructedClips.Count; i++) + { + var state = baseLayer.stateMachine.AddState(constructedClips[i].name); + state.motion = constructedClips[i]; + } + animator.runtimeAnimatorController = controller; +#else + Debug.Log(LogType.Warning, "Importing animations at runtime requires the Legacy AnimationMethod to be enabled, or custom handling of the resulting clips."); +#endif + } +#else + Debug.Log(LogType.Warning, "glTF scene contains animations but com.unity.modules.animation isn't installed. Install that module to import animations."); +#endif + CreatedAnimationClips = constructedClips.ToArray(); + } + } + + if (_options.AnimationMethod == AnimationMethod.MecanimHumanoid) + { + if (!sceneObj.GetComponent()) + sceneObj.AddComponent(); + } + + CreatedObject = sceneObj; + InitializeGltfTopLevelObject(); + } + catch (Exception ex) + { + // If some failure occured during loading, clean up the scene + GameObject.DestroyImmediate(sceneObj); + CreatedObject = null; + + if (ex is OutOfMemoryException) + { + Resources.UnloadUnusedAssets(); + } + + throw; + } + } + + protected virtual BufferCacheData ConstructBufferFromGLB(int bufferIndex) + { + GLTFParser.SeekToBinaryChunk(_gltfStream.Stream, bufferIndex, _gltfStream.StartPosition); // sets stream to correct start position + return new BufferCacheData + { + Stream = _gltfStream.Stream, + ChunkOffset = (uint)_gltfStream.Stream.Position + }; + } + + /// + /// Get the absolute path to a gltf uri reference. + /// + /// The path to the gltf file + /// A path without the filename or extension + protected static string AbsoluteUriPath(string gltfPath) + { + var uri = new Uri(gltfPath); + var partialPath = uri.AbsoluteUri.Remove(uri.AbsoluteUri.Length - uri.Query.Length - uri.Segments[uri.Segments.Length - 1].Length); + return partialPath; + } + + /// + /// Get the absolute path a gltf file directory + /// + /// The path to the gltf file + /// A path without the filename or extension + protected static string AbsoluteFilePath(string gltfPath) + { + var fileName = Path.GetFileName(gltfPath); + var lastIndex = gltfPath.IndexOf(fileName); + var partialPath = gltfPath.Substring(0, lastIndex); + return partialPath; + } + + /// + /// Cleans up any undisposed streams after loading a scene or a node. + /// + private void Cleanup() + { + if (_assetCache != null) + { + _assetCache.Dispose(); + _assetCache = null; + } + } + + private async Task SetupLoad(Func callback) + { + try + { + lock (this) + { + if (_isRunning) + { + throw new GLTFLoadException("Cannot start a load while GLTFSceneImporter is already running"); + } + + _isRunning = true; + } + + Statistics = new ImportStatistics(); + if (_options.ThrowOnLowMemory) + { + _memoryChecker = new MemoryChecker(); + } + + if (_gltfRoot == null) + { + await LoadJson(_gltfFileName); + } + + if (_assetCache == null) + { + _assetCache = new AssetCache(_gltfRoot); + } + + await callback(); + } + catch + { + Cleanup(); + throw; + } + finally + { + lock (this) + { + _isRunning = false; + } + } + } + + protected async Task YieldOnTimeoutAndThrowOnLowMemory() + { + if (_options.ThrowOnLowMemory) + { + _memoryChecker.ThrowIfOutOfMemory(); + } + + if (_options.AsyncCoroutineHelper != null) + { + await _options.AsyncCoroutineHelper.YieldOnTimeout(); + } + } + + protected IEnumerator WaitUntilEnum(WaitUntil waitUntil) + { + yield return waitUntil; + } + + private static void RunCoroutineSync(IEnumerator streamEnum) + { + var stack = new Stack(); + stack.Push(streamEnum); + while (stack.Count > 0) + { + var enumerator = stack.Pop(); + if (enumerator.MoveNext()) + { + stack.Push(enumerator); + var subEnumerator = enumerator.Current as IEnumerator; + if (subEnumerator != null) + { + stack.Push(subEnumerator); + } + } + } + } + + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs.meta new file mode 100644 index 0000000..6c2cddb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSceneImporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2215b68d185249408d7b16c1c8799b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs new file mode 100644 index 0000000..85f9b44 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs @@ -0,0 +1,227 @@ +#if UNITY_EDITOR && UNITY_IMGUI +#define SHOW_SETTINGS_EDITOR +#endif + +using System.Collections.Generic; +using UnityEngine; +using System.IO; +using UnityEngine.UIElements; +using UnityGLTF.Cache; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF +{ +#if SHOW_SETTINGS_EDITOR + internal class GltfSettingsProvider : SettingsProvider + { + private GLTFSettings settings; + private SerializedObject m_SerializedObject; + private SerializedProperty showDefaultReferenceNameWarning, showNamingRecommendationHint; + + public override void OnGUI(string searchContext) + { + EditorGUIUtility.labelWidth = 200; + if (m_SerializedObject == null) + { + if (!settings) settings = GLTFSettings.GetOrCreateSettings(); + m_SerializedObject = new SerializedObject(settings); + } + + SerializedProperty prop = m_SerializedObject.GetIterator(); + prop.NextVisible(true); + if (prop.NextVisible(true)) + { + do + { + EditorGUILayout.PropertyField(prop, true); + switch (prop.name) + { + case nameof(GLTFSettings.UseCaching): + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button($"Clear Cache ({(exportCacheByteLength / (1024f * 1024f)):F2} MB)")) { + ExportCache.Clear(); + CalculateCacheStats(); + } + if (GUILayout.Button("Open Cache Directory ↗")) + ExportCache.OpenCacheDirectory(); + EditorGUILayout.EndHorizontal(); + break; + } + } + while (prop.NextVisible(false)); + } + + if(m_SerializedObject.hasModifiedProperties) { + m_SerializedObject.ApplyModifiedProperties(); + } + } + + public override void OnActivate(string searchContext, VisualElement rootElement) + { + base.OnActivate(searchContext, rootElement); + CalculateCacheStats(); + } + + private long exportCacheByteLength = 0; + private void CalculateCacheStats() + { + var files = new List(); + exportCacheByteLength = ExportCache.CalculateCacheSize(files); + } + + [SettingsProvider] + public static SettingsProvider CreateGltfSettingsProvider() + { + GLTFSettings.GetOrCreateSettings(); + return new GltfSettingsProvider("Project/UnityGLTF", SettingsScope.Project); + } + + public GltfSettingsProvider(string path, SettingsScope scopes, IEnumerable keywords = null) : base(path, scopes, keywords) { } + } +#endif + + public class GLTFSettings : ScriptableObject + { + private const string k_PreferencesPrefix = "UnityGLTF_Preferences_"; + private const string k_SettingsFileName = "UnityGLTFSettings.asset"; + public const string k_RuntimeAndEditorSettingsPath = "Assets/Resources/" + k_SettingsFileName; + + [System.Flags] + public enum BlendShapeExportPropertyFlags + { + None = 0, + PositionOnly = 1, + Normal = 2, + Tangent = 4, + All = ~0 + } + + [Header("Export Settings")] + [SerializeField] + private bool exportNames = true; + [SerializeField] + [Tooltip("If on, the entire texture path will be preserved. If off (default), textures are exported at root level.")] + private bool exportFullPath = false; + [SerializeField] + private bool requireExtensions = false; + + [Header("Export Visibility")] + [SerializeField] + [Tooltip("Uses Camera.main layer settings to filter which objects are exported")] + private bool useMainCameraVisibility = true; + [SerializeField] + [Tooltip("glTF does not support visibility state. If this setting is true, disabled GameObjects will still be exported and be visible in the glTF file.")] + private bool exportDisabledGameObjects = false; + + [Header("Export Textures")] + [SerializeField] + [Tooltip("(Experimental) Exports PNG/JPEG directly from disk instead of re-encoding from Unity's import result. No channel repacking will happen for these textures. Textures in other formats (PSD, TGA etc) not supported by glTF and in-memory textures (e.g. RenderTextures) are always re-encoded.")] + private bool tryExportTexturesFromDisk = false; + [SerializeField] [Tooltip("Determines texture export type (PNG or JPEG) based on alpha channel. When false, always exports lossless PNG files.")] + private bool useTextureFileTypeHeuristic = true; + [SerializeField] [Tooltip("Quality setting for exported JPEG files.")] + private int defaultJpegQuality = 90; + + [Header("Export Animation")] + [SerializeField] + private bool exportAnimations = true; + [Tooltip("(Experimental) Export animations using KHR_animation_pointer. Requires the viewer to also support this extension.")] + [SerializeField] + private bool useAnimationPointer = false; + [SerializeField] + [Tooltip("Some viewers can't distinguish between animation clips that have the same name. This option ensures all exported animation names are unique.")] + private bool uniqueAnimationNames = false; + [SerializeField] + private bool bakeSkinnedMeshes = false; + + [Header("Export Mesh Data")] + [SerializeField] + private BlendShapeExportPropertyFlags blendShapeExportProperties = BlendShapeExportPropertyFlags.All; + [SerializeField] + [Tooltip("(Experimental) Use Sparse Accessors for blend shape export. Not supported on some viewers.")] + private bool blendShapeExportSparseAccessors = true; + [SerializeField] + [Tooltip("If off, vertex colors are not exported. Vertex Colors aren't supported in some viewers (e.g. Google's SceneViewer).")] + private bool exportVertexColors = true; + + [Header("Export Cache")] + [Tooltip("When enabled textures will be cached to disc for faster export times.\n(The cache size is reduced to stay below 1024 MB when the Editor quits)")] + public bool UseCaching = true; + + public bool ExportNames { get => exportNames; set => exportNames = value; } + public bool ExportFullPath { get => exportFullPath; set => exportFullPath = value; } + public bool UseMainCameraVisibility { get => useMainCameraVisibility; set => useMainCameraVisibility = value; } + public bool RequireExtensions { get => requireExtensions; set => requireExtensions = value; } + public bool TryExportTexturesFromDisk { get => tryExportTexturesFromDisk; set => tryExportTexturesFromDisk = value; } + public bool UseTextureFileTypeHeuristic { get => useTextureFileTypeHeuristic; set => useTextureFileTypeHeuristic = value; } + public bool ExportVertexColors { get => exportVertexColors; set => exportVertexColors = value; } + public int DefaultJpegQuality { get => defaultJpegQuality; set => defaultJpegQuality = value; } + public bool ExportDisabledGameObjects { get => exportDisabledGameObjects; set => exportDisabledGameObjects = value; } + public bool ExportAnimations { get => exportAnimations; set => exportAnimations = value; } + public bool UseAnimationPointer { get => useAnimationPointer; set => useAnimationPointer = value; } + public bool UniqueAnimationNames { get => uniqueAnimationNames; set => uniqueAnimationNames = value; } + public bool BlendShapeExportSparseAccessors { get => blendShapeExportSparseAccessors; set => blendShapeExportSparseAccessors = value; } + public BlendShapeExportPropertyFlags BlendShapeExportProperties { get => blendShapeExportProperties; set => blendShapeExportProperties = value; } + public bool BakeSkinnedMeshes { get => bakeSkinnedMeshes; set => bakeSkinnedMeshes = value; } + + +#if UNITY_EDITOR + private const string SaveFolderPathPref = k_PreferencesPrefix + "SaveFolderPath"; + public string SaveFolderPath + { + get => EditorPrefs.GetString(SaveFolderPathPref, null); + set => EditorPrefs.SetString(SaveFolderPathPref, value); + } +#endif + + internal static GLTFSettings cachedSettings; + + public static GLTFSettings GetOrCreateSettings() + { + if (!TryGetSettings(out var settings)) + { +#if UNITY_EDITOR + settings = ScriptableObject.CreateInstance(); + var dir = Path.GetDirectoryName(k_RuntimeAndEditorSettingsPath); + if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); + AssetDatabase.CreateAsset(settings, k_RuntimeAndEditorSettingsPath); + AssetDatabase.SaveAssets(); +#else + settings = ScriptableObject.CreateInstance(); +#endif + } + cachedSettings = settings; + return settings; + } + + public static bool TryGetSettings(out GLTFSettings settings) + { + settings = cachedSettings; + if (settings) + return true; + + settings = Resources.Load(Path.GetFileNameWithoutExtension(k_SettingsFileName)); + +#if UNITY_EDITOR + if (!settings) + { + settings = AssetDatabase.LoadAssetAtPath(k_RuntimeAndEditorSettingsPath); + } + if (!settings) + { + var allSettings = AssetDatabase.FindAssets("t:GLTFSettings"); + if (allSettings.Length > 0) + { + settings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(allSettings[0])); + } + } + cachedSettings = settings; + return settings; +#else + return settings; +#endif + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs.meta new file mode 100644 index 0000000..e701272 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/GLTFSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9d9a5969691dba845877d0a52b6d9397 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs new file mode 100644 index 0000000..cf92f31 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs @@ -0,0 +1,65 @@ +using UnityEngine; +using UnityGLTF.Cache; + +namespace UnityGLTF +{ + /// + /// Instantiated GLTF Object component that gets added to the root of every GLTF game object created by a scene importer. + /// + public class InstantiatedGLTFObject : MonoBehaviour + { + /// + /// Ref-counted cache data for this object. + /// The same instance of this cached data will be used for all copies of this GLTF object, + /// and the data gets cleaned up when the ref counts goes to 0. + /// + private RefCountedCacheData cachedData; + public RefCountedCacheData CachedData + { + get + { + return cachedData; + } + + set + { + if (cachedData != value) + { + if (cachedData != null) + { + cachedData.DecreaseRefCount(); + } + + cachedData = value; + + if (cachedData != null) + { + cachedData.IncreaseRefCount(); + } + } + } + } + + /// + /// Duplicates the instantiated GLTF object. + /// Note that this should always be called if you intend to create a new instance of a GLTF object, + /// in order to properly preserve the ref count of the dynamically loaded mesh data, otherwise + /// you will run into a memory leak due to non-destroyed meshes, textures and materials. + /// + /// + public InstantiatedGLTFObject Duplicate() + { + GameObject duplicatedObject = Instantiate(gameObject); + + InstantiatedGLTFObject newGltfObjectComponent = duplicatedObject.GetComponent(); + newGltfObjectComponent.CachedData = CachedData; + + return newGltfObjectComponent; + } + + private void OnDestroy() + { + CachedData = null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs.meta new file mode 100644 index 0000000..9c6a4b9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/InstantiatedGLTFObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 943fbcf4d915b934db023669fa205a37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer.meta new file mode 100644 index 0000000..690e385 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8b6a60ae7ada43ce81c9fe3d7d34cdb3 +timeCreated: 1651350262 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs new file mode 100644 index 0000000..b53ebc7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs @@ -0,0 +1,7 @@ +namespace UnityGLTF.JsonPointer +{ + public interface IJsonPointerResolver + { + bool TryResolve(object target, ref string path); + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs.meta new file mode 100644 index 0000000..992be1b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/JsonPointer/IJsonPointerResolver.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8c60ec8461d64f80a335777129bdde18 +timeCreated: 1651350280 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader.meta new file mode 100644 index 0000000..acb52fd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9b9e509156e15f242836bedd245ddd21 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs new file mode 100644 index 0000000..105c82d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs @@ -0,0 +1,73 @@ +using System.IO; +using System; +using System.Threading.Tasks; + +namespace UnityGLTF.Loader +{ + public class FileLoader : IDataLoader2 + { + private readonly string _rootDirectoryPath; + + public FileLoader(string rootDirectoryPath) + { + _rootDirectoryPath = rootDirectoryPath; + } + + public Task LoadStreamAsync(string relativeFilePath) + { +#if UNITY_EDITOR + string path = Path.Combine(_rootDirectoryPath, relativeFilePath).Replace("\\", "/"); + + if (!File.Exists(path)) + { + path = Path.Combine(_rootDirectoryPath, Uri.UnescapeDataString(relativeFilePath)).Replace("\\", "/"); + } + + if (UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(path) == typeof(UnityEngine.Texture2D)) + { + var stream = new GLTFSceneImporter.AssetDatabaseStream(path); + return Task.FromResult((Stream) stream); + } +#endif + +#if !WINDOWS_UWP && !UNITY_WEBGL + // seems the Editor locks up in some cases when directly using Task.Run(() => {}) + if (UnityEngine.Application.isPlaying) + { + return Task.Run(() => LoadStream(relativeFilePath)); + } +#endif + return Task.FromResult(LoadStream(relativeFilePath)); + } + + public Stream LoadStream(string relativeFilePath) + { + if (relativeFilePath == null) + { + throw new ArgumentNullException(nameof(relativeFilePath)); + } + + if (File.Exists(relativeFilePath)) + return File.OpenRead(relativeFilePath); + + string pathToLoad = Path.Combine(_rootDirectoryPath, relativeFilePath); + if (!File.Exists(pathToLoad)) + { + pathToLoad = Path.Combine(_rootDirectoryPath, Uri.UnescapeDataString(relativeFilePath)); + } + + if (!File.Exists(pathToLoad)) + { + if (relativeFilePath.ToLowerInvariant().EndsWith(".bin")) + throw new FileNotFoundException("Buffer file " + relativeFilePath + " not found in " + _rootDirectoryPath + ", complete path: " + pathToLoad, relativeFilePath); + + UnityEngine.Debug.LogError("Buffer file " + relativeFilePath + " not found in " + _rootDirectoryPath + ", complete path: " + pathToLoad); + return InvalidStream; + } + + return File.OpenRead(pathToLoad); + } + + internal static readonly Stream InvalidStream = new MemoryStream(); + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs.meta new file mode 100644 index 0000000..228985a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/FileLoader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e1980a22c6cc4ce4e920022d7d9e941d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs new file mode 100644 index 0000000..c3923cf --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs @@ -0,0 +1,10 @@ +using System.IO; +using System.Threading.Tasks; + +namespace UnityGLTF.Loader +{ + public interface IDataLoader + { + Task LoadStreamAsync(string relativeFilePath); + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs.meta new file mode 100644 index 0000000..20286d5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fdb6a96a5ee34824685713dbad74cf51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs new file mode 100644 index 0000000..e378de3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs @@ -0,0 +1,9 @@ +using System.IO; + +namespace UnityGLTF.Loader +{ + public interface IDataLoader2 : IDataLoader + { + Stream LoadStream(string relativeFilePath); + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs.meta new file mode 100644 index 0000000..51dfb75 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/IDataLoader2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88e0d77167dc3af489e57a17abcde939 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs new file mode 100644 index 0000000..3fffbbc --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs @@ -0,0 +1,18 @@ +using System; +using System.IO; +using System.Threading.Tasks; + +namespace UnityGLTF.Loader +{ + [Obsolete("Please switch to IDataLoader. This interface is deprecated and will be removed in a future release.")] + public interface ILoader + { + Task LoadStream(string relativeFilePath); + + void LoadStreamSync(string jsonFilePath); + + Stream LoadedStream { get; } + + bool HasSyncLoadMethod { get; } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs.meta new file mode 100644 index 0000000..5f96023 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/ILoader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba15ab25bba758f4e8867413d5011747 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs new file mode 100644 index 0000000..278c267 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs @@ -0,0 +1,56 @@ +using System.IO; +using System.Threading.Tasks; + +namespace UnityGLTF.Loader +{ +#pragma warning disable CS0618 // Type or member is obsolete + /// + /// Wrapper utility for exposing an as a (and if appropriate, ). + /// + public static class LegacyLoaderWrapper + { + public static IDataLoader Wrap(ILoader loader) + { + if (loader == null) + { + return null; + } + if (loader.HasSyncLoadMethod) + { + return new LegacyLoader2(loader); + } + return new LegacyLoader(loader); + } + + private class LegacyLoader : IDataLoader + { + protected readonly ILoader _loader; + + public LegacyLoader(ILoader loader) + { + _loader = loader; + } + + public Task LoadStreamAsync(string relativeFilePath) + { + _loader.LoadStream(relativeFilePath); + return Task.FromResult(_loader.LoadedStream); + } + } + + private class LegacyLoader2 : LegacyLoader, IDataLoader2 + { + public LegacyLoader2(ILoader loader) : + base(loader) + { + } + + public Stream LoadStream(string relativeFilePath) + { + _loader.LoadStreamSync(relativeFilePath); + return _loader.LoadedStream; + } + } + } +#pragma warning restore CS0618 // Type or member is obsolete +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs.meta new file mode 100644 index 0000000..7249423 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/LegacyLoaderWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ca569386b974e44d8f914fdd0781b2a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs new file mode 100644 index 0000000..37a30e6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs @@ -0,0 +1,39 @@ +#if WINDOWS_UWP +using System.IO; +using System.Threading.Tasks; +using Windows.Storage; +using System; +using System.Collections; + +namespace UnityGLTF.Loader +{ + public class StorageFolderLoader : IDataLoader + { + private StorageFolder _rootFolder; + + public StorageFolderLoader(StorageFolder rootFolder) + { + _rootFolder = rootFolder; + } + + public async Task LoadStreamAsync(string relativeFilePath) + { + if (relativeFilePath == null) + { + throw new ArgumentNullException("relativeFilePath"); + } + + StorageFolder parentFolder = _rootFolder; + string fileName = Path.GetFileName(relativeFilePath); + if (relativeFilePath != fileName) + { + string folderToLoad = relativeFilePath.Substring(0, relativeFilePath.Length - fileName.Length); + parentFolder = await _rootFolder.GetFolderAsync(folderToLoad); + } + + StorageFile bufferFile = await parentFolder.GetFileAsync(fileName); + return await bufferFile.OpenStreamForReadAsync(); + } + } +} +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs.meta new file mode 100644 index 0000000..48209d8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/StorageFolderLoader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e7fd7d6556ddd446903db465957f23d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs new file mode 100644 index 0000000..49c863b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs @@ -0,0 +1,97 @@ +using System.IO; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.Networking; + +namespace UnityGLTF.Loader +{ + public class UnityWebRequestLoader : IDataLoader + { + private string dir; + + public UnityWebRequestLoader(string dir) + { + this.dir = dir; + } +#if UNITY_WEBREQUEST + public async Task LoadStreamAsync(string relativeFilePath) + { + var path = Path.Combine(dir, relativeFilePath).Replace("\\","/"); + if (File.Exists(path)) + path = "file://" + Path.GetFullPath(path); + var request = UnityWebRequest.Get(path); + // request.downloadHandler = new DownloadStreamHandler(new byte[1024 * 1024]); + var asyncOperation = request.SendWebRequest(); + + while (!asyncOperation.isDone) { + await Task.Yield(); + } + +#if UNITY_2020_1_OR_NEWER + if (request.result != UnityWebRequest.Result.Success) +#else + if (request.isNetworkError || request.isHttpError) +#endif + { + Debug.LogError($"Error when loading {relativeFilePath} ({path}): {request.error}"); + return null; + } + + var results = request.downloadHandler.data; + var stream = new MemoryStream(results, 0, results.Length, false, true); + return stream; + } +#else + public async Task LoadStreamAsync(string relativeFilePath) + { + await Task.CompletedTask; + throw new System.ApplicationException("The module com.unity.modules.unitywebrequest is required for this functionality. Please install it in your project."); + } +#endif + + // TODO: figure out how to do this correctly in a streaming fashion. + // private class DownloadStreamHandler : DownloadHandlerScript + // { + // private ulong expectedTotalBytes = 0; + // private Stream stream; + // public Stream GetStream() + // { + // return stream; + // } + // + // public DownloadStreamHandler(byte[] buffer) : base(buffer) + // { + // stream = new MemoryStream(buffer, true); + // } + // + // protected override bool ReceiveData(byte[] data, int dataLength) + // { + // if(data == null || data.Length < 1) + // { + // Debug.Log("LoggingDownloadHandler :: ReceiveData - received a null/empty buffer"); + // return false; + // } + // + // stream.Write(data, 0, dataLength); + // return true; + // } + // + // protected override byte[] GetData() + // { + // throw new System.NotSupportedException("This is a stream, can't get all bytes"); + // } + // + // protected override void CompleteContent() + // { + // Debug.Log("LoggingDownloadHandler :: CompleteContent - DOWNLOAD COMPLETE!"); + // } + // + // protected override void ReceiveContentLengthHeader(ulong contentLength) + // { + // Debug.Log(string.Format("LoggingDownloadHandler :: ReceiveContentLength - length {0}", contentLength)); + // expectedTotalBytes = contentLength; + // stream.SetLength((long) contentLength); + // } + // } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs.meta new file mode 100644 index 0000000..c50e2e9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/UnityWebRequestLoader.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f570680f27e849d59aeaa47194bfa5e4 +timeCreated: 1650878357 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/WebRequestLoader.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/WebRequestLoader.cs new file mode 100644 index 0000000..850a2ac --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Loader/WebRequestLoader.cs @@ -0,0 +1,101 @@ +using System; +using System.IO; +using System.Net; +#if WINDOWS_UWP +using Windows.Web.Http; +using Windows.Security; +using Windows.Storage.Streams; +#else +using System.Net.Http; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +#endif +using System.Threading; +using System.Threading.Tasks; + +namespace UnityGLTF.Loader +{ + public class WebRequestLoader : IDataLoader + { + private readonly HttpClient httpClient = new HttpClient(); + private readonly Uri baseAddress; + + public WebRequestLoader(string rootUri) + { +#if !WINDOWS_UWP + ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; +#endif + baseAddress = new Uri(rootUri); + } + + public async Task LoadStreamAsync(string gltfFilePath) + { + if (gltfFilePath == null) + { + throw new ArgumentNullException(nameof(gltfFilePath)); + } + + HttpResponseMessage response; + try + { +#if WINDOWS_UWP + response = await httpClient.GetAsync(new Uri(baseAddress, gltfFilePath)); +#else + var tokenSource = new CancellationTokenSource(30000); + response = await httpClient.GetAsync(new Uri(baseAddress, gltfFilePath), tokenSource.Token); +#endif + } + catch (TaskCanceledException) + { +#if WINDOWS_UWP + throw new Exception("Connection timeout"); +#else + throw new HttpRequestException("Connection timeout"); +#endif + } + + response.EnsureSuccessStatusCode(); + + // HACK: Download the whole file before returning the stream + // Ideally the parsers would wait for data to be available, but they don't. + var result = new MemoryStream((int?)response.Content.Headers.ContentLength ?? 5000); +#if WINDOWS_UWP + await response.Content.WriteToStreamAsync(result.AsOutputStream()); +#else + await response.Content.CopyToAsync(result); +#endif + response.Dispose(); + return result; + } + +#if !WINDOWS_UWP + // enables HTTPS support + // https://answers.unity.com/questions/50013/httpwebrequestgetrequeststream-https-certificate-e.html + private static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) + { + bool isOk = true; + // If there are errors in the certificate chain, look at each error to determine the cause. + if (errors != SslPolicyErrors.None) + { + for (int i = 0; i + /// Allows polling for app low memory situation. Listens to Application.lowMemory, which works for iOS and Android. + /// Also listens to Windows-specific MemoryManager.AppMemoryUsageIncreased. + /// + public MemoryChecker() + { + Application.lowMemory += Application_lowMemory; + +#if WINDOWS_UWP + MemoryManager.AppMemoryUsageIncreased += MemoryManager_AppMemoryUsageIncreased; +#endif + } + + /// + /// If the OS has notified the app that it is low on memory since MemoryChecker was constructed, this method will throw an OutOfMemoryException. + /// Once it throws once, it will continue to throw. Callers are advised to construct a new MemoryChecker after memory usage has gone down. + /// + public void ThrowIfOutOfMemory() + { + if (outOfMemory) + { + throw new OutOfMemoryException(); + } + } + + private void Application_lowMemory() + { + outOfMemory = true; + } + +#if WINDOWS_UWP + private void MemoryManager_AppMemoryUsageIncreased(object sender, object e) + { + if (MemoryManager.AppMemoryUsageLevel == AppMemoryUsageLevel.OverLimit) + { + outOfMemory = true; + } + } +#endif + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/MemoryChecker.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/MemoryChecker.cs.meta new file mode 100644 index 0000000..d7cc777 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/MemoryChecker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4bde1c330cae17541b9fb48d321d1722 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines.meta new file mode 100644 index 0000000..a0fb936 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 463af91555c2fdb479c0951afcf7a7d2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs new file mode 100644 index 0000000..4662818 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using UnityEngine; + +[ExecuteAlways, ImageEffectAllowedInSceneView] +public class RoughRefraction : MonoBehaviour +{ + private readonly Dictionary renderTextureCache = new Dictionary(); + private static readonly int CameraOpaqueTexture = Shader.PropertyToID("_CameraOpaqueTexture"); + + private void OnDisable() + { + if (renderTextureCache != null) { + foreach(var kvp in renderTextureCache) + RenderTexture.ReleaseTemporary(kvp.Value); + } + renderTextureCache?.Clear(); + } + + private void OnPreRender() + { + SetTexture(); + } + + private void SetTexture() + { + var current = Camera.current; + if (!renderTextureCache.ContainsKey(current)) + { + Shader.SetGlobalTexture(CameraOpaqueTexture, Texture2D.blackTexture); + return; + } + + Shader.SetGlobalTexture(CameraOpaqueTexture, renderTextureCache[current]); + } + + [ImageEffectOpaque] + private void OnRenderImage(RenderTexture src, RenderTexture dest) + { + var dsc = src.descriptor; + dsc.useMipMap = true; + dsc.autoGenerateMips = false; + dsc.msaaSamples = 1; + dsc.width = Mathf.ClosestPowerOfTwo(dsc.width); + dsc.height = Mathf.ClosestPowerOfTwo(dsc.height); + + var current = Camera.current; + if (!renderTextureCache.ContainsKey(current)) + renderTextureCache.Add(current, null); + if(renderTextureCache[current]) + RenderTexture.ReleaseTemporary(renderTextureCache[current]); + + renderTextureCache[current] = RenderTexture.GetTemporary(dsc); + renderTextureCache[current].filterMode = FilterMode.Trilinear; + // temp[current].useMipMap = true; + + Graphics.Blit(src, renderTextureCache[current]); + renderTextureCache[current].GenerateMips(); + Graphics.Blit(src, dest); + + SetTexture(); + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs.meta new file mode 100644 index 0000000..7952d50 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefraction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2b5788589ee445e45bf87cdf1ec6ee90 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs new file mode 100644 index 0000000..c37d3ad --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs @@ -0,0 +1,86 @@ +#if HAVE_URP_12_OR_NEWER || HAVE_URP_10_OR_NEWER + +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; +using UnityEngine.Rendering.Universal.Internal; + +namespace UnityGLTF +{ +#if HAVE_URP_12_OR_NEWER + [DisallowMultipleRendererFeature("Opaque Texture (Rough Refractions)")] +#endif + public class RoughRefractionFeature : ScriptableRendererFeature + { + public Downsampling downsampling = Downsampling.None; + + class CustomRenderPass : CopyColorPass + { + public Downsampling m_DownsamplingMethod; + public RenderTargetHandle destination; + + public CustomRenderPass(RenderPassEvent evt) : base(evt, + CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Universal Render Pipeline/Sampling")), + CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Universal Render Pipeline/Blit"))) + { } + + public new void Setup(RenderTargetIdentifier source, RenderTargetHandle destination, Downsampling downsampling) + { + base.Setup(source, destination, downsampling); + + this.destination = destination; + this.m_DownsamplingMethod = downsampling; + } + + public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) + { + var desc = renderingData.cameraData.cameraTargetDescriptor; + desc.useMipMap = true; + desc.autoGenerateMips = true; + renderingData.cameraData.cameraTargetDescriptor = desc; + + // base.OnCameraSetup(cmd, ref renderingData); + + RenderTextureDescriptor descriptor = renderingData.cameraData.cameraTargetDescriptor; + descriptor.msaaSamples = 1; + descriptor.depthBufferBits = 0; + if (m_DownsamplingMethod == Downsampling._2xBilinear) + { + descriptor.width /= 2; + descriptor.height /= 2; + } + else if (m_DownsamplingMethod == Downsampling._4xBox || m_DownsamplingMethod == Downsampling._4xBilinear) + { + descriptor.width /= 4; + descriptor.height /= 4; + } + + cmd.GetTemporaryRT(destination.id, descriptor, FilterMode.Trilinear); + } + } + + CustomRenderPass m_ScriptablePass; + RenderTargetHandle m_OpaqueColor; + + /// + public override void Create() + { + m_OpaqueColor.Init("_CameraOpaqueTexture"); + } + + // Here you can inject one or multiple render passes in the renderer. + // This method is called when setting up the renderer once per-camera. + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + if (m_ScriptablePass == null) + { + m_ScriptablePass = new CustomRenderPass(RenderPassEvent.AfterRenderingSkybox); + } + m_ScriptablePass.Setup(renderer.cameraColorTarget, m_OpaqueColor, downsampling); + + renderer.EnqueuePass(m_ScriptablePass); + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs.meta new file mode 100644 index 0000000..996c1d1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/RoughRefractionFeature.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9aa176c7981ee2a469e664fd93f010b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef new file mode 100644 index 0000000..a4f0f8c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef @@ -0,0 +1,30 @@ +{ + "name": "UnityGltf.RenderPipelines", + "references": [ + "GUID:15fc0a57446b3144c949da3e2b9737a9", + "GUID:df380645f10b7bc4b97d4f5eb6303d95", + "GUID:2bafac87e7f4b9b418d9448d219b01ab" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_2020_3_OR_NEWER" + ], + "versionDefines": [ + { + "name": "com.unity.render-pipelines.universal", + "expression": "12", + "define": "HAVE_URP_12_OR_NEWER" + }, + { + "name": "com.unity.render-pipelines.universal", + "expression": "10", + "define": "HAVE_URP_10_OR_NEWER" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef.meta new file mode 100644 index 0000000..975d3dd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/RenderPipelines/UnityGltf.RenderPipelines.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fe848190f1a690142846fa6384b74e17 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter.meta new file mode 100644 index 0000000..0ed5453 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61f928488f87d3147ac6bcad15cf6ea1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs new file mode 100644 index 0000000..55909a3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs @@ -0,0 +1,1143 @@ +#define USE_FAST_BINARY_WRITER + +using System; +using System.Collections.Generic; +using System.IO; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Extensions; + +namespace UnityGLTF +{ +public partial class GLTFSceneExporter +{ +#if USE_FAST_BINARY_WRITER + private BinaryWriterWithLessAllocations _bufferWriter; +#else + private BinaryWriter _bufferWriter; +#endif + + /// + /// Convenience function to copy from a stream to a binary writer, for + /// compatibility with pre-.NET 4.0. + /// Note: Does not set position/seek in either stream. After executing, + /// the input buffer's position should be the end of the stream. + /// + /// Stream to copy from + /// Stream to copy to. + private static void CopyStream(Stream input, BinaryWriter output) + { + byte[] buffer = new byte[8 * 1024]; + int length; + while ((length = input.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer, 0, length); + } + } + + /// + /// Pads a stream with additional bytes. + /// + /// The stream to be modified. + /// The padding byte to append. Defaults to ASCII + /// space (' '). + /// The boundary to align with, in bytes. + /// + private static void AlignToBoundary(Stream stream, byte pad = (byte)' ', uint boundary = 4) + { + uint currentLength = (uint)stream.Length; + uint newLength = CalculateAlignment(currentLength, boundary); + for (int i = 0; i < newLength - currentLength; i++) + { + stream.WriteByte(pad); + } + } + + /// + /// Calculates the number of bytes of padding required to align the + /// size of a buffer with some multiple of byteAllignment. + /// + /// The current size of the buffer. + /// The number of bytes to align with. + /// + public static uint CalculateAlignment(uint currentSize, uint byteAlignment) + { + return (currentSize + byteAlignment - 1) / byteAlignment * byteAlignment; + } + + private AccessorId ExportAccessorUint(Vector4[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorUintArrayMarker.Begin(); + + var count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.UnsignedShort; + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.VEC4; + + float minX = arr[0].x; + float minY = arr[0].y; + float minZ = arr[0].z; + float minW = arr[0].w; + float maxX = arr[0].x; + float maxY = arr[0].y; + float maxZ = arr[0].z; + float maxW = arr[0].w; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur.x < minX) + { + minX = cur.x; + } + if (cur.y < minY) + { + minY = cur.y; + } + if (cur.z < minZ) + { + minZ = cur.z; + } + if (cur.w < minW) + { + minW = cur.w; + } + if (cur.x > maxX) + { + maxX = cur.x; + } + if (cur.y > maxY) + { + maxY = cur.y; + } + if (cur.z > maxZ) + { + maxZ = cur.z; + } + if (cur.w > maxW) + { + maxW = cur.w; + } + } + + accessor.Min = new List { minX, minY, minZ, minW }; + accessor.Max = new List { maxX, maxY, maxZ, maxW }; + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + exportAccessorBufferWriteMarker.Begin(); + foreach (var vec in arr) + { + _bufferWriter.Write((ushort)vec.x); + _bufferWriter.Write((ushort)vec.y); + _bufferWriter.Write((ushort)vec.z); + _bufferWriter.Write((ushort)vec.w); + } + exportAccessorBufferWriteMarker.End(); + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView((uint)byteOffset, (uint)byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorUintArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + // This is used for Quaternions / Rotations. Lights' and Cameras' orientations need to be flipped. + private AccessorId ExportAccessorSwitchHandedness(Quaternion[] arr, bool invertLookDirection) + { + exportAccessorMarker.Begin(); + exportAccessorVector4ArrayMarker.Begin(); + + var count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var copy = new Quaternion[count]; + Array.Copy(arr, copy, count); + for (int i = 0; i < count; i++) + { + var v = copy[i]; + if (invertLookDirection) + { + v *= new Quaternion(0, -1, 0, 0); + } + v = v.SwitchHandedness().normalized; + copy[i] = v; + } + arr = copy; + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.VEC4; + + var a0 = arr[0]; + float minX = a0.x; + float minY = a0.y; + float minZ = a0.z; + float minW = a0.w; + float maxX = a0.x; + float maxY = a0.y; + float maxZ = a0.z; + float maxW = a0.w; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur.x < minX) + { + minX = cur.x; + } + if (cur.y < minY) + { + minY = cur.y; + } + if (cur.z < minZ) + { + minZ = cur.z; + } + if (cur.w < minW) + { + minW = cur.w; + } + if (cur.x > maxX) + { + maxX = cur.x; + } + if (cur.y > maxY) + { + maxY = cur.y; + } + if (cur.z > maxZ) + { + maxZ = cur.z; + } + if (cur.w > maxW) + { + maxW = cur.w; + } + } + + accessor.Min = new List { minX, minY, minZ, minW }; + accessor.Max = new List { maxX, maxY, maxZ, maxW }; + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + exportAccessorBufferWriteMarker.Begin(); +#if USE_FAST_BINARY_WRITER + _bufferWriter.Write(arr); +#else + foreach (var vec in arr) + { + _bufferWriter.Write(vect.x); + _bufferWriter.Write(vect.y); + _bufferWriter.Write(vect.z); + _bufferWriter.Write(vect.w); + } +#endif + exportAccessorBufferWriteMarker.End(); + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView((uint)byteOffset, (uint)byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorVector4ArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(Matrix4x4[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorMatrix4x4ArrayMarker.Begin(); + + var count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.MAT4; + + // Dont serialize min/max for matrices + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + exportAccessorBufferWriteMarker.Begin(); + foreach (var mat in arr) + { + var m = SchemaExtensions.ToGltfMatrix4x4Convert(mat); + for (uint i = 0; i < 4; ++i) + { + var col = m.GetColumn(i); + _bufferWriter.Write(col.X); + _bufferWriter.Write(col.Y); + _bufferWriter.Write(col.Z); + _bufferWriter.Write(col.W); + } + } + exportAccessorBufferWriteMarker.End(); + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView((uint)byteOffset, (uint)byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorMatrix4x4ArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(byte[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorByteArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.SCALAR; + + int min = arr[0]; + int max = arr[0]; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur < min) + { + min = cur; + } + if (cur > max) + { + max = cur; + } + } + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + accessor.ComponentType = GLTFComponentType.UnsignedByte; + + foreach (var v in arr) + { + _bufferWriter.Write((byte)v); + } + + accessor.Min = new List { min }; + accessor.Max = new List { max }; + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorByteArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(float[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorFloatArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.SCALAR; + + exportAccessorMinMaxMarker.Begin(); + var min = arr[0]; + var max = arr[0]; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur < min) + { + min = cur; + } + if (cur > max) + { + max = cur; + } + } + exportAccessorMinMaxMarker.End(); + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, sizeof(float)); + + exportAccessorBufferWriteMarker.Begin(); + accessor.ComponentType = GLTFComponentType.Float; + +#if USE_FAST_BINARY_WRITER + _bufferWriter.Write(arr); +#else + foreach (var v in arr) + { + _bufferWriter.Write((float)v); + } +#endif + exportAccessorBufferWriteMarker.End(); + + accessor.Min = new List { min }; + accessor.Max = new List { max }; + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorFloatArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(int[] arr, bool isIndices = false) + { + exportAccessorMarker.Begin(); + if (isIndices) exportAccessorIntArrayIndicesMarker.Begin(); else exportAccessorIntArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.SCALAR; + + int min = arr[0]; + int max = arr[0]; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur < min) + { + min = cur; + } + if (cur > max) + { + max = cur; + } + } + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + // From the spec: + // Values of the index accessor must not include the maximum value for the given component type, + // which triggers primitive restart in several graphics APIs and would require client implementations to rebuild the index buffer. + // Primitive restart values are disallowed and all index values must refer to actual vertices. + int maxAllowedValue = isIndices ? max + 1 : max; + + if (maxAllowedValue <= byte.MaxValue && min >= byte.MinValue) + { + accessor.ComponentType = GLTFComponentType.UnsignedByte; + + foreach (var v in arr) + { + _bufferWriter.Write((byte)v); + } + } + else if (maxAllowedValue <= sbyte.MaxValue && min >= sbyte.MinValue && !isIndices) + { + accessor.ComponentType = GLTFComponentType.Byte; + + foreach (var v in arr) + { + _bufferWriter.Write((sbyte)v); + } + } + else if (maxAllowedValue <= short.MaxValue && min >= short.MinValue && !isIndices) + { + accessor.ComponentType = GLTFComponentType.Short; + + foreach (var v in arr) + { + _bufferWriter.Write((short)v); + } + } + else if (maxAllowedValue <= ushort.MaxValue && min >= ushort.MinValue) + { + accessor.ComponentType = GLTFComponentType.UnsignedShort; + + foreach (var v in arr) + { + _bufferWriter.Write((ushort)v); + } + } + else if (maxAllowedValue >= uint.MinValue) + { + accessor.ComponentType = GLTFComponentType.UnsignedInt; + + foreach (var v in arr) + { + _bufferWriter.Write((uint)v); + } + } + else + { + accessor.ComponentType = GLTFComponentType.Float; + + foreach (var v in arr) + { + _bufferWriter.Write((float)v); + } + } + + accessor.Min = new List { min }; + accessor.Max = new List { max }; + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + if (isIndices) exportAccessorIntArrayIndicesMarker.End(); else exportAccessorIntArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(Vector2[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorVector2ArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.VEC2; + + float minX = arr[0].x; + float minY = arr[0].y; + float maxX = arr[0].x; + float maxY = arr[0].y; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur.x < minX) + { + minX = cur.x; + } + if (cur.y < minY) + { + minY = cur.y; + } + if (cur.x > maxX) + { + maxX = cur.x; + } + if (cur.y > maxY) + { + maxY = cur.y; + } + } + + accessor.Min = new List { minX, minY }; + accessor.Max = new List { maxX, maxY }; + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + foreach (var vec in arr) + { + _bufferWriter.Write(vec.x); + _bufferWriter.Write(vec.y); + } + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorVector2ArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(Vector3[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorVector3ArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.VEC3; + + float minX = arr[0].x; + float minY = arr[0].y; + float minZ = arr[0].z; + float maxX = arr[0].x; + float maxY = arr[0].y; + float maxZ = arr[0].z; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur.x < minX) + { + minX = cur.x; + } + if (cur.y < minY) + { + minY = cur.y; + } + if (cur.z < minZ) + { + minZ = cur.z; + } + if (cur.x > maxX) + { + maxX = cur.x; + } + if (cur.y > maxY) + { + maxY = cur.y; + } + if (cur.z > maxZ) + { + maxZ = cur.z; + } + } + + accessor.Min = new List { minX, minY, minZ }; + accessor.Max = new List { maxX, maxY, maxZ }; + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + exportAccessorBufferWriteMarker.Begin(); +#if USE_FAST_BINARY_WRITER + _bufferWriter.Write(arr); +#else + foreach (var vec in arr) + { + _bufferWriter.Write(vec.x); + _bufferWriter.Write(vec.y); + _bufferWriter.Write(vec.z); + } +#endif + exportAccessorBufferWriteMarker.End(); + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength, sizeof(float) * 3); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorVector3ArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + /// + /// + /// + /// + /// The data is treated as "additive" (e.g. blendshapes) when baseData != null + /// + /// + /// + private AccessorId ExportSparseAccessor(AccessorId baseAccessor, Vector3[] baseData, Vector3[] arr) + { + exportSparseAccessorMarker.Begin(); + + uint dataCount = (uint) arr.Length; + if (dataCount == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + // TODO need to assert that these types match to the base accessor + // TODO we might need to build a data <> accessor dict as well to avoid having to pass in the base data again + + // need to assert data and baseData have the same length etc. + if (baseData != null && baseData.Length != arr.Length) + { + throw new Exception("Sparse Accessor Base Data must either be null or the same length as the data array, current: " + baseData.Length + " != " + arr.Length); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = dataCount; + accessor.Type = GLTFAccessorAttributeType.VEC3; + + if(baseAccessor != null) + { + accessor.BufferView = baseAccessor.Value.BufferView; + accessor.ByteOffset = baseAccessor.Value.ByteOffset; + } + + accessor.Sparse = new AccessorSparse(); + var sparse = accessor.Sparse; + + var indices = new List(); + + // Debug.Log("Values for sparse data array:\n " + string.Join("\n ", arr)); + for (int i = 0; i < arr.Length; i++) + { + var comparer = (baseAccessor == null || baseData == null) ? Vector3.zero : baseData[i]; + if (comparer != arr[i]) + { + indices.Add(i); + } + } + + // HACK since GLTF doesn't allow 0 buffer length, but that can well happen when a morph target exactly matches the base mesh + // NOT doing this results in GLTF validation errors about buffers having length 0 + if (indices.Count < 1) + { + indices = new List() {0}; + } + + // we need to calculate the min/max of the entire new data array + uint count = (uint) arr.Length; + + var firstElement = baseData != null ? (baseData[0] + arr[0]) : arr[0]; + float minX = firstElement.x; + float minY = firstElement.y; + float minZ = firstElement.z; + float maxX = firstElement.x; + float maxY = firstElement.y; + float maxZ = firstElement.z; + + for (var i = 1; i < count; i++) + { + var cur = baseData != null ? (baseData[i] + arr[i]) : arr[i]; + + if (cur.x < minX) + { + minX = cur.x; + } + if (cur.y < minY) + { + minY = cur.y; + } + if (cur.z < minZ) + { + minZ = cur.z; + } + if (cur.x > maxX) + { + maxX = cur.x; + } + if (cur.y > maxY) + { + maxY = cur.y; + } + if (cur.z > maxZ) + { + maxZ = cur.z; + } + } + + accessor.Min = new List { minX, minY, minZ }; + accessor.Max = new List { maxX, maxY, maxZ }; + + // write indices + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffsetIndices = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + // Debug.Log("Storing " + indices.Count + " sparse indices + values"); + + foreach (var index in indices) + { + _bufferWriter.Write(index); + } + + uint byteLengthIndices = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffsetIndices, 4); + + sparse.Indices = new AccessorSparseIndices(); + // TODO should be properly using the smallest possible component type + sparse.Indices.ComponentType = GLTFComponentType.UnsignedInt; + sparse.Indices.BufferView = ExportBufferView(byteOffsetIndices, byteLengthIndices); + + // write values + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + exportAccessorBufferWriteMarker.Begin(); + foreach (var i in indices) + { + var vec = arr[i]; + _bufferWriter.Write(vec.x); + _bufferWriter.Write(vec.y); + _bufferWriter.Write(vec.z); + } + exportAccessorBufferWriteMarker.End(); + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + sparse.Values = new AccessorSparseValues(); + sparse.Values.BufferView = ExportBufferView(byteOffset, byteLength); + + sparse.Count = indices.Count; + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportSparseAccessorMarker.End(); + + return id; + } + + + private AccessorId ExportAccessor(Vector4[] arr) + { + exportAccessorMarker.Begin(); + exportAccessorVector4ArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = count; + accessor.Type = GLTFAccessorAttributeType.VEC4; + + float minX = arr[0].x; + float minY = arr[0].y; + float minZ = arr[0].z; + float minW = arr[0].w; + float maxX = arr[0].x; + float maxY = arr[0].y; + float maxZ = arr[0].z; + float maxW = arr[0].w; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur.x < minX) + { + minX = cur.x; + } + if (cur.y < minY) + { + minY = cur.y; + } + if (cur.z < minZ) + { + minZ = cur.z; + } + if (cur.w < minW) + { + minW = cur.w; + } + if (cur.x > maxX) + { + maxX = cur.x; + } + if (cur.y > maxY) + { + maxY = cur.y; + } + if (cur.z > maxZ) + { + maxZ = cur.z; + } + if (cur.w > maxW) + { + maxW = cur.w; + } + } + + accessor.Min = new List { minX, minY, minZ, minW }; + accessor.Max = new List { maxX, maxY, maxZ, maxW }; + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + exportAccessorBufferWriteMarker.Begin(); +#if USE_FAST_BINARY_WRITER + _bufferWriter.Write(arr); +#else + foreach (var vec in arr) + { + _bufferWriter.Write(vec.x); + _bufferWriter.Write(vec.y); + _bufferWriter.Write(vec.z); + _bufferWriter.Write(vec.w); + } +#endif + exportAccessorBufferWriteMarker.End(); + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorVector4ArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private AccessorId ExportAccessor(Color[] arr, bool exportAlphaChannel) + { + exportAccessorMarker.Begin(); + exportAccessorColorArrayMarker.Begin(); + + uint count = (uint)arr.Length; + + if (count == 0) + { + throw new Exception("Accessors can not have a count of 0."); + } + + var accessor = new Accessor(); + accessor.ComponentType = GLTFComponentType.Float; + accessor.Count = count; + accessor.Type = exportAlphaChannel ? GLTFAccessorAttributeType.VEC4 : GLTFAccessorAttributeType.VEC3; + + float minR = arr[0].r; + float minG = arr[0].g; + float minB = arr[0].b; + float minA = arr[0].a; + float maxR = arr[0].r; + float maxG = arr[0].g; + float maxB = arr[0].b; + float maxA = arr[0].a; + + for (var i = 1; i < count; i++) + { + var cur = arr[i]; + + if (cur.r < minR) + { + minR = cur.r; + } + if (cur.g < minG) + { + minG = cur.g; + } + if (cur.b < minB) + { + minB = cur.b; + } + if (cur.a < minA) + { + minA = cur.a; + } + if (cur.r > maxR) + { + maxR = cur.r; + } + if (cur.g > maxG) + { + maxG = cur.g; + } + if (cur.b > maxB) + { + maxB = cur.b; + } + if (cur.a > maxA) + { + maxA = cur.a; + } + } + + if (exportAlphaChannel) + { + accessor.Min = new List { minR, minG, minB, minA }; + accessor.Max = new List { maxR, maxG, maxB, maxA }; + } + else + { + accessor.Min = new List { minR, minG, minB }; + accessor.Max = new List { maxR, maxG, maxB }; + } + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + if(exportAlphaChannel) + { + foreach (var color in arr) + { + _bufferWriter.Write(color.r); + _bufferWriter.Write(color.g); + _bufferWriter.Write(color.b); + _bufferWriter.Write(color.a); + } + } + else + { + foreach (var color in arr) + { + _bufferWriter.Write(color.r); + _bufferWriter.Write(color.g); + _bufferWriter.Write(color.b); + } + } + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + + accessor.BufferView = ExportBufferView(byteOffset, byteLength); + + var id = new AccessorId + { + Id = _root.Accessors.Count, + Root = _root + }; + _root.Accessors.Add(accessor); + + exportAccessorColorArrayMarker.End(); + exportAccessorMarker.End(); + + return id; + } + + private BufferViewId ExportBufferView(uint byteOffset, uint byteLength, uint byteStride = 0) + { + var bufferView = new BufferView + { + Buffer = _bufferId, + ByteOffset = byteOffset, + ByteLength = byteLength, + ByteStride = byteStride + }; + + var id = new BufferViewId + { + Id = _root.BufferViews.Count, + Root = _root + }; + + _root.BufferViews.Add(bufferView); + + return id; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs.meta new file mode 100644 index 0000000..16cc2dd --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAccessors.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 47321deab892e9044bb9d4a193a41208 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs new file mode 100644 index 0000000..9d6af8c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs @@ -0,0 +1,1358 @@ +#if UNITY_EDITOR +#define ANIMATION_EXPORT_SUPPORTED +#endif + +#if ANIMATION_EXPORT_SUPPORTED && (UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER) +#define ANIMATION_SUPPORTED +#endif + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Extensions; +using Object = UnityEngine.Object; + +#if ANIMATION_EXPORT_SUPPORTED +using UnityEditor; +using UnityEditor.Animations; +#endif + +#if HAVE_ANIMATIONRIGGING +using UnityEngine.Animations.Rigging; +#endif + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { +#if ANIMATION_SUPPORTED + private readonly Dictionary<(AnimationClip clip, float speed), GLTFAnimation> _clipToAnimation = new Dictionary<(AnimationClip, float), GLTFAnimation>(); +#endif +#if ANIMATION_SUPPORTED + private readonly Dictionary<(AnimationClip clip, float speed, string targetPath), Transform> _clipAndSpeedAndPathToExportedTransform = new Dictionary<(AnimationClip, float, string), Transform>(); +#endif + +#if ANIMATION_SUPPORTED + private static int AnimationBakingFramerate = 30; // FPS + private static bool BakeAnimationData = true; +#endif + + // Parses Animation/Animator component and generate a glTF animation for the active clip + // This may need additional work to fully support animatorControllers + public void ExportAnimationFromNode(ref Transform transform) + { + exportAnimationFromNodeMarker.Begin(); + +#if ANIMATION_SUPPORTED + Animator animator = transform.GetComponent(); + if (animator) + { +#if ANIMATION_EXPORT_SUPPORTED + AnimationClip[] clips = AnimationUtility.GetAnimationClips(transform.gameObject); + var animatorController = animator.runtimeAnimatorController as AnimatorController; + // Debug.Log("animator: " + animator + "=> " + animatorController); + ExportAnimationClips(transform, clips, animator, animatorController); +#endif + } + + UnityEngine.Animation animation = transform.GetComponent(); + if (animation) + { +#if ANIMATION_EXPORT_SUPPORTED + AnimationClip[] clips = UnityEditor.AnimationUtility.GetAnimationClips(transform.gameObject); + ExportAnimationClips(transform, clips); +#endif + } +#endif + exportAnimationFromNodeMarker.End(); + } + +#if ANIMATION_SUPPORTED + private IEnumerable GetAnimatorStateParametersForClip(AnimationClip clip, AnimatorController animatorController) + { + if (!clip) + yield break; + + if (!animatorController) + yield return new AnimatorState() { name = clip.name, speed = 1f }; + + foreach (var layer in animatorController.layers) + { + foreach (var state in layer.stateMachine.states) + { + // find a matching clip in the animator + if (state.state.motion is AnimationClip c && c == clip) + { + yield return state.state; + } + } + } + } + + private GLTFAnimation GetOrCreateAnimation(AnimationClip clip, string searchForDuplicateName, float speed) + { + var existingAnim = default(GLTFAnimation); + if (_exportOptions.MergeClipsWithMatchingNames) + { + // Check if we already exported an animation with exactly that name. If yes, we want to append to the previous one instead of making a new one. + // This allows to merge multiple animations into one if required (e.g. a character and an instrument that should play at the same time but have individual clips). + existingAnim = _root.Animations?.FirstOrDefault(x => x.Name == searchForDuplicateName); + } + + // TODO when multiple AnimationClips are exported, we're currently not properly merging those; + // we should only export the GLTFAnimation once but then apply that to all nodes that require it (duplicating the animation but not the accessors) + // instead of naively writing over the GLTFAnimation with the same data. + var animationClipAndSpeed = (clip, speed); + if (existingAnim == null) + { + if(_clipToAnimation.TryGetValue(animationClipAndSpeed, out existingAnim)) + { + // we duplicate the clip it was exported before so we can retarget to another transform. + existingAnim = new GLTFAnimation(existingAnim, _root); + } + } + + GLTFAnimation anim = existingAnim != null ? existingAnim : new GLTFAnimation(); + + // add to set of already exported clip-state pairs + if (!_clipToAnimation.ContainsKey(animationClipAndSpeed)) + _clipToAnimation.Add(animationClipAndSpeed, anim); + + return anim; + } + + // Creates GLTFAnimation for each clip and adds it to the _root + public void ExportAnimationClips(Transform nodeTransform, IList clips, Animator animator = null, AnimatorController animatorController = null) + { + // When sampling animation using AnimationMode the animator might be disabled afterwards when the animation is exported from a prefab (e.g. Prefab -> object with humanoid animation -> export from referenced prefab -> animator is disabled) + // Here we ensure that the animator is enabled again after export + // See ExportAnimationHumanoid with StartAnimationMode + var animatorEnabled = !animator || animator.enabled; + + // Debug.Log("exporting clips from " + nodeTransform + " with " + animatorController); + if (animatorController) + { + if (!animator) throw new ArgumentNullException("Missing " + nameof(animator)); + for (int i = 0; i < clips.Count; i++) + { + if (!clips[i]) continue; + + // special case: there could be multiple states with the same animation clip. + // if we want to handle this here, we need to find all states that match this clip + foreach(var state in GetAnimatorStateParametersForClip(clips[i], animatorController)) + { + var speed = state.speed * (state.speedParameterActive ? animator.GetFloat(state.speedParameter) : 1f); + var name = clips[i].name; + ExportAnimationClip(clips[i], name, nodeTransform, speed); + } + } + } + else + { + for (int i = 0; i < clips.Count; i++) + { + if (!clips[i]) continue; + var speed = 1f; + ExportAnimationClip(clips[i], clips[i].name, nodeTransform, speed); + } + } + + if(animator) + animator.enabled = animatorEnabled; + } + + public GLTFAnimation ExportAnimationClip(AnimationClip clip, string name, Transform node, float speed) + { + if (!clip) return null; + GLTFAnimation anim = GetOrCreateAnimation(clip, name, speed); + + anim.Name = name; + if(settings.UniqueAnimationNames) + anim.Name = ObjectNames.GetUniqueName(_root.Animations.Select(x => x.Name).ToArray(), anim.Name); + + ConvertClipToGLTFAnimation(clip, node, anim, speed); + + if (anim.Channels.Count > 0 && anim.Samplers.Count > 0 && !_root.Animations.Contains(anim)) + { + _root.Animations.Add(anim); + _animationClips.Add((node, clip)); + } + return anim; + } +#endif + +#if ANIMATION_SUPPORTED + public enum AnimationKeyRotationType + { + Unknown, + Quaternion, + Euler + } + + public class PropertyCurve + { + public string propertyName; + public Type propertyType; + public List curve; + public List curveName; + public Object target; + + public PropertyCurve(Object target, string propertyName) + { + this.target = target; + this.propertyName = propertyName; + curve = new List(); + curveName = new List(); + } + + public void AddCurve(AnimationCurve animCurve, string name) + { + this.curve.Add(animCurve); + this.curveName.Add(name); + } + + public float Evaluate(float time, int index) + { + if (index < 0 || index >= curve.Count) + { + // common case: A not animated but RGB is. + // TODO this should actually use the value from the material. + if (propertyType == typeof(Color) && index == 3) + return 1; + + throw new ArgumentOutOfRangeException(nameof(index), $"PropertyCurve {propertyName} ({propertyType}) has only {curve.Count} curves but index {index} was accessed for time {time}"); + } + + return curve[index].Evaluate(time); + } + + internal bool Validate() + { + if (propertyType == typeof(Color)) + { + var hasEnoughCurves = curve.Count == 4; + if (!hasEnoughCurves) + { + UnityEngine.Debug.LogWarning("Animating single channels for colors is not supported. Please add at least one keyframe for all channels (RGBA): " + propertyName, target); + return false; + } + } + + return true; + } + + /// + /// Call this method once before beginning to evaluate curves + /// + internal void SortCurves() + { + // If we animate a color property in Unity and start by creating keys for green then the green curve will be at index 0 + // This method ensures that the curves are in a known order e.g. rgba (instead of green red blue alpha) + if (curve?.Count > 0 && curveName.Count > 0) + { + if (propertyType == typeof(Color)) + { + FillTempLists(); + var indexOfR = FindIndex(name => name.EndsWith(".r")); + var indexOfG = FindIndex(name => name.EndsWith(".g")); + var indexOfB = FindIndex(name => name.EndsWith(".b")); + var indexOfA = FindIndex(name => name.EndsWith(".a")); + for(var i = 0; i < curve.Count; i++) + { + var curveIndex = i; + if (i == 0) curveIndex = indexOfR; + else if (i == 1) curveIndex = indexOfG; + else if (i == 2) curveIndex = indexOfB; + else if (i == 3) curveIndex = indexOfA; + if (curveIndex >= 0 && curveIndex != i) + { + this.curve[i] = _tempList1[curveIndex];; + this.curveName[i] = _tempList2[curveIndex];; + } + } + } + } + } + + private static readonly List _tempList1 = new List(); + private static readonly List _tempList2 = new List(); + + private void FillTempLists() + { + _tempList1.Clear(); + _tempList2.Clear(); + _tempList1.AddRange(curve); + _tempList2.AddRange(curveName); + } + + public int FindIndex(Predicate test) + { + for(var i = 0; i < curveName.Count; i++) + { + if (test(curveName[i])) + return i; + } + return -1; + } + + + } + + internal struct TargetCurveSet + { + #pragma warning disable 0649 + public AnimationCurve[] translationCurves; + public AnimationCurve[] rotationCurves; + public AnimationCurve[] scaleCurves; + public Dictionary weightCurves; + public PropertyCurve propertyCurve; + #pragma warning restore + + public Dictionary propertyCurves; + + // for KHR_animation_pointer + public void AddPropertyCurves(Object animatedObject, AnimationCurve curve, EditorCurveBinding binding) + { + if (propertyCurves == null) propertyCurves = new Dictionary(); + if (!binding.propertyName.Contains(".")) + { + var prop = new PropertyCurve(animatedObject, binding.propertyName); + // if (binding.propertyName == "translation") + // prop.needsCoordinateConversion = true; + prop.AddCurve(curve, binding.propertyName); + if (animatedObject is GameObject || animatedObject is Component) + TryFindMemberBinding(binding, prop, prop.propertyName); + propertyCurves.Add(binding.propertyName, prop); + } + else + { + var memberName = binding.propertyName; + + // Color is animated as a Color/Vector4 + if (memberName.EndsWith(".r", StringComparison.Ordinal) || memberName.EndsWith(".g", StringComparison.Ordinal) || + memberName.EndsWith(".b", StringComparison.Ordinal) || memberName.EndsWith(".a", StringComparison.Ordinal) || + memberName.EndsWith(".x", StringComparison.Ordinal) || memberName.EndsWith(".y", StringComparison.Ordinal) || + memberName.EndsWith(".z", StringComparison.Ordinal) || memberName.EndsWith(".w", StringComparison.Ordinal)) + memberName = binding.propertyName.Substring(0, binding.propertyName.LastIndexOf(".", StringComparison.Ordinal)); + + if (propertyCurves.TryGetValue(memberName, out var existing)) + { + existing.AddCurve(curve, binding.propertyName); + } + else + { + var prop = new PropertyCurve(animatedObject, binding.propertyName); + prop.propertyName = memberName; + prop.AddCurve(curve, binding.propertyName); + propertyCurves.Add(memberName, prop); + if (memberName.StartsWith("material.") && animatedObject is Renderer rend) + { + var mat = rend.sharedMaterial; + if (!mat) + { + Debug.LogWarning("Animated missing material?", animatedObject); + } + memberName = memberName.Substring("material.".Length); + prop.propertyName = memberName; + prop.target = mat; + if (memberName.EndsWith("_ST", StringComparison.Ordinal)) + { + prop.propertyType = typeof(Vector4); + } + else + { + var found = false; + for (var i = 0; i < ShaderUtil.GetPropertyCount(mat.shader); i++) + { + if (found) break; + var name = ShaderUtil.GetPropertyName(mat.shader, i); + if (!memberName.EndsWith(name)) continue; + found = true; + var materialProperty = ShaderUtil.GetPropertyType(mat.shader, i); + switch (materialProperty) + { + case ShaderUtil.ShaderPropertyType.Color: + prop.propertyType = typeof(Color); + break; + case ShaderUtil.ShaderPropertyType.Vector: + prop.propertyType = typeof(Vector4); + break; + case ShaderUtil.ShaderPropertyType.Float: + prop.propertyType = typeof(float); + break; + case ShaderUtil.ShaderPropertyType.TexEnv: + prop.propertyType = typeof(Texture); + break; + } + } + } + } + else if (animatedObject is Light) + { + switch (memberName) + { + case "m_Color": + prop.propertyType = typeof(Color); + break; + case "m_Intensity": + prop.propertyType = typeof(float); + break; + case "m_SpotAngle": + case "m_InnerSpotAngle": + prop.propertyType = typeof(float); + break; + } + } + else if (animatedObject is Camera) + { + // types match, names are explicitly handled in ExporterAnimationPointer.cs + } + else + { + TryFindMemberBinding(binding, prop, prop.propertyName); + // var member = FindMemberOnTypeIncludingBaseTypes(binding.type, prop.propertyName); + // if (member is FieldInfo field) prop.propertyType = field.FieldType; + // else if (member is PropertyInfo p) prop.propertyType = p.PropertyType; + // if(prop.propertyType == null) + // Debug.LogWarning($"Member {prop.propertyName} not found on {binding.type}: implicitly handling animated property {prop.propertyName} ({prop.propertyType}) on target {prop.target}", prop.target); + } + } + } + } + + private static bool TryFindMemberBinding(EditorCurveBinding binding, PropertyCurve prop, string memberName, int iteration = 0) + { + // explicitly handled + if(binding.type == typeof(Camera) || binding.type == typeof(Light)) + return true; + + if (memberName == "m_IsActive") + { + prop.propertyType = typeof(float); + prop.propertyName = "activeSelf"; + return true; + } + + if (binding.type == typeof(Animator)) + { + // These seem to be magic names when exporting humanoid animation (?) + if (memberName == "MotionT" || memberName == "MotionQ") + { + return false; + } + } + + var member = FindMemberOnTypeIncludingBaseTypes(binding.type, memberName); + if (member is FieldInfo field) prop.propertyType = field.FieldType; + else if (member is PropertyInfo p) prop.propertyType = p.PropertyType; + if (member != null) + { + prop.propertyName = member.Name; + return true; + } + + if (iteration == 0) + { + // some members start with m_, for example m_AnchoredPosition in RectTransform but the field/property name is actually anchoredPosition + if (memberName.StartsWith("m_")) + { + memberName = char.ToLowerInvariant(memberName[2]) + memberName.Substring(3); + return TryFindMemberBinding(binding, prop, memberName, ++iteration); + } + } + + Debug.LogWarning($"Member {prop.propertyName} not found on {binding.type}: implicitly handling animated property {prop.propertyName} ({prop.propertyType}) on target {prop.target}", prop.target); + return false; + } + + private static MemberInfo FindMemberOnTypeIncludingBaseTypes(Type type, string memberName) + { + while (type != null) + { + var member = type.GetMember(memberName, BindingFlags.Default | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + if (member.Length > 0) return member[0]; + type = type.BaseType; + } + return null; + } + + public void Init() + { + translationCurves = new AnimationCurve[3]; + rotationCurves = new AnimationCurve[4]; + scaleCurves = new AnimationCurve[3]; + weightCurves = new Dictionary(); + } + } + + private static string LogObject(object obj) + { + if (obj == null) return "null"; + + if (obj is Component tr) + return $"{tr.name} (InstanceID: {tr.GetInstanceID()}, Type: {tr.GetType()})"; + if (obj is GameObject go) + return $"{go.name} (InstanceID: {go.GetInstanceID()})"; + + return obj.ToString(); + } + + private Dictionary<(Object key, AnimationClip clip, float speed), AnimationClip> _sampledClipInstanceCache = new Dictionary<(Object, AnimationClip, float), AnimationClip>(); + + private bool ClipRequiresSampling(AnimationClip clip, Transform transform) + { + var clipRequiresSampling = clip.isHumanMotion; + +#if HAVE_ANIMATIONRIGGING + // we also need to bake if this Animator uses animation rigging for dynamic motion + var rig = transform.GetComponent(); + if (rig && rig.enabled) clipRequiresSampling = true; +#endif + + return clipRequiresSampling; + } + + private void ConvertClipToGLTFAnimation(AnimationClip clip, Transform transform, GLTFAnimation animation, float speed) + { + convertClipToGLTFAnimationMarker.Begin(); + + // Generate GLTF.Schema.AnimationChannel and GLTF.Schema.AnimationSampler + // 1 channel per node T/R/S, one sampler per node T/R/S + // Need to keep a list of nodes to convert to indexes + + // Special case for animated humanoids: we also need to cache transform-to-humanoid and make sure that individual clips are used there. + // since we're baking humanoids, we'd otherwise end up with the same clip being applied to different rigs; + // in the future, we may want to support a system like VRM or EXT_skin_humanoid (https://github.com/takahirox/EXT_skin_humanoid) and support runtime retargeting of animations. + if (ClipRequiresSampling(clip, transform)) + { + var animator = transform.GetComponent(); + var avatar = animator.avatar; + Object instanceCacheKey = avatar; +#if HAVE_ANIMATIONRIGGING + var rig = transform.GetComponent(); + if (rig) instanceCacheKey = rig; +#endif + if (clip.isHumanMotion && !avatar) + { + Debug.LogWarning(null, $"No avatar found on animated humanoid, skipping humanoid animation export on {transform.name}", transform); + convertClipToGLTFAnimationMarker.End(); + return; + } + var key = (instanceCacheKey, clip, speed); + if(!_sampledClipInstanceCache.ContainsKey(key)) + _sampledClipInstanceCache.Add(key, Object.Instantiate(clip)); + clip = _sampledClipInstanceCache[key]; + } + + // 1. browse clip, collect all curves and create a TargetCurveSet for each target + Dictionary targetCurvesBinding = new Dictionary(); + CollectClipCurves(transform.gameObject, clip, targetCurvesBinding); + + // Baking needs all properties, fill missing curves with transform data in 2 keyframes (start, endTime) + // where endTime is clip duration + // Note: we should avoid creating curves for a property if none of it's components is animated + + GenerateMissingCurves(clip.length, transform, ref targetCurvesBinding); + + if (BakeAnimationData) + { + // Bake animation for all animated nodes + foreach (string target in targetCurvesBinding.Keys) + { + var hadAlreadyExportedThisBindingBefore = _clipAndSpeedAndPathToExportedTransform.TryGetValue((clip, speed, target), out var alreadyExportedTransform); + Transform targetTr = target.Length > 0 ? transform.Find(target) : transform; + int newTargetId = targetTr ? GetTransformIndex(targetTr) : -1; + + var targetTrShouldNotBeExported = targetTr && !targetTr.gameObject.activeInHierarchy && !settings.ExportDisabledGameObjects; + + if (hadAlreadyExportedThisBindingBefore && newTargetId < 0) + { + // warn: the transform for this binding exists, but its Node isn't exported. It's probably disabled and "Export Disabled" is off. + if (targetTr) + { + Debug.LogWarning("An animated transform is not part of _exportedTransforms, is the object disabled? " + LogObject(targetTr), targetTr); + } + + // we need to remove the channels and samplers from the existing animation that was passed in if they exist + int alreadyExportedChannelTargetId = GetTransformIndex(alreadyExportedTransform); + animation.Channels.RemoveAll(x => x.Target.Node != null && x.Target.Node.Id == alreadyExportedChannelTargetId); + + if (settings.UseAnimationPointer) + { + animation.Channels.RemoveAll(x => + { + if (x.Target.Extensions != null && x.Target.Extensions.TryGetValue(KHR_animation_pointer.EXTENSION_NAME, out var ext) && ext is KHR_animation_pointer animationPointer) + { + var obj = animationPointer.animatedObject; + if (obj is Component c) + obj = c.transform; + if (obj is Transform tr2 && tr2 == alreadyExportedTransform) + return true; + } + return false; + }); + } + + // TODO remove all samplers from this animation that were targeting the channels that we just removed + // TODO: this doesn't work because we're punching holes in the sampler order; all channel sampler IDs would need to be adjusted as well. + + continue; + } + + if (hadAlreadyExportedThisBindingBefore) + { + int alreadyExportedChannelTargetId = GetTransformIndex(alreadyExportedTransform); + + for (int i = 0; i < animation.Channels.Count; i++) + { + var existingTarget = animation.Channels[i].Target; + if (existingTarget.Node != null && existingTarget.Node.Id != alreadyExportedChannelTargetId) continue; + + // if we're here it means that an existing AnimationChannel already targets the same node that we're currently targeting. + // Without KHR_animation_pointer, that just means we reuse the existing data and tell it to target a new node. + // With KHR_animation_pointer, we need to do the same, and retarget the path to the new node. + if (existingTarget.Extensions != null && existingTarget.Extensions.TryGetValue(KHR_animation_pointer.EXTENSION_NAME, out var ext) && ext is KHR_animation_pointer animationPointer) + { + // Debug.Log($"export? {!targetTrShouldNotBeExported} - {nameof(existingTarget)}: {L(existingTarget)}, {nameof(animationPointer)}: {L(animationPointer.animatedObject)}, {nameof(alreadyExportedTransform)}: {L(alreadyExportedTransform)}, {nameof(targetTr)}: {L(targetTr)}"); + var obj = animationPointer.animatedObject; + Transform animatedTransform = default; + if (obj is Component comp) animatedTransform = comp.transform; + else if (obj is GameObject go) animatedTransform = go.transform; + if (animatedTransform == alreadyExportedTransform) + { + if (targetTrShouldNotBeExported) + { + // Debug.LogWarning("Need to remove this", null); + } + else + { + if (animationPointer.animatedObject is GameObject) + { + animationPointer.animatedObject = targetTr.gameObject; + animationPointer.channel = existingTarget; + animationPointerResolver.Add(animationPointer); + } + else if(animationPointer.animatedObject is Component) + { + var targetType = animationPointer.animatedObject.GetType(); + var newTarget = targetTr.GetComponent(targetType); + if (newTarget) + { + animationPointer.animatedObject = newTarget; + animationPointer.channel = existingTarget; + animationPointerResolver.Add(animationPointer); + } + } + } + } + else if (animationPointer.animatedObject is Material m) + { + var renderer = targetTr.GetComponent(); + if (renderer) + { + // TODO we don't have a good way right now to solve this if there's multiple materials on this renderer... + // would probably need to keep the clip path / binding around and check if that uses a specific index and so on + var newTarget = renderer.sharedMaterial; + if (newTarget) + { + animationPointer.animatedObject = newTarget; + animationPointer.channel = existingTarget; + animationPointerResolver.Add(animationPointer); + } + } + } + } + else if (targetTr) + { + existingTarget.Node = new NodeId() + { + Id = newTargetId, + Root = _root + }; + } + } + continue; + } + + if (targetTrShouldNotBeExported) + { + Debug.Log("Object " + targetTr + " is disabled, not exporting animated curve " + target, targetTr); + continue; + } + + // add to cache: this is the first time we're exporting that particular binding. + if (targetTr) + _clipAndSpeedAndPathToExportedTransform.Add((clip, speed, target), targetTr); + + var curve = targetCurvesBinding[target]; + var speedMultiplier = Mathf.Clamp(speed, 0.01f, Mathf.Infinity); + + // Initialize data + // Bake and populate animation data + float[] times = null; + + // arbitrary properties require the KHR_animation_pointer extension + bool sampledAnimationData = false; + if (settings.UseAnimationPointer && curve.propertyCurves != null && curve.propertyCurves.Count > 0) + { + var curves = curve.propertyCurves; + foreach (KeyValuePair c in curves) + { + var prop = c.Value; + if (BakePropertyAnimation(prop, clip.length, AnimationBakingFramerate, speedMultiplier, out times, out var values)) + { + AddAnimationData(prop.target, prop.propertyName, animation, times, values); + sampledAnimationData = true; + } + } + } + + if (targetTr) + { + // TODO these should be moved into curve.propertyCurves as well + // TODO should filter by possible propertyCurve string names at that point to avoid + // moving KHR_animation_pointer data into regular animations + if (curve.translationCurves.Any(x => x != null)) + { + var trp2 = new PropertyCurve(targetTr, "translation") { propertyType = typeof(Vector3) }; + trp2.curve.AddRange(curve.translationCurves); + if (BakePropertyAnimation(trp2, clip.length, AnimationBakingFramerate, speedMultiplier, out times, out var values2)) + { + AddAnimationData(targetTr, trp2.propertyName, animation, times, values2); + sampledAnimationData = true; + } + } + + if (curve.rotationCurves.Any(x => x != null)) + { + var trp3 = new PropertyCurve(targetTr, "rotation") { propertyType = typeof(Quaternion) }; + trp3.curve.AddRange(curve.rotationCurves.Where(x => x != null)); + if (BakePropertyAnimation(trp3, clip.length, AnimationBakingFramerate, speedMultiplier, out times, out var values3)) + { + AddAnimationData(targetTr, trp3.propertyName, animation, times, values3); + sampledAnimationData = true; + } + + } + + if (curve.scaleCurves.Any(x => x != null)) + { + var trp4 = new PropertyCurve(targetTr, "scale") { propertyType = typeof(Vector3) }; + trp4.curve.AddRange(curve.scaleCurves); + if (BakePropertyAnimation(trp4, clip.length, AnimationBakingFramerate, speedMultiplier, out times, out var values4)) + { + AddAnimationData(targetTr, trp4.propertyName, animation, times, values4); + sampledAnimationData = true; + } + } + + if (curve.weightCurves.Any(x => x.Value != null)) + { + var trp5 = new PropertyCurve(targetTr, "weights") { propertyType = typeof(float) }; + trp5.curve.AddRange(curve.weightCurves.Values); + if (BakePropertyAnimation(trp5, clip.length, AnimationBakingFramerate, speedMultiplier, out times, out var values5)) + { + var targetComponent = targetTr.GetComponent(); + AddAnimationData(targetComponent, trp5.propertyName, animation, times, values5); + sampledAnimationData = true; + } + } + } + + if (!sampledAnimationData) + Debug.LogWarning("Warning: empty animation curves for " + target + " in " + clip + " from " + transform, transform); + } + } + else + { + Debug.LogError("Only baked animation is supported for now. Skipping animation", null); + } + + convertClipToGLTFAnimationMarker.End(); + } + + private void CollectClipCurves(GameObject root, AnimationClip clip, Dictionary targetCurves) + { +#if UNITY_EDITOR + if (ClipRequiresSampling(clip, root.transform)) + { + CollectClipCurvesBySampling(root, clip, targetCurves); + return; + } + + foreach (var binding in UnityEditor.AnimationUtility.GetCurveBindings(clip)) + { + AnimationCurve curve = UnityEditor.AnimationUtility.GetEditorCurve(clip, binding); + + var containsPosition = binding.propertyName.Contains("m_LocalPosition"); + var containsScale = binding.propertyName.Contains("m_LocalScale"); + var containsRotation = binding.propertyName.ToLowerInvariant().Contains("localrotation"); + var containsEuler = binding.propertyName.ToLowerInvariant().Contains("localeuler"); + var containsBlendShapeWeight = binding.propertyName.StartsWith("blendShape.", StringComparison.Ordinal); + var containsCompatibleData = containsPosition || containsScale || containsRotation || containsEuler || containsBlendShapeWeight; + + if (!containsCompatibleData && !settings.UseAnimationPointer) + { + Debug.LogWarning("No compatible data found in clip binding: " + binding.propertyName, clip); + continue; + } + + if (!targetCurves.ContainsKey(binding.path)) + { + TargetCurveSet curveSet = new TargetCurveSet(); + curveSet.Init(); + targetCurves.Add(binding.path, curveSet); + } + + TargetCurveSet current = targetCurves[binding.path]; + + if (containsPosition) + { + if (binding.propertyName.Contains(".x")) + current.translationCurves[0] = curve; + else if (binding.propertyName.Contains(".y")) + current.translationCurves[1] = curve; + else if (binding.propertyName.Contains(".z")) + current.translationCurves[2] = curve; + } + else if (containsScale) + { + if (binding.propertyName.Contains(".x")) + current.scaleCurves[0] = curve; + else if (binding.propertyName.Contains(".y")) + current.scaleCurves[1] = curve; + else if (binding.propertyName.Contains(".z")) + current.scaleCurves[2] = curve; + } + else if (containsRotation) + { + if (binding.propertyName.Contains(".x")) + current.rotationCurves[0] = curve; + else if (binding.propertyName.Contains(".y")) + current.rotationCurves[1] = curve; + else if (binding.propertyName.Contains(".z")) + current.rotationCurves[2] = curve; + else if (binding.propertyName.Contains(".w")) + current.rotationCurves[3] = curve; + } + // Takes into account 'localEuler', 'localEulerAnglesBaked' and 'localEulerAnglesRaw' + else if (containsEuler) + { + if (binding.propertyName.Contains(".x")) + current.rotationCurves[0] = curve; + else if (binding.propertyName.Contains(".y")) + current.rotationCurves[1] = curve; + else if (binding.propertyName.Contains(".z")) + current.rotationCurves[2] = curve; + } + // ReSharper disable once ConditionIsAlwaysTrueOrFalse + else if (containsBlendShapeWeight) + { + var weightName = binding.propertyName.Substring("blendShape.".Length); + current.weightCurves.Add(weightName, curve); + } + else if (settings.UseAnimationPointer) + { + var obj = AnimationUtility.GetAnimatedObject(root, binding); + if (obj) + { + current.AddPropertyCurves(obj, curve, binding); + targetCurves[binding.path] = current; + } + + continue; + } + + targetCurves[binding.path] = current; + } + + // object reference curves - in some cases animated data can be contained in here, e.g. for SpriteRenderers. + // this only makes sense when AnimationPointer is on, and someone needs to resolve the data to something in the glTF later via KHR_animation_pointer_Resolver + if (settings.UseAnimationPointer) + { + var objectBindings = AnimationUtility.GetObjectReferenceCurveBindings(clip); + foreach (var binding in objectBindings) + { + var obj = AnimationUtility.GetAnimatedObject(root, binding); + switch (obj) + { + case SpriteRenderer spriteRenderer: + if (!spriteRenderer.sprite) continue; + if (binding.propertyName != "m_Sprite") continue; + + var spriteSheet = spriteRenderer.sprite; + var spriteSheetPath = AssetDatabase.GetAssetPath(spriteSheet); + // will only work with all sprites from the same spritesheet right now + var sprites = AssetDatabase.LoadAllAssetRepresentationsAtPath(spriteSheetPath); + + var path = binding.propertyName; + if (!targetCurves.ContainsKey(path)) + { + var curveSet = new TargetCurveSet(); + curveSet.Init(); + targetCurves.Add(path, curveSet); + } + + TargetCurveSet current = targetCurves[path]; + var objectKeys = AnimationUtility.GetObjectReferenceCurve(clip, binding); + var curve = new AnimationCurve(); + var keyframes = new List(); + var lastKeyframe = default(Keyframe); + for (var index = 0; index < objectKeys.Length; index++) + { + var objectKey = objectKeys[index]; + var spriteIndex = objectKeys[index].value ? Array.IndexOf(sprites, objectKeys[index].value) : 0; + var kf = new Keyframe(objectKey.time, spriteIndex); + + // create intermediate keyframe to make sure we dont have interpolation between sprites + // TODO better would be to allow configuring a constant track + if ((int)lastKeyframe.value != (int)kf.value) + { + var intermediate = new Keyframe(kf.time - 0.0001f, lastKeyframe.value); + keyframes.Add(intermediate); + } + keyframes.Add(kf); + lastKeyframe = kf; + } + curve.keys = keyframes.ToArray(); + current.AddPropertyCurves(obj, curve, binding); + targetCurves[path] = current; + + break; + } + } + } + +#endif + } + + private void GenerateMissingCurves(float endTime, Transform tr, ref Dictionary targetCurvesBinding) + { + var keyList = targetCurvesBinding.Keys.ToList(); + foreach (string target in keyList) + { + Transform targetTr = target.Length > 0 ? tr.Find(target) : tr; + if (targetTr == null) + continue; + + TargetCurveSet current = targetCurvesBinding[target]; + + if (current.weightCurves.Count > 0) + { + // need to sort and generate the other matching curves as constant curves for all blend shapes + var renderer = targetTr.GetComponent(); + var mesh = renderer.sharedMesh; + var shapeCount = mesh.blendShapeCount; + + // need to reorder weights: Unity stores the weights alphabetically in the AnimationClip, + // not in the order of the weights. + var newWeights = new Dictionary(); + for (int i = 0; i < shapeCount; i++) + { + var shapeName = mesh.GetBlendShapeName(i); + var shapeCurve = current.weightCurves.ContainsKey(shapeName) ? current.weightCurves[shapeName] : CreateConstantCurve(renderer.GetBlendShapeWeight(i), endTime); + newWeights.Add(shapeName, shapeCurve); + } + + current.weightCurves = newWeights; + } + + if (current.propertyCurves?.Count > 0) + { + foreach (var kvp in current.propertyCurves) + { + var prop = kvp.Value; + if (prop.propertyType == typeof(Color)) + { + var memberName = prop.propertyName; + if (TryGetCurrentValue(prop.target, memberName, out var value)) + { + // Generate missing color channels (so an animated color has always keyframes for all 4 channels) + + var col = (Color)value; + + var hasRedChannel = prop.FindIndex(v => v.EndsWith(".r")) >= 0; + var hasGreenChannel = prop.FindIndex(v => v.EndsWith(".g")) >= 0; + var hasBlueChannel = prop.FindIndex(v => v.EndsWith(".b")) >= 0; + var hasAlphaChannel = prop.FindIndex(v => v.EndsWith(".a")) >= 0; + + if (!hasRedChannel) AddMissingCurve(memberName + ".r", col.r); + if (!hasGreenChannel) AddMissingCurve(memberName + ".g", col.g); + if (!hasBlueChannel) AddMissingCurve(memberName + ".b", col.b); + if (!hasAlphaChannel) AddMissingCurve(memberName + ".a", col.a); + + void AddMissingCurve(string curveName, float constantValue) + { + var curve = CreateConstantCurve(constantValue, endTime); + prop.curve.Add(curve); + prop.curveName.Add(curveName); + } + } + } + } + } + + targetCurvesBinding[target] = current; + } + } + + private static readonly Dictionary<(Type type, string name), MemberInfo> memberCache = new Dictionary<(Type type, string name), MemberInfo>(); + private static bool TryGetCurrentValue(object instance, string memberName, out object value) + { + if (instance == null || memberName == null) + { + value = null; + return false; + } + + var key = (instance.GetType(), memberName); + if (!memberCache.TryGetValue(key, out var member)) + { + var type = instance.GetType(); + while (type != null) + { + member = type + .GetMember(memberName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) + .FirstOrDefault(); + if (member != null) + { + memberCache.Add(key, member); + break; + } + type = type.BaseType; + } + } + + if (member == null) + { + value = null; + return false; + } + + switch (member) + { + case FieldInfo field: + value = field.GetValue(instance); + return true; + case PropertyInfo property: + value = property.GetValue(instance); + return true; + default: + value = null; + return false; + } + } + + private AnimationCurve CreateConstantCurve(float value, float endTime) + { + // No translation curves, adding them + AnimationCurve curve = new AnimationCurve(); + curve.AddKey(0, value); + curve.AddKey(endTime, value); + return curve; + } + + private bool BakePropertyAnimation(PropertyCurve prop, float length, float bakingFramerate, float speedMultiplier, out float[] times, out object[] values) + { + times = null; + values = null; + + if (!prop.Validate()) return false; + + var nbSamples = Mathf.Max(1, Mathf.CeilToInt(length * bakingFramerate)); + var deltaTime = length / nbSamples; + + var _times = new List(nbSamples * 2); + var _values = new List(nbSamples * 2); + + var curveCount = prop.curve.Count; + var keyframes = prop.curve.Select(x => x.keys).ToArray(); + var keyframeIndex = new int[curveCount]; + + prop.SortCurves(); + + var vector3Scale = SchemaExtensions.CoordinateSpaceConversionScale.ToUnityVector3Raw(); + + // Assuming all the curves exist now + for (var i = 0; i < nbSamples; ++i) + { + var time = i * deltaTime; + if (i == nbSamples - 1) time = length; + + for (var k = 0; k < curveCount; k++) + while (keyframeIndex[k] < keyframes[k].Length - 1 && keyframes[k][keyframeIndex[k]].time < time) + keyframeIndex[k]++; + + var isConstant = false; + for (var k = 0; k < curveCount; k++) + isConstant |= float.IsInfinity(keyframes[k][keyframeIndex[k]].inTangent); + + if (isConstant && _times.Count > 0) + { + var lastTime = _times[_times.Count - 1]; + var t0 = lastTime + 0.0001f; + if (i != nbSamples - 1) + time += deltaTime * 0.999f; + _times.Add(t0 / speedMultiplier); + _times.Add(time / speedMultiplier); + var success = AddValue(time); + success &= AddValue(time); + if (!success) return false; + } + else + { + var t0 = time / speedMultiplier; + _times.Add(t0); + if (!AddValue(t0)) return false; + } + + bool AddValue(float t) + { + if (prop.curve.Count == 1) + { + var value = prop.curve[0].Evaluate(t); + _values.Add(value); + } + else + { + var type = prop.propertyType; + + if (typeof(Vector2) == type) + { + _values.Add(new Vector2(prop.Evaluate(t, 0), prop.Evaluate(t, 1))); + } + else if (typeof(Vector3) == type) + { + var vec = new Vector3(prop.Evaluate(t, 0), prop.Evaluate(t, 1), prop.Evaluate(t, 2)); + _values.Add(vec); + } + else if (typeof(Vector4) == type) + { + _values.Add(new Vector4(prop.Evaluate(t, 0), prop.Evaluate(t, 1), prop.Evaluate(t, 2), prop.Evaluate(t, 3))); + } + else if (typeof(Color) == type) + { + // TODO should actually access r,g,b,a separately since any of these can have curves assigned. + var r = prop.Evaluate(t, 0); + var g = prop.Evaluate(t, 1); + var b = prop.Evaluate(t, 2); + var a = prop.Evaluate(t, 3); + _values.Add(new Color(r, g, b, a)); + } + else if (typeof(Quaternion) == type) + { + if (prop.curve.Count == 3) + { + Quaternion eulerToQuat = Quaternion.Euler(prop.Evaluate(t, 0), prop.Evaluate(t, 1), prop.Evaluate(t, 2)); + _values.Add(new Quaternion(eulerToQuat.x, eulerToQuat.y, eulerToQuat.z, eulerToQuat.w)); + } + else if (prop.curve.Count == 4) + { + _values.Add(new Quaternion(prop.Evaluate(t, 0), prop.Evaluate(t, 1), prop.Evaluate(t, 2), prop.Evaluate(t, 3))); + } + else + { + Debug.LogError(null, $"Rotation animation has {prop.curve.Count} curves, expected Euler Angles (3 curves) or Quaternions (4 curves). This is not supported, make sure to animate all components of rotations. Animated object {prop.target}", prop.target); + } + } + else if (typeof(float) == type) + { + foreach (var val in prop.curve) + _values.Add(val.Evaluate(t)); + } + else + { + switch (prop.propertyName) + { + case "MotionT": + case "MotionQ": + // Ignore + break; + default: + Debug.LogWarning(null, "Property is animated but can't be exported - Name: " + prop.propertyName + ", Type: " + prop.propertyType + ". Does its target exist? You can enable KHR_animation_pointer export in the Project Settings to export more animated properties."); + break; + + } + return false; + } + } + + return true; + } + } + + times = _times.ToArray(); + values = _values.ToArray(); + + RemoveUnneededKeyframes(ref times, ref values); + + return true; + } +#endif + + [Obsolete("Please use " + nameof(GetTransformIndex), false)] + public int GetNodeIdFromTransform(Transform transform) + { + return GetTransformIndex(transform); + } + + internal int GetIndex(object obj) + { + switch (obj) + { + case Material m: return GetMaterialIndex(m); + case Light l: return GetLightIndex(l); + case Camera c: return GetCameraIndex(c); + case Transform t: return GetTransformIndex(t); + case GameObject g: return GetTransformIndex(g.transform); + case Component k: return GetTransformIndex(k.transform); + } + + return -1; + } + + public int GetTransformIndex(Transform transform) + { + if (transform && _exportedTransforms.TryGetValue(transform.GetInstanceID(), out var index)) return index; + return -1; + } + + public int GetMaterialIndex(Material mat) + { + if (mat && _exportedMaterials.TryGetValue(mat.GetInstanceID(), out var index)) return index; + return -1; + } + + public int GetLightIndex(Light light) + { + if (light && _exportedLights.TryGetValue(light.GetInstanceID(), out var index)) return index; + return -1; + } + + public int GetCameraIndex(Camera cam) + { + if (cam && _exportedCameras.TryGetValue(cam.GetInstanceID(), out var index)) return index; + return -1; + } + + public IEnumerable<(int subMeshIndex, MeshPrimitive prim)> GetPrimitivesForMesh(Mesh mesh) + { + if (!_meshToPrims.TryGetValue(mesh, out var prims)) yield break; + foreach (var k in prims.subMeshPrimitives) + { + yield return (k.Key, k.Value); + } + } + + private static void DecomposeEmissionColor(Color input, out Color output, out float intensity) + { + var emissiveAmount = input.linear; + var maxEmissiveAmount = Mathf.Max(emissiveAmount.r, emissiveAmount.g, emissiveAmount.b); + if (maxEmissiveAmount > 1) + { + emissiveAmount.r /= maxEmissiveAmount; + emissiveAmount.g /= maxEmissiveAmount; + emissiveAmount.b /= maxEmissiveAmount; + } + emissiveAmount.a = Mathf.Clamp01(emissiveAmount.a); + + // this feels wrong but leads to the right results, probably the above calculations are in the wrong color space + maxEmissiveAmount = Mathf.LinearToGammaSpace(maxEmissiveAmount); + + output = emissiveAmount; + intensity = maxEmissiveAmount; + } + + private static void DecomposeScaleOffset(Vector4 input, out Vector2 scale, out Vector2 offset) + { + scale = new Vector2(input.x, input.y); + offset = new Vector2(input.z, 1 - input.w - input.y); + } + + private bool ArrayRangeEquals(object[] array, int sectionLength, int lastExportedSectionStart, int prevSectionStart, int sectionStart, int nextSectionStart) + { + var equals = true; + for (int i = 0; i < sectionLength; i++) + { + equals &= (lastExportedSectionStart >= prevSectionStart || array[lastExportedSectionStart + i].Equals(array[sectionStart + i])) && + array[prevSectionStart + i].Equals(array[sectionStart + i]) && + array[sectionStart + i].Equals(array[nextSectionStart + i]); + if (!equals) return false; + } + + return true; + } + + public void RemoveUnneededKeyframes(ref float[] times, ref object[] values) + { + if (times.Length == 1) + return; + + removeAnimationUnneededKeyframesMarker.Begin(); + + var t2 = new List(times.Length); + var v2 = new List(values.Length); + + var arraySize = values.Length / times.Length; + + if (arraySize == 1) + { + t2.Add(times[0]); + v2.Add(values[0]); + + int lastExportedIndex = 0; + for (int i = 1; i < times.Length - 1; i++) + { + removeAnimationUnneededKeyframesCheckIdenticalMarker.Begin(); + var isIdentical = (lastExportedIndex >= i - 1 || values[lastExportedIndex].Equals(values[i])) && values[i - 1].Equals(values[i]) && values[i].Equals(values[i + 1]); + if (!isIdentical) + { + lastExportedIndex = i; + t2.Add(times[i]); + v2.Add(values[i]); + } + removeAnimationUnneededKeyframesCheckIdenticalMarker.End(); + } + + var max = times.Length - 1; + t2.Add(times[max]); + v2.Add(values[max]); + } + else + { + var singleFrameWeights = new object[arraySize]; + Array.Copy(values, 0, singleFrameWeights, 0, arraySize); + t2.Add(times[0]); + v2.AddRange(singleFrameWeights); + + int lastExportedIndex = 0; + for (int i = 1; i < times.Length - 1; i++) + { + removeAnimationUnneededKeyframesCheckIdenticalMarker.Begin(); + var isIdentical = ArrayRangeEquals(values, arraySize, lastExportedIndex * arraySize, (i - 1) * arraySize, i * arraySize, (i + 1) * arraySize); + if (!isIdentical) + { + Array.Copy(values, (i - 1) * arraySize, singleFrameWeights, 0, arraySize); + v2.AddRange(singleFrameWeights); + t2.Add(times[i]); + } + + removeAnimationUnneededKeyframesCheckIdenticalMarker.End(); + } + + var max = times.Length - 1; + t2.Add(times[max]); + var skipped = values.Skip((max - 1) * arraySize).ToArray(); + v2.AddRange(skipped.Take(arraySize)); + } + + times = t2.ToArray(); + values = v2.ToArray(); + + removeAnimationUnneededKeyframesMarker.End(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs.meta new file mode 100644 index 0000000..a186f00 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a4e5800392410254a94542e26677d4e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs new file mode 100644 index 0000000..dfc8d66 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs @@ -0,0 +1,207 @@ +#if UNITY_EDITOR +#define ANIMATION_EXPORT_SUPPORTED +#endif + +#if ANIMATION_EXPORT_SUPPORTED && (UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER) +#define ANIMATION_SUPPORTED +#endif + +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEngine; +using UnityEngine.Animations; +using UnityEngine.Playables; +using UnityGLTF.Timeline; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { +#if ANIMATION_SUPPORTED + internal void CollectClipCurvesBySampling(GameObject root, AnimationClip clip, Dictionary targetCurves) + { + var recorder = new GLTFRecorder(root.transform, false, false, false); + + var playableGraph = PlayableGraph.Create(); + var animationClipPlayable = (Playable) AnimationClipPlayable.Create(playableGraph, clip); + + var rigs = root.GetComponents(); + if (rigs != null) + { + foreach (var rig in rigs) + { + rig.StopPreview(); // seems to be needed in some cases because the Rig isn't properly marked as non-initialized by Unity + rig.StartPreview(); + animationClipPlayable = rig.BuildPreviewGraph(playableGraph, animationClipPlayable); // modifies the playable to include Animation Rigging data + } + } + else + { + rigs = System.Array.Empty(); + } + + var playableOutput = AnimationPlayableOutput.Create(playableGraph, "Animation", root.GetComponent()); + playableOutput.SetSourcePlayable(animationClipPlayable); + playableGraph.SetTimeUpdateMode(DirectorUpdateMode.Manual); + + var timeStep = 1.0f / 30.0f; + var length = clip.length; + var time = 0f; + +#if UNITY_2020_1_OR_NEWER + // This seems to not properly cleanup when exporting animation from inside a prefab asset + // e.g. when exporting animator with humanoid animation the animator is left disabled after this + // the animator is disabled after the first call to `SampleAnimationClip` + var driver = ScriptableObject.CreateInstance(); + AnimationMode.StartAnimationMode(driver); +#else + AnimationMode.StartAnimationMode(); +#endif + AnimationMode.BeginSampling(); + + // if this is a Prefab, we need to collect property modifications here to work around + // limitations of AnimationMode - otherwise prefab modifications will persist... + var isPrefabAsset = PrefabUtility.IsPartOfPrefabAsset(root); + var prefabModifications = isPrefabAsset ? PrefabUtility.GetPropertyModifications(root) : default; + Undo.RegisterFullObjectHierarchyUndo(root, "Animation Sampling"); + + // add the root since we need to shift it around - + // it will be reset when exiting AnimationMode again and will not be dirty. + AnimationMode_AddTransformTRS(root); + + // TODO not entirely sure if only checking for humanMotion here is correct + if (clip.isHumanMotion) + { + root.transform.localPosition = Vector3.zero; + root.transform.localRotation = Quaternion.identity; + // root.transform.localScale = Vector3.one; + } + + // first frame + foreach (var rig in rigs) rig.UpdatePreviewGraph(playableGraph); + AnimationMode.SamplePlayableGraph(playableGraph, 0, time); + + // for Animation Rigging its often desired to have one complete loop first, so we need to prewarm to have a nice exportable animation + var prewarm = rigs.Length > 0 && clip.isLooping; + if (prewarm) + { + while (time + timeStep < length) + { + time += timeStep; + foreach (var rig in rigs) rig.UpdatePreviewGraph(playableGraph); + AnimationMode.SamplePlayableGraph(playableGraph, 0, time); + } + + // reset time to the start + time = 0; + } + + recorder.StartRecording(time); + + while (time + timeStep < length) + { + time += timeStep; + foreach (var rig in rigs) rig.UpdatePreviewGraph(playableGraph); + AnimationMode.SamplePlayableGraph(playableGraph, 0, time); + recorder.UpdateRecording(time); + } + + // last frame + time = length; + foreach (var rig in rigs) rig.UpdatePreviewGraph(playableGraph); + AnimationMode.SamplePlayableGraph(playableGraph, 0, time); + recorder.UpdateRecording(time); + + foreach (var rig in rigs) rig.StopPreview(); + + AnimationMode.EndSampling(); +#if UNITY_2020_1_OR_NEWER + AnimationMode.StopAnimationMode(driver); +#else + AnimationMode.StopAnimationMode(); +#endif + + // reset prefab modifications if this was a prefab asset + if (isPrefabAsset) { + PrefabUtility.SetPropertyModifications(root, prefabModifications); + } + + // seems to be necessary because the animation sampling API doesn't fully work; + // sometimes samples still "leak" into property modifications + Undo.FlushUndoRecordObjects(); + Undo.PerformUndo(); + + recorder.EndRecording(out var data); + if (data == null || !data.Any()) return; + + string CalculatePath(Transform child, Transform parent) + { + if (child == parent) return ""; + if (child.parent == null) return ""; + var parentPath = CalculatePath(child.parent, parent); + if (!string.IsNullOrEmpty(parentPath)) return parentPath + "/" + child.name; + return child.name; + } + + // convert AnimationData back to AnimationCurve (slow) + // better would be to directly emit the animation here, but then we need to be careful with partial hierarchies + // and other cases that can go wrong. + foreach (var kvp in data) + { + var curveSet = new TargetCurveSet(); + curveSet.Init(); + + var positionTrack = kvp.Value.tracks.FirstOrDefault(x => x.propertyName == "translation"); + if (positionTrack != null) + { + var t0 = positionTrack.times; + var frameData = positionTrack.values; + var posX = new AnimationCurve(t0.Select((value, index) => new Keyframe((float)value, ((Vector3)frameData[index]).x)).ToArray()); + var posY = new AnimationCurve(t0.Select((value, index) => new Keyframe((float)value, ((Vector3)frameData[index]).y)).ToArray()); + var posZ = new AnimationCurve(t0.Select((value, index) => new Keyframe((float)value, ((Vector3)frameData[index]).z)).ToArray()); + curveSet.translationCurves = new [] { posX, posY, posZ }; + } + + var rotationTrack = kvp.Value.tracks.FirstOrDefault(x => x.propertyName == "rotation"); + if (rotationTrack != null) + { + var t1 = rotationTrack.times; + var frameData = rotationTrack.values; + var rotX = new AnimationCurve(t1.Select((value, index) => new Keyframe((float)value, ((Quaternion)frameData[index]).x)).ToArray()); + var rotY = new AnimationCurve(t1.Select((value, index) => new Keyframe((float)value, ((Quaternion)frameData[index]).y)).ToArray()); + var rotZ = new AnimationCurve(t1.Select((value, index) => new Keyframe((float)value, ((Quaternion)frameData[index]).z)).ToArray()); + var rotW = new AnimationCurve(t1.Select((value, index) => new Keyframe((float)value, ((Quaternion)frameData[index]).w)).ToArray()); + curveSet.rotationCurves = new [] { rotX, rotY, rotZ, rotW }; + } + + var scaleTrack = kvp.Value.tracks.FirstOrDefault(x => x.propertyName == "scale"); + if (scaleTrack != null) + { + var t2 = scaleTrack.times; + var frameData = scaleTrack.values; + var sclX = new AnimationCurve(t2.Select((value, index) => new Keyframe((float)value, ((Vector3)frameData[index]).x)).ToArray()); + var sclY = new AnimationCurve(t2.Select((value, index) => new Keyframe((float)value, ((Vector3)frameData[index]).y)).ToArray()); + var sclZ = new AnimationCurve(t2.Select((value, index) => new Keyframe((float)value, ((Vector3)frameData[index]).z)).ToArray()); + curveSet.scaleCurves = new [] { sclX, sclY, sclZ }; + } + + var calculatedPath = CalculatePath(kvp.Key, root.transform); + targetCurves[calculatedPath] = curveSet; + } + } + + private static MethodInfo _AddTransformTRS; + private static void AnimationMode_AddTransformTRS(GameObject gameObject) + { + if (!gameObject) return; + if (_AddTransformTRS == null) _AddTransformTRS = typeof(AnimationMode).GetMethod("AddTransformTRS", (BindingFlags)(-1)); + _AddTransformTRS?.Invoke(null, new object[] { gameObject, "" }); + } +#endif + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs.meta new file mode 100644 index 0000000..c2b8567 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationHumanoid.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 16ea658e76ce4a14b5ef14d825c52147 +timeCreated: 1662914636 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs new file mode 100644 index 0000000..7d8a308 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs @@ -0,0 +1,609 @@ +using System; +using System.Collections.Generic; +using GLTF.Schema; +using GLTF.Schema.KHR_lights_punctual; +using UnityEngine; +using UnityGLTF.Extensions; +using UnityGLTF.JsonPointer; +using Object = UnityEngine.Object; + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + internal readonly List pointerResolvers = new List(); + private readonly KHR_animation_pointer_Resolver animationPointerResolver = new KHR_animation_pointer_Resolver(); + +#region Shader Property Names + // ReSharper disable InconsistentNaming + + private static readonly int _MainTex = Shader.PropertyToID("_MainTex"); + private static readonly int _BaseMap = Shader.PropertyToID("_BaseMap"); + private static readonly int _BaseColorTexture = Shader.PropertyToID("_BaseColorTexture"); + private static readonly int baseColorTexture = Shader.PropertyToID("baseColorTexture"); + private static readonly int _EmissionMap = Shader.PropertyToID("_EmissionMap"); + private static readonly int _EmissiveTexture = Shader.PropertyToID("_EmissiveTexture"); + private static readonly int emissiveTexture = Shader.PropertyToID("emissiveTexture"); + private static readonly int _BumpMap = Shader.PropertyToID("_BumpMap"); + private static readonly int _NormalTexture = Shader.PropertyToID("_NormalTexture"); + private static readonly int normalTexture = Shader.PropertyToID("normalTexture"); + private static readonly int _OcclusionMap = Shader.PropertyToID("_OcclusionMap"); + private static readonly int _OcclusionTexture = Shader.PropertyToID("_OcclusionTexture"); + private static readonly int occlusionTexture = Shader.PropertyToID("occlusionTexture"); + + // ReSharper restore InconsistentNaming +#endregion + + public void RegisterResolver(IJsonPointerResolver resolver) + { + if (!pointerResolvers.Contains(resolver)) + pointerResolvers.Add(resolver); + } + + public void AddAnimationData(Object animatedObject, string propertyName, GLTFAnimation animation, float[] times, object[] values) + { + if (!animatedObject) return; + + // TODO should skip property switches that are not supported without KHR_animation_pointer + // TODO should probably start with the transform check below and stop afterwards if KHR_animation_pointer is off + + if (values.Length <= 0) return; + for (var i = 0; i < values.Length; i++) + { + if (values[i] != null) continue; + + Debug.LogError($"GLTFExporter error: value {i} in animated property \"{propertyName}\" is null. Skipping", animatedObject); + return; + } + + var channelTargetId = GetIndex(animatedObject); + if (channelTargetId < 0) + { + Debug.LogWarning($"An animated {animatedObject.GetType()} has not been exported, is the object disabled? {animatedObject.name} (InstanceID: {animatedObject.GetInstanceID()})", animatedObject); + return; + } + + bool flipValueRange = false; + float? valueMultiplier = null; + bool isTextureTransform = false; + bool keepColorAlpha = true; + string secondPropertyName = null; + string extensionName = null; + + switch (animatedObject) + { + case Material material: + // Debug.Log("material: " + material + ", propertyName: " + propertyName); + // mapping from known Unity property names to glTF property names + switch (propertyName) + { + case "_Color": + case "_BaseColor": + case "_BaseColorFactor": + case "baseColorFactor": + propertyName = "pbrMetallicRoughness/baseColorFactor"; + break; + case "_Smoothness": + case "_Glossiness": + propertyName = "pbrMetallicRoughness/roughnessFactor"; + flipValueRange = true; + break; + case "_Roughness": + case "_RoughnessFactor": + case "roughnessFactor": + propertyName = "pbrMetallicRoughness/roughnessFactor"; + break; + case "_Metallic": + case "_MetallicFactor": + case "metallicFactor": + propertyName = "pbrMetallicRoughness/metallicFactor"; + break; + case "_MainTex_ST": + case "_BaseMap_ST": + case "_BaseColorTexture_ST": + case "baseColorTexture_ST": + if (!(material.HasProperty(_MainTex) && material.GetTexture(_MainTex)) && + !(material.HasProperty(_BaseMap) && material.GetTexture(_BaseMap)) && + !(material.HasProperty(_BaseColorTexture) && material.GetTexture(_BaseColorTexture)) && + !(material.HasProperty(baseColorTexture) && material.GetTexture(baseColorTexture))) return; + propertyName = $"pbrMetallicRoughness/baseColorTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.SCALE}"; + secondPropertyName = $"pbrMetallicRoughness/baseColorTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.OFFSET}"; + isTextureTransform = true; + extensionName = ExtTextureTransformExtensionFactory.EXTENSION_NAME; + break; + case "_EmissionColor": + case "_EmissiveFactor": + case "emissiveFactor": + propertyName = "emissiveFactor"; + secondPropertyName = $"extensions/{KHR_materials_emissive_strength_Factory.EXTENSION_NAME}/{nameof(KHR_materials_emissive_strength.emissiveStrength)}"; + extensionName = KHR_materials_emissive_strength_Factory.EXTENSION_NAME; + keepColorAlpha = false; + break; + case "_EmissionMap_ST": + case "_EmissiveTexture_ST": + case "emissiveTexture_ST": + if (!(material.HasProperty(_EmissionMap) && material.GetTexture(_EmissionMap)) && + !(material.HasProperty(_EmissiveTexture) && material.GetTexture(_EmissiveTexture)) && + !(material.HasProperty(emissiveTexture) && material.GetTexture(emissiveTexture))) return; + propertyName = $"emissiveTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.SCALE}"; + secondPropertyName = $"emissiveTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.OFFSET}"; + isTextureTransform = true; + extensionName = ExtTextureTransformExtensionFactory.EXTENSION_NAME; + break; + case "_Cutoff": + case "_AlphaCutoff": + case "alphaCutoff": + propertyName = "alphaCutoff"; + break; + case "_BumpScale": + case "_NormalScale": + case "normalScale": + case "normalTextureScale": + propertyName = "normalTexture/scale"; + break; + case "_BumpMap_ST": + case "_NormalTexture_ST": + case "normalTexture_ST": + if (!(material.HasProperty(_BumpMap) && material.GetTexture(_BumpMap)) && + !(material.HasProperty(_NormalTexture) && material.GetTexture(_NormalTexture)) && + !(material.HasProperty(normalTexture) && material.GetTexture(normalTexture))) return; + propertyName = $"normalTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.SCALE}"; + secondPropertyName = $"normalTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.OFFSET}"; + isTextureTransform = true; + extensionName = ExtTextureTransformExtensionFactory.EXTENSION_NAME; + break; + case "_OcclusionStrength": + case "occlusionStrength": + case "occlusionTextureStrength": + propertyName = "occlusionTexture/strength"; + break; + case "_OcclusionMap_ST": + case "_OcclusionTexture_ST": + case "occlusionTexture_ST": + if (!(material.HasProperty(_OcclusionMap) && material.GetTexture(_OcclusionMap)) && + !(material.HasProperty(_OcclusionTexture) && material.GetTexture(_OcclusionTexture)) && + !(material.HasProperty(occlusionTexture) && material.GetTexture(occlusionTexture))) return; + propertyName = $"occlusionTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.SCALE}"; + secondPropertyName = $"occlusionTexture/extensions/{ExtTextureTransformExtensionFactory.EXTENSION_NAME}/{ExtTextureTransformExtensionFactory.OFFSET}"; + isTextureTransform = true; + extensionName = ExtTextureTransformExtensionFactory.EXTENSION_NAME; + break; + + // TODO metallic/roughness _ST + + // KHR_materials_transmission + case "_TransmissionFactor": + case "transmissionFactor": + propertyName = $"extensions/{KHR_materials_transmission_Factory.EXTENSION_NAME}/{nameof(KHR_materials_transmission.transmissionFactor)}"; + extensionName = KHR_materials_transmission_Factory.EXTENSION_NAME; + break; + + // KHR_materials_volume + case "_ThicknessFactor": + case "thicknessFactor": + propertyName = $"extensions/{KHR_materials_volume_Factory.EXTENSION_NAME}/{nameof(KHR_materials_volume.thicknessFactor)}"; + extensionName = KHR_materials_volume_Factory.EXTENSION_NAME; + break; + case "_AttenuationDistance": + case "attenuationDistance": + propertyName = $"extensions/{KHR_materials_volume_Factory.EXTENSION_NAME}/{nameof(KHR_materials_volume.attenuationDistance)}"; + extensionName = KHR_materials_volume_Factory.EXTENSION_NAME; + break; + case "_AttenuationColor": + case "attenuationColor": + propertyName = $"extensions/{KHR_materials_volume_Factory.EXTENSION_NAME}/{nameof(KHR_materials_volume.attenuationColor)}"; + extensionName = KHR_materials_volume_Factory.EXTENSION_NAME; + keepColorAlpha = false; + break; + + // KHR_materials_ior + case "_IOR": + case "ior": + propertyName = $"extensions/{KHR_materials_ior_Factory.EXTENSION_NAME}/{nameof(KHR_materials_ior.ior)}"; + extensionName = KHR_materials_ior_Factory.EXTENSION_NAME; + break; + + // KHR_materials_iridescence + case "_IridescenceFactor": + case "iridescenceFactor": + propertyName = $"extensions/{KHR_materials_iridescence_Factory.EXTENSION_NAME}/{nameof(KHR_materials_iridescence.iridescenceFactor)}"; + extensionName = KHR_materials_iridescence_Factory.EXTENSION_NAME; + break; + case "_IridescenceIor": + case "iridescenceIor": + propertyName = $"extensions/{KHR_materials_iridescence_Factory.EXTENSION_NAME}/{nameof(KHR_materials_iridescence.iridescenceIor)}"; + extensionName = KHR_materials_iridescence_Factory.EXTENSION_NAME; + break; + case "_IridescenceThicknessMinimum": + case "iridescenceThicknessMinimum": + propertyName = $"extensions/{KHR_materials_iridescence_Factory.EXTENSION_NAME}/{nameof(KHR_materials_iridescence.iridescenceThicknessMinimum)}"; + extensionName = KHR_materials_iridescence_Factory.EXTENSION_NAME; + break; + case "_IridescenceThicknessMaximum": + case "iridescenceThicknessMaximum": + propertyName = $"extensions/{KHR_materials_iridescence_Factory.EXTENSION_NAME}/{nameof(KHR_materials_iridescence.iridescenceThicknessMaximum)}"; + extensionName = KHR_materials_iridescence_Factory.EXTENSION_NAME; + break; + + // KHR_materials_specular + case "_SpecularFactor": + case "specularFactor": + propertyName = $"extensions/{KHR_materials_specular_Factory.EXTENSION_NAME}/{nameof(KHR_materials_specular.specularFactor)}"; + extensionName = KHR_materials_specular_Factory.EXTENSION_NAME; + break; + case "_SpecularColorFactor": + case "specularColorFactor": + propertyName = $"extensions/{KHR_materials_specular_Factory.EXTENSION_NAME}/{nameof(KHR_materials_specular.specularColorFactor)}"; + extensionName = KHR_materials_specular_Factory.EXTENSION_NAME; + keepColorAlpha = false; + break; + + // TODO KHR_materials_clearcoat + // case "_ClearcoatFactor": + // case "clearcoatFactor": + // propertyName = $"extensions/{KHR_materials_clearcoat_Factory.EXTENSION_NAME}/{nameof(KHR_materials_clearcoat.clearcoatFactor)}"; + // extensionName = KHR_materials_clearcoat_Factory.EXTENSION_NAME; + // break; + // case "_ClearcoatRoughnessFactor": + // case "clearcoatRoughnessFactor": + // propertyName = $"extensions/{KHR_materials_clearcoat_Factory.EXTENSION_NAME}/{nameof(KHR_materials_clearcoat.clearcoatRoughnessFactor)}"; + // extensionName = KHR_materials_clearcoat_Factory.EXTENSION_NAME; + // break; + + // TODO KHR_materials_sheen + // case "_SheenColorFactor": + // case "sheenColorFactor": + // propertyName = $"extensions/{KHR_materials_sheen_Factory.EXTENSION_NAME}/{nameof(KHR_materials_sheen.sheenColorFactor)}"; + // extensionName = KHR_materials_sheen_Factory.EXTENSION_NAME; + // keepColorAlpha = false; + // break; + // case "_SheenRoughnessFactor": + // case "sheenRoughnessFactor": + // propertyName = $"extensions/{KHR_materials_sheen_Factory.EXTENSION_NAME}/{nameof(KHR_materials_sheen.sheenRoughnessFactor)}"; + // extensionName = KHR_materials_sheen_Factory.EXTENSION_NAME; + // break; + default: + Debug.Log(LogType.Warning, "Unknown property name on Material " + material + ": " + propertyName); + break; + } + break; + case Light light: + extensionName = KHR_lights_punctualExtensionFactory.EXTENSION_NAME; + switch (propertyName) + { + case "m_Color": + propertyName = $"color"; + keepColorAlpha = false; + break; + case "m_Intensity": + valueMultiplier = Mathf.PI; // matches ExportLight + propertyName = $"intensity"; + break; + case "m_SpotAngle": + valueMultiplier = Mathf.Deg2Rad / 2; + propertyName = $"spot/outerConeAngle"; + break; + case "m_InnerSpotAngle": + valueMultiplier = Mathf.Deg2Rad / 2; + propertyName = $"spot/innerConeAngle"; + break; + case "m_Range": + propertyName = "range"; + break; + default: + extensionName = null; + Debug.Log(LogType.Warning, "Unknown property name on Light " + light + ": " + propertyName); + break; + } + break; + case Camera camera: + if(camera.orthographic) + { + switch (propertyName) + { + case "orthographic size": + // TODO conversion factor + propertyName = "orthographic/ymag"; + secondPropertyName = "orthographic/xmag"; + break; + case "near clip plane": + propertyName = "orthographic/znear"; + break; + case "far clip plane": + propertyName = "orthographic/zfar"; + break; + default: + Debug.Log(LogType.Warning, "Unknown property name on Camera " + camera + ": " + propertyName); + break; + } + } + else + { + switch (propertyName) + { + case "field of view": + // TODO conversion factor + propertyName = "perspective/yfov"; + valueMultiplier = Mathf.Deg2Rad; + break; + case "near clip plane": + propertyName = "perspective/znear"; + break; + case "far clip plane": + propertyName = "perspective/zfar"; + break; + default: + Debug.Log(LogType.Warning, "Unknown property name on Camera " + camera + ": " + propertyName); + break; + } + } + break; + case SkinnedMeshRenderer skinnedMesh: + // this code is adapted from SkinnedMeshRendererEditor (which calculates the right range for sliders to show) + // instead of calculating per blend shape, we're assuming all blendshapes have the same min/max here though. + var minBlendShapeFrameWeight = 0.0f; + var maxBlendShapeFrameWeight = 0.0f; + + var sharedMesh = skinnedMesh.sharedMesh; + if (!sharedMesh) + { + Debug.Log(LogType.Error, "No mesh on SkinnedMeshRenderer " + skinnedMesh + ", skipping animation"); + return; + } + + var shapeCount = sharedMesh.blendShapeCount; + for (int index = 0; index < shapeCount; ++index) + { + var blendShapeFrameCount = sharedMesh.GetBlendShapeFrameCount(index); + for (var frameIndex = 0; frameIndex < blendShapeFrameCount; ++frameIndex) + { + var shapeFrameWeight = sharedMesh.GetBlendShapeFrameWeight(index, frameIndex); + minBlendShapeFrameWeight = Mathf.Min(shapeFrameWeight, minBlendShapeFrameWeight); + maxBlendShapeFrameWeight = Mathf.Max(shapeFrameWeight, maxBlendShapeFrameWeight); + } + } + + if (maxBlendShapeFrameWeight != 0) + valueMultiplier = 1.0f / maxBlendShapeFrameWeight; + + break; + case Transform _: + // generally allowed and already in the right format + break; + default: + // propertyName is exported as-is + // Debug.LogWarning($"Implicitly handling animated property \"{propertyName}\" for target {animatedObject}", animatedObject); + + // filtering for what to include / what not to include based on whether its target can be resolved + if (settings.UseAnimationPointer && animatedObject is Component _) + { + var couldResolve = false; + var prop = $"/nodes/{channelTargetId}/{propertyName}"; + foreach (var res in pointerResolvers) + { + // TODO: ideally we have a new method here to just ask the resolver if it supports that type + if (res.TryResolve(animatedObject, ref prop)) + { + couldResolve = true; + } + } + if (!couldResolve) + { + return; + } + } + break; + } + + var Node = new NodeId + { + Id = channelTargetId, + Root = _root + }; + + AccessorId timeAccessor = ExportAccessor(times); + + AnimationChannel Tchannel = new AnimationChannel(); + AnimationChannelTarget TchannelTarget = new AnimationChannelTarget() { Path = propertyName, Node = Node }; + Tchannel.Target = TchannelTarget; + + AnimationSampler Tsampler = new AnimationSampler(); + Tsampler.Input = timeAccessor; + + // for cases where one property needs to be split up into multiple tracks + // example: emissiveFactor * emissiveStrength + // TODO not needed when secondPropertyName==null + AnimationChannel Tchannel2 = new AnimationChannel(); + AnimationChannelTarget TchannelTarget2 = new AnimationChannelTarget() { Path = secondPropertyName, Node = Node }; + Tchannel2.Target = TchannelTarget2; + AnimationSampler Tsampler2 = new AnimationSampler(); + Tsampler2.Input = timeAccessor; + bool actuallyNeedSecondSampler = true; + + var val = values[0]; + switch (val) + { + case float _: + if (flipValueRange) + { + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => 1.0f - (float)e)); + } + else if (valueMultiplier.HasValue) + { + var multiplier = valueMultiplier.Value; + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => ((float)e) * multiplier)); + } + else + { + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => (float)e)); + + if (propertyName == "orthographic/ymag") + { + Tsampler2.Output = Tsampler.Output; + } + } + break; + case float[] _: + // check that all entries have the same length using a for loop + var firstLength = ((float[])values[0]).Length; + for (var i = 1; i < values.Length; i++) + { + if (((float[])values[i]).Length == firstLength) continue; + + Debug.Log(LogType.Error, "When animating float arrays, all array entries must have the same length. Skipping"); + return; + } + + // construct a float array of all the float arrays together + var floatArray = new float[values.Length * firstLength]; + + // copy the individual arrays into the float array using Array.Copy + for (int i = 0; i < values.Length; i++) + Array.Copy((float[])values[i], 0, floatArray, i * firstLength, firstLength); + + // glTF weights 0..1 match to Unity weights 0..100, but Unity weights can be in arbitrary ranges + if (valueMultiplier.HasValue) + { + for (var i = 0; i < floatArray.Length; i++) + floatArray[i] *= valueMultiplier.Value; + } + + Tsampler.Output = ExportAccessor(floatArray); + break; + case Vector2 _: + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => (Vector2)e)); + break; + case Vector3 _: + if (propertyName == "translation") + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => + { + var v = (Vector3)e; + v.Scale(new Vector3(-1, 1, 1)); + return v; + })); + else + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => (Vector3)e)); + break; + case Vector4 _: + if (!isTextureTransform) + { + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => (Vector4)e)); + } + else + { + var scales = new Vector2[values.Length]; + var offsets = new Vector2[values.Length]; + for (int i = 0; i < values.Length; i++) + { + DecomposeScaleOffset((Vector4) values[i], out var scale, out var offset); + scales[i] = scale; + offsets[i] = offset; + } + Tsampler.Output = ExportAccessor(scales); + Tsampler2.Output = ExportAccessor(offsets); + } + break; + case Quaternion _: + var animatedNode = _root.Nodes[channelTargetId]; + var needsFlippedLookDirection = animatedNode.Light != null || animatedNode.Camera != null; + Tsampler.Output = ExportAccessorSwitchHandedness(Array.ConvertAll(values, e => (Quaternion)e), needsFlippedLookDirection); // Vec4 for rotations + break; + case Color _: + if (propertyName == "emissiveFactor" && secondPropertyName != null) + { + var colors = new Color[values.Length]; + var strengths = new float[values.Length]; + actuallyNeedSecondSampler = false; + for (int i = 0; i < values.Length; i++) + { + DecomposeEmissionColor((Color) values[i], out var color, out var intensity); + colors[i] = color; + strengths[i] = intensity; + if (intensity > 1) + actuallyNeedSecondSampler = true; + } + Tsampler.Output = ExportAccessor(colors, false); + Tsampler2.Output = ExportAccessor(strengths); + } + else + { + Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => (Color)e), keepColorAlpha); + } + break; + } + + if (Tsampler.Output != null) Tsampler.Output.Value.BufferView.Value.ByteStride = 0; + if (Tsampler2.Output != null) Tsampler2.Output.Value.BufferView.Value.ByteStride = 0; + + if (Tsampler.Output == null) + { + Debug.LogError($"GLTFExporter: Something went wrong, empty sampler output for \"{propertyName}\" in {animatedObject}", animatedObject); + return; + } + + Tchannel.Sampler = new AnimationSamplerId + { + Id = animation.Samplers.Count, + GLTFAnimation = animation, + Root = _root + }; + animation.Samplers.Add(Tsampler); + animation.Channels.Add(Tchannel); + + if (settings.UseAnimationPointer) + ConvertToAnimationPointer(animatedObject, propertyName, TchannelTarget); + + // in some cases, extensions aren't required even when we think they might, e.g. for emission color animation. + // if all animated values are below 1, we don't need a separate channel for emissive_intensity. + if (!actuallyNeedSecondSampler) + { + extensionName = null; + secondPropertyName = null; + } + + if (extensionName != null) + { + DeclareExtensionUsage(extensionName, false); + + // add extension to material if needed + if(animatedObject is Material material) + { + var mat = GetMaterialId(_root, material); + if (mat.Value.Extensions == null || !mat.Value.Extensions.ContainsKey(extensionName)) + { + mat.Value.AddExtension(extensionName, GLTFProperty.CreateEmptyExtension(extensionName)); + } + } + } + + if (secondPropertyName != null) + { + Tchannel2.Sampler = new AnimationSamplerId + { + Id = animation.Samplers.Count, + GLTFAnimation = animation, + Root = _root + }; + animation.Samplers.Add(Tsampler2); + animation.Channels.Add(Tchannel2); + + if (settings.UseAnimationPointer) + ConvertToAnimationPointer(animatedObject, secondPropertyName, TchannelTarget2); + } + } + + void ConvertToAnimationPointer(object animatedObject, string propertyName, AnimationChannelTarget target) + { + var ext = new KHR_animation_pointer(); + ext.propertyBinding = propertyName; + ext.animatedObject = animatedObject; + ext.channel = target; + animationPointerResolver.Add(ext); + + target.Node = null; + target.Path = "pointer"; + target.AddExtension(KHR_animation_pointer.EXTENSION_NAME, ext); + DeclareExtensionUsage(KHR_animation_pointer.EXTENSION_NAME, false); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs.meta new file mode 100644 index 0000000..1f11999 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 23441437ac77a884d83d8ae32ae8b705 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs new file mode 100644 index 0000000..18c425d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using GLTF.Schema; +using UnityEngine; +using CameraType = GLTF.Schema.CameraType; + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + private Dictionary _exportedCameras; + + private CameraId ExportCamera(Camera unityCamera) + { + GLTFCamera camera = new GLTFCamera(); + //name + camera.Name = unityCamera.name; + + //type + bool isOrthographic = unityCamera.orthographic; + camera.Type = isOrthographic ? CameraType.orthographic : CameraType.perspective; + Matrix4x4 matrix = unityCamera.projectionMatrix; + + //matrix properties: compute the fields from the projection matrix + if (isOrthographic) + { + CameraOrthographic ortho = new CameraOrthographic(); + + ortho.XMag = 1 / matrix[0, 0]; + ortho.YMag = 1 / matrix[1, 1]; + + float farClip = (matrix[2, 3] / matrix[2, 2]) - (1 / matrix[2, 2]); + float nearClip = farClip + (2 / matrix[2, 2]); + ortho.ZFar = farClip; + ortho.ZNear = nearClip; + + camera.Orthographic = ortho; + } + else + { + CameraPerspective perspective = new CameraPerspective(); + float fov = 2 * Mathf.Atan(1 / matrix[1, 1]); + float aspectRatio = matrix[1, 1] / matrix[0, 0]; + perspective.YFov = fov; + perspective.AspectRatio = aspectRatio; + + if (matrix[2, 2] == -1) + { + //infinite projection matrix + float nearClip = matrix[2, 3] * -0.5f; + perspective.ZNear = nearClip; + } + else + { + //finite projection matrix + float farClip = matrix[2, 3] / (matrix[2, 2] + 1); + float nearClip = farClip * (matrix[2, 2] + 1) / (matrix[2, 2] - 1); + perspective.ZFar = farClip; + perspective.ZNear = nearClip; + } + camera.Perspective = perspective; + } + + var id = new CameraId + { + Id = _root.Cameras.Count, + Root = _root + }; + + // Register nodes for animation parsing (could be disabled if animation is disabled) + _exportedCameras.Add(unityCamera.GetInstanceID(), _root.Cameras.Count); + _root.Cameras.Add(camera); + + return id; + } + + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs.meta new file mode 100644 index 0000000..159e0b1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterCameras.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 44a8dfd50fa642f4baf09232690eeab2 +timeCreated: 1657013996 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs new file mode 100644 index 0000000..a724097 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using GLTF.Schema; +using GLTF.Schema.KHR_lights_punctual; +using UnityEngine; +using LightType = UnityEngine.LightType; + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + private Dictionary _exportedLights; + + private LightId ExportLight(Light unityLight) + { + GLTFLight light = null; + + if (unityLight.type == LightType.Spot) + { + // TODO URP/HDRP can distinguish here, no need to guess innerConeAngle there + light = new GLTFSpotLight() { innerConeAngle = unityLight.spotAngle / 2 * Mathf.Deg2Rad * 0.8f, outerConeAngle = unityLight.spotAngle / 2 * Mathf.Deg2Rad }; + light.Name = unityLight.name; + + light.type = unityLight.type.ToString().ToLower(); + light.color = new GLTF.Math.Color(unityLight.color.r, unityLight.color.g, unityLight.color.b, 1); + light.range = unityLight.range; + light.intensity = unityLight.intensity * Mathf.PI; + } + else if (unityLight.type == LightType.Directional) + { + light = new GLTFDirectionalLight(); + light.Name = unityLight.name; + + light.type = unityLight.type.ToString().ToLower(); + light.color = new GLTF.Math.Color(unityLight.color.r, unityLight.color.g, unityLight.color.b, 1); + light.intensity = unityLight.intensity * Mathf.PI; + } + else if (unityLight.type == LightType.Point) + { + light = new GLTFPointLight(); + light.Name = unityLight.name; + + light.type = unityLight.type.ToString().ToLower(); + light.color = new GLTF.Math.Color(unityLight.color.r, unityLight.color.g, unityLight.color.b, 1); + light.range = unityLight.range; + light.intensity = unityLight.intensity * Mathf.PI; + } + else + { + // unknown light type, we shouldn't export this + + // light = new GLTFLight(); + // light.Name = unityLight.name; + // light.type = unityLight.type.ToString().ToLower(); + // light.color = new GLTF.Math.Color(unityLight.color.r, unityLight.color.g, unityLight.color.b, 1); + } + + if (light != null) + { + DeclareExtensionUsage(KHR_lights_punctualExtensionFactory.EXTENSION_NAME, false); + } + else + { + Debug.LogWarning(null, $"Light couldn't be exported: {unityLight.name}. The type may be unsupported in glTF ({unityLight.type})", unityLight.gameObject); + return null; + } + + if (_root.Lights == null) + { + _root.Lights = new List(); + } + + var id = new LightId + { + Id = _root.Lights.Count, + Root = _root + }; + + // Register nodes for animation parsing (could be disabled if animation is disabled) + _exportedLights.Add(unityLight.GetInstanceID(), _root.Lights.Count); + + //list of lightids should be in extensions object + _root.Lights.Add(light); + + return id; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs.meta new file mode 100644 index 0000000..a8d6af7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterLights.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 122e3cac6af1417c88b9cb6b6d91b933 +timeCreated: 1657013984 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs new file mode 100644 index 0000000..a02736f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs @@ -0,0 +1,933 @@ +using System; +using System.Collections.Generic; +using GLTF.Schema; +using UnityEngine; +using UnityEngine.Rendering; +using UnityGLTF.Extensions; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + /// True: material export is complete. False: continue regular export. + public delegate bool BeforeMaterialExportDelegate(GLTFSceneExporter exporter, GLTFRoot gltfRoot, Material material, GLTFMaterial materialNode); + public delegate void AfterMaterialExportDelegate(GLTFSceneExporter exporter, GLTFRoot gltfRoot, Material material, GLTFMaterial materialNode); + + // Static callbacks + public static event BeforeSceneExportDelegate BeforeSceneExport; + public static event AfterSceneExportDelegate AfterSceneExport; + public static event AfterNodeExportDelegate AfterNodeExport; + /// True: material export is complete. False: continue regular export. + public static event BeforeMaterialExportDelegate BeforeMaterialExport; + public static event AfterMaterialExportDelegate AfterMaterialExport; + + // mock for Default material + private static Material _defaultMaterial = null; + public static Material DefaultMaterial + { + get + { + if (_defaultMaterial) return _defaultMaterial; + +#if UNITY_2019_3_OR_NEWER + var pipelineAsset = GraphicsSettings.currentRenderPipeline; + if (pipelineAsset) + { + _defaultMaterial = pipelineAsset.defaultMaterial; + } + else +#endif + { + var shader = Shader.Find("Legacy Shaders/Diffuse"); // by default in the always included shaders list + if (shader) + _defaultMaterial = new Material(shader); + } + return _defaultMaterial; + } + } + + public MaterialId ExportMaterial(Material materialObj) + { + MaterialId id = GetMaterialId(_root, materialObj); + if (id != null) + { + return id; + } + + var material = new GLTFMaterial(); + + if (!materialObj) + { + if (ExportNames) + { + material.Name = "default"; + } + + // create default material + // TODO check why we need to do anything here + material.PbrMetallicRoughness = new PbrMetallicRoughness() { MetallicFactor = 0, RoughnessFactor = 1.0f }; + return CreateAndAddMaterialId(materialObj, material); + } + + if (ExportNames) + { + material.Name = materialObj.name; + } + + // before material export: only continue with regular export if that didn't succeed. + if (_exportOptions.BeforeMaterialExport != null) + { + beforeMaterialExportMarker.Begin(); + if (_exportOptions.BeforeMaterialExport.Invoke(this, _root, materialObj, material)) + { + beforeMaterialExportMarker.End(); + return CreateAndAddMaterialId(materialObj, material); + } + else + { + beforeMaterialExportMarker.End(); + } + } + + + // static callback, run after options callback + // we're iterating here because we want to stop calling any once we hit one that can export this material. + if (BeforeMaterialExport != null) + { + var list = BeforeMaterialExport.GetInvocationList(); + foreach (var entry in list) + { + beforeMaterialExportMarker.Begin(); + var cb = (BeforeMaterialExportDelegate) entry; + if (cb != null && cb.Invoke(this, _root, materialObj, material)) + { + beforeMaterialExportMarker.End(); + return CreateAndAddMaterialId(materialObj, material); + } + else + { + beforeMaterialExportMarker.End(); + } + } + } + + exportMaterialMarker.Begin(); + var isBirp = +#if UNITY_2019_3_OR_NEWER + !GraphicsSettings.currentRenderPipeline; +#else + true; +#endif + + switch (materialObj.GetTag("RenderType", false, "")) + { + case "TransparentCutout": + if (materialObj.HasProperty("alphaCutoff")) + material.AlphaCutoff = materialObj.GetFloat("alphaCutoff"); + else if (materialObj.HasProperty("_AlphaCutoff")) + material.AlphaCutoff = materialObj.GetFloat("_AlphaCutoff"); + else if (materialObj.HasProperty("_Cutoff")) + material.AlphaCutoff = materialObj.GetFloat("_Cutoff"); + material.AlphaMode = AlphaMode.MASK; + break; + case "Transparent": + case "Fade": + material.AlphaMode = AlphaMode.BLEND; + break; + default: + if ((!isBirp && materialObj.IsKeywordEnabled("_ALPHATEST_ON")) || + (isBirp && materialObj.IsKeywordEnabled("_BUILTIN_ALPHATEST_ON")) || + materialObj.renderQueue == 2450) + { + if (materialObj.HasProperty("alphaCutoff")) + material.AlphaCutoff = materialObj.GetFloat("alphaCutoff"); + else if (materialObj.HasProperty("_AlphaCutoff")) + material.AlphaCutoff = materialObj.GetFloat("_AlphaCutoff"); + else if (materialObj.HasProperty("_Cutoff")) + material.AlphaCutoff = materialObj.GetFloat("_Cutoff"); + material.AlphaMode = AlphaMode.MASK; + } + else + { + material.AlphaMode = AlphaMode.OPAQUE; + } + break; + } + + material.DoubleSided = (materialObj.HasProperty("_Cull") && materialObj.GetInt("_Cull") == (int)CullMode.Off) || + (materialObj.HasProperty("_CullMode") && materialObj.GetInt("_CullMode") == (int)CullMode.Off) || + (materialObj.shader.name.EndsWith("-Double")); // workaround for exporting shaders that are set to double-sided on 2020.3 + + if (materialObj.IsKeywordEnabled("_EMISSION") || materialObj.IsKeywordEnabled("EMISSION") || materialObj.HasProperty("emissiveTexture") || materialObj.HasProperty("_EmissiveTexture")) + { + if (materialObj.HasProperty("_EmissionColor") || materialObj.HasProperty("emissiveFactor") || materialObj.HasProperty("_EmissiveFactor")) + { + var c = materialObj.HasProperty("_EmissionColor") ? materialObj.GetColor("_EmissionColor") : materialObj.HasProperty("emissiveFactor") ? materialObj.GetColor("emissiveFactor") : materialObj.GetColor("_EmissiveFactor"); + DecomposeEmissionColor(c, out var emissiveAmount, out var maxEmissiveAmount); + material.EmissiveFactor = emissiveAmount.ToNumericsColorRaw(); + + if(maxEmissiveAmount > 1) + { + material.AddExtension(KHR_materials_emissive_strength_Factory.EXTENSION_NAME, new KHR_materials_emissive_strength() { emissiveStrength = maxEmissiveAmount }); + DeclareExtensionUsage(KHR_materials_emissive_strength_Factory.EXTENSION_NAME, false); + } + } + + if (materialObj.HasProperty("_EmissionMap") || materialObj.HasProperty("_EmissiveMap") || materialObj.HasProperty("_EmissiveTexture") || materialObj.HasProperty("emissiveTexture")) + { + var propName = materialObj.HasProperty("emissiveTexture") ? "emissiveTexture" : materialObj.HasProperty("_EmissiveTexture") ? "_EmissiveTexture" : materialObj.HasProperty("_EmissionMap") ? "_EmissionMap" : "_EmissiveMap"; + var emissionTex = materialObj.GetTexture(propName); + + if (emissionTex) + { + if(emissionTex is Texture2D) + { + material.EmissiveTexture = ExportTextureInfo(emissionTex, TextureMapType.Emissive); + + ExportTextureTransform(material.EmissiveTexture, materialObj, propName); + } + else + { + Debug.LogFormat(LogType.Error, "Can't export a {0} emissive texture in material {1}", emissionTex.GetType(), materialObj.name); + } + + } + } + } + + // workaround for glTFast roundtrip: has a _BumpMap but no _NORMALMAP or _BUMPMAP keyword. + var is_glTFastShader = materialObj.shader.name.IndexOf("glTF", StringComparison.Ordinal) > -1; + if (materialObj.HasProperty("_BumpMap") && (materialObj.IsKeywordEnabled("_NORMALMAP") || materialObj.IsKeywordEnabled("_BUMPMAP") || is_glTFastShader)) + { + var normalTex = materialObj.GetTexture("_BumpMap"); + + if (normalTex) + { + if(normalTex is Texture2D) + { + material.NormalTexture = ExportNormalTextureInfo(normalTex, TextureMapType.Normal, materialObj); + ExportTextureTransform(material.NormalTexture, materialObj, "_BumpMap"); + } + else + { + Debug.LogFormat(LogType.Error, "Can't export a {0} normal texture in material {1}", normalTex.GetType(), materialObj.name); + } + } + } + if (materialObj.HasProperty("normalTexture") || materialObj.HasProperty("_NormalTexture")) + { + var propName = materialObj.HasProperty("normalTexture") ? "normalTexture" : "_NormalTexture"; + var normalTex = materialObj.GetTexture(propName); + + if (normalTex) + { + if(normalTex is Texture2D) + { + material.NormalTexture = ExportNormalTextureInfo(normalTex, TextureMapType.Normal, materialObj); + ExportTextureTransform(material.NormalTexture, materialObj, propName); + } + else + { + Debug.LogFormat(LogType.Error, "Can't export a {0} normal texture in material {1}", normalTex.GetType(), materialObj.name); + } + } + } + + if (materialObj.HasProperty("_OcclusionMap") || materialObj.HasProperty("occlusionTexture") || materialObj.HasProperty("_OcclusionTexture")) + { + var propName = materialObj.HasProperty("occlusionTexture") ? "occlusionTexture" : materialObj.HasProperty("_OcclusionTexture") ? "_OcclusionTexture" : "_OcclusionMap"; + var occTex = materialObj.GetTexture(propName); + if (occTex) + { + if(occTex is Texture2D) + { + material.OcclusionTexture = ExportOcclusionTextureInfo(occTex, TextureMapType.Occlusion, materialObj); + ExportTextureTransform(material.OcclusionTexture, materialObj, propName); + material.OcclusionTexture.TexCoord = materialObj.HasProperty("occlusionTextureTexCoord") ? + Mathf.RoundToInt(materialObj.GetFloat("occlusionTextureTexCoord")) : + materialObj.HasProperty("_OcclusionTextureTexCoord") ? + Mathf.RoundToInt(materialObj.GetFloat("_OcclusionTextureTexCoord")) : 0; + } + else + { + Debug.LogFormat(LogType.Error, "Can't export a {0} occlusion texture in material {1}", occTex.GetType(), materialObj.name); + } + } + } + if (IsUnlit(materialObj)) + { + ExportUnlit( material, materialObj ); + } + else if (IsPBRMetallicRoughness(materialObj)) + { + material.PbrMetallicRoughness = ExportPBRMetallicRoughness(materialObj); + } + else if (IsPBRSpecularGlossiness(materialObj)) + { + ExportPBRSpecularGlossiness(material, materialObj); + } + else if (IsCommonConstant(materialObj)) + { + material.CommonConstant = ExportCommonConstant(materialObj); + } + else if (materialObj.HasProperty("_BaseMap")) + { + var mainTex = materialObj.GetTexture("_BaseMap"); + material.PbrMetallicRoughness = new PbrMetallicRoughness() + { + BaseColorFactor = (materialObj.HasProperty("_BaseColor") + ? materialObj.GetColor("_BaseColor") + : Color.white).ToNumericsColorLinear(), + BaseColorTexture = mainTex ? ExportTextureInfo(mainTex, TextureMapType.BaseColor) : null + }; + } + else if (materialObj.HasProperty("_ColorTexture")) + { + var mainTex = materialObj.GetTexture("_ColorTexture"); + material.PbrMetallicRoughness = new PbrMetallicRoughness() + { + BaseColorFactor = (materialObj.HasProperty("_BaseColor") + ? materialObj.GetColor("_BaseColor") + : Color.white).ToNumericsColorLinear(), + BaseColorTexture = mainTex ? ExportTextureInfo(mainTex, TextureMapType.BaseColor) : null + }; + } + else if (materialObj.HasProperty("_MainTex")) //else export main texture + { + var mainTex = materialObj.GetTexture("_MainTex"); + + if (mainTex != null) + { + material.PbrMetallicRoughness = new PbrMetallicRoughness() { MetallicFactor = 0, RoughnessFactor = 1.0f }; + material.PbrMetallicRoughness.BaseColorTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(material.PbrMetallicRoughness.BaseColorTexture, materialObj, "_MainTex"); + } + if (materialObj.HasProperty("_TintColor")) //particles use _TintColor instead of _Color + { + if (material.PbrMetallicRoughness == null) + material.PbrMetallicRoughness = new PbrMetallicRoughness() { MetallicFactor = 0, RoughnessFactor = 1.0f }; + + material.PbrMetallicRoughness.BaseColorFactor = materialObj.GetColor("_TintColor").ToNumericsColorLinear(); + } + material.DoubleSided = true; + } + + exportMaterialMarker.End(); + + return CreateAndAddMaterialId(materialObj, material); + } + + private MaterialId CreateAndAddMaterialId(Material materialObj, GLTFMaterial material) + { + var key = materialObj ? materialObj.GetInstanceID() : 0; + if(!_exportedMaterials.ContainsKey(key)) + _exportedMaterials.Add(key, _root.Materials.Count); + + var id = new MaterialId + { + Id = _root.Materials.Count, + Root = _root + }; + _root.Materials.Add(material); + + // after material export + afterMaterialExportMarker.Begin(); + if (materialObj) + { + _exportOptions.AfterMaterialExport?.Invoke(this, _root, materialObj, material); + AfterMaterialExport?.Invoke(this, _root, materialObj, material); + } + afterMaterialExportMarker.End(); + + return id; + } + + private bool IsPBRMetallicRoughness(Material material) + { + return (material.HasProperty("_Metallic") || material.HasProperty("_MetallicFactor") || material.HasProperty("metallicFactor")) && + (material.HasProperty("_MetallicGlossMap") || material.HasProperty("_Glossiness") || + material.HasProperty("_Roughness") || material.HasProperty("_RoughnessFactor") || material.HasProperty("roughnessFactor") || + material.HasProperty("_MetallicRoughnessTexture") || material.HasProperty("metallicRoughnessTexture")); + } + + private bool IsUnlit(Material material) + { + return material.shader.name.ToLowerInvariant().Contains("unlit"); + } + + private bool IsPBRSpecularGlossiness(Material material) + { + return material.HasProperty("_SpecColor") && material.HasProperty("_SpecGlossMap"); + } + + private bool IsCommonConstant(Material material) + { + return material.HasProperty("_AmbientFactor") && + material.HasProperty("_LightMap") && + material.HasProperty("_LightFactor"); + } + +#if UNITY_2019_1_OR_NEWER + private static bool CheckForPropertyInShader(Shader shader, string name, ShaderPropertyType type) + { + // TODO result can be cached, we might do many similar checks for one export + + var c = shader.GetPropertyCount(); + var foundProperty = false; + for (var i = 0; i < c; i++) + { + if (shader.GetPropertyName(i) == name && shader.GetPropertyType(i) == type) + { + foundProperty = true; + break; + } + } + return foundProperty; + } +#endif + + private void ExportTextureTransform(TextureInfo def, Material mat, string texName) + { + // early out if texture transform is explicitly disabled + if (mat.HasProperty("_TEXTURE_TRANSFORM") && !mat.IsKeywordEnabled("_TEXTURE_TRANSFORM_ON")) + return; + + Vector2 offset = mat.GetTextureOffset(texName); + Vector2 scale = mat.GetTextureScale(texName); + //var rotationMatrix = mat.GetVector(texName + "Rotation"); + //var rotation = -Mathf.Atan2(offset.y, rotationMatrix.x); + var rotProp = texName + "Rotation"; + var rotation = 0f; +#if UNITY_2021_1_OR_NEWER + if (mat.HasFloat(rotProp)) +#else + if (mat.HasProperty(rotProp) +#if UNITY_2019_1_OR_NEWER + && CheckForPropertyInShader(mat.shader, rotProp, ShaderPropertyType.Float) +#endif + ) +#endif + rotation = mat.GetFloat(rotProp); + + if (offset == Vector2.zero && scale == Vector2.one && rotation == 0) + { + var checkForName = texName + "_ST"; + // Debug.Log("Checking for property: " + checkForName + " : " + mat.HasProperty(checkForName) + " == " + (mat.HasProperty(checkForName) ? mat.GetVector(checkForName) : "null")); + var textureHasTilingOffset = mat.HasProperty(checkForName); + +#if UNITY_2019_1_OR_NEWER + // turns out we have to check extra hard if that property actually exists + // the material ALWAYS says true for mat.HasProperty(someTex_ST) when someTex is defined and doesn't have [NoTextureScale] attribute + if (textureHasTilingOffset) + { + if (!CheckForPropertyInShader(mat.shader, checkForName, ShaderPropertyType.Vector)) + textureHasTilingOffset = false; + } +#endif + + if (textureHasTilingOffset) + { + // ignore, texture has explicit _ST property + } + else if(mat.HasProperty("_MainTex_ST") || mat.HasProperty("_BaseMap_ST") || mat.HasProperty("_BaseColorMap_ST") || mat.HasProperty("_BaseColorTexture_ST") || mat.HasProperty("baseColorTexture_ST")) + { + // difficult choice here: some shaders might support texture transform per-texture, others use the main transform. + if (mat.HasProperty("baseColorTexture")) + { + offset = mat.GetTextureOffset("baseColorTexture"); + scale = mat.GetTextureScale("baseColorTexture"); + rotation = mat.HasProperty("baseColorTextureRotation") ? mat.GetFloat("baseColorTextureRotation") : 0; + } + else if (mat.HasProperty("_BaseColorTexture")) + { + offset = mat.GetTextureOffset("_BaseColorTexture"); + scale = mat.GetTextureScale("_BaseColorTexture"); + rotation = mat.HasProperty("_BaseColorTextureRotation") ? mat.GetFloat("_BaseColorTextureRotation") : 0; + } + else if (mat.HasProperty("_BaseColorMap")) + { + offset = mat.GetTextureOffset("_BaseColorMap"); + scale = mat.GetTextureScale("_BaseColorMap"); + } + else if (mat.HasProperty("_BaseMap")) + { + offset = mat.GetTextureOffset("_BaseMap"); + scale = mat.GetTextureScale("_BaseMap"); + } + else if(mat.HasProperty("_MainTex")) + { + offset = mat.mainTextureOffset; + scale = mat.mainTextureScale; + rotation = 0; +#if UNITY_2021_1_OR_NEWER + if (mat.HasFloat("_MainTexRotation")) +#else + if (mat.HasProperty("_MainTexRotation")) +#endif + rotation = mat.GetFloat("_MainTexRotation"); + } + } + else + { + offset = Vector2.zero; + scale = Vector2.one; + } + } + + if (_root.ExtensionsUsed == null) + { + _root.ExtensionsUsed = new List( + new[] { ExtTextureTransformExtensionFactory.EXTENSION_NAME } + ); + } + else if (!_root.ExtensionsUsed.Contains(ExtTextureTransformExtensionFactory.EXTENSION_NAME)) + { + _root.ExtensionsUsed.Add(ExtTextureTransformExtensionFactory.EXTENSION_NAME); + } + + if (RequireExtensions) + { + if (_root.ExtensionsRequired == null) + { + _root.ExtensionsRequired = new List( + new[] { ExtTextureTransformExtensionFactory.EXTENSION_NAME } + ); + } + else if (!_root.ExtensionsRequired.Contains(ExtTextureTransformExtensionFactory.EXTENSION_NAME)) + { + _root.ExtensionsRequired.Add(ExtTextureTransformExtensionFactory.EXTENSION_NAME); + } + } + + if (def.Extensions == null) + def.Extensions = new Dictionary(); + + def.Extensions[ExtTextureTransformExtensionFactory.EXTENSION_NAME] = new ExtTextureTransformExtension( + new GLTF.Math.Vector2(offset.x, 1 - offset.y - scale.y), + rotation, + new GLTF.Math.Vector2(scale.x, scale.y), + 0 // TODO: support UV channels + ); + } + + public NormalTextureInfo ExportNormalTextureInfo( + Texture texture, + string textureSlot, + Material material) + { + var info = new NormalTextureInfo(); + + info.Index = ExportTexture(texture, textureSlot); + + if (material.HasProperty("normalScale")) + { + info.Scale = material.GetFloat("normalScale"); + } + else if (material.HasProperty("_NormalScale")) + { + info.Scale = material.GetFloat("_NormalScale"); + } + else if (material.HasProperty("_BumpScale")) + { + info.Scale = material.GetFloat("_BumpScale"); + } + + + return info; + } + + private OcclusionTextureInfo ExportOcclusionTextureInfo( + Texture texture, + string textureSlot, + Material material) + { + var info = new OcclusionTextureInfo(); + + info.Index = ExportTexture(texture, textureSlot); + + if (material.HasProperty("occlusionStrength")) + { + info.Strength = material.GetFloat("occlusionStrength"); + } + else if (material.HasProperty("_OcclusionStrength")) + { + info.Strength = material.GetFloat("_OcclusionStrength"); + } + + return info; + } + + public PbrMetallicRoughness ExportPBRMetallicRoughness(Material material) + { + var pbr = new PbrMetallicRoughness() { MetallicFactor = 0, RoughnessFactor = 1.0f }; + var isGltfPbrMetallicRoughnessShader = material.shader.name.Equals("GLTF/PbrMetallicRoughness", StringComparison.Ordinal); + var isGlTFastShader = material.shader.name.Equals("glTF/PbrMetallicRoughness", StringComparison.Ordinal); + + if (material.HasProperty("baseColorFactor")) + { + pbr.BaseColorFactor = material.GetColor("baseColorFactor").ToNumericsColorLinear(); + } + else if (material.HasProperty("_BaseColorFactor")) + { + pbr.BaseColorFactor = material.GetColor("_BaseColorFactor").ToNumericsColorLinear(); + } + else if (material.HasProperty("_BaseColor")) + { + pbr.BaseColorFactor = material.GetColor("_BaseColor").ToNumericsColorLinear(); + } + else if (material.HasProperty("_Color")) + { + pbr.BaseColorFactor = material.GetColor("_Color").ToNumericsColorLinear(); + } + + if (material.HasProperty("_TintColor")) //particles use _TintColor instead of _Color + { + float white = 1; + if (material.HasProperty("_Color")) + { + var c = material.GetColor("_Color"); + white = (c.r + c.g + c.b) / 3.0f; //multiply alpha by overall whiteness of TintColor + } + + pbr.BaseColorFactor = (material.GetColor("_TintColor") * white).ToNumericsColorLinear() ; + } + + if (material.HasProperty("_MainTex") || material.HasProperty("_BaseMap") || material.HasProperty("_BaseColorTexture") || material.HasProperty("baseColorTexture")) //TODO if additive particle, render black into alpha + { + // TODO use private Material.GetFirstPropertyNameIdByAttribute here, supported from 2020.1+ + var mainTexPropertyName = material.HasProperty("_BaseMap") ? "_BaseMap" : material.HasProperty("_MainTex") ? "_MainTex" : material.HasProperty("baseColorTexture") ? "baseColorTexture" : "_BaseColorTexture"; + var mainTex = material.GetTexture(mainTexPropertyName); + + if (mainTex) + { + pbr.BaseColorTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(pbr.BaseColorTexture, material, mainTexPropertyName); + pbr.BaseColorTexture.TexCoord = material.HasProperty("baseColorTextureTexCoord") ? + Mathf.RoundToInt(material.GetFloat("baseColorTextureTexCoord")) : + material.HasProperty("_BaseColorTextureTexCoord") ? + Mathf.RoundToInt(material.GetFloat("_BaseColorTextureTexCoord")) : 0; + } + } + + var ignoreMetallicFactor = (material.IsKeywordEnabled("_METALLICGLOSSMAP") || material.IsKeywordEnabled("_METALLICSPECGLOSSMAP")) && !isGltfPbrMetallicRoughnessShader && !isGlTFastShader; + if (material.HasProperty("metallicFactor") && !ignoreMetallicFactor) + { + pbr.MetallicFactor = material.GetFloat("metallicFactor"); + } + else if (material.HasProperty("_MetallicFactor") && !ignoreMetallicFactor) + { + pbr.MetallicFactor = material.GetFloat("_MetallicFactor"); + } + else if (material.HasProperty("_Metallic") && !ignoreMetallicFactor) + { + pbr.MetallicFactor = material.GetFloat("_Metallic"); + } + + var needToBakeRoughnessIntoTexture = false; + float roughnessMultiplier = 1f; + + if (material.HasProperty("roughnessFactor")) + { + float roughness = material.GetFloat("roughnessFactor"); + pbr.RoughnessFactor = roughness; + } + else if (material.HasProperty("_RoughnessFactor")) + { + float roughness = material.GetFloat("_RoughnessFactor"); + pbr.RoughnessFactor = roughness; + } + else if (material.HasProperty("_Roughness")) + { + float roughness = material.GetFloat("_Roughness"); + pbr.RoughnessFactor = roughness; + } + else if (material.HasProperty("_Glossiness") || material.HasProperty("_Smoothness")) + { + var smoothnessPropertyName = material.HasProperty("_Smoothness") ? "_Smoothness" : "_Glossiness"; + var metallicGlossMap = material.HasProperty("_MetallicGlossMap") ? material.GetTexture("_MetallicGlossMap") : null; + float smoothness = material.GetFloat(smoothnessPropertyName); + + // legacy workaround: the UnityGLTF shaders misuse "_Glossiness" as roughness but don't have a keyword for it. + if (isGltfPbrMetallicRoughnessShader) + smoothness = 1 - smoothness; + if (metallicGlossMap && material.HasProperty("_GlossMapScale") && material.IsKeywordEnabled("_METALLICGLOSSMAP")) + smoothness = material.GetFloat("_GlossMapScale"); + + var hasMetallicRoughnessMap = + (material.HasProperty("metallicRoughnessTexture") && material.GetTexture("metallicRoughnessTexture")) || + (material.HasProperty("_MetallicRoughnessTexture") && material.GetTexture("_MetallicRoughnessTexture")) || + (material.HasProperty("_MetallicGlossMap") && material.GetTexture("_MetallicGlossMap")); + + if (!hasMetallicRoughnessMap) + pbr.RoughnessFactor = 1 - smoothness; + else + { + needToBakeRoughnessIntoTexture = true; + roughnessMultiplier = 1 - smoothness; + pbr.RoughnessFactor = 1; + } + } + + if (material.HasProperty("metallicRoughnessTexture")) + { + var mrTex = material.GetTexture("metallicRoughnessTexture"); + if (mrTex) + { + pbr.MetallicRoughnessTexture = ExportTextureInfo(mrTex, TextureMapType.MetallicRoughness); + } + } + else if (material.HasProperty("_MetallicRoughnessTexture")) + { + var mrTex = material.GetTexture("_MetallicRoughnessTexture"); + if (mrTex) + { + pbr.MetallicRoughnessTexture = ExportTextureInfo(mrTex, TextureMapType.MetallicRoughness); + } + } + else if (material.HasProperty("_MetallicGlossMap")) + { + var mrTex = material.GetTexture("_MetallicGlossMap"); + + if (mrTex) + { + var conversion = GetExportSettingsForSlot((isGltfPbrMetallicRoughnessShader || isGlTFastShader) ? TextureMapType.Linear : TextureMapType.MetallicGloss); + if (needToBakeRoughnessIntoTexture) + { + conversion = new TextureExportSettings(conversion); + conversion.smoothnessMultiplier = 1 - roughnessMultiplier; + } + pbr.MetallicRoughnessTexture = ExportTextureInfo(mrTex, TextureMapType.MetallicRoughness, conversion); + // in the Standard shader, _METALLICGLOSSMAP replaces _Metallic and so we need to set the multiplier to 1; + // that's not true for the gltf shaders though, so we keep the value there. + if (ignoreMetallicFactor) + pbr.MetallicFactor = 1.0f; + ExportTextureTransform(pbr.MetallicRoughnessTexture, material, "_MetallicGlossMap"); + } + } + + return pbr; + } + + public void ExportUnlit(GLTFMaterial def, Material material){ + + const string extname = KHR_MaterialsUnlitExtensionFactory.EXTENSION_NAME; + DeclareExtensionUsage( extname, true ); + def.AddExtension( extname, new KHR_MaterialsUnlitExtension()); + + var pbr = new PbrMetallicRoughness(); + + if (material.HasProperty("baseColorFactor")) + { + pbr.BaseColorFactor = material.GetColor("baseColorFactor").ToNumericsColorLinear(); + } + else if (material.HasProperty("_BaseColorFactor")) + { + pbr.BaseColorFactor = material.GetColor("_BaseColorFactor").ToNumericsColorLinear(); + } + else if (material.HasProperty("_BaseColor")) + { + pbr.BaseColorFactor = material.GetColor("_BaseColor").ToNumericsColorLinear(); + } + else if (material.HasProperty("_Color")) + { + pbr.BaseColorFactor = material.GetColor("_Color").ToNumericsColorLinear(); + } + + if (material.HasProperty("baseColorTexture")) + { + var mainTex = material.GetTexture("baseColorTexture"); + if (mainTex) + { + pbr.BaseColorTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(pbr.BaseColorTexture, material, "baseColorTexture"); + } + } + else if (material.HasProperty("_BaseColorTexture")) + { + var mainTex = material.GetTexture("_BaseColorTexture"); + if (mainTex) + { + pbr.BaseColorTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(pbr.BaseColorTexture, material, "_BaseColorTexture"); + } + } + else if (material.HasProperty("_BaseMap")) + { + var mainTex = material.GetTexture("_BaseMap"); + if (mainTex) + { + pbr.BaseColorTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(pbr.BaseColorTexture, material, "_BaseMap"); + } + } + else if (material.HasProperty("_MainTex")) + { + var mainTex = material.GetTexture("_MainTex"); + if (mainTex) + { + pbr.BaseColorTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(pbr.BaseColorTexture, material, "_MainTex"); + } + } + + def.PbrMetallicRoughness = pbr; + + } + + private void ExportPBRSpecularGlossiness(GLTFMaterial material, Material materialObj) + { + if (_root.ExtensionsUsed == null) + { + _root.ExtensionsUsed = new List(new[] { "KHR_materials_pbrSpecularGlossiness" }); + } + else if (!_root.ExtensionsUsed.Contains("KHR_materials_pbrSpecularGlossiness")) + { + _root.ExtensionsUsed.Add("KHR_materials_pbrSpecularGlossiness"); + } + + if (RequireExtensions) + { + if (_root.ExtensionsRequired == null) + { + _root.ExtensionsRequired = new List(new[] { "KHR_materials_pbrSpecularGlossiness" }); + } + else if (!_root.ExtensionsRequired.Contains("KHR_materials_pbrSpecularGlossiness")) + { + _root.ExtensionsRequired.Add("KHR_materials_pbrSpecularGlossiness"); + } + } + + if (material.Extensions == null) + { + material.Extensions = new Dictionary(); + } + + GLTF.Math.Color diffuseFactor = KHR_materials_pbrSpecularGlossinessExtension.DIFFUSE_FACTOR_DEFAULT; + TextureInfo diffuseTexture = KHR_materials_pbrSpecularGlossinessExtension.DIFFUSE_TEXTURE_DEFAULT; + GLTF.Math.Vector3 specularFactor = KHR_materials_pbrSpecularGlossinessExtension.SPEC_FACTOR_DEFAULT; + double glossinessFactor = KHR_materials_pbrSpecularGlossinessExtension.GLOSS_FACTOR_DEFAULT; + TextureInfo specularGlossinessTexture = KHR_materials_pbrSpecularGlossinessExtension.SPECULAR_GLOSSINESS_TEXTURE_DEFAULT; + + if (materialObj.HasProperty("_BaseColor")) + { + diffuseFactor = materialObj.GetColor("_BaseColor").ToNumericsColorLinear(); + } + else if (materialObj.HasProperty("_Color")) + { + diffuseFactor = materialObj.GetColor("_Color").ToNumericsColorLinear(); + } + + if (materialObj.HasProperty("_BaseMap")) + { + var mainTex = materialObj.GetTexture("_BaseMap"); + + if (mainTex != null) + { + diffuseTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(diffuseTexture, materialObj, "_BaseMap"); + } + } + else if (materialObj.HasProperty("_MainTex")) + { + var mainTex = materialObj.GetTexture("_MainTex"); + + if (mainTex != null) + { + diffuseTexture = ExportTextureInfo(mainTex, TextureMapType.BaseColor); + ExportTextureTransform(diffuseTexture, materialObj, "_MainTex"); + } + } + + if (materialObj.HasProperty("_SpecColor")) + { + var specGlossMap = materialObj.GetTexture("_SpecGlossMap"); + if (specGlossMap == null) + { + var specColor = materialObj.GetColor("_SpecColor").ToNumericsColorLinear(); + specularFactor = new GLTF.Math.Vector3(specColor.R, specColor.G, specColor.B); + } + } + + if (materialObj.HasProperty("_Glossiness")) + { + var specGlossMap = materialObj.GetTexture("_SpecGlossMap"); + if (specGlossMap == null) + { + glossinessFactor = materialObj.GetFloat("_Glossiness"); + } + } + + if (materialObj.HasProperty("_SpecGlossMap")) + { + var mgTex = materialObj.GetTexture("_SpecGlossMap"); + + if (mgTex) + { + specularGlossinessTexture = ExportTextureInfo(mgTex, TextureMapType.SpecGloss); + ExportTextureTransform(specularGlossinessTexture, materialObj, "_SpecGlossMap"); + } + } + + material.Extensions[KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME] = new KHR_materials_pbrSpecularGlossinessExtension( + diffuseFactor, + diffuseTexture, + specularFactor, + glossinessFactor, + specularGlossinessTexture + ); + } + + private MaterialCommonConstant ExportCommonConstant(Material materialObj) + { + if (_root.ExtensionsUsed == null) + { + _root.ExtensionsUsed = new List(new[] { "KHR_materials_common" }); + } + else if (!_root.ExtensionsUsed.Contains("KHR_materials_common")) + { + _root.ExtensionsUsed.Add("KHR_materials_common"); + } + + if (RequireExtensions) + { + if (_root.ExtensionsRequired == null) + { + _root.ExtensionsRequired = new List(new[] { "KHR_materials_common" }); + } + else if (!_root.ExtensionsRequired.Contains("KHR_materials_common")) + { + _root.ExtensionsRequired.Add("KHR_materials_common"); + } + } + + var constant = new MaterialCommonConstant(); + + if (materialObj.HasProperty("_AmbientFactor")) + { + constant.AmbientFactor = materialObj.GetColor("_AmbientFactor").ToNumericsColorRaw(); + } + + if (materialObj.HasProperty("_LightMap")) + { + var lmTex = materialObj.GetTexture("_LightMap"); + + if (lmTex) + { + constant.LightmapTexture = ExportTextureInfo(lmTex, TextureMapType.Linear); + ExportTextureTransform(constant.LightmapTexture, materialObj, "_LightMap"); + } + + } + + if (materialObj.HasProperty("_LightFactor")) + { + constant.LightmapFactor = materialObj.GetColor("_LightFactor").ToNumericsColorRaw(); + } + + return constant; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs.meta new file mode 100644 index 0000000..3c32c57 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMaterials.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e09c9ec7a50e4331bd773f4c54f1b9ab +timeCreated: 1657010581 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs new file mode 100644 index 0000000..59b5efa --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs @@ -0,0 +1,526 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using GLTF.Schema; +using UnityEngine; +using UnityEngine.Rendering; +using UnityGLTF.Extensions; + +#if UNITY_EDITOR // required for in-editor access to non-readable meshes +using UnityEditor; +#endif + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + private struct MeshAccessors + { + public AccessorId aPosition, aNormal, aTangent, aTexcoord0, aTexcoord1, aColor0; + public Dictionary subMeshPrimitives; + } + + private struct BlendShapeAccessors + { + public List> targets; + public List weights; + public List targetNames; + } + + private readonly Dictionary _meshToPrims = new Dictionary(); + private readonly Dictionary _meshToBlendShapeAccessors = new Dictionary(); + + public void RegisterPrimitivesWithNode(Node node, List uniquePrimitives) + { + // associate unity meshes with gltf mesh id + foreach (var primKey in uniquePrimitives) + { + _primOwner[primKey] = node.Mesh; + } + } + + private static List GetUniquePrimitivesFromGameObjects(IEnumerable primitives) + { + var primKeys = new List(); + + foreach (var prim in primitives) + { + Mesh meshObj = null; + SkinnedMeshRenderer smr = null; + var filter = prim.GetComponent(); + if (filter) + { + meshObj = filter.sharedMesh; + } + else + { + smr = prim.GetComponent(); + if (smr) + { + meshObj = smr.sharedMesh; + } + } + + if (!meshObj) + { + Debug.LogWarning($"MeshFilter.sharedMesh on GameObject:{prim.name} is missing, skipping", prim); + exportPrimitiveMarker.End(); + return null; + } + + +#if UNITY_EDITOR + if (!MeshIsReadable(meshObj) && EditorUtility.IsPersistent(meshObj)) + { +#if UNITY_2019_3_OR_NEWER + var assetPath = AssetDatabase.GetAssetPath(meshObj); + if (assetPath?.Length > 30) assetPath = "..." + assetPath.Substring(assetPath.Length - 30); + var otherOption = Application.isPlaying ? "No, skip mesh" : "Cancel export"; + if(EditorUtility.DisplayDialog("Exporting mesh but mesh is not readable", + $"The mesh {meshObj.name} is not readable. Do you want to change its import settings and make it readable now?\n\n" + assetPath, + "Make it readable", otherOption, + DialogOptOutDecisionType.ForThisSession, MakeMeshReadableDialogueDecisionKey)) +#endif + { + var path = AssetDatabase.GetAssetPath(meshObj); + var importer = AssetImporter.GetAtPath(path) as ModelImporter; + if (importer) + { + importer.isReadable = true; + importer.SaveAndReimport(); + } + } +#if UNITY_2019_3_OR_NEWER + else + { + if (Application.isPlaying) + { + Debug.LogWarning(null, $"The mesh {meshObj.name} is not readable. Skipping", meshObj); + exportPrimitiveMarker.End(); + } + else + { + Debug.LogError(null, $"The mesh {meshObj.name} is not readable and you decided to cancel the export. Canceling", meshObj); + exportPrimitiveMarker.End(); + throw new OperationCanceledException($"Canceled export because a mesh ({meshObj}) is not readable."); + } + return null; + } +#endif + } +#endif + + if (Application.isPlaying && !MeshIsReadable(meshObj)) + { + Debug.LogWarning($"The mesh {meshObj.name} is not readable. Skipping", null); + exportPrimitiveMarker.End(); + return null; + } + + var renderer = prim.GetComponent(); + if (!renderer) smr = prim.GetComponent(); + + if(!renderer && !smr) + { + Debug.LogWarning("GameObject does have neither renderer nor SkinnedMeshRenderer! " + prim.name, prim); + exportPrimitiveMarker.End(); + return null; + } + + var materialsObj = renderer ? renderer.sharedMaterials : smr.sharedMaterials; + + var primKey = new UniquePrimitive(); + primKey.Mesh = meshObj; + primKey.Materials = materialsObj; + primKey.SkinnedMeshRenderer = smr; + + primKeys.Add(primKey); + } + + return primKeys; + } + + public NodeId ExportNode(GameObject gameObject) => ExportNode(gameObject.transform); + + /// + /// Convenience wrapper around ExportMesh(string, List) + /// + public MeshId ExportMesh(Mesh mesh) + { + var uniquePrimitives = new List + { + new UniquePrimitive() + { + Mesh = mesh, + SkinnedMeshRenderer = null, + Materials = new [] { DefaultMaterial }, + } + }; + return ExportMesh(mesh.name, uniquePrimitives); + } + + public MeshId ExportMesh(string name, List uniquePrimitives) + { + exportMeshMarker.Begin(); + + // check if this set of primitives is already a mesh + MeshId existingMeshId = null; + + foreach (var prim in uniquePrimitives) + { + MeshId tempMeshId; + if (_primOwner.TryGetValue(prim, out tempMeshId) && (existingMeshId == null || tempMeshId == existingMeshId)) + { + existingMeshId = tempMeshId; + } + else + { + existingMeshId = null; + break; + } + } + + // if so, return that mesh id + if (existingMeshId != null) + { + exportMeshMarker.End(); + return existingMeshId; + } + + // if not, create new mesh and return its id + var mesh = new GLTFMesh(); + + if (settings.ExportNames) + { + mesh.Name = name; + } + + mesh.Primitives = new List(uniquePrimitives.Count); + foreach (var primKey in uniquePrimitives) + { + MeshPrimitive[] meshPrimitives = ExportPrimitive(primKey, mesh); + if (meshPrimitives != null) + { + mesh.Primitives.AddRange(meshPrimitives); + } + } + + var id = new MeshId + { + Id = _root.Meshes.Count, + Root = _root + }; + + exportMeshMarker.End(); + + if (mesh.Primitives.Count > 0) + { + _root.Meshes.Add(mesh); + return id; + } + + return null; + } + + // a mesh *might* decode to multiple prims if there are submeshes + private MeshPrimitive[] ExportPrimitive(UniquePrimitive primKey, GLTFMesh mesh) + { + exportPrimitiveMarker.Begin(); + + Mesh meshObj = primKey.Mesh; + Material[] materialsObj = primKey.Materials; + + var prims = new MeshPrimitive[meshObj.subMeshCount]; + List nonEmptyPrims = null; + var vertices = meshObj.vertices; + if (vertices.Length < 1) + { + Debug.LogWarning(null, "MeshFilter does not contain any vertices or they can't be accessed, won't export: " + meshObj.name, meshObj); + exportPrimitiveMarker.End(); + return null; + } + + if (!_meshToPrims.ContainsKey(meshObj)) + { + AccessorId aPosition = null, aNormal = null, aTangent = null, aTexcoord0 = null, aTexcoord1 = null, aColor0 = null; + + aPosition = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.vertices, SchemaExtensions.CoordinateSpaceConversionScale)); + + if (meshObj.normals.Length != 0) + aNormal = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.normals, SchemaExtensions.CoordinateSpaceConversionScale)); + + if (meshObj.tangents.Length != 0) + aTangent = ExportAccessor(SchemaExtensions.ConvertVector4CoordinateSpaceAndCopy(meshObj.tangents, SchemaExtensions.TangentSpaceConversionScale)); + + if (meshObj.uv.Length != 0) + aTexcoord0 = ExportAccessor(SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv)); + + if (meshObj.uv2.Length != 0) + aTexcoord1 = ExportAccessor(SchemaExtensions.FlipTexCoordArrayVAndCopy(meshObj.uv2)); + + if (settings.ExportVertexColors && meshObj.colors.Length != 0) + aColor0 = ExportAccessor(QualitySettings.activeColorSpace == ColorSpace.Linear ? meshObj.colors : meshObj.colors.ToLinear(), true); + + aPosition.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + if (aNormal != null) aNormal.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + if (aTangent != null) aTangent.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + if (aTexcoord0 != null) aTexcoord0.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + if (aTexcoord1 != null) aTexcoord1.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + if (aColor0 != null) aColor0.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + + _meshToPrims.Add(meshObj, new MeshAccessors() + { + aPosition = aPosition, + aNormal = aNormal, + aTangent = aTangent, + aTexcoord0 = aTexcoord0, + aTexcoord1 = aTexcoord1, + aColor0 = aColor0, + subMeshPrimitives = new Dictionary() + }); + } + + var accessors = _meshToPrims[meshObj]; + + // walk submeshes and export the ones with non-null meshes + for (int submesh = 0; submesh < meshObj.subMeshCount; submesh++) + { + var mat = materialsObj[submesh % materialsObj.Length]; + if (!mat) continue; + + if (!accessors.subMeshPrimitives.ContainsKey(submesh)) + { + var primitive = new MeshPrimitive(); + + var topology = meshObj.GetTopology(submesh); + var indices = meshObj.GetIndices(submesh); + if (topology == MeshTopology.Triangles) SchemaExtensions.FlipTriangleFaces(indices); + + primitive.Mode = GetDrawMode(topology); + primitive.Indices = ExportAccessor(indices, true); + primitive.Indices.Value.BufferView.Value.Target = BufferViewTarget.ElementArrayBuffer; + + primitive.Attributes = new Dictionary(); + primitive.Attributes.Add(SemanticProperties.POSITION, accessors.aPosition); + + if (accessors.aNormal != null) + primitive.Attributes.Add(SemanticProperties.NORMAL, accessors.aNormal); + if (accessors.aTangent != null) + primitive.Attributes.Add(SemanticProperties.TANGENT, accessors.aTangent); + if (accessors.aTexcoord0 != null) + primitive.Attributes.Add(SemanticProperties.TEXCOORD_0, accessors.aTexcoord0); + if (accessors.aTexcoord1 != null) + primitive.Attributes.Add(SemanticProperties.TEXCOORD_1, accessors.aTexcoord1); + if (accessors.aColor0 != null) + primitive.Attributes.Add(SemanticProperties.COLOR_0, accessors.aColor0); + + primitive.Material = null; + + ExportBlendShapes(primKey.SkinnedMeshRenderer, meshObj, submesh, primitive, mesh); + + accessors.subMeshPrimitives.Add(submesh, primitive); + } + + var submeshPrimitive = accessors.subMeshPrimitives[submesh]; + prims[submesh] = new MeshPrimitive(submeshPrimitive, _root) + { + Material = ExportMaterial(mat), + }; + accessors.subMeshPrimitives[submesh] = prims[submesh]; + } + + nonEmptyPrims = new List(prims.Length); + for (var i = 0; i < prims.Length; i++) + { + var prim = prims[i]; + // remove any prims that have empty triangles + if (EmptyPrimitive(prim)) continue; + // invoke pre export event + _exportOptions.AfterPrimitiveExport?.Invoke(this, meshObj, prim, i); + nonEmptyPrims.Add(prim); + } + prims = nonEmptyPrims.ToArray(); + + exportPrimitiveMarker.End(); + + return prims; + } + + // Blend Shapes / Morph Targets + // Adopted from Gary Hsu (bghgary) + // https://github.com/bghgary/glTF-Tools-for-Unity/blob/master/UnityProject/Assets/Gltf/Editor/Exporter.cs + private void ExportBlendShapes(SkinnedMeshRenderer smr, Mesh meshObj, int submeshIndex, MeshPrimitive primitive, GLTFMesh mesh) + { + if (settings.BlendShapeExportProperties == GLTFSettings.BlendShapeExportPropertyFlags.None) + return; + + if (_meshToBlendShapeAccessors.TryGetValue(meshObj, out var data)) + { + mesh.Weights = data.weights; + primitive.Targets = data.targets; + primitive.TargetNames = data.targetNames; + return; + } + + if (smr != null && meshObj.blendShapeCount > 0) + { + List> targets = new List>(meshObj.blendShapeCount); + List weights = new List(meshObj.blendShapeCount); + List targetNames = new List(meshObj.blendShapeCount); + +#if UNITY_2019_3_OR_NEWER + var meshHasNormals = meshObj.HasVertexAttribute(VertexAttribute.Normal); + var meshHasTangents = meshObj.HasVertexAttribute(VertexAttribute.Tangent); +#else + var meshHasNormals = meshObj.normals.Length > 0; + var meshHasTangents = meshObj.tangents.Length > 0; +#endif + + for (int blendShapeIndex = 0; blendShapeIndex < meshObj.blendShapeCount; blendShapeIndex++) + { + exportBlendShapeMarker.Begin(); + + targetNames.Add(meshObj.GetBlendShapeName(blendShapeIndex)); + // As described above, a blend shape can have multiple frames. Given that glTF only supports a single frame + // per blend shape, we'll always use the final frame (the one that would be for when 100% weight is applied). + int frameIndex = meshObj.GetBlendShapeFrameCount(blendShapeIndex) - 1; + + var deltaVertices = new Vector3[meshObj.vertexCount]; + var deltaNormals = new Vector3[meshObj.vertexCount]; + var deltaTangents = new Vector3[meshObj.vertexCount]; + meshObj.GetBlendShapeFrameVertices(blendShapeIndex, frameIndex, deltaVertices, deltaNormals, deltaTangents); + + var exportTargets = new Dictionary(); + + if (!settings.BlendShapeExportSparseAccessors) + { + var positionAccessor = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(deltaVertices, SchemaExtensions.CoordinateSpaceConversionScale)); + positionAccessor.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + exportTargets.Add(SemanticProperties.POSITION, positionAccessor); + } + else + { + // Debug.Log("Delta Vertices:\n"+string.Join("\n ", deltaVertices)); + // Debug.Log("Vertices:\n"+string.Join("\n ", meshObj.vertices)); + // Experimental: sparse accessor. + // - get the accessor we want to base this upon + // - this is how position is originally exported: + // ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(meshObj.vertices, SchemaExtensions.CoordinateSpaceConversionScale)); + var baseAccessor = _meshToPrims[meshObj].aPosition; + var exportedAccessor = ExportSparseAccessor(null, null, SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(deltaVertices, SchemaExtensions.CoordinateSpaceConversionScale)); + if (exportedAccessor != null) + { + exportTargets.Add(SemanticProperties.POSITION, exportedAccessor); + } + } + + if (meshHasNormals && settings.BlendShapeExportProperties.HasFlag(GLTFSettings.BlendShapeExportPropertyFlags.Normal)) + { + if (!settings.BlendShapeExportSparseAccessors) + { + var accessor = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(deltaNormals, SchemaExtensions.CoordinateSpaceConversionScale)); + accessor.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + exportTargets.Add(SemanticProperties.NORMAL, accessor); + } + else + { + var baseAccessor = _meshToPrims[meshObj].aNormal; + exportTargets.Add(SemanticProperties.NORMAL, ExportSparseAccessor(null, null, SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(deltaVertices, SchemaExtensions.CoordinateSpaceConversionScale))); + } + } + if (meshHasTangents && settings.BlendShapeExportProperties.HasFlag(GLTFSettings.BlendShapeExportPropertyFlags.Tangent)) + { + if (!settings.BlendShapeExportSparseAccessors) + { + var accessor = ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(deltaTangents, SchemaExtensions.CoordinateSpaceConversionScale)); + accessor.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + exportTargets.Add(SemanticProperties.TANGENT, accessor); + } + else + { + // var baseAccessor = _meshToPrims[meshObj].aTangent; + // exportTargets.Add(SemanticProperties.TANGENT, ExportSparseAccessor(baseAccessor, SchemaExtensions.ConvertVector4CoordinateSpaceAndCopy(meshObj.tangents, SchemaExtensions.TangentSpaceConversionScale), SchemaExtensions.ConvertVector4CoordinateSpaceAndCopy(deltaVertices, SchemaExtensions.TangentSpaceConversionScale))); + exportTargets.Add(SemanticProperties.TANGENT, ExportAccessor(SchemaExtensions.ConvertVector3CoordinateSpaceAndCopy(deltaTangents, SchemaExtensions.CoordinateSpaceConversionScale))); + // Debug.LogWarning("Blend Shape Tangents for " + meshObj + " won't be exported with sparse accessors – sparse accessor for tangents isn't supported right now."); + } + } + targets.Add(exportTargets); + + // We need to get the weight from the SkinnedMeshRenderer because this represents the currently + // defined weight by the user to apply to this blend shape. If we instead got the value from + // the unityMesh, it would be a _per frame_ weight, and for a single-frame blend shape, that would + // always be 100. A blend shape might have more than one frame if a user wanted to more tightly + // control how a blend shape will be animated during weight changes (e.g. maybe they want changes + // between 0-50% to be really minor, but between 50-100 to be extreme, hence they'd have two frames + // where the first frame would have a weight of 50 (meaning any weight between 0-50 should be relative + // to the values in this frame) and then any weight between 50-100 would be relevant to the weights in + // the second frame. See Post 20 for more info: + // https://forum.unity3d.com/threads/is-there-some-method-to-add-blendshape-in-editor.298002/#post-2015679 + if(exportTargets.Any()) + weights.Add(smr.GetBlendShapeWeight(blendShapeIndex) / 100); + + exportBlendShapeMarker.End(); + } + + if(weights.Any() && targets.Any()) + { + mesh.Weights = weights; + primitive.Targets = targets; + primitive.TargetNames = targetNames; + } + else + { + mesh.Weights = null; + primitive.Targets = null; + primitive.TargetNames = null; + } + + // cache the exported data; we can re-use it between all submeshes of a mesh. + _meshToBlendShapeAccessors.Add(meshObj, new BlendShapeAccessors() + { + targets = targets, + weights = weights, + targetNames = targetNames + }); + } + } + + private static bool EmptyPrimitive(MeshPrimitive prim) + { + if (prim == null || prim.Attributes == null) + { + return true; + } + return false; + } + + private static DrawMode GetDrawMode(MeshTopology topology) + { + switch (topology) + { + case MeshTopology.Points: return DrawMode.Points; + case MeshTopology.Lines: return DrawMode.Lines; + case MeshTopology.LineStrip: return DrawMode.LineStrip; + case MeshTopology.Triangles: return DrawMode.Triangles; + } + + throw new Exception("glTF does not support Unity mesh topology: " + topology); + } + +#if UNITY_EDITOR + private const string MakeMeshReadableDialogueDecisionKey = nameof(MakeMeshReadableDialogueDecisionKey); + private static PropertyInfo canAccessProperty = + typeof(Mesh).GetProperty("canAccess", BindingFlags.Instance | BindingFlags.Default | BindingFlags.NonPublic); +#endif + + private static bool MeshIsReadable(Mesh mesh) + { +#if UNITY_EDITOR + return mesh.isReadable || (bool) (canAccessProperty?.GetMethod?.Invoke(mesh, null) ?? true); +#else + return mesh.isReadable; +#endif + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs.meta new file mode 100644 index 0000000..2a0868d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterMeshes.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6bd3287ee078412b83c46ff0e7af9c6b +timeCreated: 1657013770 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs new file mode 100644 index 0000000..27e5ade --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs @@ -0,0 +1,180 @@ +using System.Collections.Generic; +using GLTF.Schema; +using UnityEngine; + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + private List _skinnedNodes; + private Dictionary _bakedMeshes; + + private void ExportSkinFromNode(Transform transform) + { + exportSkinFromNodeMarker.Begin(); + + var go = transform.gameObject; + var skin = transform.GetComponent(); + var mesh = GetMeshFromGameObject(go); + UniquePrimitive key = new UniquePrimitive(); + key.Mesh = mesh; + key.SkinnedMeshRenderer = skin; + key.Materials = GetMaterialsFromGameObject(go); + MeshId val; + if (!_primOwner.TryGetValue(key, out val)) + { + Debug.Log("No mesh found for skin on " + transform, transform); + exportSkinFromNodeMarker.End(); + return; + } + GLTF.Schema.Skin gltfSkin = new Skin(); + + // early out of this SkinnedMeshRenderer has no bones assigned (could be BlendShapes-only) + if (skin.bones == null || skin.bones.Length == 0) + { + exportSkinFromNodeMarker.End(); + return; + } + + bool allBoneTransformNodesHaveBeenExported = true; + for (int i = 0; i < skin.bones.Length; ++i) + { + if (!skin.bones[i]) + { + Debug.LogWarning("Skin has null bone at index " + i + ": " + skin, skin); + continue; + } + var nodeId = skin.bones[i].GetInstanceID(); + if (!_exportedTransforms.ContainsKey(nodeId)) + { + allBoneTransformNodesHaveBeenExported = false; + break; + } + } + + if (!allBoneTransformNodesHaveBeenExported) + { + Debug.LogWarning("Not all bones for SkinnedMeshRenderer " + transform + " were exported. Skin information will be skipped. Make sure the bones are active and enabled if you want to export them.", transform); + exportSkinFromNodeMarker.End(); + return; + } + + for (int i = 0; i < skin.bones.Length; ++i) + { + if (!skin.bones[i]) + { + continue; + } + + var nodeId = skin.bones[i].GetInstanceID(); + + gltfSkin.Joints.Add( + new NodeId + { + Id = _exportedTransforms[nodeId], + Root = _root + }); + } + + gltfSkin.InverseBindMatrices = ExportAccessor(mesh.bindposes); + + Vector4[] bones = boneWeightToBoneVec4(mesh.boneWeights); + Vector4[] weights = boneWeightToWeightVec4(mesh.boneWeights); + + if(val != null) + { + GLTF.Schema.GLTFMesh gltfMesh = _root.Meshes[val.Id]; + if(gltfMesh != null) + { + foreach (MeshPrimitive prim in gltfMesh.Primitives) + { + if (!prim.Attributes.ContainsKey("JOINTS_0")) + { + var jointsAccessor = ExportAccessorUint(bones); + jointsAccessor.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + prim.Attributes.Add("JOINTS_0", jointsAccessor); + } + + if (!prim.Attributes.ContainsKey("WEIGHTS_0")) + { + var weightsAccessor = ExportAccessor(weights); + weightsAccessor.Value.BufferView.Value.Target = BufferViewTarget.ArrayBuffer; + prim.Attributes.Add("WEIGHTS_0", weightsAccessor); + } + } + } + } + + _root.Nodes[_exportedTransforms[transform.GetInstanceID()]].Skin = new SkinId() { Id = _root.Skins.Count, Root = _root }; + _root.Skins.Add(gltfSkin); + + exportSkinFromNodeMarker.End(); + } + + private UnityEngine.Mesh GetMeshFromGameObject(GameObject gameObject) + { + if (gameObject.GetComponent()) + { + return gameObject.GetComponent().sharedMesh; + } + + SkinnedMeshRenderer skinMesh = gameObject.GetComponent(); + if (skinMesh) + { + if (!ExportAnimations && settings.BakeSkinnedMeshes) + { + if (!_bakedMeshes.ContainsKey(skinMesh)) + { + UnityEngine.Mesh bakedMesh = new UnityEngine.Mesh(); + skinMesh.BakeMesh(bakedMesh); + _bakedMeshes.Add(skinMesh, bakedMesh); + } + + return _bakedMeshes[skinMesh]; + } + + return gameObject.GetComponent().sharedMesh; + } + + return null; + } + + private UnityEngine.Material[] GetMaterialsFromGameObject(GameObject gameObject) + { + if (gameObject.GetComponent()) + { + return gameObject.GetComponent().sharedMaterials; + } + + if (gameObject.GetComponent()) + { + return gameObject.GetComponent().sharedMaterials; + } + + return null; + } + + private Vector4[] boneWeightToBoneVec4(BoneWeight[] bw) + { + Vector4[] bones = new Vector4[bw.Length]; + for (int i = 0; i < bw.Length; ++i) + { + bones[i] = new Vector4(bw[i].boneIndex0, bw[i].boneIndex1, bw[i].boneIndex2, bw[i].boneIndex3); + } + + return bones; + } + + private Vector4[] boneWeightToWeightVec4(BoneWeight[] bw) + { + Vector4[] weights = new Vector4[bw.Length]; + for (int i = 0; i < bw.Length; ++i) + { + weights[i] = new Vector4(bw[i].weight0, bw[i].weight1, bw[i].weight2, bw[i].weight3); + } + + return weights; + } + + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs.meta new file mode 100644 index 0000000..fe477e7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterSkinning.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fb74840032dc4385aea8ea2f67c3d17e +timeCreated: 1657012764 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs new file mode 100644 index 0000000..d3b1730 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs @@ -0,0 +1,789 @@ +using System; +using System.Collections.Generic; +using System.IO; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Cache; +using Object = UnityEngine.Object; +using WrapMode = GLTF.Schema.WrapMode; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF +{ + public partial class GLTFSceneExporter + { + private string GetUniqueName(HashSet existingNames, string name) + { + if (!existingNames.Contains(name)) return name; + var i = 1; + while (existingNames.Contains(name + "-" + i)) + i++; + return name + "-" + i; + } + + private void ExportImages(string outputPath) + { + var allPaths = new HashSet(); + for (int t = 0; t < _imageInfos.Count; ++t) + { + writeImageToDiskMarker.Begin(); + + var image = _imageInfos[t].texture; + var textureMapType = _imageInfos[t].textureMapType; + var fileOutputPath = Path.Combine(outputPath, GetUniqueName(allPaths, _imageInfos[t].outputPath)); + allPaths.Add(fileOutputPath); + + var canBeExportedFromDisk = _imageInfos[t].canBeExportedFromDisk; + + var dir = Path.GetDirectoryName(fileOutputPath); + if (!Directory.Exists(dir) && dir != null) + Directory.CreateDirectory(dir); + + bool wasAbleToExportTexture = false; + if (canBeExportedFromDisk) + { + File.WriteAllBytes(fileOutputPath, GetTextureDataFromDisk(image)); + } + + if (!wasAbleToExportTexture) + { + switch (textureMapType.conversion) + { + case TextureExportSettings.Conversion.MetalGlossChannelSwap: + ExportLinearTexture(image, fileOutputPath, true); + break; + case TextureExportSettings.Conversion.None: + if (textureMapType.linear) + ExportLinearTexture(image, fileOutputPath, false); + else + ExportTexture(image, fileOutputPath); + break; + case TextureExportSettings.Conversion.NormalChannel: + ExportNormalTexture(image, fileOutputPath); + break; + default: + ExportTexture(image, fileOutputPath); + break; + } + } + + writeImageToDiskMarker.End(); + } + } + + /// + /// This converts Unity's metallic-gloss texture representation into GLTF's metallic-roughness specifications. + /// Unity's metallic-gloss A channel (glossiness) is inverted and goes into GLTF's metallic-roughness G channel (roughness). + /// Unity's metallic-gloss R channel (metallic) goes into GLTF's metallic-roughess B channel. + /// + /// Unity's metallic-gloss texture to be exported + /// The location to export the texture + private void ExportLinearTexture(Texture2D texture, string outputPath, bool swapMetalGlossChannels) + { + if (!texture) + { + UnityEngine.Debug.LogError("Can not export missing texture: " + outputPath); + return; + } + var destRenderTexture = RenderTexture.GetTemporary(texture.width, texture.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); + if (swapMetalGlossChannels) + Graphics.Blit(texture, destRenderTexture, _metalGlossChannelSwapMaterial); + else + Graphics.Blit(texture, destRenderTexture); + WriteRenderTextureToDiskAndRelease(destRenderTexture, outputPath, true); + } + + /// + /// This export's the normal texture. If a texture is marked as a normal map, the values are stored in the A and G channel. + /// To output the correct normal texture, the A channel is put into the R channel. + /// + /// Unity's normal texture to be exported + /// The location to export the texture + private void ExportNormalTexture(Texture2D texture, string outputPath) + { + var destRenderTexture = RenderTexture.GetTemporary(texture.width, texture.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); + var wr = GL.sRGBWrite; + GL.sRGBWrite = false; + Graphics.Blit(texture, destRenderTexture, _normalChannelMaterial); + WriteRenderTextureToDiskAndRelease(destRenderTexture, outputPath, true); + GL.sRGBWrite = wr; + } + + private void ExportTexture(Texture2D texture, string outputPath) + { + var destRenderTexture = RenderTexture.GetTemporary(texture.width, texture.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB); + Graphics.Blit(texture, destRenderTexture); + WriteRenderTextureToDiskAndRelease(destRenderTexture, outputPath, false); + } + + private void WriteRenderTextureToDiskAndRelease(RenderTexture destRenderTexture, string outputPath, bool linear) + { + RenderTexture.active = destRenderTexture; + + var exportTexture = new Texture2D(destRenderTexture.width, destRenderTexture.height, TextureFormat.ARGB32, false, linear); + exportTexture.ReadPixels(new Rect(0, 0, destRenderTexture.width, destRenderTexture.height), 0, 0); + exportTexture.Apply(); + + var binaryData = outputPath.EndsWith(".jpg") ? exportTexture.EncodeToJPG(settings.DefaultJpegQuality) : exportTexture.EncodeToPNG(); + File.WriteAllBytes(outputPath, binaryData); + + RenderTexture.ReleaseTemporary(destRenderTexture); + if (Application.isEditor) + Object.DestroyImmediate(exportTexture); + else + Object.Destroy(exportTexture); + } + + public TextureInfo ExportTextureInfo(Texture texture, string textureSlot, TextureExportSettings exportSettings = default) + { + var info = new TextureInfo(); + + info.Index = ExportTexture(texture, textureSlot, exportSettings); + + return info; + } + + public TextureId ExportTexture(Texture textureObj, string textureSlot, TextureExportSettings exportSettings = default) + { + var uniqueTexture = exportSettings.isValid ? + new UniqueTexture(textureObj, exportSettings) : + new UniqueTexture(textureObj, textureSlot, this); + + _exportOptions.BeforeTextureExport?.Invoke(this, ref uniqueTexture, textureSlot); + + TextureId id = GetTextureId(_root, uniqueTexture); + if (id != null) + { + return id; + } + + var texture = new GLTFTexture(); + + //If texture name not set give it a unique name using count + if (textureObj.name == "") + { + textureObj.name = (_root.Textures.Count + 1).ToString(); + } + + if (settings.ExportNames) + { + texture.Name = textureObj.name; + } + + if (_shouldUseInternalBufferForImages) + { + texture.Source = ExportImageInternalBuffer(uniqueTexture, textureSlot); + } + else + { + texture.Source = ExportImage(uniqueTexture, textureSlot); + } + texture.Sampler = ExportSampler(textureObj); + + _textures.Add(uniqueTexture); + + id = new TextureId + { + Id = _root.Textures.Count, + Root = _root + }; + + _root.Textures.Add(texture); + + // HACK we should properly check if the above texture was exported as EXR and then treat it differently; + // this here assumes the texture is already readable / was read back + if (textureSlot == TextureMapType.Custom_HDR) + { + if (texture.Extensions == null) texture.Extensions = new Dictionary(); + texture.Extensions.Add(EXT_texture_exr.EXTENSION_NAME, new EXT_texture_exr(texture.Source)); + DeclareExtensionUsage(EXT_texture_exr.EXTENSION_NAME); + } + + _exportOptions.AfterTextureExport?.Invoke(this, uniqueTexture, id.Id, texture); + + return id; + } + + /// + /// Used for determining the resulting file output path for external images (not internal buffer). + /// Depends on various factors such as alpha channel, texture map type / conversion needs, and existing data on disk. + /// Logic needs to match the one in ExportImageInternalBuffer. + /// The actual export happens in ExportImages. + /// + /// The relative texture output path on disk, including extension + private string GetImageOutputPath(Texture texture, TextureExportSettings textureMapType, string textureSlot, out bool ableToExportFromDisk) + { + var imagePath = _exportOptions.TexturePathRetriever(texture); + if (string.IsNullOrEmpty(imagePath)) + { + imagePath = texture.name; + } + + ableToExportFromDisk = false; + bool textureHasAlpha = true; + + if (settings.TryExportTexturesFromDisk && CanGetTextureDataFromDisk(textureMapType, texture, out string path)) + { + if (IsPng(path) || IsJpeg(path)) + { + imagePath = path; + ableToExportFromDisk = true; + } + } + + switch (textureMapType.alphaMode) + { + case TextureExportSettings.AlphaMode.Never: + textureHasAlpha = false; + break; + case TextureExportSettings.AlphaMode.Heuristic: + textureHasAlpha = TextureHasAlphaChannel(texture); + break; + } + + var canExportAsJpeg = !textureHasAlpha && settings.UseTextureFileTypeHeuristic; + var desiredExtension = canExportAsJpeg ? ".jpg" : ".png"; + if (textureSlot == TextureMapType.Custom_HDR) + desiredExtension = ".exr"; + + if (!settings.ExportFullPath) + { + imagePath = Path.GetFileName(imagePath); + } + + if (!ableToExportFromDisk) + { + imagePath = Path.ChangeExtension(imagePath, desiredExtension); + } + + return imagePath; + } + + private ImageId ExportImage(UniqueTexture uniqueTexture, string textureSlot) + { + var texture = uniqueTexture.Texture; + var width = uniqueTexture.GetWidth(); + var height = uniqueTexture.GetHeight(); + + ImageId id = GetImageId(_root, texture, uniqueTexture.ExportSettings); + if (id != null) + { + return id; + } + + var image = new GLTFImage(); + + if (ExportNames) + { + image.Name = texture.name; + } + + if (texture.GetType() == typeof(RenderTexture)) + { + Texture2D tempTexture = new Texture2D(width, height); + tempTexture.name = texture.name; + + RenderTexture.active = texture as RenderTexture; + tempTexture.ReadPixels(new Rect(0, 0, width, height), 0, 0); + tempTexture.Apply(); + texture = tempTexture; + } + +#if UNITY_2017_1_OR_NEWER + if (texture.GetType() == typeof(CustomRenderTexture)) + { + Texture2D tempTexture = new Texture2D(width, height); + tempTexture.name = texture.name; + + RenderTexture.active = texture as CustomRenderTexture; + tempTexture.ReadPixels(new Rect(0, 0, width, height), 0, 0); + tempTexture.Apply(); + texture = tempTexture; + } +#endif + + var filenamePath = GetImageOutputPath(texture, uniqueTexture.ExportSettings, textureSlot, out var canBeExportedFromDisk); + + // some characters such as # are allowed as part of an URI and are thus not escaped + // by EscapeUriString. They need to be escaped if they're part of the filename though. + image.Uri = Path.Combine( + Uri.EscapeUriString(Path.GetDirectoryName(filenamePath).Replace("\\","/")), + Uri.EscapeDataString(Path.GetFileName(filenamePath)) + ).Replace("\\","/"); + + // TODO: handle cubemap export + var imageInfoTexture = texture as Texture2D; + _imageInfos.Add(new ImageInfo + { + texture = imageInfoTexture, + textureMapType = uniqueTexture.ExportSettings, + outputPath = filenamePath, + canBeExportedFromDisk = canBeExportedFromDisk, + }); + + id = new ImageId + { + Id = _root.Images.Count, + Root = _root + }; + + _root.Images.Add(image); + + return id; + } + + private bool CanGetTextureDataFromDisk(TextureExportSettings textureMapType, Texture texture, out string path) + { + path = null; + +#if UNITY_EDITOR + if (Application.isEditor && UnityEditor.AssetDatabase.Contains(texture)) + { + path = UnityEditor.AssetDatabase.GetAssetPath(texture); + var importer = AssetImporter.GetAtPath(path) as TextureImporter; + if (importer?.textureShape != TextureImporterShape.Texture2D) + return false; + + switch (textureMapType.conversion) + { + // if this is a normal map generated from greyscale, we shouldn't attempt to export from disk + case TextureExportSettings.Conversion.NormalChannel: + if (importer && importer.textureType == TextureImporterType.NormalMap && importer.convertToNormalmap) + return false; + break; + // check if the texture contains an alpha channel; if yes, we shouldn't attempt to export from disk but instead convert. + case TextureExportSettings.Conversion.MetalGlossChannelSwap: + if (importer && importer.DoesSourceTextureHaveAlpha()) + return false; + break; + } + + if (File.Exists(path)) + { + if(AssetDatabase.GetMainAssetTypeAtPath(path) != typeof(Texture2D)) + { + var ext = Path.GetExtension(path); + path = path.Replace(ext, "-" + texture.name + ext); + } + return true; + } + } +#endif + return false; + } + + private byte[] GetTextureDataFromDisk(Texture texture) + { +#if UNITY_EDITOR + var path = UnityEditor.AssetDatabase.GetAssetPath(texture); + + if (File.Exists(path)) + return File.ReadAllBytes(path); +#endif + return null; + } + + bool TextureHasAlphaChannel(Texture sourceTexture) + { + var hasAlpha = false; + +#if UNITY_EDITOR + if (AssetDatabase.Contains(sourceTexture) && sourceTexture is Texture2D) + { + var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(sourceTexture)) as TextureImporter; + if (importer) + { + switch (importer.alphaSource) + { + case TextureImporterAlphaSource.FromInput: + hasAlpha = importer.DoesSourceTextureHaveAlpha(); + break; + case TextureImporterAlphaSource.FromGrayScale: + hasAlpha = true; + break; + case TextureImporterAlphaSource.None: + hasAlpha = false; + break; + } + } + } +#endif + + UnityEngine.Experimental.Rendering.GraphicsFormat graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None; +#if !UNITY_2019_1_OR_NEWER + if (sourceTexture is Texture2D tex2D) + graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetGraphicsFormat(tex2D.format, true); +#else + graphicsFormat = sourceTexture.graphicsFormat; +#endif +#if UNITY_2018_2_OR_NEWER + if(graphicsFormat != UnityEngine.Experimental.Rendering.GraphicsFormat.None) + hasAlpha |= UnityEngine.Experimental.Rendering.GraphicsFormatUtility.HasAlphaChannel(graphicsFormat); +#else + hasAlpha = true; +#endif + return hasAlpha; + } + + private bool IsPng(string filename) + { + return Path.GetExtension(filename).EndsWith("png", StringComparison.InvariantCultureIgnoreCase); + } + + private bool IsJpeg(string filename) + { + return Path.GetExtension(filename).EndsWith("jpg", StringComparison.InvariantCultureIgnoreCase) || Path.GetExtension(filename).EndsWith("jpeg", StringComparison.InvariantCultureIgnoreCase); + } + +#if UNITY_EDITOR + private bool TryGetImporter(Object obj, out T importer) where T : AssetImporter + { + if (EditorUtility.IsPersistent(obj)) + { + var texturePath = AssetDatabase.GetAssetPath(obj); + importer = AssetImporter.GetAtPath(texturePath) as T; + return importer; + } + importer = null; + return false; + } +#endif + + private ImageId ExportImageInternalBuffer(UniqueTexture uniqueTexture, string textureSlot) + { + var texture = uniqueTexture.Texture; + var exportSettings = uniqueTexture.ExportSettings; + + const string PNGMimeType = "image/png"; + const string JPEGMimeType = "image/jpeg"; + + if (texture == null) + { + throw new NullReferenceException("texture can not be NULL."); + } + + var image = new GLTFImage(); + image.MimeType = PNGMimeType; + + AlignToBoundary(_bufferWriter.BaseStream, 0x00); + uint byteOffset = CalculateAlignment((uint)_bufferWriter.BaseStream.Position, 4); + + bool wasAbleToExport = false; + bool textureHasAlpha = true; + + if (settings.TryExportTexturesFromDisk && CanGetTextureDataFromDisk(exportSettings, texture, out string path)) + { + if (IsPng(path)) + { + image.MimeType = PNGMimeType; + var imageBytes = GetTextureDataFromDisk(texture); + _bufferWriter.Write(imageBytes); + wasAbleToExport = true; + } + else if (IsJpeg(path)) + { + image.MimeType = JPEGMimeType; + var imageBytes = GetTextureDataFromDisk(texture); + _bufferWriter.Write(imageBytes); + wasAbleToExport = true; + } + else + { + Debug.Log("Texture can't be exported from disk: " + path + ". Only PNG & JPEG are supported. The texture will be re-encoded as PNG.", texture); + } + } + + // export in-memory floating point textures as EXR + // TODO add readback when not readable + if (!wasAbleToExport && textureSlot == TextureMapType.Custom_HDR) + { + byte[] exrImageData = default; + + if (texture.isReadable) + { + const Texture2D.EXRFlags EXR_Flags = Texture2D.EXRFlags.CompressZIP; + + if (texture is Texture2D texture2D) + { + exrImageData = texture2D.EncodeToEXR(EXR_Flags); + } + else if (texture is RenderTexture rt) + { + var prev = RenderTexture.active; + RenderTexture.active = rt; + var temp = new Texture2D(rt.width, rt.height, TextureFormat.RGBAFloat, false, true); + temp.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0); + temp.Apply(); + RenderTexture.active = prev; + exrImageData = temp.EncodeToEXR(EXR_Flags); + } + } + + if (exrImageData != null) + { + image.MimeType = "image/exr"; + _bufferWriter.Write(exrImageData); + wasAbleToExport = true; + } + } + + if (!wasAbleToExport) + { + var sRGB = !exportSettings.linear; + +#if UNITY_EDITOR + if (textureSlot == TextureMapType.Custom_Unknown) + { +#if UNITY_EDITOR + if (TryGetImporter(texture, out var importer)) + { + if (!importer.sRGBTexture) + sRGB = false; + else + sRGB = true; + } +#endif + } +#endif + + var format = sRGB ? RenderTextureReadWrite.sRGB : RenderTextureReadWrite.Linear; + + var width = uniqueTexture.GetWidth(); + var height = uniqueTexture.GetHeight(); + + // TODO we could make sure texture size is power-of-two here + + switch (exportSettings.alphaMode) + { + case TextureExportSettings.AlphaMode.Never: + textureHasAlpha = false; + break; + case TextureExportSettings.AlphaMode.Always: + textureHasAlpha = true; + break; + case TextureExportSettings.AlphaMode.Heuristic: + textureHasAlpha = TextureHasAlphaChannel(texture); + break; + } + + if (textureSlot == TextureMapType.Custom_HDR) + { + Debug.LogWarning("HDR Texture Export from non-readable textures isn't supported yet", texture); + } + + + var canExportAsJpeg = !textureHasAlpha && settings.UseTextureFileTypeHeuristic; + image.MimeType = canExportAsJpeg ? JPEGMimeType : PNGMimeType; + + var cacheKey = uniqueTexture.GetHashCode().ToString(); + if (settings.UseCaching && ExportCache.TryGetBytes(texture, cacheKey, out var bytes)) + { + _bufferWriter.Write(bytes); + } + else + { + var destRenderTexture = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.Default, format); + var previousSRGBState = GL.sRGBWrite; + GL.sRGBWrite = sRGB; + + var shader = GetConversionMaterial(exportSettings); + if (shader && shader.HasProperty("_SmoothnessMultiplier")) + shader.SetFloat("_SmoothnessMultiplier", exportSettings.smoothnessMultiplier); + + if (shader) + Graphics.Blit(texture, destRenderTexture, shader); + else + Graphics.Blit(texture, destRenderTexture); + + var exportTexture = new Texture2D(width, height, TextureFormat.ARGB32, false, false); + exportTexture.ReadPixels(new Rect(0, 0, destRenderTexture.width, destRenderTexture.height), 0, 0); + exportTexture.Apply(); + + var imageData = canExportAsJpeg ? exportTexture.EncodeToJPG(settings.DefaultJpegQuality) : exportTexture.EncodeToPNG(); + _bufferWriter.Write(imageData); + + if (settings.UseCaching) + ExportCache.AddBytes(texture, cacheKey, imageData); + + GL.sRGBWrite = previousSRGBState; + + RenderTexture.ReleaseTemporary(destRenderTexture); + + if (Application.isEditor) + { + UnityEngine.Object.DestroyImmediate(exportTexture); + } + else + { + UnityEngine.Object.Destroy(exportTexture); + } + } + + + } + + // // Check for potential warnings in GLTF validation + // if (!Mathf.IsPowerOfTwo(texture.width) || !Mathf.IsPowerOfTwo(texture.height)) + // { + // Debug.LogWarning("Validation Warning: " + "Image has non-power-of-two dimensions: " + texture.width + "x" + texture.height + ".", texture); + // } + + uint byteLength = CalculateAlignment((uint)_bufferWriter.BaseStream.Position - byteOffset, 4); + image.BufferView = ExportBufferView((uint)byteOffset, (uint)byteLength); + + if (ExportNames) + { + image.Name = texture.name; + } + + var id = new ImageId + { + Id = _root.Images.Count, + Root = _root + }; + _root.Images.Add(image); + + return id; + } + + private struct SamplerRelevantTextureData : IEquatable + { + private readonly TextureWrapMode wrapMode; + private readonly FilterMode filterMode; + private readonly bool hasMipmaps; + private readonly bool hasAniso; + public bool HasMipmaps => hasMipmaps; + public bool HasAniso => hasAniso; + + public SamplerRelevantTextureData(Texture texture) + { + var mipmapCount = 1; + var aniso = 1; +#if UNITY_2019_2_OR_NEWER + mipmapCount = texture.mipmapCount; + aniso = texture.anisoLevel; +#else + if (texture is Texture2D tex2D) mipmapCount = tex2D.mipmapCount; +#endif + wrapMode = texture.wrapMode; + filterMode = texture.filterMode; + hasMipmaps = mipmapCount > 1; + hasAniso = aniso > 0; + } + + public bool Equals(SamplerRelevantTextureData other) + { + return wrapMode == other.wrapMode && filterMode == other.filterMode && hasMipmaps == other.hasMipmaps && hasAniso == other.hasAniso; + } + + public override bool Equals(object obj) + { + return obj is SamplerRelevantTextureData other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (int)wrapMode; + hashCode = (hashCode * 397) ^ (int)filterMode; + hashCode = (hashCode * 397) ^ hasMipmaps.GetHashCode(); + hashCode = (hashCode * 397) ^ hasAniso.GetHashCode(); + return hashCode; + } + } + } + + private Dictionary _textureSettingsToSamplerIndices = + new Dictionary(); + private SamplerId ExportSampler(Texture texture) + { + var dataForTexture = new SamplerRelevantTextureData(texture); + + if (_textureSettingsToSamplerIndices.TryGetValue(dataForTexture, out var existingSamplerIndex)) + { + return new SamplerId + { + Id = existingSamplerIndex, + Root = _root + }; + } + + var sampler = new Sampler(); + + switch (texture.wrapMode) + { + case TextureWrapMode.Clamp: + sampler.WrapS = WrapMode.ClampToEdge; + sampler.WrapT = WrapMode.ClampToEdge; + break; + case TextureWrapMode.Repeat: + sampler.WrapS = WrapMode.Repeat; + sampler.WrapT = WrapMode.Repeat; + break; + case TextureWrapMode.Mirror: + sampler.WrapS = WrapMode.MirroredRepeat; + sampler.WrapT = WrapMode.MirroredRepeat; + break; + default: + Debug.LogWarning("Unsupported Texture.wrapMode: " + texture.wrapMode, texture); + sampler.WrapS = WrapMode.Repeat; + sampler.WrapT = WrapMode.Repeat; + break; + } + + if(dataForTexture.HasMipmaps) + { + switch (texture.filterMode) + { + case FilterMode.Point: + sampler.MinFilter = MinFilterMode.NearestMipmapNearest; + sampler.MagFilter = MagFilterMode.Nearest; + break; + case FilterMode.Bilinear: + // not technically correct but matches result in Unity much better. When any aniso is on, the expectation is a smooth texture transition. + sampler.MinFilter = dataForTexture.HasAniso ? MinFilterMode.LinearMipmapLinear : MinFilterMode.LinearMipmapNearest; + sampler.MagFilter = MagFilterMode.Linear; + break; + case FilterMode.Trilinear: + sampler.MinFilter = MinFilterMode.LinearMipmapLinear; + sampler.MagFilter = MagFilterMode.Linear; + break; + default: + Debug.LogWarning("Unsupported Texture.filterMode: " + texture.filterMode, texture); + sampler.MinFilter = MinFilterMode.LinearMipmapLinear; + sampler.MagFilter = MagFilterMode.Linear; + break; + } + } + else + { + switch (texture.filterMode) + { + case FilterMode.Point: + sampler.MinFilter = MinFilterMode.Nearest; + sampler.MagFilter = MagFilterMode.Nearest; + break; + default: + sampler.MinFilter = MinFilterMode.Linear; + sampler.MagFilter = MagFilterMode.Linear; + break; + } + } + + var samplerId = new SamplerId + { + Id = _root.Samplers.Count, + Root = _root + }; + + _root.Samplers.Add(sampler); + _textureSettingsToSamplerIndices.Add(dataForTexture, samplerId.Id); + + return samplerId; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs.meta new file mode 100644 index 0000000..eabd3fc --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneExporter/ExporterTextures.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e2d7fb34285a479db4c18291fe881855 +timeCreated: 1657010903 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter.meta new file mode 100644 index 0000000..93c2b46 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4903dfef32b84dd2862485b344995895 +timeCreated: 1657012079 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs new file mode 100644 index 0000000..2b73066 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs @@ -0,0 +1,346 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using GLTF; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Cache; +using UnityGLTF.Extensions; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { +#if UNITY_ANIMATION || !UNITY_2019_1_OR_NEWER + private static string RelativePathFrom(Transform self, Transform root) + { + var path = new List(); + for (var current = self; current != null; current = current.parent) + { + if (current == root) + { + return String.Join("/", path.ToArray()); + } + + path.Insert(0, current.name); + } + + throw new Exception("no RelativePath"); + } + + protected virtual async Task BuildAnimationSamplers(GLTFAnimation animation, int animationId) + { + // look up expected data types + var typeMap = new Dictionary(); + foreach (var channel in animation.Channels) + { + typeMap[channel.Sampler.Id] = channel.Target.Path.ToString(); + } + + var samplers = _assetCache.AnimationCache[animationId].Samplers; + var samplersByType = new Dictionary> + { + {"time", new List(animation.Samplers.Count)} + }; + + for (var i = 0; i < animation.Samplers.Count; i++) + { + // no sense generating unused samplers + if (!typeMap.ContainsKey(i)) + { + continue; + } + + var samplerDef = animation.Samplers[i]; + + samplers[i].Interpolation = samplerDef.Interpolation; + + // set up input accessors + BufferCacheData inputBufferCacheData = await GetBufferData(samplerDef.Input.Value.BufferView.Value.Buffer); + AttributeAccessor attributeAccessor = new AttributeAccessor + { + AccessorId = samplerDef.Input, + Stream = inputBufferCacheData.Stream, + Offset = inputBufferCacheData.ChunkOffset + }; + + samplers[i].Input = attributeAccessor; + samplersByType["time"].Add(attributeAccessor); + + // set up output accessors + BufferCacheData outputBufferCacheData = await GetBufferData(samplerDef.Output.Value.BufferView.Value.Buffer); + attributeAccessor = new AttributeAccessor + { + AccessorId = samplerDef.Output, + Stream = outputBufferCacheData.Stream, + Offset = outputBufferCacheData.ChunkOffset + }; + + samplers[i].Output = attributeAccessor; + + if (!samplersByType.ContainsKey(typeMap[i])) + { + samplersByType[typeMap[i]] = new List(); + } + + samplersByType[typeMap[i]].Add(attributeAccessor); + } + + // populate attributeAccessors with buffer data + GLTFHelpers.BuildAnimationSamplers(ref samplersByType); + } + + protected void SetAnimationCurve( + AnimationClip clip, + string relativePath, + string[] propertyNames, + NumericArray input, + NumericArray output, + InterpolationType mode, + Type curveType, + ValuesConvertion getConvertedValues) + { + + var channelCount = propertyNames.Length; + var frameCount = input.AsFloats.Length; + + // copy all the key frame data to cache + Keyframe[][] keyframes = new Keyframe[channelCount][]; + for (var ci = 0; ci < channelCount; ++ci) + { + keyframes[ci] = new Keyframe[frameCount]; + } + + for (var i = 0; i < frameCount; ++i) + { + var time = input.AsFloats[i]; + + float[] values = null; + float[] inTangents = null; + float[] outTangents = null; + if (mode == InterpolationType.CUBICSPLINE) + { + // For cubic spline, the output will contain 3 values per keyframe; inTangent, dataPoint, and outTangent. + // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation + + var cubicIndex = i * 3; + inTangents = getConvertedValues(output, cubicIndex); + values = getConvertedValues(output, cubicIndex + 1); + outTangents = getConvertedValues(output, cubicIndex + 2); + } + else + { + // For other interpolation types, the output will only contain one value per keyframe + values = getConvertedValues(output, i); + } + + for (var ci = 0; ci < channelCount; ++ci) + { + if (mode == InterpolationType.CUBICSPLINE) + { + keyframes[ci][i] = new Keyframe(time, values[ci], inTangents[ci], outTangents[ci]); + } + else + { + keyframes[ci][i] = new Keyframe(time, values[ci]); + } + } + } + + for (var ci = 0; ci < channelCount; ++ci) + { + // copy all key frames data to animation curve and add it to the clip + AnimationCurve curve = new AnimationCurve(keyframes[ci]); + + // For cubic spline interpolation, the inTangents and outTangents are already explicitly defined. + // For the rest, set them appropriately. + if (mode != InterpolationType.CUBICSPLINE) + { + for (var i = 0; i < keyframes[ci].Length; i++) + { + SetTangentMode(curve, keyframes[ci], i, mode); + } + } + clip.SetCurve(relativePath, curveType, propertyNames[ci], curve); + } + } + + private static void SetTangentMode(AnimationCurve curve, Keyframe[] keyframes, int keyframeIndex, InterpolationType interpolation) + { + var key = keyframes[keyframeIndex]; + + switch (interpolation) + { + case InterpolationType.CATMULLROMSPLINE: + key.inTangent = 0; + key.outTangent = 0; + break; + case InterpolationType.LINEAR: + key.inTangent = GetCurveKeyframeLeftLinearSlope(keyframes, keyframeIndex); + key.outTangent = GetCurveKeyframeLeftLinearSlope(keyframes, keyframeIndex + 1); + break; + case InterpolationType.STEP: + key.inTangent = float.PositiveInfinity; + key.outTangent = float.PositiveInfinity; + break; + + default: + throw new NotImplementedException(); + } + + if(curve.length < keyframeIndex) + curve.MoveKey(keyframeIndex, key); + } + + private static float GetCurveKeyframeLeftLinearSlope(Keyframe[] keyframes, int keyframeIndex) + { + if (keyframeIndex <= 0 || keyframeIndex >= keyframes.Length) + { + return 0; + } + + var valueDelta = keyframes[keyframeIndex].value - keyframes[keyframeIndex - 1].value; + var timeDelta = keyframes[keyframeIndex].time - keyframes[keyframeIndex - 1].time; + + if (timeDelta <= 0) + { + var k = keyframes[keyframeIndex]; + k.time = keyframes[keyframeIndex - 1].time + Mathf.Epsilon + 1 / 100f; + keyframes[keyframeIndex] = k; + Debug.Log(LogType.Warning, "Time of subsequent animation keyframes is not increasing (glTF-Validator error ACCESSOR_ANIMATION_INPUT_NON_INCREASING)"); + return float.PositiveInfinity; + } + return valueDelta / timeDelta; + } + + protected async Task ConstructClip(Transform root, int animationId, CancellationToken cancellationToken) + { + GLTFAnimation animation = _gltfRoot.Animations[animationId]; + + AnimationCacheData animationCache = _assetCache.AnimationCache[animationId]; + if (animationCache == null) + { + animationCache = new AnimationCacheData(animation.Samplers.Count); + _assetCache.AnimationCache[animationId] = animationCache; + } + else if (animationCache.LoadedAnimationClip != null) + { + return animationCache.LoadedAnimationClip; + } + + // unpack accessors + await BuildAnimationSamplers(animation, animationId); + + // init clip + AnimationClip clip = new AnimationClip + { + name = animation.Name ?? $"animation:{animationId}", + }; + _assetCache.AnimationCache[animationId].LoadedAnimationClip = clip; + + if (_options.AnimationMethod == AnimationMethod.Legacy) + clip.legacy = true; + + foreach (AnimationChannel channel in animation.Channels) + { + AnimationSamplerCacheData samplerCache = animationCache.Samplers[channel.Sampler.Id]; + if (channel.Target.Node == null) + { + // If a channel doesn't have a target node, then just skip it. + // This is legal and is present in one of the asset generator models, but means that animation doesn't actually do anything. + // https://github.com/KhronosGroup/glTF-Asset-Generator/tree/master/Output/Positive/Animation_NodeMisc + // Model 08 + continue; + } + var node = await GetNode(channel.Target.Node.Id, cancellationToken); + string relativePath = RelativePathFrom(node.transform, root); + + NumericArray input = samplerCache.Input.AccessorContent, + output = samplerCache.Output.AccessorContent; + + string[] propertyNames; + var known = Enum.TryParse(channel.Target.Path, out GLTFAnimationChannelPath path); + if (!known) continue; + switch (path) + { + case GLTFAnimationChannelPath.translation: + propertyNames = new string[] { "localPosition.x", "localPosition.y", "localPosition.z" }; + + SetAnimationCurve(clip, relativePath, propertyNames, input, output, + samplerCache.Interpolation, typeof(Transform), + (data, frame) => + { + var position = data.AsVec3s[frame].ToUnityVector3Convert(); + return new float[] { position.x, position.y, position.z }; + }); + break; + + case GLTFAnimationChannelPath.rotation: + propertyNames = new string[] { "localRotation.x", "localRotation.y", "localRotation.z", "localRotation.w" }; + + SetAnimationCurve(clip, relativePath, propertyNames, input, output, + samplerCache.Interpolation, typeof(Transform), + (data, frame) => + { + var rotation = data.AsVec4s[frame]; + var quaternion = new GLTF.Math.Quaternion(rotation.X, rotation.Y, rotation.Z, rotation.W).ToUnityQuaternionConvert(); + return new float[] { quaternion.x, quaternion.y, quaternion.z, quaternion.w }; + }); + + break; + + case GLTFAnimationChannelPath.scale: + propertyNames = new string[] { "localScale.x", "localScale.y", "localScale.z" }; + + SetAnimationCurve(clip, relativePath, propertyNames, input, output, + samplerCache.Interpolation, typeof(Transform), + (data, frame) => + { + var scale = data.AsVec3s[frame].ToUnityVector3Raw(); + return new float[] { scale.x, scale.y, scale.z }; + }); + break; + + case GLTFAnimationChannelPath.weights: + var primitives = channel.Target.Node.Value.Mesh.Value.Primitives; + var targetCount = primitives[0].Targets.Count; + for (int primitiveIndex = 0; primitiveIndex < primitives.Count; primitiveIndex++) + { + // see SceneImporter:156 + // blend shapes are always called "Morphtarget" and always have frame weight 100 on import + + var prim = primitives[primitiveIndex]; + var targetNames = prim.TargetNames; + propertyNames = new string[targetCount]; + for (var i = 0; i < targetCount; i++) + propertyNames[i] = "blendShape." + (targetNames != null ? targetNames[i] : ("Morphtarget" + i)); + + var frameFloats = new float[targetCount]; + + SetAnimationCurve(clip, relativePath, propertyNames, input, output, + samplerCache.Interpolation, typeof(SkinnedMeshRenderer), + (data, frame) => + { + var allValues = data.AsFloats; + for (var k = 0; k < targetCount; k++) + frameFloats[k] = allValues[frame * targetCount + k]; + + return frameFloats; + }); + } + break; + + default: + Debug.Log(LogType.Warning, "Cannot read GLTF animation path"); + break; + } // switch target type + } // foreach channel + + clip.EnsureQuaternionContinuity(); + return clip; + } +#endif + + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs.meta new file mode 100644 index 0000000..2e73fa9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterAnimation.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 20eade7af2db4b06a0d23b23c3a83c47 +timeCreated: 1657012127 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs new file mode 100644 index 0000000..cc4eaa7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs @@ -0,0 +1,93 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using GLTF.Schema; +using UnityEngine; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { + private async Task ConstructLods(GLTFRoot gltfRoot, GameObject nodeObj, Node node, int nodeIndex, CancellationToken cancellationToken) + { + const string msft_LODExtName = MSFT_LODExtensionFactory.EXTENSION_NAME; + MSFT_LODExtension lodsExtension = null; + if (_gltfRoot.ExtensionsUsed != null + && _gltfRoot.ExtensionsUsed.Contains(msft_LODExtName) + && node.Extensions != null + && node.Extensions.ContainsKey(msft_LODExtName)) + { + lodsExtension = node.Extensions[msft_LODExtName] as MSFT_LODExtension; + if (lodsExtension != null && lodsExtension.NodeIds.Count > 0) + { + int lodCount = lodsExtension.NodeIds.Count + 1; + if (CullFarLOD) + { + lodCount += 1; + } + LOD[] lods = new LOD[lodCount]; + List lodCoverage = lodsExtension.GetLODCoverage(node); + if (lodCoverage == null) + lodCoverage = new List(); + + var hasExplicitLodCoverage = lodCoverage.Count > 0; + if (lodCoverage.Count != lods.Length) + { + if (!hasExplicitLodCoverage) + lodCoverage.Add(0.5f); + + var count = lodCoverage.Count; + var length = lods.Length; + for (var i = count; i < length; i++) + { + lodCoverage.Add(lodCoverage[i - 1] / 2); + } + + if (!CullFarLOD && !hasExplicitLodCoverage) + lodCoverage[lodCoverage.Count - 1] = 0; + } + + // sanitize values so that they are strictly decreasing + for (int i = lodCoverage.Count - 2; i >= 0; i--) + { + if (lodCoverage[i] <= lodCoverage[i + 1]) + lodCoverage[i] = lodCoverage[i + 1] + 0.01f; + } + + var lodGroupNodeObj = nodeObj; + lodGroupNodeObj.SetActive(false); + var firstLodChildRenderers = nodeObj.GetComponentsInChildren().ToList(); + + LODGroup lodGroup = lodGroupNodeObj.AddComponent(); + for (int i = 0; i < lodsExtension.NodeIds.Count; i++) + { + int lodNodeId = lodsExtension.NodeIds[i]; + var lodNodeObj = await GetNode(lodNodeId, cancellationToken); + // progressStatus.NodeTotal++; + lodNodeObj.transform.SetParent(lodGroupNodeObj.transform, false); + var childRenderers = lodNodeObj.GetComponentsInChildren(); + int lodIndex = i + 1; + // make sure to kick out the renderers that are used in lower LOD levels from the root LOD level + foreach (var child in childRenderers) + firstLodChildRenderers.Remove(child); + lods[lodIndex] = new LOD(GetLodCoverage(lodCoverage, lodIndex), childRenderers); + } + + lods[0] = new LOD(GetLodCoverage(lodCoverage, 0), firstLodChildRenderers.ToArray()); + + if (CullFarLOD) + { + //use the last mesh as the LOD + lods[lodsExtension.NodeIds.Count + 1] = new LOD(0, null); + } + + lodGroup.SetLODs(lods); + lodGroup.RecalculateBounds(); + lodGroupNodeObj.SetActive(true); + _assetCache.NodeCache[nodeIndex] = lodGroupNodeObj; + } + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs.meta new file mode 100644 index 0000000..70c40d6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLODs.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fe34f290cdf64038ad7d60c706251109 +timeCreated: 1675772109 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs new file mode 100644 index 0000000..cf19a54 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs @@ -0,0 +1,53 @@ +using GLTF.Schema; +using GLTF.Schema.KHR_lights_punctual; +using UnityEngine; +using LightType = UnityEngine.LightType; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { + private void ConstructLights(GameObject nodeObj, Node node) + { + // TODO this should be handled by the lights extension directly, not here + const string lightExt = KHR_lights_punctualExtensionFactory.EXTENSION_NAME; + KHR_LightsPunctualNodeExtension lightsExtension = null; + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(lightExt) && node.Extensions != null && node.Extensions.ContainsKey(lightExt)) + { + lightsExtension = node.Extensions[lightExt] as KHR_LightsPunctualNodeExtension; + var l = lightsExtension.LightId; + + var light = l.Value; + + var newLight = nodeObj.AddComponent(); + switch (light.Type) + { + case GLTF.Schema.KHR_lights_punctual.LightType.spot: + newLight.type = LightType.Spot; + break; + case GLTF.Schema.KHR_lights_punctual.LightType.directional: + newLight.type = LightType.Directional; + break; + case GLTF.Schema.KHR_lights_punctual.LightType.point: + newLight.type = LightType.Point; + break; + } + + newLight.name = light.Name; + newLight.intensity = (float) light.Intensity / Mathf.PI; + newLight.color = new Color(light.Color.R, light.Color.G, light.Color.B, light.Color.A); + newLight.range = (float) light.Range; + if (light.Spot != null) + { +#if UNITY_2019_1_OR_NEWER + newLight.innerSpotAngle = (float) light.Spot.InnerConeAngle * 2 / (Mathf.Deg2Rad * 0.8f); +#endif + newLight.spotAngle = (float) light.Spot.OuterConeAngle * 2 / Mathf.Deg2Rad; + } + + // flip? + nodeObj.transform.localRotation *= Quaternion.Euler(0, 180, 0); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs.meta new file mode 100644 index 0000000..85ea90d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterLights.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7b547db626e3430c87fe1e060a131222 +timeCreated: 1657014645 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs new file mode 100644 index 0000000..c7d1f07 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs @@ -0,0 +1,641 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Cache; +using UnityGLTF.Extensions; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { + protected virtual async Task ConstructMaterial(GLTFMaterial def, int materialIndex) + { + IUniformMap mapper; + + const string specGlossExtName = KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME; + const string unlitExtName = KHR_MaterialsUnlitExtensionFactory.EXTENSION_NAME; + + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(specGlossExtName) && def.Extensions != null && def.Extensions.ContainsKey(specGlossExtName)) + { + if (!string.IsNullOrEmpty(CustomShaderName)) + { + mapper = new SpecGlossMap(CustomShaderName, MaximumLod); + } + else + { + mapper = new SpecGlossMap(MaximumLod); + } + } + else if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(unlitExtName) && def.Extensions != null && def.Extensions.ContainsKey(unlitExtName)) + { + if (!string.IsNullOrEmpty(CustomShaderName)) + { + mapper = new UnlitMap(CustomShaderName, null, MaximumLod); + } + else + { +#if UNITY_2021_3_OR_NEWER + mapper = new UnlitGraphMap(); +#elif UNITY_2019_1_OR_NEWER + if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline) + mapper = new UnlitGraphMap(def.AlphaMode == AlphaMode.BLEND, def.DoubleSided); + else + mapper = new UnlitMap(MaximumLod); +#else + mapper = new UnlitMap(MaximumLod); +#endif + } + } + else + { + if (!string.IsNullOrEmpty(CustomShaderName)) + { + mapper = new MetalRoughMap(CustomShaderName, MaximumLod); + } + else + { + // do we have URP or Unity 2021.2+? Use the PBR Graph Material! +#if UNITY_2021_3_OR_NEWER + mapper = new PBRGraphMap(); +#elif UNITY_2019_1_OR_NEWER + if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline) + mapper = new PBRGraphMap(def.AlphaMode == AlphaMode.BLEND, def.DoubleSided); + else + mapper = new MetalRoughMap(MaximumLod); +#else + mapper = new MetalRoughMap(MaximumLod); +#endif + } + } + + mapper.Material.name = def.Name; + mapper.AlphaMode = def.AlphaMode; + mapper.AlphaCutoff = def.AlphaCutoff; + mapper.DoubleSided = def.DoubleSided; + mapper.Material.SetFloat("_BUILTIN_QueueControl", -1); + mapper.Material.SetFloat("_QueueControl", -1); + + var mrMapper = mapper as IMetalRoughUniformMap; + if (def.PbrMetallicRoughness != null && mrMapper != null) + { + var pbr = def.PbrMetallicRoughness; + + mrMapper.BaseColorFactor = pbr.BaseColorFactor.ToUnityColorRaw(); + + if (pbr.BaseColorTexture != null) + { + TextureId textureId = pbr.BaseColorTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, false); + mrMapper.BaseColorTexture = _assetCache.TextureCache[textureId.Id].Texture; + mrMapper.BaseColorTexCoord = pbr.BaseColorTexture.TexCoord; + + var ext = GetTextureTransform(pbr.BaseColorTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + mrMapper.BaseColorXOffset = offset; + mrMapper.BaseColorXRotation = ext.Rotation; + mrMapper.BaseColorXScale = ext.Scale.ToUnityVector2Raw(); + mrMapper.BaseColorXTexCoord = ext.TexCoord; + + MatHelper.SetKeyword(mapper.Material, "_TEXTURE_TRANSFORM", true); + } + } + + mrMapper.MetallicFactor = pbr.MetallicFactor; + mrMapper.RoughnessFactor = pbr.RoughnessFactor; + + if (pbr.MetallicRoughnessTexture != null) + { + TextureId textureId = pbr.MetallicRoughnessTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, true); + mrMapper.MetallicRoughnessTexture = _assetCache.TextureCache[textureId.Id].Texture; + mrMapper.MetallicRoughnessTexCoord = pbr.MetallicRoughnessTexture.TexCoord; + + var ext = GetTextureTransform(pbr.MetallicRoughnessTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + mrMapper.MetallicRoughnessXOffset = offset; + mrMapper.MetallicRoughnessXRotation = ext.Rotation; + mrMapper.MetallicRoughnessXScale = ext.Scale.ToUnityVector2Raw(); + mrMapper.MetallicRoughnessXTexCoord = ext.TexCoord; + } + } + } + // when PbrMetallicRoughness is not defined, default values MUST apply + else if (def.PbrMetallicRoughness == null && mrMapper != null) + { + mrMapper.MetallicFactor = 1; + mrMapper.RoughnessFactor = 1; + } + + var sgMapper = mapper as ISpecGlossUniformMap; + if (sgMapper != null) + { + var specGloss = def.Extensions[specGlossExtName] as KHR_materials_pbrSpecularGlossinessExtension; + + sgMapper.DiffuseFactor = specGloss.DiffuseFactor.ToUnityColorRaw(); + + if (specGloss.DiffuseTexture != null) + { + TextureId textureId = specGloss.DiffuseTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, false); + sgMapper.DiffuseTexture = _assetCache.TextureCache[textureId.Id].Texture; + sgMapper.DiffuseTexCoord = specGloss.DiffuseTexture.TexCoord; + + var ext = GetTextureTransform(specGloss.DiffuseTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + sgMapper.DiffuseXOffset = offset; + sgMapper.DiffuseXRotation = ext.Rotation; + sgMapper.DiffuseXScale = ext.Scale.ToUnityVector2Raw(); + sgMapper.DiffuseXTexCoord = ext.TexCoord; + } + } + + sgMapper.SpecularFactor = specGloss.SpecularFactor.ToUnityVector3Raw(); + sgMapper.GlossinessFactor = specGloss.GlossinessFactor; + + if (specGloss.SpecularGlossinessTexture != null) + { + TextureId textureId = specGloss.SpecularGlossinessTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, false); + sgMapper.SpecularGlossinessTexture = _assetCache.TextureCache[textureId.Id].Texture; + + var ext = GetTextureTransform(specGloss.SpecularGlossinessTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + sgMapper.SpecularGlossinessXOffset = offset; + sgMapper.SpecularGlossinessXRotation = ext.Rotation; + sgMapper.SpecularGlossinessXScale = ext.Scale.ToUnityVector2Raw(); + sgMapper.SpecularGlossinessXTexCoord = ext.TexCoord; + } + } + } + + var unlitMapper = mapper as IUnlitUniformMap; + if (unlitMapper != null) + { + var pbr = def.PbrMetallicRoughness; + unlitMapper.BaseColorFactor = pbr.BaseColorFactor.ToUnityColorRaw(); + + if (pbr.BaseColorTexture != null) + { + TextureId textureId = pbr.BaseColorTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, false); + unlitMapper.BaseColorTexture = _assetCache.TextureCache[textureId.Id].Texture; + unlitMapper.BaseColorTexCoord = pbr.BaseColorTexture.TexCoord; + + var ext = GetTextureTransform(pbr.BaseColorTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + unlitMapper.BaseColorXOffset = offset; + unlitMapper.BaseColorXRotation = ext.Rotation; + unlitMapper.BaseColorXScale = ext.Scale.ToUnityVector2Raw(); + unlitMapper.BaseColorXTexCoord = ext.TexCoord; + + unlitMapper.Material.SetKeyword("_TEXTURE_TRANSFORM", true); + } + } + } + + var iorMapper = mapper as IIORMap; + if (iorMapper != null) + { + var ior = GetIOR(def); + if (ior != null) + { + iorMapper.IOR = ior.ior; + } + } + + var transmissionMapper = mapper as ITransmissionMap; + if (transmissionMapper != null) + { + var transmission = GetTransmission(def); + if (transmission != null) + { + transmissionMapper.TransmissionFactor = transmission.transmissionFactor; + var td = await FromTextureInfo(transmission.transmissionTexture); + transmissionMapper.TransmissionTexture = td.Texture; + + mapper.Material.renderQueue = 3000; + mapper.Material.SetKeyword("_VOLUME_TRANSMISSION", true); + mapper.Material.SetFloat("_VOLUME_TRANSMISSION_ON", 1f); + } + } + + var volumeMapper = mapper as IVolumeMap; + if (volumeMapper != null) + { + var volume = GetVolume(def); + if (volume != null) + { + volumeMapper.AttenuationColor = QualitySettings.activeColorSpace == ColorSpace.Linear ? volume.attenuationColor.ToUnityColorLinear() : volume.attenuationColor.ToUnityColorRaw(); + volumeMapper.AttenuationDistance = volume.attenuationDistance; + volumeMapper.ThicknessFactor = volume.thicknessFactor; + var td = await FromTextureInfo(volume.thicknessTexture); + volumeMapper.ThicknessTexture = td.Texture; + + mapper.Material.renderQueue = 3000; + mapper.Material.SetFloat("_VOLUME_ON", 1f); + } + } + + var iridescenceMapper = mapper as IIridescenceMap; + if (iridescenceMapper != null) + { + var iridescence = GetIridescence(def); + if (iridescence != null) + { + iridescenceMapper.IridescenceFactor = iridescence.iridescenceFactor; + iridescenceMapper.IridescenceIor = iridescence.iridescenceIor; + iridescenceMapper.IridescenceThicknessMinimum = iridescence.iridescenceThicknessMinimum; + iridescenceMapper.IridescenceThicknessMaximum = iridescence.iridescenceThicknessMaximum; + var td = await FromTextureInfo(iridescence.iridescenceTexture); + iridescenceMapper.IridescenceTexture = td.Texture; + var td2 = await FromTextureInfo(iridescence.iridescenceThicknessTexture); + iridescenceMapper.IridescenceThicknessTexture = td2.Texture; + + mapper.Material.SetKeyword("_IRIDESCENCE", true); + } + } + + var specularMapper = mapper as ISpecularMap; + if (specularMapper != null) + { + var specular = GetSpecular(def); + if (specular != null) + { + specularMapper.SpecularFactor = specular.specularFactor; + specularMapper.SpecularColorFactor = specular.specularColorFactor.ToUnityColorLinear(); + var td = await FromTextureInfo(specular.specularTexture); + specularMapper.SpecularTexture = td.Texture; + var td2 = await FromTextureInfo(specular.specularColorTexture); + specularMapper.SpecularColorTexture = td2.Texture; + + mapper.Material.SetKeyword("_SPECULAR", true); + } + } + + var clearcoatMapper = mapper as IClearcoatMap; + if (clearcoatMapper != null) + { + var clearcoat = GetClearcoat(def); + if (clearcoat != null) + { + clearcoatMapper.ClearcoatFactor = clearcoat.clearcoatFactor; + clearcoatMapper.ClearcoatRoughnessFactor = clearcoat.clearcoatRoughnessFactor; + var td = await FromTextureInfo(clearcoat.clearcoatTexture); + clearcoatMapper.ClearcoatTexture = td.Texture; + var td2 = await FromTextureInfo(clearcoat.clearcoatRoughnessTexture); + clearcoatMapper.ClearcoatRoughnessTexture = td2.Texture; + var td3 = await FromTextureInfo(clearcoat.clearcoatNormalTexture); + clearcoatMapper.ClearcoatNormalTexture = td3.Texture; + + mapper.Material.SetKeyword("_CLEARCOAT", true); + } + } + + var uniformMapper = mapper as ILitMap; + if (uniformMapper != null) + { + if (def.NormalTexture != null) + { + TextureId textureId = def.NormalTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, true); + uniformMapper.NormalTexture = _assetCache.TextureCache[textureId.Id].Texture; + uniformMapper.NormalTexCoord = def.NormalTexture.TexCoord; + uniformMapper.NormalTexScale = def.NormalTexture.Scale; + + var ext = GetTextureTransform(def.NormalTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + uniformMapper.NormalXOffset = offset; + uniformMapper.NormalXRotation = ext.Rotation; + uniformMapper.NormalXScale = ext.Scale.ToUnityVector2Raw(); + uniformMapper.NormalXTexCoord = ext.TexCoord; + + mapper.Material.SetKeyword("_TEXTURE_TRANSFORM", true); + + // workaround for PBRGraph not supporting per-texture transforms right now + if (mapper is IMetalRoughUniformMap map && !map.BaseColorTexture) + { + map.BaseColorXScale = ext.Scale.ToUnityVector2Raw(); + map.BaseColorXOffset = offset; + } + } + } + + if (def.EmissiveTexture != null) + { + TextureId textureId = def.EmissiveTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, false); + uniformMapper.EmissiveTexture = _assetCache.TextureCache[textureId.Id].Texture; + uniformMapper.EmissiveTexCoord = def.EmissiveTexture.TexCoord; + + var ext = GetTextureTransform(def.EmissiveTexture); + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + uniformMapper.EmissiveXOffset = offset; + uniformMapper.EmissiveXRotation = ext.Rotation; + uniformMapper.EmissiveXScale = ext.Scale.ToUnityVector2Raw(); + uniformMapper.EmissiveXTexCoord = ext.TexCoord; + + mapper.Material.SetKeyword("_TEXTURE_TRANSFORM", true); + + // workaround for PBRGraph not supporting per-texture transforms right now + if (mapper is IMetalRoughUniformMap map && !map.BaseColorTexture && !map.NormalTexture) + { + map.BaseColorXScale = ext.Scale.ToUnityVector2Raw(); + map.BaseColorXOffset = offset; + } + } + } + + if (def.OcclusionTexture != null) + { + uniformMapper.OcclusionTexStrength = def.OcclusionTexture.Strength; + TextureId textureId = def.OcclusionTexture.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, true); + uniformMapper.OcclusionTexture = _assetCache.TextureCache[textureId.Id].Texture; + uniformMapper.OcclusionTexCoord = def.OcclusionTexture.TexCoord; + + var ext = GetTextureTransform(def.OcclusionTexture); + + if (ext != null) + { + var offset = ext.Offset.ToUnityVector2Raw(); + offset.y = 1 - ext.Scale.Y - offset.y; + uniformMapper.OcclusionXOffset = offset; + uniformMapper.OcclusionXRotation = ext.Rotation; + uniformMapper.OcclusionXScale = ext.Scale.ToUnityVector2Raw(); + // mapper.OcclusionXTexCoord = ext.TexCoord; + + mapper.Material.SetKeyword("_TEXTURE_TRANSFORM", true); + + // workaround for PBRGraph not supporting per-texture transforms right now + if (mapper is IMetalRoughUniformMap map && !map.BaseColorTexture && !map.NormalTexture && !map.EmissiveTexture) + { + map.BaseColorXScale = ext.Scale.ToUnityVector2Raw(); + map.BaseColorXOffset = offset; + } + } + } + + uniformMapper.EmissiveFactor = QualitySettings.activeColorSpace == ColorSpace.Linear ? def.EmissiveFactor.ToUnityColorLinear() : def.EmissiveFactor.ToUnityColorRaw(); + + var emissiveExt = GetEmissiveStrength(def); + if (emissiveExt != null) + { + uniformMapper.EmissiveFactor = uniformMapper.EmissiveFactor * emissiveExt.emissiveStrength; + } + } + var vertColorMapper = mapper.Clone(); + vertColorMapper.VertexColorsEnabled = true; + + // if (mapper is PBRGraphMap pbrGraphMap) + // { + // MaterialExtensions.ValidateMaterialKeywords(pbrGraphMap.Material); + // } + + MaterialCacheData materialWrapper = new MaterialCacheData + { + UnityMaterial = mapper.Material, + UnityMaterialWithVertexColor = vertColorMapper.Material, + GLTFMaterial = def + }; + + if (materialIndex >= 0) + { + _assetCache.MaterialCache[materialIndex] = materialWrapper; + } + else + { + _defaultLoadedMaterial = materialWrapper; + } + } + + protected virtual Task ConstructMaterialImageBuffers(GLTFMaterial def) + { + var tasks = new List(8); + if (def.PbrMetallicRoughness != null) + { + var pbr = def.PbrMetallicRoughness; + + if (pbr.BaseColorTexture != null) + { + var textureId = pbr.BaseColorTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + if (pbr.MetallicRoughnessTexture != null) + { + var textureId = pbr.MetallicRoughnessTexture.Index; + + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.CommonConstant != null) + { + if (def.CommonConstant.LightmapTexture != null) + { + var textureId = def.CommonConstant.LightmapTexture.Index; + + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.NormalTexture != null) + { + var textureId = def.NormalTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + + if (def.OcclusionTexture != null) + { + var textureId = def.OcclusionTexture.Index; + + if (!(def.PbrMetallicRoughness != null + && def.PbrMetallicRoughness.MetallicRoughnessTexture != null + && def.PbrMetallicRoughness.MetallicRoughnessTexture.Index.Id == textureId.Id)) + { + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.EmissiveTexture != null) + { + var textureId = def.EmissiveTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + + // pbr_spec_gloss extension + const string specGlossExtName = KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME; + if (def.Extensions != null && def.Extensions.ContainsKey(specGlossExtName)) + { + var specGlossDef = (KHR_materials_pbrSpecularGlossinessExtension)def.Extensions[specGlossExtName]; + if (specGlossDef.DiffuseTexture != null) + { + var textureId = specGlossDef.DiffuseTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + + if (specGlossDef.SpecularGlossinessTexture != null) + { + var textureId = specGlossDef.SpecularGlossinessTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.Extensions != null && def.Extensions.ContainsKey(KHR_materials_transmission_Factory.EXTENSION_NAME)) + { + var transmissionDef = (KHR_materials_transmission)def.Extensions[KHR_materials_transmission_Factory.EXTENSION_NAME]; + if (transmissionDef.transmissionTexture != null) + { + var textureId = transmissionDef.transmissionTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.Extensions != null && def.Extensions.ContainsKey(KHR_materials_volume_Factory.EXTENSION_NAME)) + { + var transmissionDef = (KHR_materials_volume)def.Extensions[KHR_materials_volume_Factory.EXTENSION_NAME]; + if (transmissionDef.thicknessTexture != null) + { + var textureId = transmissionDef.thicknessTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.Extensions != null && def.Extensions.ContainsKey(KHR_materials_iridescence_Factory.EXTENSION_NAME)) + { + var iridescenceDef = (KHR_materials_iridescence) def.Extensions[KHR_materials_iridescence_Factory.EXTENSION_NAME]; + if (iridescenceDef.iridescenceTexture != null) + { + var textureId = iridescenceDef.iridescenceTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + if (iridescenceDef.iridescenceThicknessTexture != null) + { + var textureId = iridescenceDef.iridescenceThicknessTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + if (def.Extensions != null && def.Extensions.ContainsKey(KHR_materials_specular_Factory.EXTENSION_NAME)) + { + var specularDef = (KHR_materials_specular) def.Extensions[KHR_materials_specular_Factory.EXTENSION_NAME]; + if (specularDef.specularTexture != null) + { + var textureId = specularDef.specularTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + if (specularDef.specularColorTexture != null) + { + var textureId = specularDef.specularColorTexture.Index; + tasks.Add(ConstructImageBuffer(textureId.Value, textureId.Id)); + } + } + + return Task.WhenAll(tasks); + } + + protected virtual ExtTextureTransformExtension GetTextureTransform(TextureInfo def) + { + IExtension extension; + if (_gltfRoot.ExtensionsUsed != null && + _gltfRoot.ExtensionsUsed.Contains(ExtTextureTransformExtensionFactory.EXTENSION_NAME) && + def.Extensions != null && + def.Extensions.TryGetValue(ExtTextureTransformExtensionFactory.EXTENSION_NAME, out extension)) + { + return (ExtTextureTransformExtension)extension; + } + else return null; + } + + protected virtual KHR_materials_emissive_strength GetEmissiveStrength(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_emissive_strength_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_emissive_strength_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_emissive_strength) extension; + } + else return null; + } + + protected virtual KHR_materials_transmission GetTransmission(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_transmission_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_transmission_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_transmission) extension; + } + return null; + } + + protected virtual KHR_materials_volume GetVolume(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_volume_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_volume_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_volume) extension; + } + return null; + } + + protected virtual KHR_materials_ior GetIOR(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_ior_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_ior_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_ior) extension; + } + return null; + } + + protected virtual KHR_materials_iridescence GetIridescence(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_iridescence_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_iridescence_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_iridescence) extension; + } + return null; + } + + protected virtual KHR_materials_specular GetSpecular(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_specular_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_specular_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_specular) extension; + } + return null; + } + + protected virtual KHR_materials_clearcoat GetClearcoat(GLTFMaterial def) + { + if (_gltfRoot.ExtensionsUsed != null && _gltfRoot.ExtensionsUsed.Contains(KHR_materials_clearcoat_Factory.EXTENSION_NAME) && + def.Extensions != null && def.Extensions.TryGetValue(KHR_materials_clearcoat_Factory.EXTENSION_NAME, out var extension)) + { + return (KHR_materials_clearcoat) extension; + } + return null; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs.meta new file mode 100644 index 0000000..d95c00b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMaterials.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 25e2614154434641a15540a7203e47f6 +timeCreated: 1657012132 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs new file mode 100644 index 0000000..7a0776e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs @@ -0,0 +1,573 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using GLTF; +using GLTF.Schema; +using UnityEngine; +using UnityEngine.Rendering; +using UnityGLTF.Cache; +using UnityGLTF.Extensions; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { + /// + /// Triggers loading, converting, and constructing of a UnityEngine.Mesh, and stores it in the asset cache + /// + /// The definition of the mesh to generate + /// The index of the mesh to generate + /// + /// A task that completes when the mesh is attached to the given GameObject + protected virtual async Task ConstructMesh(GLTFMesh mesh, int meshIndex, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + if (_assetCache.MeshCache[meshIndex] == null) + { + throw new Exception("Cannot generate mesh before ConstructMeshAttributes is called!"); + } + else if (_assetCache.MeshCache[meshIndex].LoadedMesh) + { + return; + } + + var totalVertCount = mesh.Primitives.Aggregate((uint)0, (sum, p) => sum + p.Attributes[SemanticProperties.POSITION].Value.Count); + var vertOffset = 0; + var firstPrim = mesh.Primitives[0]; + var meshCache = _assetCache.MeshCache[meshIndex]; + UnityMeshData unityData = new UnityMeshData() + { + Vertices = new Vector3[totalVertCount], + Normals = firstPrim.Attributes.ContainsKey(SemanticProperties.NORMAL) ? new Vector3[totalVertCount] : null, + Tangents = firstPrim.Attributes.ContainsKey(SemanticProperties.TANGENT) ? new Vector4[totalVertCount] : null, + Uv1 = firstPrim.Attributes.ContainsKey(SemanticProperties.TEXCOORD_0) ? new Vector2[totalVertCount] : null, + Uv2 = firstPrim.Attributes.ContainsKey(SemanticProperties.TEXCOORD_1) ? new Vector2[totalVertCount] : null, + Uv3 = firstPrim.Attributes.ContainsKey(SemanticProperties.TEXCOORD_2) ? new Vector2[totalVertCount] : null, + Uv4 = firstPrim.Attributes.ContainsKey(SemanticProperties.TEXCOORD_3) ? new Vector2[totalVertCount] : null, + Colors = firstPrim.Attributes.ContainsKey(SemanticProperties.COLOR_0) ? new Color[totalVertCount] : null, + BoneWeights = firstPrim.Attributes.ContainsKey(SemanticProperties.WEIGHTS_0) ? new BoneWeight[totalVertCount] : null, + + MorphTargetVertices = firstPrim.Targets != null && firstPrim.Targets[0].ContainsKey(SemanticProperties.POSITION) ? + Allocate2dArray((uint)firstPrim.Targets.Count, totalVertCount) : null, + MorphTargetNormals = firstPrim.Targets != null && firstPrim.Targets[0].ContainsKey(SemanticProperties.NORMAL) ? + Allocate2dArray((uint)firstPrim.Targets.Count, totalVertCount) : null, + MorphTargetTangents = firstPrim.Targets != null && firstPrim.Targets[0].ContainsKey(SemanticProperties.TANGENT) ? + Allocate2dArray((uint)firstPrim.Targets.Count, totalVertCount) : null, + + Topology = new MeshTopology[mesh.Primitives.Count], + Indices = new int[mesh.Primitives.Count][] + }; + + for (int i = 0; i < mesh.Primitives.Count; ++i) + { + var primitive = mesh.Primitives[i]; + var primCache = meshCache.Primitives[i]; + unityData.Topology[i] = GetTopology(primitive.Mode); + + if (IsMultithreaded) + { + await Task.Run(() => ConvertAttributeAccessorsToUnityTypes(primCache, unityData, vertOffset, i)); + } + else + { + ConvertAttributeAccessorsToUnityTypes(primCache, unityData, vertOffset, i); + } + + bool shouldUseDefaultMaterial = primitive.Material == null; + + GLTFMaterial materialToLoad = shouldUseDefaultMaterial ? DefaultMaterial : primitive.Material.Value; + if ((shouldUseDefaultMaterial && _defaultLoadedMaterial == null) || + (!shouldUseDefaultMaterial && _assetCache.MaterialCache[primitive.Material.Id] == null)) + { + await ConstructMaterial(materialToLoad, shouldUseDefaultMaterial ? -1 : primitive.Material.Id); + } + + cancellationToken.ThrowIfCancellationRequested(); + + var vertCount = primitive.Attributes[SemanticProperties.POSITION].Value.Count; + vertOffset += (int)vertCount; + + if (unityData.Topology[i] == MeshTopology.Triangles && primitive.Indices != null && primitive.Indices.Value != null) + { + Statistics.TriangleCount += primitive.Indices.Value.Count / 3; + } + } + + Statistics.VertexCount += vertOffset; + await ConstructUnityMesh(unityData, meshIndex, mesh.Name); + } + + /// + /// Populate a UnityEngine.Mesh from preloaded and preprocessed buffer data + /// + /// + /// + /// + /// + /// + protected async Task ConstructUnityMesh(UnityMeshData unityMeshData, int meshIndex, string meshName) + { + await YieldOnTimeoutAndThrowOnLowMemory(); + Mesh mesh = new Mesh + { + name = meshName, +#if UNITY_2017_3_OR_NEWER + indexFormat = unityMeshData.Vertices.Length > 65535 ? IndexFormat.UInt32 : IndexFormat.UInt16, +#endif + }; + + mesh.vertices = unityMeshData.Vertices; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.normals = unityMeshData.Normals; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.tangents = unityMeshData.Tangents; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.uv = unityMeshData.Uv1; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.uv2 = unityMeshData.Uv2; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.uv3 = unityMeshData.Uv3; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.uv4 = unityMeshData.Uv4; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.colors = unityMeshData.Colors; + await YieldOnTimeoutAndThrowOnLowMemory(); + mesh.boneWeights = unityMeshData.BoneWeights; + await YieldOnTimeoutAndThrowOnLowMemory(); + + mesh.subMeshCount = unityMeshData.Indices.Length; + uint baseVertex = 0; + for (int i = 0; i < unityMeshData.Indices.Length; i++) + { + mesh.SetIndices(unityMeshData.Indices[i], unityMeshData.Topology[i], i, false, (int)baseVertex); + baseVertex += _assetCache.MeshCache[meshIndex].Primitives[i].Attributes[SemanticProperties.POSITION].AccessorId.Value.Count; + } + mesh.RecalculateBounds(); + await YieldOnTimeoutAndThrowOnLowMemory(); + + if (unityMeshData.MorphTargetVertices != null) + { + var firstPrim = _gltfRoot.Meshes[meshIndex].Primitives[0]; + for (int i = 0; i < firstPrim.Targets.Count; i++) + { + var targetName = firstPrim.TargetNames != null ? firstPrim.TargetNames[i] : $"Morphtarget{i}"; + mesh.AddBlendShapeFrame(targetName, 1f, + unityMeshData.MorphTargetVertices[i], + unityMeshData.MorphTargetNormals != null ? unityMeshData.MorphTargetNormals[i] : null, + unityMeshData.MorphTargetTangents != null ? unityMeshData.MorphTargetTangents[i] : null + ); + } + } + await YieldOnTimeoutAndThrowOnLowMemory(); + + if (unityMeshData.Normals == null && unityMeshData.Topology[0] == MeshTopology.Triangles) + { + mesh.RecalculateNormals(); + } + + if (!KeepCPUCopyOfMesh) + { + mesh.UploadMeshData(true); + } + + _assetCache.MeshCache[meshIndex].LoadedMesh = mesh; + } + + protected virtual async Task ConstructMeshTargets(MeshPrimitive primitive, int meshIndex, int primitiveIndex) + { + var newTargets = new List>(primitive.Targets.Count); + _assetCache.MeshCache[meshIndex].Primitives[primitiveIndex].Targets = newTargets; + + for (int i = 0; i < primitive.Targets.Count; i++) + { + var target = primitive.Targets[i]; + newTargets.Add(new Dictionary()); + + NumericArray[] sparseNormals = null; + NumericArray[] sparsePositions = null; + NumericArray[] sparseTangents = null; + + const string NormalKey = "NORMALS"; + const string PositionKey = "POSITIONS"; + const string TangentKey = "TANGENTS"; + + // normals, positions, tangents + foreach (var targetAttribute in target) + { + BufferId bufferIdPair = null; + if (targetAttribute.Value.Value.Sparse == null) + { + bufferIdPair = targetAttribute.Value.Value.BufferView.Value.Buffer; + } + else + { + bufferIdPair = primitive.Attributes[targetAttribute.Key].Value.BufferView.Value.Buffer; + targetAttribute.Value.Value.BufferView = primitive.Attributes[targetAttribute.Key].Value.BufferView; + } + GLTFBuffer buffer = bufferIdPair.Value; + int bufferID = bufferIdPair.Id; + + if (_assetCache.BufferCache[bufferID] == null) + { + await ConstructBuffer(buffer, bufferID); + } + + newTargets[i][targetAttribute.Key] = new AttributeAccessor + { + AccessorId = targetAttribute.Value, + Stream = _assetCache.BufferCache[bufferID].Stream, + Offset = (uint)_assetCache.BufferCache[bufferID].ChunkOffset + }; + + // if this buffer isn't sparse, we're done here + if (targetAttribute.Value.Value.Sparse == null) continue; + + // Values + var bufferId = targetAttribute.Value.Value.Sparse.Values.BufferView.Value.Buffer; + var bufferData = await GetBufferData(bufferId); + AttributeAccessor sparseValues = new AttributeAccessor + { + AccessorId = targetAttribute.Value, + Stream = bufferData.Stream, + Offset = (uint)bufferData.ChunkOffset + }; + uint offset1 = GLTFHelpers.LoadBufferView(sparseValues.AccessorId.Value.Sparse.Values.BufferView.Value, sparseValues.Offset, sparseValues.Stream, out byte[] bufferViewCache1); + + // Indices + bufferId = targetAttribute.Value.Value.Sparse.Indices.BufferView.Value.Buffer; + bufferData = await GetBufferData(bufferId); + AttributeAccessor sparseIndices = new AttributeAccessor + { + AccessorId = targetAttribute.Value, + Stream = bufferData.Stream, + Offset = (uint)bufferData.ChunkOffset + }; + uint offset2 = GLTFHelpers.LoadBufferView(sparseIndices.AccessorId.Value.Sparse.Indices.BufferView.Value, sparseIndices.Offset, sparseIndices.Stream, out byte[] bufferViewCache2); + + switch (targetAttribute.Key) + { + case NormalKey: + sparseNormals = new NumericArray[2]; + Accessor.AsSparseVector3Array(targetAttribute.Value.Value, ref sparseNormals[0], bufferViewCache1, offset1); + Accessor.AsSparseUIntArray(targetAttribute.Value.Value, ref sparseNormals[1], bufferViewCache2, offset2); + break; + case PositionKey: + sparsePositions = new NumericArray[2]; + Accessor.AsSparseVector3Array(targetAttribute.Value.Value, ref sparsePositions[0], bufferViewCache1, offset1); + Accessor.AsSparseUIntArray(targetAttribute.Value.Value, ref sparsePositions[1], bufferViewCache2, offset2); + break; + case TangentKey: + sparseTangents = new NumericArray[2]; + Accessor.AsSparseVector3Array(targetAttribute.Value.Value, ref sparseTangents[0], bufferViewCache1, offset1); + Accessor.AsSparseUIntArray(targetAttribute.Value.Value, ref sparseTangents[1], bufferViewCache2, offset2); + break; + } + } + + var att = newTargets[i]; + GLTFHelpers.BuildTargetAttributes(ref att); + + if (sparseNormals != null) + { + var current = att[NormalKey].AccessorContent; + NumericArray before = new NumericArray(); + before.AsVec3s = new GLTF.Math.Vector3[current.AsVec3s.Length]; + Array.Copy(current.AsVec3s, before.AsVec3s, before.AsVec3s.Length); + for (int j = 0; j < sparseNormals[1].AsUInts.Length; j++) + { + before.AsVec3s[sparseNormals[1].AsUInts[j]] = sparseNormals[0].AsVec3s[j]; + } + att[NormalKey].AccessorContent = before; + } + + if (sparsePositions != null) + { + var current = att[PositionKey].AccessorContent; + NumericArray before = new NumericArray(); + before.AsVec3s = new GLTF.Math.Vector3[current.AsVec3s.Length]; + Array.Copy(current.AsVec3s, before.AsVec3s, before.AsVec3s.Length); + for (int j = 0; j < sparsePositions[1].AsUInts.Length; j++) + { + before.AsVec3s[sparsePositions[1].AsUInts[j]] = sparsePositions[0].AsVec3s[j]; + } + att[PositionKey].AccessorContent = before; + } + + if (sparseTangents != null) + { + var current = att[TangentKey].AccessorContent; + NumericArray before = new NumericArray(); + before.AsVec3s = new GLTF.Math.Vector3[current.AsVec3s.Length]; + Array.Copy(current.AsVec3s, before.AsVec3s, before.AsVec3s.Length); + for (int j = 0; j < sparseTangents[1].AsUInts.Length; j++) + { + before.AsVec3s[sparseTangents[1].AsUInts[j]] = sparseTangents[0].AsVec3s[j]; + } + att[TangentKey].AccessorContent = before; + } + + TransformTargets(ref att); + } + } + + private async Task ConstructMeshAttributes(GLTFMesh mesh, MeshId meshId) + { + int meshIndex = meshId.Id; + + if (_assetCache.MeshCache[meshIndex] == null) + _assetCache.MeshCache[meshIndex] = new MeshCacheData(); + else if (_assetCache.MeshCache[meshIndex].Primitives.Count > 0) + return; + + for (int i = 0; i < mesh.Primitives.Count; ++i) + { + MeshPrimitive primitive = mesh.Primitives[i]; + + await ConstructPrimitiveAttributes(primitive, meshIndex, i); + + if (primitive.Material != null) + { + await ConstructMaterialImageBuffers(primitive.Material.Value); + } + + if (primitive.Targets != null) + { + // read mesh primitive targets into assetcache + await ConstructMeshTargets(primitive, meshIndex, i); + } + } + } + + protected virtual async Task ConstructPrimitiveAttributes(MeshPrimitive primitive, int meshIndex, int primitiveIndex) + { + var primData = new MeshCacheData.PrimitiveCacheData(); + _assetCache.MeshCache[meshIndex].Primitives.Add(primData); + + var attributeAccessors = primData.Attributes; + var sparseAccessors = new Dictionary(); + foreach (var attributePair in primitive.Attributes) + { + var bufferId = attributePair.Value.Value.BufferView.Value.Buffer; + var bufferData = await GetBufferData(bufferId); + + attributeAccessors[attributePair.Key] = new AttributeAccessor + { + AccessorId = attributePair.Value, + Stream = bufferData.Stream, + Offset = (uint)bufferData.ChunkOffset + }; + + var sparse = attributePair.Value.Value.Sparse; + if (sparse != null) + { + var sparseBufferId = sparse.Values.BufferView.Value.Buffer; + var sparseBufferData = await GetBufferData(sparseBufferId); + AttributeAccessor sparseValues = new AttributeAccessor + { + AccessorId = attributePair.Value, + Stream = sparseBufferData.Stream, + Offset = (uint)sparseBufferData.ChunkOffset + }; + + var sparseIndicesBufferId = sparse.Indices.BufferView.Value.Buffer; + var sparseIndicesBufferData = await GetBufferData(sparseIndicesBufferId); + AttributeAccessor sparseIndices = new AttributeAccessor + { + AccessorId = attributePair.Value, + Stream = sparseIndicesBufferData.Stream, + Offset = (uint)sparseIndicesBufferData.ChunkOffset + }; + + sparseAccessors[attributePair.Key] = (sparseIndices, sparseValues); + } + } + + if (primitive.Indices != null) + { + var bufferId = primitive.Indices.Value.BufferView.Value.Buffer; + var bufferData = await GetBufferData(bufferId); + + attributeAccessors[SemanticProperties.INDICES] = new AttributeAccessor + { + AccessorId = primitive.Indices, + Stream = bufferData.Stream, + Offset = (uint)bufferData.ChunkOffset + }; + } + try + { + GLTFHelpers.BuildMeshAttributes(ref attributeAccessors, ref sparseAccessors); + } + catch (GLTFLoadException e) + { + Debug.Log(LogType.Warning, e.ToString()); + } + TransformAttributes(ref attributeAccessors); + } + + protected void ConvertAttributeAccessorsToUnityTypes( + MeshCacheData.PrimitiveCacheData primData, + UnityMeshData unityData, + int vertOffset, + int indexOffset) + { + // todo optimize: There are multiple copies being performed to turn the buffer data into mesh data. Look into reducing them + var meshAttributes = primData.Attributes; + int vertexCount = (int)meshAttributes[SemanticProperties.POSITION].AccessorId.Value.Count; + + var indices = meshAttributes.ContainsKey(SemanticProperties.INDICES) + ? meshAttributes[SemanticProperties.INDICES].AccessorContent.AsUInts.ToIntArrayRaw() + : MeshPrimitive.GenerateTriangles(vertexCount); + if (unityData.Topology[indexOffset] == MeshTopology.Triangles) + SchemaExtensions.FlipTriangleFaces(indices); + unityData.Indices[indexOffset] = indices; + + if (meshAttributes.ContainsKey(SemanticProperties.Weight[0]) && meshAttributes.ContainsKey(SemanticProperties.Joint[0])) + { + CreateBoneWeightArray( + meshAttributes[SemanticProperties.Joint[0]].AccessorContent.AsVec4s.ToUnityVector4Raw(), + meshAttributes[SemanticProperties.Weight[0]].AccessorContent.AsVec4s.ToUnityVector4Raw(), + ref unityData.BoneWeights, + vertOffset); + } + + if (meshAttributes.ContainsKey(SemanticProperties.POSITION)) + { + meshAttributes[SemanticProperties.POSITION].AccessorContent.AsVertices.ToUnityVector3Raw(unityData.Vertices, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.NORMAL)) + { + meshAttributes[SemanticProperties.NORMAL].AccessorContent.AsNormals.ToUnityVector3Raw(unityData.Normals, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.TANGENT)) + { + meshAttributes[SemanticProperties.TANGENT].AccessorContent.AsTangents.ToUnityVector4Raw(unityData.Tangents, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.TexCoord[0])) + { + meshAttributes[SemanticProperties.TexCoord[0]].AccessorContent.AsTexcoords.ToUnityVector2Raw(unityData.Uv1, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.TexCoord[1])) + { + meshAttributes[SemanticProperties.TexCoord[1]].AccessorContent.AsTexcoords.ToUnityVector2Raw(unityData.Uv2, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.TexCoord[2])) + { + meshAttributes[SemanticProperties.TexCoord[2]].AccessorContent.AsTexcoords.ToUnityVector2Raw(unityData.Uv3, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.TexCoord[3])) + { + meshAttributes[SemanticProperties.TexCoord[3]].AccessorContent.AsTexcoords.ToUnityVector2Raw(unityData.Uv4, vertOffset); + } + if (meshAttributes.ContainsKey(SemanticProperties.Color[0])) + { + if (QualitySettings.activeColorSpace == ColorSpace.Gamma) + meshAttributes[SemanticProperties.Color[0]].AccessorContent.AsColors.ToUnityColorRaw(unityData.Colors, vertOffset); + else + meshAttributes[SemanticProperties.Color[0]].AccessorContent.AsColors.ToUnityColorLinear(unityData.Colors, vertOffset); + } + + var targets = primData.Targets; + if (targets != null) + { + for (int i = 0; i < targets.Count; ++i) + { + if (targets[i].ContainsKey(SemanticProperties.POSITION)) + { + targets[i][SemanticProperties.POSITION].AccessorContent.AsVec3s.ToUnityVector3Raw(unityData.MorphTargetVertices[i], vertOffset); + } + if (targets[i].ContainsKey(SemanticProperties.NORMAL)) + { + targets[i][SemanticProperties.NORMAL].AccessorContent.AsVec3s.ToUnityVector3Raw(unityData.MorphTargetNormals[i], vertOffset); + } + if (targets[i].ContainsKey(SemanticProperties.TANGENT)) + { + targets[i][SemanticProperties.TANGENT].AccessorContent.AsVec3s.ToUnityVector3Raw(unityData.MorphTargetTangents[i], vertOffset); + } + } + } + } + + // Flip vectors to Unity coordinate system + private void TransformTargets(ref Dictionary attributeAccessors) + { + if (attributeAccessors.ContainsKey(SemanticProperties.POSITION)) + { + AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.POSITION]; + SchemaExtensions.ConvertVector3CoordinateSpace(ref attributeAccessor, SchemaExtensions.CoordinateSpaceConversionScale); + } + + if (attributeAccessors.ContainsKey(SemanticProperties.NORMAL)) + { + AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.NORMAL]; + SchemaExtensions.ConvertVector3CoordinateSpace(ref attributeAccessor, SchemaExtensions.CoordinateSpaceConversionScale); + } + + if (attributeAccessors.ContainsKey(SemanticProperties.TANGENT)) + { + AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.TANGENT]; + SchemaExtensions.ConvertVector3CoordinateSpace(ref attributeAccessor, SchemaExtensions.CoordinateSpaceConversionScale); + } + } + + protected void TransformAttributes(ref Dictionary attributeAccessors) + { + foreach (var name in attributeAccessors.Keys) + { + var aa = attributeAccessors[name]; + switch (name) + { + case SemanticProperties.POSITION: + case SemanticProperties.NORMAL: + SchemaExtensions.ConvertVector3CoordinateSpace(ref aa, SchemaExtensions.CoordinateSpaceConversionScale); + break; + case SemanticProperties.TANGENT: + SchemaExtensions.ConvertVector4CoordinateSpace(ref aa, SchemaExtensions.TangentSpaceConversionScale); + break; + case SemanticProperties.TEXCOORD_0: + case SemanticProperties.TEXCOORD_1: + case SemanticProperties.TEXCOORD_2: + case SemanticProperties.TEXCOORD_3: + SchemaExtensions.FlipTexCoordArrayV(ref aa); + break; + } + } + } + + private static void AddNewBufferAndViewToAccessor(byte[] data, Accessor accessor, GLTFRoot _gltfRoot) + { + _gltfRoot.Buffers.Add(new GLTFBuffer() { ByteLength = (uint) data.Length }); + _gltfRoot.BufferViews.Add(new BufferView() { ByteLength = (uint) data.Length, ByteOffset = 0, Buffer = new BufferId() { Id = _gltfRoot.Buffers.Count, Root = _gltfRoot } }); + accessor.BufferView = new BufferViewId() { Id = _gltfRoot.BufferViews.Count - 1, Root = _gltfRoot }; + } + + protected static MeshTopology GetTopology(DrawMode mode) + { + switch (mode) + { + case DrawMode.Points: return MeshTopology.Points; + case DrawMode.Lines: return MeshTopology.Lines; + case DrawMode.LineStrip: return MeshTopology.LineStrip; + case DrawMode.Triangles: return MeshTopology.Triangles; + } + + throw new Exception("Unity does not support glTF draw mode: " + mode); + } + + /// + /// Allocate a generic type 2D array. The size is depending on the given parameters. + /// + /// Defines the depth of the arrays first dimension + /// >Defines the depth of the arrays second dimension + /// + private static T[][] Allocate2dArray(uint x, uint y) + { + var result = new T[x][]; + for (var i = 0; i < x; i++) result[i] = new T[y]; + return result; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs.meta new file mode 100644 index 0000000..0edafab --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterMeshes.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7f4930a0205140bbbcfaa67b79ab587b +timeCreated: 1657013019 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs new file mode 100644 index 0000000..4fad326 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs @@ -0,0 +1,97 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using GLTF; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF.Extensions; +using Matrix4x4 = GLTF.Math.Matrix4x4; +using Vector4 = UnityEngine.Vector4; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { + + protected virtual async Task SetupBones(Skin skin, SkinnedMeshRenderer renderer, CancellationToken cancellationToken) + { + var boneCount = skin.Joints.Count; + Transform[] bones = new Transform[boneCount]; + + // TODO: build bindpose arrays only once per skin, instead of once per node + Matrix4x4[] gltfBindPoses = null; + if (skin.InverseBindMatrices != null) + { + var bufferId = skin.InverseBindMatrices.Value.BufferView.Value.Buffer; + var bufferData = await GetBufferData(bufferId); + AttributeAccessor attributeAccessor = new AttributeAccessor + { + AccessorId = skin.InverseBindMatrices, + Stream = bufferData.Stream, + Offset = bufferData.ChunkOffset + }; + + GLTFHelpers.BuildBindPoseSamplers(ref attributeAccessor); + gltfBindPoses = attributeAccessor.AccessorContent.AsMatrix4x4s; + } + + UnityEngine.Matrix4x4[] bindPoses = new UnityEngine.Matrix4x4[boneCount]; + for (int i = 0; i < boneCount; i++) + { + var node = await GetNode(skin.Joints[i].Id, cancellationToken); + + bones[i] = node.transform; + bindPoses[i] = gltfBindPoses != null ? gltfBindPoses[i].ToUnityMatrix4x4Convert() : UnityEngine.Matrix4x4.identity; + } + + if (skin.Skeleton != null) + { + var rootBoneNode = await GetNode(skin.Skeleton.Id, cancellationToken); + renderer.rootBone = rootBoneNode.transform; + } + else + { + var rootBoneId = GLTFHelpers.FindCommonAncestor(skin.Joints); + if (rootBoneId != null) + { + var rootBoneNode = await GetNode(rootBoneId.Id, cancellationToken); + renderer.rootBone = rootBoneNode.transform; + } + else + { + throw new Exception("glTF skin joints do not share a root node!"); + } + } + renderer.sharedMesh.bindposes = bindPoses; + renderer.bones = bones; + } + + private void CreateBoneWeightArray(Vector4[] joints, Vector4[] weights, ref BoneWeight[] destArr, int offset = 0) + { + // normalize weights (built-in normalize function only normalizes three components) + for (int i = 0; i < weights.Length; i++) + { + var weightSum = (weights[i].x + weights[i].y + weights[i].z + weights[i].w); + + if (!Mathf.Approximately(weightSum, 0)) + { + weights[i] /= weightSum; + } + } + + for (int i = 0; i < joints.Length; i++) + { + destArr[offset + i].boneIndex0 = (int)joints[i].x; + destArr[offset + i].boneIndex1 = (int)joints[i].y; + destArr[offset + i].boneIndex2 = (int)joints[i].z; + destArr[offset + i].boneIndex3 = (int)joints[i].w; + + destArr[offset + i].weight0 = weights[i].x; + destArr[offset + i].weight1 = weights[i].y; + destArr[offset + i].weight2 = weights[i].z; + destArr[offset + i].weight3 = weights[i].w; + } + } + + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs.meta new file mode 100644 index 0000000..fe761d7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterSkinning.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cef61a6932d545e0aca7bb7cd4a819db +timeCreated: 1657012769 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs new file mode 100644 index 0000000..4cf9579 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs @@ -0,0 +1,444 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using GLTF.Schema; +using GLTF.Utilities; +using UnityEngine; +using UnityGLTF.Cache; +using UnityGLTF.Extensions; +using UnityGLTF.Loader; +using Object = UnityEngine.Object; + +namespace UnityGLTF +{ + public partial class GLTFSceneImporter + { + private class TextureData + { + public Texture Texture = null; + public int TexCoord = 0; + public double DataMultiplier = 1; + public Vector2 Offset = Vector2.zero; + public double Rotation = 0; + public Vector2 Scale = Vector2.one; + public int TexCoordExtra = 0; + } + + private async Task FromTextureInfo(TextureInfo textureInfo) + { + var result = new TextureData(); + if (textureInfo?.Index?.Value == null) return result; + + TextureId textureId = textureInfo.Index; + await ConstructTexture(textureId.Value, textureId.Id, !KeepCPUCopyOfTexture, true); + result.Texture = _assetCache.TextureCache[textureId.Id].Texture; + result.TexCoord = textureInfo.TexCoord; + + if (textureInfo is NormalTextureInfo nti) + result.DataMultiplier = nti.Scale; + if (textureInfo is OcclusionTextureInfo oti) + result.DataMultiplier = oti.Strength; + + var ext = GetTextureTransform(textureInfo); + if (ext != null) + { + result.Offset = ext.Offset.ToUnityVector2Raw(); + result.Rotation = ext.Rotation; + result.Scale = ext.Scale.ToUnityVector2Raw(); + result.TexCoordExtra = ext.TexCoord; + } + + return result; + } + + protected async Task ConstructImage(GLTFImage image, int imageCacheIndex, bool markGpuOnly, bool isLinear) + { + if (_assetCache.ImageCache[imageCacheIndex] == null) + { + Stream stream = null; + if (image.Uri == null) + { + var bufferView = image.BufferView.Value; + var data = new byte[bufferView.ByteLength]; + + BufferCacheData bufferContents = _assetCache.BufferCache[bufferView.Buffer.Id]; + bufferContents.Stream.Position = bufferView.ByteOffset + bufferContents.ChunkOffset; + stream = new SubStream(bufferContents.Stream, 0, data.Length); + } + else + { + string uri = image.Uri; + + byte[] bufferData; + URIHelper.TryParseBase64(uri, out bufferData); + if (bufferData != null) + { + stream = new MemoryStream(bufferData, 0, bufferData.Length, false, true); + } + else + { + stream = _assetCache.ImageStreamCache[imageCacheIndex]; + } + } + + await YieldOnTimeoutAndThrowOnLowMemory(); + await ConstructUnityTexture(stream, markGpuOnly, isLinear, image, imageCacheIndex); + } + } + + protected async Task ConstructImageBuffer(GLTFTexture texture, int textureIndex) + { + int sourceId = GetTextureSourceId(texture); + if (_assetCache.ImageStreamCache[sourceId] == null) + { + GLTFImage image = _gltfRoot.Images[sourceId]; + + // we only load the streams if not a base64 uri, meaning the data is in the uri + if (image.Uri != null && !URIHelper.IsBase64Uri(image.Uri)) + { + _assetCache.ImageStreamCache[sourceId] = await _options.DataLoader.LoadStreamAsync(image.Uri); + } + else if (image.Uri == null && image.BufferView != null && _assetCache.BufferCache[image.BufferView.Value.Buffer.Id] == null) + { + int bufferIndex = image.BufferView.Value.Buffer.Id; + await ConstructBuffer(_gltfRoot.Buffers[bufferIndex], bufferIndex); + } + } + + if (_assetCache.TextureCache[textureIndex] == null) + { + _assetCache.TextureCache[textureIndex] = new TextureCacheData + { + TextureDefinition = texture + }; + } + } + + async Task CheckMimeTypeAndLoadImage(GLTFImage image, Texture2D texture, byte[] data, bool markGpuOnly) + { + switch (image.MimeType) + { + case "image/png": + case "image/jpeg": + // NOTE: the second parameter of LoadImage() marks non-readable, but we can't mark it until after we call Apply() + texture.LoadImage(data, markGpuOnly); + break; + case "image/ktx2": +#if HAVE_KTX + // TODO doesn't work yet, blocks? + // var ktxTexture = new KtxUnity.KtxTexture(); + // using(var alloc = new Unity.Collections.NativeArray(data, Unity.Collections.Allocator.Persistent)) + // { + // var resultTextureData = await ktxTexture.LoadFromBytes(alloc, false); + // var tmp = texture; + // texture = resultTextureData.texture; + // texture.name = tmp.name; + // } +#else + Debug.Log(LogType.Warning, "The KTX2 Texture Format (KHR_texture_basisu) isn't supported right now. The texture " + texture.name + " won't load and will be black. Try using glTFast instead."); + await Task.CompletedTask; +#endif + break; + default: + texture.LoadImage(data, markGpuOnly); + break; + } + + await Task.CompletedTask; + } + + protected virtual async Task ConstructUnityTexture(Stream stream, bool markGpuOnly, bool isLinear, GLTFImage image, int imageCacheIndex) + { +#if UNITY_EDITOR + if (stream is AssetDatabaseStream assetDatabaseStream) + { + var tx = UnityEditor.AssetDatabase.LoadAssetAtPath(assetDatabaseStream.AssetUri); + progressStatus.TextureLoaded++; + progress?.Report(progressStatus); + _assetCache.ImageCache[imageCacheIndex] = tx; + return; + } +#endif + Texture2D texture = new Texture2D(0, 0, TextureFormat.RGBA32, GenerateMipMapsForTextures, isLinear); + texture.name = string.IsNullOrEmpty(image.Name) ? Path.GetFileNameWithoutExtension(image.Uri) : image.Name; + + if (stream == FileLoader.InvalidStream) + { + // ignore + texture = null; + } + else if (stream is MemoryStream) + { + using (MemoryStream memoryStream = stream as MemoryStream) + { + await YieldOnTimeoutAndThrowOnLowMemory(); + await CheckMimeTypeAndLoadImage(image, texture, memoryStream.ToArray(), markGpuOnly); + } + } + else + { + byte[] buffer = new byte[stream.Length]; + + // todo: potential optimization is to split stream read into multiple frames (or put it on a thread?) + if (stream.Length > int.MaxValue) + { + throw new Exception("Stream is larger than can be copied into byte array"); + } + stream.Read(buffer, 0, (int)stream.Length); + + await YieldOnTimeoutAndThrowOnLowMemory(); + await CheckMimeTypeAndLoadImage(image, texture, buffer, markGpuOnly); + } + + if (_assetCache.ImageCache[imageCacheIndex] != null) Debug.Log(LogType.Assert, "ImageCache should not be loaded multiple times"); + if (texture) + { + progressStatus.TextureLoaded++; + progress?.Report(progressStatus); + } + _assetCache.ImageCache[imageCacheIndex] = texture; + } + + + protected virtual int GetTextureSourceId(GLTFTexture texture) + { + return texture.Source?.Id ?? 0; + } + + /// + /// Creates a texture from a glTF texture + /// + /// The texture to load + /// The index in the texture cache + /// Whether the texture is GPU only, instead of keeping a CPU copy + /// Whether the texture is linear rather than sRGB + /// The loading task + public virtual async Task LoadTextureAsync(GLTFTexture texture, int textureIndex, bool markGpuOnly, bool isLinear) + { + try + { + lock (this) + { + if (_isRunning) + { + throw new GLTFLoadException("Cannot CreateTexture while GLTFSceneImporter is already running"); + } + + _isRunning = true; + } + + if (_options.ThrowOnLowMemory) + { + _memoryChecker = new MemoryChecker(); + } + + if (_gltfRoot == null) + { + await LoadJson(_gltfFileName); + } + + if (_assetCache == null) + { + _assetCache = new AssetCache(_gltfRoot); + } + + await ConstructImageBuffer(texture, textureIndex); + await ConstructTexture(texture, textureIndex, markGpuOnly, isLinear); + } + finally + { + lock (this) + { + _isRunning = false; + } + } + } + + public virtual Task LoadTextureAsync(GLTFTexture texture, int textureIndex, bool isLinear) + { + return LoadTextureAsync(texture, textureIndex, !KeepCPUCopyOfTexture, isLinear); + } + + /// + /// Gets texture that has been loaded from CreateTexture + /// + /// The texture to get + /// Created texture + public virtual Texture GetTexture(int textureIndex) + { + if (_assetCache == null) + { + throw new GLTFLoadException("Asset cache needs initialized before calling GetTexture"); + } + + if (_assetCache.TextureCache[textureIndex] == null) + { + return null; + } + + return _assetCache.TextureCache[textureIndex].Texture; + } + + protected virtual async Task ConstructTexture(GLTFTexture texture, int textureIndex, bool markGpuOnly, bool isLinear) + { + if (_assetCache.TextureCache[textureIndex].Texture == null) + { + int sourceId = GetTextureSourceId(texture); + GLTFImage image = _gltfRoot.Images[sourceId]; + await ConstructImage(image, sourceId, markGpuOnly, isLinear); + + var source = _assetCache.ImageCache[sourceId]; + if (!source) return; + + FilterMode desiredFilterMode; + TextureWrapMode desiredWrapModeS, desiredWrapModeT; + + if (texture.Sampler != null) + { + var sampler = texture.Sampler.Value; + switch (sampler.MinFilter) + { + case MinFilterMode.Nearest: + case MinFilterMode.NearestMipmapNearest: + case MinFilterMode.NearestMipmapLinear: + desiredFilterMode = FilterMode.Point; + break; + case MinFilterMode.Linear: + case MinFilterMode.LinearMipmapNearest: + desiredFilterMode = FilterMode.Bilinear; + break; + case MinFilterMode.LinearMipmapLinear: + desiredFilterMode = FilterMode.Trilinear; + break; + default: + Debug.Log(LogType.Warning, "Unsupported Sampler.MinFilter: " + sampler.MinFilter); + desiredFilterMode = FilterMode.Trilinear; + break; + } + + TextureWrapMode UnityWrapMode(GLTF.Schema.WrapMode gltfWrapMode) + { + switch (gltfWrapMode) + { + case GLTF.Schema.WrapMode.ClampToEdge: + return TextureWrapMode.Clamp; + case GLTF.Schema.WrapMode.Repeat: + return TextureWrapMode.Repeat; + case GLTF.Schema.WrapMode.MirroredRepeat: + return TextureWrapMode.Mirror; + default: + Debug.Log(LogType.Warning, "Unsupported Sampler.Wrap: " + gltfWrapMode); + return TextureWrapMode.Repeat; + } + } + + desiredWrapModeS = UnityWrapMode(sampler.WrapS); + desiredWrapModeT = UnityWrapMode(sampler.WrapT); + } + else + { + desiredFilterMode = FilterMode.Trilinear; + desiredWrapModeS = TextureWrapMode.Repeat; + desiredWrapModeT = TextureWrapMode.Repeat; + } + + var matchSamplerState = source.filterMode == desiredFilterMode && source.wrapModeU == desiredWrapModeS && source.wrapModeV == desiredWrapModeT; + if (matchSamplerState || markGpuOnly) + { + if (_assetCache.TextureCache[textureIndex].Texture != null) Debug.Log(LogType.Assert, "Texture should not be reset to prevent memory leaks"); + _assetCache.TextureCache[textureIndex].Texture = source; + + if (!matchSamplerState) + { + Debug.Log(LogType.Warning, $"Ignoring sampler; filter mode: source {source.filterMode}, desired {desiredFilterMode}; wrap mode: source {source.wrapModeU}x{source.wrapModeV}, desired {desiredWrapModeS}x{desiredWrapModeT}"); + } + } + else +#if UNITY_EDITOR + if (!UnityEditor.AssetDatabase.Contains(source)) +#endif + { + var unityTexture = Object.Instantiate(source); + unityTexture.name = string.IsNullOrEmpty(image.Name) ? + string.IsNullOrEmpty(texture.Name) ? + Path.GetFileNameWithoutExtension(image.Uri) : + texture.Name : + image.Name; + unityTexture.filterMode = desiredFilterMode; + unityTexture.wrapModeU = desiredWrapModeS; + unityTexture.wrapModeV = desiredWrapModeT; + + if (_assetCache.TextureCache[textureIndex].Texture != null) Debug.Log(LogType.Assert, "Texture should not be reset to prevent memory leaks"); + _assetCache.TextureCache[textureIndex].Texture = unityTexture; + } +#if UNITY_EDITOR + else + { + // don't warn for just filter mode, user choice + if (source.wrapModeU != desiredWrapModeS || source.wrapModeV != desiredWrapModeT) + Debug.Log(LogType.Warning, ($"Sampler state doesn't match but source texture is non-readable. Results might not be correct if textures are used multiple times with different sampler states. {source.filterMode} == {desiredFilterMode} && {source.wrapModeU} == {desiredWrapModeS} && {source.wrapModeV} == {desiredWrapModeT}")); + _assetCache.TextureCache[textureIndex].Texture = source; + } +#endif + } + + _assetCache.TextureCache[textureIndex].IsLinear = isLinear; + } + + protected virtual void ConstructImageFromGLB(GLTFImage image, int imageCacheIndex) + { + var texture = new Texture2D(0, 0); + texture.name = nameof(GLTFSceneImporter) + (image.Name != null ? ("." + image.Name) : ""); + var bufferView = image.BufferView.Value; + var data = new byte[bufferView.ByteLength]; + + var bufferContents = _assetCache.BufferCache[bufferView.Buffer.Id]; + bufferContents.Stream.Position = bufferView.ByteOffset + bufferContents.ChunkOffset; + bufferContents.Stream.Read(data, 0, data.Length); + texture.LoadImage(data); + + if (_assetCache.ImageCache[imageCacheIndex] != null) Debug.Log(LogType.Assert, "ImageCache should not be loaded multiple times"); + progressStatus.TextureLoaded++; + progress?.Report(progressStatus); + _assetCache.ImageCache[imageCacheIndex] = texture; + } + +#if UNITY_EDITOR + internal class AssetDatabaseStream : Stream + { + public string AssetUri { get; } + + public AssetDatabaseStream(string imageUri) + { + AssetUri = imageUri; + } + + public override void Flush() => throw new NotImplementedException(); + public override int Read(byte[] buffer, int offset, int count) => throw new NotImplementedException(); + public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException(); + public override void SetLength(long value) => throw new NotImplementedException(); + public override void Write(byte[] buffer, int offset, int count) => throw new NotImplementedException(); + + public override bool CanRead { get; } + public override bool CanSeek { get; } + public override bool CanWrite { get; } + public override long Length { get; } + public override long Position { get; set; } + } +#endif + } + + internal static class MatHelper + { + internal static void SetKeyword(this Material material, string keyword, bool state) + { + if (state) + material.EnableKeyword(keyword + "_ON"); + else + material.DisableKeyword(keyword + "_ON"); + + if (material.HasProperty(keyword)) + material.SetFloat(keyword, state ? 1 : 0); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs.meta new file mode 100644 index 0000000..a00c414 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/SceneImporter/ImporterTextures.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 859436f420e4466daa129c3fc03f4480 +timeCreated: 1657012139 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline.meta new file mode 100644 index 0000000..1b7db75 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bab39c7055582594da14a45f4b1bebf1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs new file mode 100644 index 0000000..8e1fa7d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs @@ -0,0 +1,468 @@ +#define USE_ANIMATION_POINTER + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using GLTF.Schema; +using Unity.Profiling; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace UnityGLTF.Timeline +{ + public class GLTFRecorder + { + public GLTFRecorder(Transform root, bool recordBlendShapes = true, bool recordRootInWorldSpace = false, bool recordAnimationPointer = false, bool addBoundsMarkerNodes = false) + { + if (!root) + throw new ArgumentNullException(nameof(root), "Please provide a root transform to record."); + + this.root = root; + this.recordBlendShapes = recordBlendShapes; + this.recordRootInWorldSpace = recordRootInWorldSpace; + this.recordAnimationPointer = recordAnimationPointer; + this.addBoundsMarkerNodes = addBoundsMarkerNodes; + } + + /// + /// Optionally assign a list of transforms to be recorded, other transforms will be ignored + /// + internal ICollection recordingList = null; + private bool AllowRecordingTransform(Transform tr) => recordingList == null || recordingList.Contains(tr); + + private Transform root; + private Dictionary data = new Dictionary(64); + private double startTime; + private double lastRecordedTime; + private bool isRecording; + + private readonly bool recordBlendShapes; + private readonly bool recordRootInWorldSpace; + private readonly bool recordAnimationPointer; + private readonly bool addBoundsMarkerNodes; + + public bool IsRecording => isRecording; + public double LastRecordedTime => lastRecordedTime; + + internal class AnimationData + { + private Transform tr; + private SkinnedMeshRenderer smr; + private bool recordBlendShapes; + private bool inWorldSpace = false; + private bool recordAnimationPointer; + +#if USE_ANIMATION_POINTER + private static List exportPlans; + private static MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock(); + internal List tracks = new List(); + + internal class ExportPlan + { + public string propertyName; + public Type dataType; + public Func GetTarget; + public Func GetData; + + public ExportPlan(string propertyName, Type dataType, Func GetTarget, Func GetData) + { + this.propertyName = propertyName; + this.dataType = dataType; + this.GetTarget = GetTarget; + this.GetData = GetData; + } + + public object Sample(AnimationData data) + { + var target = GetTarget(data.tr); + return GetData(data.tr, target, data); + } + } +#endif + + public AnimationData(Transform tr, double time, bool zeroScale = false, bool recordBlendShapes = true, bool inWorldSpace = false, bool recordAnimationPointer = false) + { + this.tr = tr; + this.smr = tr.GetComponent(); + this.recordBlendShapes = recordBlendShapes; + this.inWorldSpace = inWorldSpace; + this.recordAnimationPointer = recordAnimationPointer; + + if (exportPlans == null) + { + exportPlans = new List(); + exportPlans.Add(new ExportPlan("translation", typeof(Vector3), x => x, (tr0, _, options) => options.inWorldSpace ? tr0.position : tr0.localPosition)); + exportPlans.Add(new ExportPlan("rotation", typeof(Quaternion), x => x, (tr0, _, options) => + { + var q = options.inWorldSpace ? tr0.rotation : tr0.localRotation; + return new Quaternion(q.x, q.y, q.z, q.w); + })); + exportPlans.Add(new ExportPlan("scale", typeof(Vector3), x => x, (tr0, _, options) => options.inWorldSpace ? tr0.lossyScale : tr0.localScale)); + + exportPlans.Add(new ExportPlan("weights", typeof(float[]), x => x.GetComponent(), (tr0, x, options) => + { + if (x is SkinnedMeshRenderer skinnedMesh && skinnedMesh.sharedMesh) + { + var mesh = skinnedMesh.sharedMesh; + var blendShapeCount = mesh.blendShapeCount; + if (blendShapeCount == 0) return null; + var weights = new float[blendShapeCount]; + for (var i = 0; i < blendShapeCount; i++) + weights[i] = skinnedMesh.GetBlendShapeWeight(i); + return weights; + } + return null; + })); + + if (recordAnimationPointer) + { + // TODO add other animation pointer export plans + + exportPlans.Add(new ExportPlan("baseColorFactor", typeof(Color), x => x.GetComponent() ? x.GetComponent().sharedMaterial : null, (tr0, mat, options) => + { + var r = tr0.GetComponent(); + + if (r.HasPropertyBlock()) + { + r.GetPropertyBlock(materialPropertyBlock); + #if UNITY_2021_1_OR_NEWER + if (materialPropertyBlock.HasColor("_BaseColor")) return materialPropertyBlock.GetColor("_BaseColor"); + if (materialPropertyBlock.HasColor("_Color")) return materialPropertyBlock.GetColor("_Color"); + #else + var c = materialPropertyBlock.GetColor("_BaseColor"); + if (c.r != 0 || c.g != 0 || c.b != 0 || c.a != 0) return c; + c = materialPropertyBlock.GetColor("_Color"); + if (c.r != 0 || c.g != 0 || c.b != 0 || c.a != 0) return c; + // this leaves an edge case where someone is actually animating color to black: + // in that case, the un-animated color would now be exported... + #endif + } + + if (mat is Material m && m) + { + if (m.HasProperty("_BaseColor")) return m.GetColor("_BaseColor"); + if (m.HasProperty("_Color")) return m.GetColor("_Color"); + } + + return null; + })); + } + } + + foreach (var plan in exportPlans) + { + if (plan.GetTarget(tr)) { + tracks.Add(new Track(this, plan, time)); + } + } + } + + internal class Track + { + public Object animatedObject => plan.GetTarget(tr.tr); + public string propertyName => plan.propertyName; + // TODO sample as floats? + public float[] times => samples.Keys.Select(x => (float) x).ToArray(); + public object[] values => samples.Values.ToArray(); + + private AnimationData tr; + private ExportPlan plan; + private Dictionary samples; + private object lastSample; + + public Track(AnimationData tr, ExportPlan plan, double time) + { + this.tr = tr; + this.plan = plan; + samples = new Dictionary(); + SampleIfChanged(time); + } + + public void SampleIfChanged(double time) + { + var value = plan.Sample(tr); + if (value == null || (value is Object o && !o)) + return; + if (!value.Equals(lastSample)) + { + samples[time] = value; + lastSample = value; + } + } + } + + public void Update(double time) + { + foreach (var track in tracks) + { + track.SampleIfChanged(time); + } + } + } + + public void StartRecording(double time) + { + startTime = time; + lastRecordedTime = time; + var trs = root.GetComponentsInChildren(true); + data.Clear(); + + foreach (var tr in trs) + { + if (!AllowRecordingTransform(tr)) continue; + data.Add(tr, new AnimationData(tr, 0, !tr.gameObject.activeSelf, recordBlendShapes, recordRootInWorldSpace && tr == root, recordAnimationPointer)); + } + + isRecording = true; + } + + public void UpdateRecording(double time) + { + if (!isRecording) + { + throw new InvalidOperationException($"{nameof(GLTFRecorder)} isn't recording, but {nameof(UpdateRecording)} was called. This is invalid."); + } + + if (time <= lastRecordedTime) + { + Debug.LogWarning("Can't record backwards in time, please avoid this."); + return; + } + + var currentTime = time - startTime; + var trs = root.GetComponentsInChildren(true); + foreach (var tr in trs) + { + if (!AllowRecordingTransform(tr)) continue; + if (!data.ContainsKey(tr)) + { + // insert "empty" frame with scale=0,0,0 because this object might have just appeared in this frame + var emptyData = new AnimationData(tr, lastRecordedTime, true, recordBlendShapes, recordAnimationPointer); + data.Add(tr, emptyData); + // insert actual keyframe + data[tr].Update(currentTime); + } + else + data[tr].Update(currentTime); + } + + lastRecordedTime = time; + } + + internal void EndRecording(out Dictionary param) + { + param = null; + if (!isRecording) return; + + isRecording = false; + param = data; + } + + public void EndRecording(string filename, string sceneName = "scene", GLTFSettings settings = null) + { + if (!isRecording) return; + + var dir = Path.GetDirectoryName(filename); + if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) Directory.CreateDirectory(dir); + using (var filestream = new FileStream(filename, FileMode.Create, FileAccess.Write)) + { + EndRecording(filestream, sceneName, settings); + } + } + + public void EndRecording(Stream stream, string sceneName = "scene", GLTFSettings settings = null) + { + if (!isRecording) return; + isRecording = false; + + Debug.Log("Gltf Recording saved. Tracks: " + data.Count + ", Total Keyframes: " + data.Sum(x => x.Value.tracks.Sum(y => y.values.Count()))); + + if (!settings) + { + var adjustedSettings = Object.Instantiate(GLTFSettings.GetOrCreateSettings()); + adjustedSettings.ExportDisabledGameObjects = true; + adjustedSettings.ExportAnimations = false; + settings = adjustedSettings; + } + + var logHandler = new StringBuilderLogHandler(); + + var exporter = new GLTFSceneExporter(new Transform[] { root }, new ExportOptions(settings) + { + AfterSceneExport = PostExport, + logger = new Logger(logHandler), + }); + + exporter.SaveGLBToStream(stream, sceneName); + + logHandler.LogAndClear(); + } + + private void PostExport(GLTFSceneExporter exporter, GLTFRoot gltfRoot) + { + // this would include animation from the original root + // exporter.ExportAnimationFromNode(ref root); + + GLTFAnimation anim = new GLTFAnimation(); + anim.Name = "Recording"; + + CollectAndProcessAnimation(exporter, anim, addBoundsMarkerNodes, out Bounds translationBounds); + + if (addBoundsMarkerNodes) + { + Debug.Log("Animation bounds: " + translationBounds.center + " => " + translationBounds.size); + + // create Cube primitive + var cube = GameObject.CreatePrimitive(PrimitiveType.Quad); + cube.transform.localScale = Vector3.one * 0.0001f; + cube.hideFlags = HideFlags.HideAndDontSave; + + var collider = cube.GetComponent(); + SafeDestroy(collider); + + var boundsRoot = new GameObject("AnimationBounds"); + boundsRoot.hideFlags = HideFlags.HideAndDontSave; + boundsRoot.transform.position = translationBounds.center; + + var extremePointsOnBounds = new Vector3[6]; + extremePointsOnBounds[0] = translationBounds.center + new Vector3(+translationBounds.extents.x, 0, 0); + extremePointsOnBounds[1] = translationBounds.center + new Vector3(-translationBounds.extents.x, 0, 0); + extremePointsOnBounds[2] = translationBounds.center + new Vector3(0, +translationBounds.extents.y, 0); + extremePointsOnBounds[3] = translationBounds.center + new Vector3(0, -translationBounds.extents.y, 0); + extremePointsOnBounds[4] = translationBounds.center + new Vector3(0, 0, +translationBounds.extents.z); + extremePointsOnBounds[5] = translationBounds.center + new Vector3(0, 0, -translationBounds.extents.z); + + foreach (var point in extremePointsOnBounds) + { + var cubeInstance = Object.Instantiate(cube); + cubeInstance.name = "AnimationBounds"; + cubeInstance.transform.position = point; + cubeInstance.transform.parent = boundsRoot.transform; + } + + // export and add explicitly to the scene list, otherwise these nodes at the root level will be ignored + var nodeId = exporter.ExportNode(boundsRoot); + gltfRoot.Scenes[0].Nodes.Add(nodeId); + + // move skinned meshes to the center of the bounds – + // they will be moved by their bones anyways, but this prevents wrong bounds calculations from them. + foreach (var skinnedMeshRenderer in root.GetComponentsInChildren()) + skinnedMeshRenderer.transform.position = translationBounds.center; + + SafeDestroy(boundsRoot); + SafeDestroy(cube); + } + + // check if the root node is outside these bounds, move it to the center if necessary + + if (anim.Channels.Count > 0 && anim.Samplers.Count > 0) + gltfRoot.Animations.Add(anim); + } + + private static void SafeDestroy(Object obj) + { + if (Application.isEditor) + Object.DestroyImmediate(obj); + else + Object.Destroy(obj); + } + + private static ProfilerMarker processAnimationMarker = new ProfilerMarker("Process Animation"); + private static ProfilerMarker simplifyKeyframesMarker = new ProfilerMarker("Simplify Keyframes"); + private static ProfilerMarker convertValuesMarker = new ProfilerMarker("Convert Values to Arrays"); + private void CollectAndProcessAnimation(GLTFSceneExporter gltfSceneExporter, GLTFAnimation anim, bool calculateTranslationBounds, out Bounds translationBounds) + { + var gotFirstValue = false; + translationBounds = new Bounds(); + + foreach (var kvp in data) + { + processAnimationMarker.Begin(); + foreach (var tr in kvp.Value.tracks) + { + if (tr.times.Length == 0) continue; + var times = tr.times; + var values = tr.values; + + if (calculateTranslationBounds && tr.propertyName == "translation") + { + for (var i = 0; i < values.Length; i++) + { + var vec = (Vector3) values[i]; + if (!gotFirstValue) + { + translationBounds = new Bounds(vec, Vector3.zero); + gotFirstValue = true; + } + else + { + translationBounds.Encapsulate(vec); + } + } + } + + gltfSceneExporter.RemoveUnneededKeyframes(ref times, ref values); + gltfSceneExporter.AddAnimationData(tr.animatedObject, tr.propertyName, anim, times, values); + } + processAnimationMarker.End(); + } + } + + private class StringBuilderLogHandler : ILogHandler + { + private readonly StringBuilder sb = new StringBuilder(); + + private string LogTypeToLog(LogType logType) + { +#if UNITY_EDITOR + // create strings with tags + switch (logType) + { + case LogType.Error: + return "[" + logType + "]"; + case LogType.Assert: + return "[" + logType + "]"; + case LogType.Warning: + return "[" + logType + "]"; + case LogType.Log: + return "[" + logType + "]"; + case LogType.Exception: + return "[" + logType + "]"; + default: + return "[" + logType + "]"; + } +#else + return "[" + logType + "]"; +#endif + } + + public void LogFormat(LogType logType, Object context, string format, params object[] args) => sb.AppendLine($"{LogTypeToLog(logType)} {string.Format(format, args)} [Context: {context}]"); + public void LogException(Exception exception, Object context) => sb.AppendLine($"{LogTypeToLog(LogType.Exception)} {exception} [Context: {context}]"); + + public void LogAndClear() + { + if(sb.Length > 0) + { + var str = sb.ToString(); +#if UNITY_2019_1_OR_NEWER + var logType = LogType.Log; +#if UNITY_EDITOR + if (str.IndexOf("[Error]", StringComparison.Ordinal) > -1 || + str.IndexOf("[Exception]", StringComparison.Ordinal) > -1 || + str.IndexOf("[Assert]", StringComparison.Ordinal) > -1) + logType = LogType.Error; + else if (str.IndexOf("[Warning]", StringComparison.Ordinal) > -1) + logType = LogType.Warning; +#endif + Debug.LogFormat(logType, LogOption.NoStacktrace, null, "Export Messages:" + "\n{0}", sb.ToString()); +#else + Debug.Log(string.Format("Export Messages:" + "\n{0}", str)); +#endif + } + sb.Clear(); + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs.meta new file mode 100644 index 0000000..82f8448 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c86ab342c27009409e8735873d51306 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs new file mode 100644 index 0000000..e9f58f9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs @@ -0,0 +1,129 @@ +#if HAVE_TIMELINE + +using UnityEngine; +using UnityEngine.Playables; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UnityGLTF.Timeline +{ + public class GLTFRecorderBehaviour : PlayableBehaviour + { + private GLTFRecorder recorder = null; + + private void BeginRecording(double getTime, Transform getExportRoot) + { + if (!getExportRoot) + { + Debug.LogError("Can't record: export root is null"); + recorder = null; + return; + } + + Time.captureFramerate = Clip.m_CaptureFrameRate; + + // will be initialized lazy to ensure that the first frame is correct and not pre-timeline refresh + recorder = null; + } + + private void StopRecording(double getTime) + { + recorder?.EndRecording(Clip.m_File); + } + + private void ProcessRecording(double getTime, Transform getExportRoot) + { + if (recorder == null) + { + recorder = new GLTFRecorder(getExportRoot, Clip.m_RecordBlendShapes, Clip.m_RecordAnimationPointer); + recorder.StartRecording(getTime); + } + else if (getTime > recorder.LastRecordedTime) + { + recorder?.UpdateRecording(getTime); + } + } + + public GLTFRecorderClip Clip; + private bool m_isPaused = false; + + private static bool IsPlaying() + { + #if UNITY_EDITOR + return EditorApplication.isPlaying; + #else + return true; + #endif + } + + public override void OnPlayableDestroy(Playable playable) + { + if (!IsPlaying()) + { + return; + } + + StopRecording(playable.GetTime()); + } + + public override void OnGraphStart(Playable playable) + { + if (!IsPlaying()) + { + return; + } + + BeginRecording(playable.GetTime(), Clip.GetExportRoot(playable.GetGraph())); + } + + public override void OnGraphStop(Playable playable) + { + if (!IsPlaying()) + { + return; + } + + StopRecording(playable.GetTime()); + } + + public override void ProcessFrame(Playable playable, FrameData info, object playerData) + { + if (!IsPlaying()) + { + return; + } + + double time = playable.GetTime(); + GLTFRecorderHelper.Add(() => OnFrameEnd(time, playable, info, playerData)); + } + + public override void OnBehaviourPlay(Playable playable, FrameData info) + { + m_isPaused = false; + } + + public override void OnBehaviourPause(Playable playable, FrameData info) + { + m_isPaused = true; + } + + public void OnFrameEnd(double time, Playable playable, FrameData info, object playerData) + { + if (!playable.IsValid()) + { + return; + } + + var root = Clip.GetExportRoot(playable.GetGraph()); + if (!root || m_isPaused) + { + return; + } + + ProcessRecording(time, root); + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs.meta new file mode 100644 index 0000000..486ba23 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c90c158375298a4b931f2f013dbf111 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs new file mode 100644 index 0000000..7861c38 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs @@ -0,0 +1,35 @@ +#if HAVE_TIMELINE + +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +namespace UnityGLTF.Timeline +{ + [System.ComponentModel.DisplayName("glTF Recorder Clip")] + public class GLTFRecorderClip : PlayableAsset, ITimelineClipAsset + { + public ExposedReference m_exportRoot; + public string m_File = "Assets/Recording.glb"; + public int m_CaptureFrameRate = 60; + public bool m_RecordBlendShapes = true; + public bool m_RecordAnimationPointer = false; + + public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) + { + var ret = ScriptPlayable.Create(graph); + var behaviour = ret.GetBehaviour(); + behaviour.Clip = this; // TOD check if needed + return ret; + } + + public ClipCaps clipCaps { get; } + + public Transform GetExportRoot(PlayableGraph graph) + { + return m_exportRoot.Resolve(graph.GetResolver()); + } + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs.meta new file mode 100644 index 0000000..7f0668b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderClip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7ec2229f5635a54cbc23eec87b45654 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs new file mode 100644 index 0000000..b0985b6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace UnityGLTF.Timeline +{ + [ExecuteInEditMode] + internal class GLTFRecorderHelper : MonoBehaviour + { + public static void Add(Action callback) + { + GetInstance().queuedActions.Add(callback); + } + + private List queuedActions = new List(); + + private static GLTFRecorderHelper instance; + + static GLTFRecorderHelper GetInstance() + { + if (instance != null) return instance; + instance = FindObjectOfType(); + if (instance != null) return instance; + + var go = new GameObject + { + name = "GLTF Recorder Helper", + hideFlags = HideFlags.HideAndDontSave, + }; + instance = go.AddComponent(); + + return instance; + } + + private IEnumerator WaitForEndOfFrame() + { + yield return new WaitForEndOfFrame(); + foreach (var callback in queuedActions) + { + try + { + callback(); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + } + + queuedActions.Clear(); + } + + private void LateUpdate() + { + StartCoroutine(WaitForEndOfFrame()); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs.meta new file mode 100644 index 0000000..6011484 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fba5af8565ac464587d0d4663f151239 +timeCreated: 1646945202 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs new file mode 100644 index 0000000..0443340 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs @@ -0,0 +1,16 @@ +#if HAVE_TIMELINE + +using UnityEngine.Timeline; + +namespace UnityGLTF.Timeline +{ + [System.Serializable] + [TrackClipType(typeof(GLTFRecorderClip))] + [TrackColor(0.7f, 0.0f, 0.0f)] + public class GLTFRecorderTrack : TrackAsset + { + + } +} + +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs.meta new file mode 100644 index 0000000..36d14be --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/Timeline/GLTFRecorderTrack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f4885dbb1716a34b84ab7851fb37ccd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs new file mode 100644 index 0000000..a7acee0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using UnityEngine; + +namespace UnityGLTF +{ + public static class URIHelper + { + private const string Base64StringInitializer = "^data:[a-z-]+/[a-z-]+;base64,"; + + /// + /// Get the absolute path to a gltf uri reference. + /// + /// The path to the gltf file + /// A path without the filename or extension + public static string AbsoluteUriPath(Uri uri) + { + var partialPath = uri.AbsoluteUri.Remove(uri.AbsoluteUri.Length - uri.Segments[uri.Segments.Length - 1].Length); + return partialPath; + } + + public static string GetFileFromUri(Uri uri) + { + return uri.Segments[uri.Segments.Length - 1]; + } + + /// + /// Gets a directory name from a file path + /// + /// Full path of a file + /// The name of directory file is in + public static string GetDirectoryName(string fullPath) + { + var fileName = Path.GetFileName(fullPath); + return fullPath.Substring(0, fullPath.Length - fileName.Length); + } + + /// + /// Tries to parse the uri as a base 64 encoded string + /// + /// The string that represents the data + /// Returns the deencoded bytes + public static void TryParseBase64(string uri, out byte[] bufferData) + { + Regex regex = new Regex(Base64StringInitializer); + Match match = regex.Match(uri); + bufferData = null; + if (match.Success) + { + var base64Data = uri.Substring(match.Length); + bufferData = Convert.FromBase64String(base64Data); + } + } + + /// + /// Returns whether the input uri is base64 encoded + /// + /// The uri data + /// Whether the uri is base64 + public static bool IsBase64Uri(string uri) + { + Regex regex = new Regex(Base64StringInitializer); + Match match = regex.Match(uri); + return match.Success; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs.meta new file mode 100644 index 0000000..9e4e598 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/URIHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e054efee73873a4b85a7a9180e6fbf2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps.meta new file mode 100644 index 0000000..11804c2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e766804828a966240ab9d312c8abb342 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs new file mode 100644 index 0000000..9946ba4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs @@ -0,0 +1,272 @@ +using GLTF.Schema; +using UnityEngine; +using UnityEngine.Rendering; + +namespace UnityGLTF +{ + public abstract class BaseGraphMap : IUniformMap + { + public abstract IUniformMap Clone(); + + protected BaseGraphMap(Material mat) + { + _material = mat; + } + + protected BaseGraphMap(string shaderName, string fallbackGuid) + { + var s = Shader.Find(shaderName); + +#if UNITY_EDITOR + // workaround for first-import issues with Shader.Find and import order + if (!s) + s = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(fallbackGuid)); +#endif + + if (!s) + throw new ShaderNotFoundException(shaderName + " not found. Did you forget to add it to the build?"); + + _material = new Material(s); + } + + public Material Material => _material; + internal Material _material; + + private AlphaMode _alphaMode; + public virtual AlphaMode AlphaMode + { + get { return _alphaMode; } + set + { + if (value == AlphaMode.MASK) + { + _material.SetOverrideTag("RenderType", "TransparentCutout"); + _material.SetFloat("_Mode", 1); + _material.SetInt("_SrcBlend", (int)BlendMode.One); + _material.SetInt("_DstBlend", (int)BlendMode.Zero); + _material.SetInt("_BUILTIN_SrcBlend", (int)BlendMode.One); + _material.SetInt("_BUILTIN_DstBlend", (int)BlendMode.Zero); + _material.SetInt("_ZWrite", 1); + _material.SetInt("_BUILTIN_ZWrite", 1); + _material.SetInt("_AlphaClip", 1); + _material.SetInt("_BUILTIN_AlphaClip", 1); + _material.EnableKeyword("_ALPHATEST_ON"); + _material.EnableKeyword("_BUILTIN_ALPHATEST_ON"); + _material.DisableKeyword("_ALPHABLEND_ON"); + _material.DisableKeyword("_BUILTIN_ALPHABLEND_ON"); + _material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + _material.DisableKeyword("_BUILTIN_ALPHAPREMULTIPLY_ON"); + _material.renderQueue = (int)RenderQueue.AlphaTest; + if (_material.HasProperty("_Cutoff")) + _material.SetFloat("_Cutoff", (float)AlphaCutoff); + if (_material.HasProperty("alphaCutoff")) + _material.SetFloat("alphaCutoff", (float)AlphaCutoff); + + SetAlphaModeMask(_material, true); + } + else if (value == AlphaMode.BLEND) + { + _material.SetOverrideTag("RenderType", "Transparent"); + _material.SetFloat("_Mode", 2); + _material.SetInt("_SrcBlend", (int)BlendMode.SrcAlpha); + _material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha); + _material.SetInt("_BUILTIN_SrcBlend", (int)BlendMode.SrcAlpha); + _material.SetInt("_BUILTIN_DstBlend", (int)BlendMode.OneMinusSrcAlpha); + _material.SetInt("_ZWrite", 0); + _material.SetInt("_BUILTIN_ZWrite", 0); + _material.SetInt("_AlphaClip", 0); + _material.SetInt("_BUILTIN_AlphaClip", 0); + _material.DisableKeyword("_ALPHATEST_ON"); + _material.DisableKeyword("_BUILTIN_ALPHATEST_ON"); + _material.EnableKeyword("_ALPHABLEND_ON"); + _material.EnableKeyword("_BUILTIN_ALPHABLEND_ON"); + _material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + _material.DisableKeyword("_BUILTIN_ALPHAPREMULTIPLY_ON"); + _material.renderQueue = (int)RenderQueue.Transparent; + _material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); + _material.EnableKeyword("_BUILTIN_SURFACE_TYPE_TRANSPARENT"); + + SetShaderModeBlend(_material); + } + else + { + _material.SetOverrideTag("RenderType", "Opaque"); + _material.SetFloat("_Mode", 0); + _material.SetInt("_SrcBlend", (int)BlendMode.One); + _material.SetInt("_DstBlend", (int)BlendMode.Zero); + _material.SetInt("_BUILTIN_SrcBlend", (int)BlendMode.One); + _material.SetInt("_BUILTIN_DstBlend", (int)BlendMode.Zero); + _material.SetInt("_ZWrite", 1); + _material.SetInt("_BUILTIN_ZWrite", 1); + _material.SetInt("_AlphaClip", 0); + _material.SetInt("_BUILTIN_AlphaClip", 0); + _material.DisableKeyword("_ALPHATEST_ON"); + _material.DisableKeyword("_ALPHABLEND_ON"); + _material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + _material.DisableKeyword("_BUILTIN_ALPHATEST_ON"); + _material.DisableKeyword("_BUILTIN_ALPHABLEND_ON"); + _material.DisableKeyword("_BUILTIN_ALPHAPREMULTIPLY_ON"); + _material.renderQueue = (int)RenderQueue.Geometry; + } + + _alphaMode = value; + } + } + + protected void SetDoubleSided (Material material, bool doubleSided) + { + material.doubleSidedGI = doubleSided; + var mode = doubleSided ? (int)CullMode.Off : (int)CullMode.Back; + material.SetFloat(cullPropId, mode); + material.SetFloat(cullModePropId, mode); + material.SetFloat(cullModePropIdBuiltin, mode); + } + + public static readonly int cutoffPropId = Shader.PropertyToID("_Cutoff"); + + protected void SetAlphaModeMask(Material material, bool isMask) { + material.SetFloat(cutoffPropId, isMask ? 1 : 0); + // #if USING_HDRP_10_OR_NEWER || USING_URP_12_OR_NEWER + material.EnableKeyword(KW_ALPHATEST_ON); + material.EnableKeyword(KW_ALPHATEST_ON_BUILTIN); + material.SetOverrideTag(TAG_RENDER_TYPE, TAG_RENDER_TYPE_CUTOUT); + material.SetFloat(k_ZTestGBufferPropId, (int)CompareFunction.Equal); //3 + // #endif + material.SetFloat(k_AlphaClip, 1); + material.SetFloat(k_AlphaClipBuiltin, 1); + if (isMask) material.EnableKeyword(KW_ALPHACLIP_ON_BUILTIN); + else material.DisableKeyword(KW_ALPHACLIP_ON_BUILTIN); + } + + static readonly int cullPropId = Shader.PropertyToID("_Cull"); + static readonly int cullModePropId = Shader.PropertyToID("_CullMode"); + static readonly int cullModePropIdBuiltin = Shader.PropertyToID("_BUILTIN_CullMode"); + static readonly int k_AlphaClip = Shader.PropertyToID("_AlphaClip"); + static readonly int k_AlphaClipBuiltin = Shader.PropertyToID("_BUILTIN_AlphaClip"); + static readonly int k_Surface = Shader.PropertyToID("_Surface"); + static readonly int k_SurfaceBuiltin = Shader.PropertyToID("_BUILTIN_Surface"); + static readonly int k_AlphaDstBlendPropId = Shader.PropertyToID("_AlphaDstBlend"); + static readonly int k_ZTestGBufferPropId = Shader.PropertyToID("_ZTestGBuffer"); + static readonly int srcBlendPropId = Shader.PropertyToID("_SrcBlend"); + static readonly int dstBlendPropId = Shader.PropertyToID("_DstBlend"); + static readonly int zWritePropId = Shader.PropertyToID("_ZWrite"); + + const string TAG_RENDER_TYPE = "RenderType"; + const string TAG_RENDER_TYPE_CUTOUT = "TransparentCutout"; + const string TAG_RENDER_TYPE_OPAQUE = "Opaque"; + const string TAG_RENDER_TYPE_FADE = "Fade"; + const string TAG_RENDER_TYPE_TRANSPARENT = "Transparent"; + const string KW_ALPHATEST_ON = "_ALPHATEST_ON"; + const string KW_ALPHATEST_ON_BUILTIN = "_BUILTIN_ALPHATEST_ON"; + const string KW_ALPHACLIP_ON_BUILTIN = "_BUILTIN_AlphaClip"; + const string KW_DISABLE_SSR_TRANSPARENT = "_DISABLE_SSR_TRANSPARENT"; + const string KW_ENABLE_FOG_ON_TRANSPARENT = "_ENABLE_FOG_ON_TRANSPARENT"; + const string KW_SURFACE_TYPE_TRANSPARENT = "_SURFACE_TYPE_TRANSPARENT"; + const string KW_SURFACE_TYPE_TRANSPARENT_BUILTIN = "_BUILTIN_SURFACE_TYPE_TRANSPARENT"; + const string k_ShaderPassTransparentDepthPrepass = "TransparentDepthPrepass"; + const string k_ShaderPassTransparentDepthPostpass = "TransparentDepthPostpass"; + const string k_ShaderPassTransparentBackface = "TransparentBackface"; + const string k_ShaderPassRayTracingPrepass = "RayTracingPrepass"; + const string k_ShaderPassDepthOnlyPass = "DepthOnly"; + + protected void SetShaderModeBlend(Material material) + { + material.SetOverrideTag(TAG_RENDER_TYPE, TAG_RENDER_TYPE_TRANSPARENT); + material.EnableKeyword(KW_SURFACE_TYPE_TRANSPARENT); + material.EnableKeyword(KW_SURFACE_TYPE_TRANSPARENT_BUILTIN); + material.EnableKeyword(KW_DISABLE_SSR_TRANSPARENT); + material.EnableKeyword(KW_ENABLE_FOG_ON_TRANSPARENT); + material.SetShaderPassEnabled(k_ShaderPassTransparentDepthPrepass, false); + material.SetShaderPassEnabled(k_ShaderPassTransparentDepthPostpass, false); + material.SetShaderPassEnabled(k_ShaderPassTransparentBackface, false); + material.SetShaderPassEnabled(k_ShaderPassRayTracingPrepass, false); + material.SetShaderPassEnabled(k_ShaderPassDepthOnlyPass, false); + material.SetFloat(srcBlendPropId, (int) BlendMode.SrcAlpha);//5 + material.SetFloat(dstBlendPropId, (int)BlendMode.OneMinusSrcAlpha);//10 + material.SetFloat(k_ZTestGBufferPropId, (int)CompareFunction.Equal); //3 + material.SetFloat(k_AlphaDstBlendPropId, (int)BlendMode.OneMinusSrcAlpha);//10 + material.SetFloat(k_Surface, 1); + material.SetFloat(k_SurfaceBuiltin, 1); + material.SetFloat(zWritePropId, 0); + } + + public double AlphaCutoff + { + get => _material.GetFloat("alphaCutoff"); + set + { + _material.SetFloat("alphaCutoff", (float) value); +#if !UNITY_2021_2_OR_NEWER + // PBRGraph/UnlitGraph always have alphaCutoff on 2020.x, so we need to set it to 0 for non-masked modes + if (_alphaMode != AlphaMode.MASK) + _material.SetFloat("alphaCutoff", 0f); +#endif + } + } + + public virtual bool DoubleSided + { + get { return +#if UNITY_2019_3_OR_NEWER + !GraphicsSettings.currentRenderPipeline ? + _material.GetInt(cullModePropIdBuiltin) == (int)CullMode.Off : +#endif + _material.GetInt(cullPropId) == (int)CullMode.Off; } + set { SetDoubleSided(_material, value); } + } + + public virtual bool VertexColorsEnabled + { + get { return _material.IsKeywordEnabled("_VERTEX_COLORS_ON"); } + set + { + if (value) + _material.EnableKeyword("_VERTEX_COLORS_ON"); + else + _material.DisableKeyword("_VERTEX_COLORS_ON"); + } + } + + public Texture BaseColorTexture + { + get => _material.GetTexture("baseColorTexture"); + set => _material.SetTexture("baseColorTexture", value); + } + + public int BaseColorTexCoord + { + get => (int) _material.GetFloat("baseColorTextureTexCoord"); + set => _material.SetFloat("baseColorTextureTexCoord", Mathf.RoundToInt(value)); + } + + public Vector2 BaseColorXOffset + { + get => _material.GetTextureOffset("baseColorTexture"); + set => _material.SetTextureOffset("baseColorTexture", value); + } + + public double BaseColorXRotation + { + get => _material.GetFloat("baseColorTextureRotation"); + set => _material.SetFloat("baseColorTextureRotation", (float) value); + } + + public Vector2 BaseColorXScale + { + get => _material.GetTextureScale("baseColorTexture"); + set => _material.SetTextureScale("baseColorTexture", value); + } + + public int BaseColorXTexCoord + { + get => (int) _material.GetFloat("baseColorTextureTexCoord"); + set => _material.SetFloat("baseColorTextureTexCoord", Mathf.RoundToInt(value)); + } + + public Color BaseColorFactor + { + get => _material.GetColor("baseColorFactor"); + set => _material.SetColor("baseColorFactor", value); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs.meta new file mode 100644 index 0000000..ce280bb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/BaseGraphMap.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3453f34a8c4d4d4b86685f873378869c +timeCreated: 1657891795 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs new file mode 100644 index 0000000..4ce0e3b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs @@ -0,0 +1,123 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public class MetalRough2StandardMap : StandardMap, IMetalRoughUniformMap + { + private Vector2 baseColorOffset = new Vector2(0, 0); + + public MetalRough2StandardMap(int MaxLOD = 1000) : base("Standard", null, MaxLOD) { } + protected MetalRough2StandardMap(string shaderName, string shaderGuid, int MaxLOD = 1000) : base(shaderName, shaderGuid, MaxLOD) { } + protected MetalRough2StandardMap(Material m, int MaxLOD = 1000) : base(m, MaxLOD) { } + + public virtual Texture BaseColorTexture + { + get { return _material.GetTexture("_MainTex"); } + set { _material.SetTexture("_MainTex", value); } + } + + // not implemented by the Standard shader + public virtual int BaseColorTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 BaseColorXOffset + { + get { return baseColorOffset; } + set { + baseColorOffset = value; + _material.SetTextureOffset("_MainTex", value); + } + } + + public virtual double BaseColorXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 BaseColorXScale + { + get { return _material.GetTextureScale("_MainTex"); } + set { + _material.SetTextureScale("_MainTex", value); + BaseColorXOffset = baseColorOffset; + } + } + + public virtual int BaseColorXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Color BaseColorFactor + { + get { return _material.GetColor("_Color"); } + set { _material.SetColor("_Color", value); } + } + + public virtual Texture MetallicRoughnessTexture + { + get { return null; } + set + { + // cap metalness at 0.5 to compensate for lack of texture + MetallicFactor = Mathf.Min(0.5f, (float)MetallicFactor); + } + } + + // not implemented by the Standard shader + public virtual int MetallicRoughnessTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 MetallicRoughnessXOffset + { + get { return new Vector2(0, 0); } + set { return; } + } + + public virtual double MetallicRoughnessXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 MetallicRoughnessXScale + { + get { return new Vector2(1, 1); } + set { return; } + } + + public virtual int MetallicRoughnessXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual double MetallicFactor + { + get { return _material.GetFloat("_Metallic"); } + set { _material.SetFloat("_Metallic", (float)value); } + } + + // not supported by the Standard shader + public virtual double RoughnessFactor + { + get { return 0.5; } + set { return; } + } + + public override IUniformMap Clone() + { + var copy = new MetalRough2StandardMap(new Material(_material)); + base.Copy(copy); + return copy; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs.meta new file mode 100644 index 0000000..d74c86c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRough2StandardMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85ac6cc1932e01e4983730c9ffe91e06 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs new file mode 100644 index 0000000..6199db3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs @@ -0,0 +1,98 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public class MetalRoughMap : MetalRough2StandardMap + { + private Vector2 metalRoughOffset = new Vector2(0, 0); + + public MetalRoughMap(int MaxLOD = 1000) : base("GLTF/PbrMetallicRoughness", "9836e4430eb58204086d7d1440e16a4f", MaxLOD) { } + public MetalRoughMap(string shaderName, int MaxLOD = 1000) : base(shaderName, "9836e4430eb58204086d7d1440e16a4f", MaxLOD) { } + protected MetalRoughMap(Material m, int MaxLOD = 1000) : base(m, MaxLOD) { } + + public override int NormalTexCoord + { + get { return 0; } + set { return; } + } + + public override int OcclusionTexCoord + { + get { return 0; } + set { return; } + } + + public override int EmissiveTexCoord + { + get { return 0; } + set { return; } + } + + public override int BaseColorTexCoord + { + get { return 0; } + set { return; } + } + + public override Texture MetallicRoughnessTexture + { + get { return _material.GetTexture("_MetallicGlossMap"); } + set + { + _material.SetTexture("_MetallicGlossMap", value); + _material.EnableKeyword("_METALLICGLOSSMAP"); + } + } + + public override int MetallicRoughnessTexCoord + { + get { return 0; } + set { return; } + } + + public override Vector2 MetallicRoughnessXOffset + { + get { return metalRoughOffset; } + set + { + metalRoughOffset = value; + _material.SetTextureOffset("_MetallicGlossMap", value); + } + } + + public override double MetallicRoughnessXRotation + { + get { return 0; } + set { return; } + } + + public override Vector2 MetallicRoughnessXScale + { + get { return _material.GetTextureScale("_MetallicGlossMap"); } + set + { + _material.SetTextureScale("_MetallicGlossMap", value); + MetallicRoughnessXOffset = metalRoughOffset; + } + } + + public override int MetallicRoughnessXTexCoord + { + get { return 0; } + set { return; } + } + + public override double RoughnessFactor + { + get { return _material.GetFloat("_Glossiness"); } + set { _material.SetFloat("_Glossiness", (float)value); } + } + + public override IUniformMap Clone() + { + var copy = new MetalRoughMap(new Material(_material)); + base.Copy(copy); + return copy; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs.meta new file mode 100644 index 0000000..677d661 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/MetalRoughMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eae97d9d46055684097402095ac8fcb6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs new file mode 100644 index 0000000..76f3416 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs @@ -0,0 +1,350 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public class PBRGraphMap : BaseGraphMap, IMetalRoughUniformMap, IVolumeMap, ITransmissionMap, IIORMap, IIridescenceMap, ISpecularMap, IClearcoatMap + { + private const string PBRGraphGuid = "478ce3626be7a5f4ea58d6b13f05a2e4"; + + public PBRGraphMap() : this("UnityGLTF/PBRGraph") {} + + protected PBRGraphMap(string shaderName) : base(shaderName, PBRGraphGuid) { } + +#if !UNITY_2021_1_OR_NEWER + private const string PBRGraphTransparentGuid = "0a931320a74ca574b91d2d7d4557dcf1"; + private const string PBRGraphTransparentDoubleGuid = "54352a53405971b41a6587615f947085"; + private const string PBRGraphDoubleGuid = "8bc739b14fe811644abb82057b363ba8"; + + public PBRGraphMap(bool transparent, bool doubleSided) : base( + "UnityGLTF/PBRGraph" + (transparent ? "-Transparent" : "") + (doubleSided ? "-Double" : ""), + (transparent && doubleSided ? PBRGraphTransparentDoubleGuid : transparent ? PBRGraphTransparentGuid : doubleSided ? PBRGraphDoubleGuid : PBRGraphGuid)) { } +#endif + + public PBRGraphMap(Material mat) : base(mat) { } + + public override IUniformMap Clone() + { + var clone = new PBRGraphMap(new Material(_material)); + clone.Material.shaderKeywords = _material.shaderKeywords; + return clone; + } + + public Texture NormalTexture + { + get => _material.GetTexture("normalTexture"); + set => _material.SetTexture("normalTexture", value); + } + + public int NormalTexCoord + { + get => 0; + set {} + } + + public double NormalTexScale + { + get => _material.GetFloat("normalScale"); + set => _material.SetFloat("normalScale", (float) value); + } + + public Vector2 NormalXOffset + { + get => _material.GetTextureOffset("normalTexture"); + set => _material.SetTextureOffset("normalTexture", value); + } + + public double NormalXRotation { get; set; } + + public Vector2 NormalXScale + { + get => _material.GetTextureScale("normalTexture"); + set => _material.SetTextureScale("normalTexture", value); + } + + public int NormalXTexCoord + { + get => 0; + set {} + } + + public Texture OcclusionTexture + { + get => _material.GetTexture("occlusionTexture"); + set => _material.SetTexture("occlusionTexture", value); + } + + public int OcclusionTexCoord + { + get => (int) _material.GetFloat("occlusionTextureTexCoord"); + set => _material.SetFloat("occlusionTextureTexCoord", Mathf.RoundToInt(value)); + } + + public double OcclusionTexStrength + { + get => _material.GetFloat("occlusionStrength"); + set => _material.SetFloat("occlusionStrength", (float) value); + } + + public Vector2 OcclusionXOffset + { + get => _material.GetTextureOffset("occlusionTexture"); + set => _material.SetTextureOffset("occlusionTexture", value); + } + + public double OcclusionXRotation + { + get => _material.GetFloat("occlusionTextureRotation"); + set => _material.SetFloat("occlusionTextureRotation", (float) value); + } + + public Vector2 OcclusionXScale + { + get => _material.GetTextureScale("occlusionTexture"); + set => _material.SetTextureScale("occlusionTexture", value); + } + + public int OcclusionXTexCoord + { + get => (int) _material.GetFloat("occlusionTextureTexCoord"); + set => _material.SetFloat("occlusionTextureTexCoord", Mathf.RoundToInt(value)); + } + + public Texture EmissiveTexture + { + get => _material.GetTexture("emissiveTexture"); + set => _material.SetTexture("emissiveTexture", value); + } + + public int EmissiveTexCoord + { + get => 0; + set {} + } + + public Color EmissiveFactor + { + get => _material.GetColor("emissiveFactor"); + set => _material.SetColor("emissiveFactor", value); + } + + public Vector2 EmissiveXOffset + { + get => _material.GetTextureOffset("emissiveTexture"); + set => _material.SetTextureOffset("emissiveTexture", value); + } + + public double EmissiveXRotation { get; set; } + + public Vector2 EmissiveXScale + { + get => _material.GetTextureScale("emissiveTexture"); + set => _material.SetTextureScale("emissiveTexture", value); + } + + public int EmissiveXTexCoord + { + get => 0; + set {} + } + + public Texture MetallicRoughnessTexture + { + get => _material.GetTexture("metallicRoughnessTexture"); + set => _material.SetTexture("metallicRoughnessTexture", value); + } + + public int MetallicRoughnessTexCoord + { + get => 0; + set {} + } + + public Vector2 MetallicRoughnessXOffset + { + get => _material.GetTextureOffset("metallicRoughnessTexture"); + set => _material.SetTextureOffset("metallicRoughnessTexture", value); + } + + public double MetallicRoughnessXRotation { get; set; } + + public Vector2 MetallicRoughnessXScale + { + get => _material.GetTextureOffset("metallicRoughnessTexture"); + set => _material.SetTextureOffset("metallicRoughnessTexture", value); + } + + public int MetallicRoughnessXTexCoord + { + get => 0; + set {} + } + + public double MetallicFactor + { + get => _material.GetFloat("metallicFactor"); + set => _material.SetFloat("metallicFactor", (float) value); + } + + public double RoughnessFactor + { + get => _material.GetFloat("roughnessFactor"); + set => _material.SetFloat("roughnessFactor", (float) value); + } + + public double ThicknessFactor + { + get => _material.GetFloat("thicknessFactor"); + set + { + _material.SetFloat("thicknessFactor", (float) value); + } + } + + public Texture ThicknessTexture + { + get => _material.GetTexture("thicknessTexture"); + set + { + _material.SetTexture("thicknessTexture", value); + } + } + + public double AttenuationDistance + { + get => _material.GetFloat("attenuationDistance"); + set => _material.SetFloat("attenuationDistance", (float) value); + } + + public Color AttenuationColor + { + get => _material.GetColor("attenuationColor"); + set => _material.SetColor("attenuationColor", value); + } + + public double TransmissionFactor + { + get => _material.GetFloat("transmissionFactor"); + set + { + _material.SetFloat("transmissionFactor", (float) value); + } + } + + public Texture TransmissionTexture + { + get => _material.GetTexture("transmissionTexture"); + set + { + _material.SetTexture("transmissionTexture", value); + } + } + + public double IOR + { + get => _material.GetFloat("ior"); + set => _material.SetFloat("ior", (float) value); + } + + public double IridescenceFactor + { + get => _material.GetFloat("iridescenceFactor"); + set => _material.SetFloat("iridescenceFactor", (float) value); + } + + public double IridescenceIor + { + get => _material.GetFloat("iridescenceIor"); + set => _material.SetFloat("iridescenceIor", (float) value); + } + + public double IridescenceThicknessMinimum + { + get => _material.GetFloat("iridescenceThicknessMinimum"); + set => _material.SetFloat("iridescenceThicknessMinimum", (float) value); + } + + public double IridescenceThicknessMaximum + { + get => _material.GetFloat("iridescenceThicknessMaximum"); + set => _material.SetFloat("iridescenceThicknessMaximum", (float) value); + } + + public Texture IridescenceTexture + { + get => _material.GetTexture("iridescenceTexture"); + set + { + _material.SetTexture("iridescenceTexture", value); + } + } + + public Texture IridescenceThicknessTexture + { + get => _material.GetTexture("iridescenceThicknessTexture"); + set + { + _material.SetTexture("iridescenceThicknessTexture", value); + } + } + + public double SpecularFactor + { + get => _material.GetFloat("specularFactor"); + set => _material.SetFloat("specularFactor", (float) value); + } + + public Texture SpecularTexture + { + get => _material.GetTexture("specularTexture"); + set + { + _material.SetTexture("specularTexture", value); + } + } + + public Color SpecularColorFactor + { + get => _material.GetColor("specularColorFactor"); + set => _material.SetColor("specularColorFactor", value); + } + + public Texture SpecularColorTexture + { + get => _material.GetTexture("specularColorTexture"); + set + { + _material.SetTexture("specularColorTexture", value); + } + } + + public double ClearcoatFactor + { + get => _material.GetFloat("clearcoatFactor"); + set => _material.SetFloat("clearcoatFactor", (float) value); + } + + public Texture ClearcoatTexture + { + get => _material.GetTexture("clearcoatTexture"); + set => _material.SetTexture("clearcoatTexture", value); + } + + public double ClearcoatRoughnessFactor + { + get => _material.GetFloat("clearcoatRoughnessFactor"); + set => _material.SetFloat("clearcoatRoughnessFactor", (float) value); + } + + public Texture ClearcoatRoughnessTexture + { + get => _material.GetTexture("clearcoatRoughnessTexture"); + set => _material.SetTexture("clearcoatRoughnessTexture", value); + } + + public Texture ClearcoatNormalTexture + { + get => _material.GetTexture("clearcoatNormalTexture"); + set => _material.SetTexture("clearcoatNormalTexture", value); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs.meta new file mode 100644 index 0000000..6bfd4b2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/PBRGraphMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3702d621b762aa4081cbc83b8349d31 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs new file mode 100644 index 0000000..823373a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs @@ -0,0 +1,137 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public class SpecGloss2StandardMap : StandardMap, ISpecGlossUniformMap + { + private Vector2 diffuseOffset = new Vector2(0, 0); + private Vector2 specGlossOffset = new Vector2(0, 0); + + public SpecGloss2StandardMap(int MaxLOD = 1000) : base("Standard (Specular setup)", null, MaxLOD) { } + protected SpecGloss2StandardMap(string shaderName, string shaderGuid, int MaxLOD = 1000) : base(shaderName, shaderGuid, MaxLOD) { } + protected SpecGloss2StandardMap(Material m, int MaxLOD = 1000) : base(m, MaxLOD) { } + + public virtual Texture DiffuseTexture + { + get { return _material.GetTexture("_MainTex"); } + set { _material.SetTexture("_MainTex", value); } + } + + // not implemented by the Standard shader + public virtual int DiffuseTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 DiffuseXOffset + { + get { return diffuseOffset; } + set + { + diffuseOffset = value; + _material.SetTextureOffset("_MainTex", value); + } + } + + public virtual double DiffuseXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 DiffuseXScale + { + get { return _material.GetTextureScale("_MainTex"); } + set + { + _material.SetTextureScale("_MainTex", value); + DiffuseXOffset = diffuseOffset; + } + } + + public virtual int DiffuseXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Color DiffuseFactor + { + get { return _material.GetColor("_Color"); } + set { _material.SetColor("_Color", value); } + } + + public virtual Texture SpecularGlossinessTexture + { + get { return _material.GetTexture("_SpecGlossMap"); } + set + { + _material.SetTexture("_SpecGlossMap", value); + _material.SetFloat("_SmoothnessTextureChannel", 0); + _material.EnableKeyword("_SPECGLOSSMAP"); + } + } + + // not implemented by the Standard shader + public virtual int SpecularGlossinessTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 SpecularGlossinessXOffset + { + get { return specGlossOffset; } + set + { + specGlossOffset = value; + _material.SetTextureOffset("_SpecGlossMap", value); + } + } + + public virtual double SpecularGlossinessXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 SpecularGlossinessXScale + { + get { return _material.GetTextureScale("_SpecGlossMap"); } + set { + _material.SetTextureScale("_SpecGlossMap", value); + SpecularGlossinessXOffset = specGlossOffset; + } + } + + public virtual int SpecularGlossinessXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector3 SpecularFactor + { + get { return _material.GetVector("_SpecColor"); } + set { _material.SetVector("_SpecColor", value); } + } + + public virtual double GlossinessFactor + { + get { return _material.GetFloat("_GlossMapScale"); } + set + { + _material.SetFloat("_GlossMapScale", (float)value); + _material.SetFloat("_Glossiness", (float)value); + } + } + + public override IUniformMap Clone() + { + var copy = new SpecGloss2StandardMap(new Material(_material)); + base.Copy(copy); + return copy; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs.meta new file mode 100644 index 0000000..95da690 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGloss2StandardMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e4ff65c43d5c3774f90e67670d589cd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs new file mode 100644 index 0000000..fd2d8da --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public class SpecGlossMap : SpecGloss2StandardMap + { + public SpecGlossMap(int MaxLOD = 1000) : base("GLTF/PbrSpecularGlossiness", "0ffe2976cdefd434c8fcd886ffa69322", MaxLOD) { } + public SpecGlossMap(string shaderName, int MaxLOD = 1000) : base(shaderName, "0ffe2976cdefd434c8fcd886ffa69322", MaxLOD) { } + protected SpecGlossMap(Material m, int MaxLOD = 1000) : base(m, MaxLOD) { } + + public override int NormalTexCoord + { + get { return 0; } + set { return; } + } + + public override int OcclusionTexCoord + { + get { return 0; } + set { return; } + } + + public override int EmissiveTexCoord + { + get { return 0; } + set { return; } + } + + public override int DiffuseTexCoord + { + get { return 0; } + set { return; } + } + + public override int SpecularGlossinessTexCoord + { + get { return 0; } + set { return; } + } + + public override IUniformMap Clone() + { + var copy = new SpecGlossMap(new Material(_material)); + base.Copy(copy); + return copy; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs.meta new file mode 100644 index 0000000..8ef3be1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/SpecGlossMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f096c5198ea17245803d827b00f12b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs new file mode 100644 index 0000000..cf29df4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs @@ -0,0 +1,379 @@ +using GLTF.Schema; +using UnityEngine; +using UnityEngine.Rendering; +using Material = UnityEngine.Material; +using Texture = UnityEngine.Texture; + +namespace UnityGLTF +{ + public class StandardMap : ILitMap + { + protected Material _material; + private AlphaMode _alphaMode = AlphaMode.OPAQUE; + private double _alphaCutoff = 0.5; + + private Vector2 normalOffset = new Vector2(0, 0); + private Vector2 occlusionOffset = new Vector2(0, 0); + private Vector2 emissiveOffset = new Vector2(0, 0); + + protected StandardMap(string shaderName, string fallbackGuid, int MaxLOD = 1000) + { + var s = Shader.Find(shaderName); +#if UNITY_EDITOR + // workaround for first-import issues with Shader.Find and import order + if (!s && fallbackGuid != null) + s = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(fallbackGuid)); +#endif + if (s == null) + { + throw new ShaderNotFoundException(shaderName + " not found. Did you forget to add it to the build?"); + } + + s.maximumLOD = MaxLOD; + _material = new Material(s); + } + + protected StandardMap(Material mat, int MaxLOD = 1000) + { + mat.shader.maximumLOD = MaxLOD; + _material = mat; + + if (mat.HasProperty("_Cutoff")) + { + _alphaCutoff = mat.GetFloat("_Cutoff"); + } + + switch (mat.renderQueue) + { + case (int)RenderQueue.AlphaTest: + _alphaMode = AlphaMode.MASK; + break; + case (int)RenderQueue.Transparent: + _alphaMode = AlphaMode.BLEND; + break; + case (int)RenderQueue.Geometry: + default: + _alphaMode = AlphaMode.OPAQUE; + break; + } + } + + public Material Material { get { return _material; } } + + public virtual Texture NormalTexture + { + get { return _material.HasProperty("_BumpMap") ? _material.GetTexture("_BumpMap") : null; } + set + { + if (_material.HasProperty("_BumpMap")) + { + _material.SetTexture("_BumpMap", value); + _material.EnableKeyword("_NORMALMAP"); + } + else + { + Debug.LogWarning("Tried to set a normal map texture to a material that does not support it."); + } + } + } + + // not implemented by the Standard shader + public virtual int NormalTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 NormalXOffset + { + get { return normalOffset; } + set + { + normalOffset = value; + _material.SetTextureOffset("_BumpMap", value); + } + } + + public virtual double NormalXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 NormalXScale + { + get { return _material.GetTextureScale("_BumpMap"); } + set { + _material.SetTextureScale("_BumpMap", value); + NormalXOffset = normalOffset; + } + } + + public virtual int NormalXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual double NormalTexScale + { + get { return _material.HasProperty("_BumpScale") ? _material.GetFloat("_BumpScale") : 1; } + set + { + if (_material.HasProperty("_BumpScale")) + { + _material.SetFloat("_BumpScale", (float)value); + } + else + { + Debug.LogWarning("Tried to set a normal map scale to a material that does not support it."); + } + } + } + + public virtual Texture OcclusionTexture + { + get { return _material.HasProperty("_OcclusionMap") ? _material.GetTexture("_OcclusionMap") : null; } + set + { + if (_material.HasProperty("_OcclusionMap")) + { + _material.SetTexture("_OcclusionMap", value); + } + else + { + Debug.LogWarning("Tried to set an occlusion map to a material that does not support it."); + } + } + } + + // not implemented by the Standard shader + public virtual int OcclusionTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 OcclusionXOffset + { + get { return occlusionOffset; } + set + { + occlusionOffset = value; + _material.SetTextureOffset("_OcclusionMap", value); + } + } + + public virtual double OcclusionXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 OcclusionXScale + { + get { return _material.GetTextureScale("_OcclusionMap"); } + set { + _material.SetTextureScale("_OcclusionMap", value); + OcclusionXOffset = occlusionOffset; + } + } + + public virtual int OcclusionXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual double OcclusionTexStrength + { + get { return _material.HasProperty("_OcclusionStrength") ? _material.GetFloat("_OcclusionStrength") : 1; } + set + { + if (_material.HasProperty("_OcclusionStrength")) + { + _material.SetFloat("_OcclusionStrength", (float)value); + } + else + { + Debug.LogWarning("Tried to set occlusion strength to a material that does not support it."); + } + } + } + + public virtual Texture EmissiveTexture + { + get { return _material.HasProperty("_EmissionMap") ? _material.GetTexture("_EmissionMap") : null; } + set + { + if (_material.HasProperty("_EmissionMap")) + { + _material.SetTexture("_EmissionMap", value); + _material.EnableKeyword("_EMISSION"); + } + else + { + Debug.LogWarning("Tried to set an emission map to a material that does not support it."); + } + } + } + + // not implemented by the Standard shader + public virtual int EmissiveTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 EmissiveXOffset + { + get { return emissiveOffset; } + set + { + emissiveOffset = value; + _material.SetTextureOffset("_EmissionMap", value); + } + } + + public virtual double EmissiveXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 EmissiveXScale + { + get { return _material.GetTextureScale("_EmissionMap"); } + set { + _material.SetTextureScale("_EmissionMap", value); + EmissiveXOffset = emissiveOffset; + } + } + + public virtual int EmissiveXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Color EmissiveFactor + { + get { return _material.HasProperty("_EmissionColor") ? _material.GetColor("_EmissionColor") : Color.white; } + set + { + if (_material.HasProperty("_EmissionColor")) + { + _material.SetColor("_EmissionColor", value); + _material.EnableKeyword("_EMISSION"); + } + else + { + Debug.LogWarning("Tried to set an emission factor to a material that does not support it."); + } + } + } + + public virtual AlphaMode AlphaMode + { + get { return _alphaMode; } + set + { + if (value == AlphaMode.MASK) + { + _material.SetOverrideTag("RenderType", "TransparentCutout"); + _material.SetFloat("_Mode", 1); + _material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); + _material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); + _material.SetInt("_ZWrite", 1); + _material.EnableKeyword("_ALPHATEST_ON"); + _material.DisableKeyword("_ALPHABLEND_ON"); + _material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + _material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest; + if (_material.HasProperty("_Cutoff")) + { + _material.SetFloat("_Cutoff", (float)_alphaCutoff); + } + } + else if (value == AlphaMode.BLEND) + { + _material.SetOverrideTag("RenderType", "Transparent"); + _material.SetFloat("_Mode", 2); + _material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha); + _material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); + _material.SetInt("_ZWrite", 0); + _material.DisableKeyword("_ALPHATEST_ON"); + _material.EnableKeyword("_ALPHABLEND_ON"); + _material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + _material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent; + } + else + { + _material.SetOverrideTag("RenderType", "Opaque"); + _material.SetFloat("_Mode", 0); + _material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); + _material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); + _material.SetInt("_ZWrite", 1); + _material.DisableKeyword("_ALPHATEST_ON"); + _material.DisableKeyword("_ALPHABLEND_ON"); + _material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); + _material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Geometry; + } + + _alphaMode = value; + } + } + + public virtual double AlphaCutoff + { + get { return _alphaCutoff; } + set + { + if ((_alphaMode == AlphaMode.MASK) && _material.HasProperty("_Cutoff")) + { + _material.SetFloat("_Cutoff", (float)value); + } + _alphaCutoff = value; + } + } + + public virtual bool DoubleSided + { + get { return _material.GetInt("_Cull") == (int)CullMode.Off; } + set + { + if (value) + _material.SetInt("_Cull", (int)CullMode.Off); + else + _material.SetInt("_Cull", (int)CullMode.Back); + } + } + + public virtual bool VertexColorsEnabled + { + get { return _material.IsKeywordEnabled("VERTEX_COLOR_ON"); } + set + { + if (value) + _material.EnableKeyword("VERTEX_COLOR_ON"); + else + _material.DisableKeyword("VERTEX_COLOR_ON"); + } + } + + public virtual IUniformMap Clone() + { + var ret = new StandardMap(new Material(_material)); + ret._alphaMode = _alphaMode; + ret._alphaCutoff = _alphaCutoff; + return ret; + } + + protected virtual void Copy(ILitMap o) + { + var other = (StandardMap)o; + other._material = _material; + other._alphaCutoff = _alphaCutoff; + other._alphaMode = _alphaMode; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs.meta new file mode 100644 index 0000000..838c01e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/StandardMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f9ec0afbd86788428f96c503a122ba6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs new file mode 100644 index 0000000..38b3328 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs @@ -0,0 +1,145 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public interface IUniformMap + { + Material Material { get; } + + GLTF.Schema.AlphaMode AlphaMode { get; set; } + double AlphaCutoff { get; set; } + bool DoubleSided { get; set; } + bool VertexColorsEnabled { get; set; } + + IUniformMap Clone(); + } + + public interface ILitMap : IUniformMap + { + Texture NormalTexture { get; set; } + int NormalTexCoord { get; set; } + double NormalTexScale { get; set; } + Vector2 NormalXOffset { get; set; } + double NormalXRotation { get; set; } + Vector2 NormalXScale { get; set; } + int NormalXTexCoord { get; set; } + + Texture OcclusionTexture { get; set; } + int OcclusionTexCoord { get; set; } + double OcclusionTexStrength { get; set; } + Vector2 OcclusionXOffset { get; set; } + double OcclusionXRotation { get; set; } + Vector2 OcclusionXScale { get; set; } + int OcclusionXTexCoord { get; set; } + + Texture EmissiveTexture { get; set; } + int EmissiveTexCoord { get; set; } + Color EmissiveFactor { get; set; } + Vector2 EmissiveXOffset { get; set; } + double EmissiveXRotation { get; set; } + Vector2 EmissiveXScale { get; set; } + int EmissiveXTexCoord { get; set; } + } + + public interface IMetalRoughUniformMap : ILitMap + { + Texture BaseColorTexture { get; set; } + int BaseColorTexCoord { get; set; } + Vector2 BaseColorXOffset { get; set; } + double BaseColorXRotation { get; set; } + Vector2 BaseColorXScale { get; set; } + int BaseColorXTexCoord { get; set; } + + Color BaseColorFactor { get; set; } + + Texture MetallicRoughnessTexture { get; set; } + int MetallicRoughnessTexCoord { get; set; } + Vector2 MetallicRoughnessXOffset { get; set; } + double MetallicRoughnessXRotation { get; set; } + Vector2 MetallicRoughnessXScale { get; set; } + int MetallicRoughnessXTexCoord { get; set; } + + double MetallicFactor { get; set; } + double RoughnessFactor { get; set; } + } + + public interface IVolumeMap : IMetalRoughUniformMap + { + double ThicknessFactor { get; set; } + Texture ThicknessTexture { get; set; } + double AttenuationDistance { get; set; } + Color AttenuationColor { get; set; } + } + + public interface ITransmissionMap : IMetalRoughUniformMap + { + double TransmissionFactor { get; set; } + Texture TransmissionTexture { get; set; } + } + + public interface IIORMap : IMetalRoughUniformMap + { + double IOR { get; set; } + } + + public interface ISpecularMap : IMetalRoughUniformMap + { + double SpecularFactor { get; set; } + Texture SpecularTexture { get; set; } + Color SpecularColorFactor { get; set; } + Texture SpecularColorTexture { get; set; } + } + + public interface IIridescenceMap : IMetalRoughUniformMap + { + double IridescenceFactor { get; set; } + double IridescenceIor { get; set; } + double IridescenceThicknessMinimum { get; set; } + double IridescenceThicknessMaximum { get; set; } + Texture IridescenceTexture { get; set; } + Texture IridescenceThicknessTexture { get; set; } + } + + public interface ISpecGlossUniformMap : ILitMap + { + Texture DiffuseTexture { get; set; } + int DiffuseTexCoord { get; set; } + Vector2 DiffuseXOffset { get; set; } + double DiffuseXRotation { get; set; } + Vector2 DiffuseXScale { get; set; } + int DiffuseXTexCoord { get; set; } + + Color DiffuseFactor { get; set; } + + Texture SpecularGlossinessTexture { get; set; } + int SpecularGlossinessTexCoord { get; set; } + Vector2 SpecularGlossinessXOffset { get; set; } + double SpecularGlossinessXRotation { get; set; } + Vector2 SpecularGlossinessXScale { get; set; } + int SpecularGlossinessXTexCoord { get; set; } + + Vector3 SpecularFactor { get; set; } + double GlossinessFactor { get; set; } + } + + public interface IClearcoatMap : IMetalRoughUniformMap + { + double ClearcoatFactor { get; set; } + Texture ClearcoatTexture { get; set; } + double ClearcoatRoughnessFactor { get; set; } + Texture ClearcoatRoughnessTexture { get; set; } + Texture ClearcoatNormalTexture { get; set; } + } + + public interface IUnlitUniformMap : IUniformMap + { + Texture BaseColorTexture { get; set; } + int BaseColorTexCoord { get; set; } + Vector2 BaseColorXOffset { get; set; } + double BaseColorXRotation { get; set; } + Vector2 BaseColorXScale { get; set; } + int BaseColorXTexCoord { get; set; } + + Color BaseColorFactor { get; set; } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs.meta new file mode 100644 index 0000000..9fe9371 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UniformMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 35a1bb8c3d231b0449dcb049debee71a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs new file mode 100644 index 0000000..d40440b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace UnityGLTF +{ + public class UnlitGraphMap : BaseGraphMap, IUnlitUniformMap + { + private const string UnlitGraphGuid = "59541e6caf586ca4f96ccf48a4813a51"; + public UnlitGraphMap() : this("UnityGLTF/UnlitGraph") {} + +#if !UNITY_2021_1_OR_NEWER + private const string UnlitGraphTransparentGuid = "83f2caca07949794fb997734c4b0520f"; + private const string UnlitGraphTransparentDoubleGuid = "8a8841b4fb2f63644896f4e2b36bc06d"; + private const string UnlitGraphDoubleGuid = "33ee70a7f505ddb4e80d235c3d70766d"; + + public UnlitGraphMap(bool transparent, bool doubleSided) : base( + "UnityGLTF/UnlitGraph" + (transparent ? "-Transparent" : "") + (doubleSided ? "-Double" : ""), + (transparent && doubleSided ? UnlitGraphTransparentDoubleGuid : transparent ? UnlitGraphTransparentGuid : doubleSided ? UnlitGraphDoubleGuid : UnlitGraphGuid)) { } +#endif + + protected UnlitGraphMap(string shaderName) : base(shaderName, UnlitGraphGuid) { } + + public UnlitGraphMap(Material mat) : base(mat) { } + + public override IUniformMap Clone() + { + var clone = new UnlitGraphMap(new Material(_material)); + clone.Material.shaderKeywords = _material.shaderKeywords; + return clone; + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs.meta new file mode 100644 index 0000000..27defa3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitGraphMap.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a3f20bde7da344549f9b68b6cf264b36 +timeCreated: 1657891307 \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs new file mode 100644 index 0000000..802228d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs @@ -0,0 +1,63 @@ +using UnityEngine; +using Material = UnityEngine.Material; +using Texture = UnityEngine.Texture; + +namespace UnityGLTF +{ + public class UnlitMap : StandardMap, IUnlitUniformMap + { + private Vector2 baseColorOffset = new Vector2(0, 0); + + public UnlitMap(int MaxLOD = 1000) : base("GLTF/Unlit", "4d20effaf200f604db8b73f8e6a2e386", MaxLOD) { } + public UnlitMap(string shaderName, string shaderGuid, int MaxLOD = 1000) : base(shaderName, shaderGuid, MaxLOD) { } + public UnlitMap(Material m, int MaxLOD = 1000) : base(m, MaxLOD) { } + + public Texture BaseColorTexture + { + get { return _material.GetTexture("_MainTex"); } + set { _material.SetTexture("_MainTex", value); } + } + + public virtual int BaseColorTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Vector2 BaseColorXOffset + { + get { return baseColorOffset; } + set { + _material.SetTextureOffset("_MainTex", value); + baseColorOffset = value; + } + } + + public virtual double BaseColorXRotation + { + get { return 0; } + set { return; } + } + + public virtual Vector2 BaseColorXScale + { + get { return _material.GetTextureScale("_MainTex"); } + set { + _material.SetTextureScale("_MainTex", value); + BaseColorXOffset = baseColorOffset; + } + } + + public virtual int BaseColorXTexCoord + { + get { return 0; } + set { return; } + } + + public virtual Color BaseColorFactor + { + get { return _material.GetColor("_Color"); } + set { _material.SetColor("_Color", value); } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs.meta b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs.meta new file mode 100644 index 0000000..b26539e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Scripts/UniformMaps/UnlitMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6ab9be6bfd7090247a61992f7b8f8adb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders.meta new file mode 100644 index 0000000..dbfffde --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d02c75d6fa599b74187404ac51b51391 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader new file mode 100644 index 0000000..b62eefb --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader @@ -0,0 +1,340 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +// Derived from DefaultResourcesExtra\Standard.shader. +// Available as part of the "Built in shaders" download from https://unity3d.com/get-unity/download/archive +// Changes include: +// Excluding _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A from all ShadowCaster passes +// Removing many Properties not relevant to this shader's logic (and rename visible strings for others) +// Using a CustomEditor GUI for the shader configuration +// Adding and respecting the _Cull property to support double-sided materials +// Forwarding calls through VetexColor.cginc's vert_vcol/frag_vcol (instead of directly to UnityStandardCoreForward.cginc's vertBase/fragBase) to add VertexColor support + +Shader "GLTF/PbrMetallicRoughness" +{ + Properties + { + _Color("Base Color Factor", Color) = (1,1,1,1) + _MainTex("Base Color Texture", 2D) = "white" {} + + [Toggle(_VERTEX_COLORS)] _VertexColors("Vertex Colors", Float) = 1.0 + + _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 + + _Glossiness("Roughness Factor", Range(0.0, 1.0)) = 1.0 + + _Metallic("Metallic Factor", Range(0.0, 1.0)) = 0.0 + _MetallicGlossMap("Metal Rough Texture", 2D) = "white" {} + + _BumpScale("Normal Scale", Float) = 1.0 + _BumpMap("Normal Map", 2D) = "bump" {} + + _OcclusionStrength("Occlusion Strength", Range(0.0, 1.0)) = 1.0 + _OcclusionMap("Occlusion Texture", 2D) = "white" {} + + [HDR] + _EmissionColor("Emissive Factor", Color) = (0,0,0) + _EmissionMap("Emissive Texture", 2D) = "white" {} + + _Cull("Cull", Int) = 0 + + // Blending state + [HideInInspector] _Mode ("__mode", Float) = 0.0 + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 + [HideInInspector] _DstBlend ("__dst", Float) = 0.0 + [HideInInspector] _ZWrite ("__zw", Float) = 1.0 + } + + CGINCLUDE + #define UNITY_SETUP_BRDF_INPUT MetallicSetup + ENDCG + + SubShader + { + Tags { "RenderType"="Opaque" "PerformanceChecks"="False" } + LOD 300 + + + // ------------------------------------------------------------------ + // Base forward pass (directional light, emission, lightmaps, ...) + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + + // ------------------------------------- + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature ___ _DETAIL_MULX2 + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + // #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + // #pragma shader_feature _PARALLAXMAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex vert_vcol + #pragma fragment frag_vcol + #pragma shader_feature _VERTEX_COLORS + #include "VertexColor.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Additive forward pass (one light per pass) + Pass + { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + Blend [_SrcBlend] One + Fog { Color (0,0,0,0) } // in additive pass fog should be black + ZWrite Off + ZTest LEqual + Cull [_Cull] + CGPROGRAM + #pragma target 3.0 + + // ------------------------------------- + + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + // #pragma shader_feature ___ _DETAIL_MULX2 + // #pragma shader_feature _PARALLAXMAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + + #pragma vertex vertAdd + #pragma fragment fragAdd + #include "UnityStandardInput.cginc" + #include "UnityStandardCoreForward.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Shadow rendering pass + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + Cull [_Cull] + ZWrite On ZTest LEqual + + CGPROGRAM + #pragma target 3.0 + + // ------------------------------------- + + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _PARALLAXMAP + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex vertShadowCaster + #pragma fragment fragShadowCaster + + #include "UnityStandardShadow.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Deferred pass + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + Cull [_Cull] + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + + // ------------------------------------- + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + // #pragma shader_feature ___ _DETAIL_MULX2 + // #pragma shader_feature _PARALLAXMAP + + #pragma multi_compile_prepassfinal + #pragma multi_compile_instancing + + #pragma vertex vertDeferred + #pragma fragment fragDeferred + #include "UnityStandardInput.cginc" + #include "UnityStandardCore.cginc" + + ENDCG + } + + // ------------------------------------------------------------------ + // Extracts information for lightmapping, GI (emission, albedo, ...) + // This pass it not used during regular rendering. + Pass + { + Name "META" + Tags { "LightMode"="Meta" } + + Cull [_Cull] + + CGPROGRAM + #pragma vertex vert_meta + #pragma fragment frag_meta + + #pragma shader_feature _EMISSION + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "UnityStandardMeta.cginc" + ENDCG + } + } + + SubShader + { + Tags { "RenderType"="Opaque" "PerformanceChecks"="False" } + LOD 150 + + // ------------------------------------------------------------------ + // Base forward pass (directional light, emission, lightmaps, ...) + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + Cull [_Cull] + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 2.0 + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + // #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + // SM2.0: NOT SUPPORTED shader_feature ___ _DETAIL_MULX2 + // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP + + #pragma skip_variants SHADOWS_SOFT DIRLIGHTMAP_COMBINED + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + + #pragma vertex vert_vcol + #pragma fragment frag_vcol + #pragma shader_feature _VERTEX_COLORS + #include "VertexColor.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Additive forward pass (one light per pass) + Pass + { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + Blend [_SrcBlend] One + Fog { Color (0,0,0,0) } // in additive pass fog should be black + ZWrite Off + ZTest LEqual + Cull [_Cull] + CGPROGRAM + #pragma target 2.0 + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + // #pragma shader_feature ___ _DETAIL_MULX2 + // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP + #pragma skip_variants SHADOWS_SOFT + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + + #pragma vertex vertAdd + #pragma fragment fragAdd + #include "UnityStandardInput.cginc" + #include "UnityStandardCoreForward.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Shadow rendering pass + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + ZWrite On ZTest LEqual + Cull [_Cull] + CGPROGRAM + #pragma target 2.0 + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _METALLICGLOSSMAP + #pragma skip_variants SHADOWS_SOFT + #pragma multi_compile_shadowcaster + + #pragma vertex vertShadowCaster + #pragma fragment fragShadowCaster + + #include "UnityStandardShadow.cginc" + + ENDCG + } + + // ------------------------------------------------------------------ + // Extracts information for lightmapping, GI (emission, albedo, ...) + // This pass it not used during regular rendering. + Pass + { + Name "META" + Tags { "LightMode"="Meta" } + + Cull [_Cull] + + CGPROGRAM + #pragma vertex vert_meta + #pragma fragment frag_meta + + #pragma shader_feature _EMISSION + #pragma shader_feature _METALLICGLOSSMAP + // #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + // #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "UnityStandardMeta.cginc" + ENDCG + } + } + + + FallBack "VertexLit" + CustomEditor "PbrShaderGUI" +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader.meta new file mode 100644 index 0000000..3c419b8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrMetallicRoughness.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9836e4430eb58204086d7d1440e16a4f +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader new file mode 100644 index 0000000..f1f14c3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader @@ -0,0 +1,350 @@ +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +Shader "GLTF/PbrSpecularGlossiness" +{ + Properties + { + _Color("Base Color Factor", Color) = (1,1,1,1) + _MainTex("Base Color Texture", 2D) = "white" {} + + [Toggle(_VERTEX_COLORS)] _VertexColors("Vertex Colors", Float) = 1.0 + + _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 + + _Glossiness("Glossiness Factor", Range(0.0, 1.0)) = 0.5 + [HideInInspector] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0 + + _SpecColor("Specular Factor", Color) = (0.2,0.2,0.2) + _SpecGlossMap("Spec Gloss Texture", 2D) = "white" {} + [HideInInspector] _SpecularHighlights("Specular Highlights", Float) = 1.0 + [HideInInspector] _GlossyReflections("Glossy Reflections", Float) = 1.0 + + _BumpScale("Normal Scale", Float) = 1.0 + _BumpMap("Normal Map", 2D) = "bump" {} + + [HideInInspector] _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02 + [HideInInspector] _ParallaxMap ("Height Map", 2D) = "black" {} + + _OcclusionStrength("Occlusion Strength", Range(0.0, 1.0)) = 1.0 + _OcclusionMap("Occlusion Texture", 2D) = "white" {} + + _EmissionColor("Emissive Factor", Color) = (0,0,0) + _EmissionMap("Emissive Texture", 2D) = "white" {} + + _Cull("Cull", Int) = 0 + + [HideInInspector] _DetailMask("Detail Mask", 2D) = "white" {} + + [HideInInspector] _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {} + [HideInInspector] _DetailNormalMapScale("Scale", Float) = 1.0 + [HideInInspector] _DetailNormalMap("Normal Map", 2D) = "bump" {} + + [HideInInspector] _UVSec ("UV Set for secondary textures", Float) = 0 + + + // Blending state + [HideInInspector] _Mode ("__mode", Float) = 0.0 + [HideInInspector] _SrcBlend ("__src", Float) = 1.0 + [HideInInspector] _DstBlend ("__dst", Float) = 0.0 + [HideInInspector] _ZWrite ("__zw", Float) = 1.0 + } + + CGINCLUDE + #define UNITY_SETUP_BRDF_INPUT SpecularSetup + ENDCG + + SubShader + { + Tags { "RenderType"="Opaque" "PerformanceChecks"="False" } + LOD 300 + + + // ------------------------------------------------------------------ + // Base forward pass (directional light, emission, lightmaps, ...) + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + + // ------------------------------------- + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + #pragma shader_feature _PARALLAXMAP + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #pragma vertex vert_vcol + #pragma fragment frag_vcol + #pragma shader_feature _VERTEX_COLORS + #include "VertexColor.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Additive forward pass (one light per pass) + Pass + { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + Blend [_SrcBlend] One + Fog { Color (0,0,0,0) } // in additive pass fog should be black + ZWrite Off + ZTest LEqual + Cull[_Cull] + + CGPROGRAM + #pragma target 3.0 + + // ------------------------------------- + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature _PARALLAXMAP + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + + #pragma vertex vertAdd + #pragma fragment fragAdd + #include "UnityStandardInput.cginc" + #include "UnityStandardCoreForward.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Shadow rendering pass + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + ZWrite On ZTest LEqual + Cull[_Cull] + + CGPROGRAM + #pragma target 3.0 + + // ------------------------------------- + + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _PARALLAXMAP + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #pragma vertex vertShadowCaster + #pragma fragment fragShadowCaster + + #include "UnityStandardShadow.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Deferred pass + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + Cull[_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma exclude_renderers nomrt + + + // ------------------------------------- + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature _PARALLAXMAP + + #pragma multi_compile_prepassfinal + #pragma multi_compile_instancing + + #pragma vertex vertDeferred + #pragma fragment fragDeferred + + #include "UnityStandardCore.cginc" + + ENDCG + } + + // ------------------------------------------------------------------ + // Extracts information for lightmapping, GI (emission, albedo, ...) + // This pass it not used during regular rendering. + Pass + { + Name "META" + Tags { "LightMode"="Meta" } + + Cull[_Cull] + + CGPROGRAM + #pragma vertex vert_meta + #pragma fragment frag_meta + + #pragma shader_feature _EMISSION + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "UnityStandardMeta.cginc" + ENDCG + } + } + + SubShader + { + Tags { "RenderType"="Opaque" "PerformanceChecks"="False" } + LOD 150 + + // ------------------------------------------------------------------ + // Base forward pass (directional light, emission, lightmaps, ...) + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_SrcBlend] [_DstBlend] + ZWrite [_ZWrite] + Cull[_Cull] + + CGPROGRAM + #pragma target 2.0 + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _EMISSION + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF + #pragma shader_feature ___ _DETAIL_MULX2 + // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP + + #pragma skip_variants SHADOWS_SOFT DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED + + #pragma multi_compile_fwdbase + #pragma multi_compile_fog + + #pragma vertex vert_vcol + #pragma fragment frag_vcol + #pragma shader_feature _VERTEX_COLORS + #include "VertexColor.cginc" + + ENDCG + } + + // ------------------------------------------------------------------ + // Additive forward pass (one light per pass) + Pass + { + Name "FORWARD_DELTA" + Tags { "LightMode" = "ForwardAdd" } + Blend [_SrcBlend] One + Fog { Color (0,0,0,0) } // in additive pass fog should be black + ZWrite Off + ZTest LEqual + Cull[_Cull] + + CGPROGRAM + #pragma target 2.0 + + #pragma shader_feature _NORMALMAP + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF + #pragma shader_feature ___ _DETAIL_MULX2 + // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP + #pragma skip_variants SHADOWS_SOFT + + #pragma multi_compile_fwdadd_fullshadows + #pragma multi_compile_fog + + #pragma vertex vertAdd + #pragma fragment fragAdd + #include "UnityStandardInput.cginc" + #include "UnityStandardCoreForward.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Shadow rendering pass + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + ZWrite On ZTest LEqual + Cull[_Cull] + + CGPROGRAM + #pragma target 2.0 + + #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON + #pragma shader_feature _SPECGLOSSMAP + #pragma skip_variants SHADOWS_SOFT + #pragma multi_compile_shadowcaster + + #pragma vertex vertShadowCaster + #pragma fragment fragShadowCaster + + #include "UnityStandardShadow.cginc" + + ENDCG + } + // ------------------------------------------------------------------ + // Extracts information for lightmapping, GI (emission, albedo, ...) + // This pass it not used during regular rendering. + Pass + { + Name "META" + Tags { "LightMode"="Meta" } + + Cull[_Cull] + + CGPROGRAM + #pragma vertex vert_meta + #pragma fragment frag_meta + + #pragma shader_feature _EMISSION + #pragma shader_feature _SPECGLOSSMAP + #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + #pragma shader_feature ___ _DETAIL_MULX2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "UnityStandardMeta.cginc" + ENDCG + } + } + + FallBack "VertexLit" + CustomEditor "PbrShaderGUI" +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader.meta new file mode 100644 index 0000000..3c0ba8d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/PbrSpecularGlossiness.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0ffe2976cdefd434c8fcd886ffa69322 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph.meta new file mode 100644 index 0000000..e698bc9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e32829a2d4263447b87ba7c367e5410 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy.meta new file mode 100644 index 0000000..65954ce --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 036670886f7d6664b84a5053642f0ad0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph.meta new file mode 100644 index 0000000..5e4e9ff --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Double.override-graph.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8bc739b14fe811644abb82057b363ba8 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: fe431e399c52971408121c6c40cde979, type: 3} + sourceShader: {fileID: -6465566751694194690, guid: 478ce3626be7a5f4ea58d6b13f05a2e4, type: 3} + upgradeShader: {fileID: 4800000, guid: 86f94ec63222e22449b77b92fcf1edc8, type: 3} + forceTransparent: 0 + forceDoublesided: 1 + hideShader: 1 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph.meta new file mode 100644 index 0000000..806a268 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent-Double.override-graph.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 54352a53405971b41a6587615f947085 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: fe431e399c52971408121c6c40cde979, type: 3} + sourceShader: {fileID: -6465566751694194690, guid: 478ce3626be7a5f4ea58d6b13f05a2e4, type: 3} + upgradeShader: {fileID: 4800000, guid: 86f94ec63222e22449b77b92fcf1edc8, type: 3} + forceTransparent: 1 + forceDoublesided: 1 + hideShader: 1 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph.meta new file mode 100644 index 0000000..d0d2be0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/PBRGraph-Transparent.override-graph.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0a931320a74ca574b91d2d7d4557dcf1 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: fe431e399c52971408121c6c40cde979, type: 3} + sourceShader: {fileID: -6465566751694194690, guid: 478ce3626be7a5f4ea58d6b13f05a2e4, type: 3} + upgradeShader: {fileID: 4800000, guid: 86f94ec63222e22449b77b92fcf1edc8, type: 3} + forceTransparent: 1 + forceDoublesided: 0 + hideShader: 1 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph.meta new file mode 100644 index 0000000..fa8b525 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Double.override-graph.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 33ee70a7f505ddb4e80d235c3d70766d +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: fe431e399c52971408121c6c40cde979, type: 3} + sourceShader: {fileID: -6465566751694194690, guid: 59541e6caf586ca4f96ccf48a4813a51, type: 3} + upgradeShader: {fileID: 4800000, guid: 86f94ec63222e22449b77b92fcf1edc8, type: 3} + forceTransparent: 0 + forceDoublesided: 1 + hideShader: 1 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph.meta new file mode 100644 index 0000000..deaad86 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent-Double.override-graph.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8a8841b4fb2f63644896f4e2b36bc06d +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: fe431e399c52971408121c6c40cde979, type: 3} + sourceShader: {fileID: -6465566751694194690, guid: 59541e6caf586ca4f96ccf48a4813a51, type: 3} + upgradeShader: {fileID: 4800000, guid: 86f94ec63222e22449b77b92fcf1edc8, type: 3} + forceTransparent: 1 + forceDoublesided: 1 + hideShader: 1 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph.meta new file mode 100644 index 0000000..156e50e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/2020-Legacy/UnlitGraph-Transparent.override-graph.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 83f2caca07949794fb997734c4b0520f +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: fe431e399c52971408121c6c40cde979, type: 3} + sourceShader: {fileID: -6465566751694194690, guid: 59541e6caf586ca4f96ccf48a4813a51, type: 3} + upgradeShader: {fileID: 4800000, guid: 86f94ec63222e22449b77b92fcf1edc8, type: 3} + forceTransparent: 1 + forceDoublesided: 0 + hideShader: 1 diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph new file mode 100644 index 0000000..b63abdf --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph @@ -0,0 +1,23777 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "91e2a81f19de4249bc97ceec39ed3170", + "m_Properties": [ + { + "m_Id": "62341c2af4b04863803ba8369da7ee0b" + }, + { + "m_Id": "ff11e8a641984c798698ae35ab35028d" + }, + { + "m_Id": "86351816717b466c977fecf4d84eb6a2" + }, + { + "m_Id": "dfd1443566c54067a2abb81aaa116653" + }, + { + "m_Id": "3c72208ecc9f4632b650d1c06ac9c4d2" + }, + { + "m_Id": "2b0a026cebb0460a83c4e4d6e29e6e36" + }, + { + "m_Id": "25aa3027d13042ddb02054db5def12d2" + }, + { + "m_Id": "c5bd9f7925ac49c8913a839e2c3077a7" + }, + { + "m_Id": "f22bfbc247554808a3b34bf10161a0ca" + }, + { + "m_Id": "02ea37d7654b45adb4b6519d05132bf0" + }, + { + "m_Id": "492d5d149f4c4a7ca0c26f791e6704e6" + }, + { + "m_Id": "d0fed3c5fc0f40768ab7ac9ec518b18d" + }, + { + "m_Id": "b4d8cf566d7d4d0d8a49901c25e25950" + }, + { + "m_Id": "90e0e7e9f75044ad959e408da384de44" + }, + { + "m_Id": "80069515911646338233075f20ccb366" + }, + { + "m_Id": "0ca6948bbb5d4e47ad215994019d2c5c" + }, + { + "m_Id": "3ce6d25358cc421582e9a91b41d39fdf" + }, + { + "m_Id": "8a0fadc477234cbe95efb02754f32e2d" + }, + { + "m_Id": "1bd126bc26d14fa9b0bd88cffc73922b" + }, + { + "m_Id": "851b64cc55064cc591c263711144feca" + }, + { + "m_Id": "7e5abe31e1414a91911f76fbf9030e2c" + }, + { + "m_Id": "58d29ed6f30d4885996b1c2b1d967e6b" + }, + { + "m_Id": "50998a16883841b483e4d4e9aa26ce91" + }, + { + "m_Id": "42d01612a467484494e13af04de1b143" + }, + { + "m_Id": "6d2dcf695f684b3d85b3bdc6615713d3" + }, + { + "m_Id": "a88f553fcc0246a2bc8a573e921ce351" + }, + { + "m_Id": "0ba2ac3a5b6a4aa8add2b7bfa647a320" + }, + { + "m_Id": "1a5d204b45a44b6bac695a4ee5fa47c8" + }, + { + "m_Id": "31516f3b61504a6080a15b03bfc5b3fa" + }, + { + "m_Id": "148b5c05a260452aa2e1ab778a38b697" + }, + { + "m_Id": "8b08f9f87c4d417ea72f69104abe93df" + }, + { + "m_Id": "cdce6996c9064903841175baee4ac9d8" + }, + { + "m_Id": "2ef8958a8ad04fc48a4990966c393b9a" + }, + { + "m_Id": "a31de1ea8ed447308eea30bd6fdac922" + }, + { + "m_Id": "5004252d15d04c2ea74cd947ee1f3b4f" + }, + { + "m_Id": "105a2c9d68ae4193ab40386151992454" + }, + { + "m_Id": "d4bf44ad812142cf81dd4619dbce963f" + }, + { + "m_Id": "b3bf6e9825a34fe5ab67bdb85f17df32" + } + ], + "m_Keywords": [ + { + "m_Id": "302d94653f844799b5f7e93c4d06ed3d" + }, + { + "m_Id": "7e862501058a45c9ad78e01eefa90605" + }, + { + "m_Id": "87b808f5412f4fc3a450ebecdf23d83e" + }, + { + "m_Id": "87f49076b11a43f2bc2c05c9154c93d4" + }, + { + "m_Id": "97df40c83f5a4671a59db5b30b4c6316" + }, + { + "m_Id": "14eb9f49890e4fdf8e6c058bfe728c2c" + } + ], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "7f64bbc2d78d4fb199ef542b88ad80bb" + }, + { + "m_Id": "318b5ae978fa4468abc6503de868db1a" + }, + { + "m_Id": "609285c40dd646329176a8c4d3cb8c4c" + }, + { + "m_Id": "6d9d970e9d054130ba8a65bc95d897ed" + }, + { + "m_Id": "597e8aa92a6c43209a247f71fd2fe72f" + }, + { + "m_Id": "e8083d985ee345de96422aa7f416003c" + }, + { + "m_Id": "531b4076d6c0443986d3c456582c3460" + }, + { + "m_Id": "282dabc0bb484dedb2f8ac7596aeb8c8" + } + ], + "m_Nodes": [ + { + "m_Id": "d62362e7b1db41b5b2850ca4f7727193" + }, + { + "m_Id": "84d55ba92e74430996e3472b42307dbe" + }, + { + "m_Id": "f99c7d64d64e494f9fa89870d003303e" + }, + { + "m_Id": "192a2fa94873447f8287e671a84cfef5" + }, + { + "m_Id": "6396afda9540464580bb27eab9db11a2" + }, + { + "m_Id": "91c58898c6bb409395192a9efe525485" + }, + { + "m_Id": "e0d099b286e74cdd8eef478c2ba6a46d" + }, + { + "m_Id": "2da8f941d9cf4a7797b3a250c322261d" + }, + { + "m_Id": "e12c5f6ea3ba4826bbd98bdadd9fdd60" + }, + { + "m_Id": "67cd62080df840ec941b6cf2653b199f" + }, + { + "m_Id": "325e14ba71ba4c1ab846128cc0cb3655" + }, + { + "m_Id": "a84bc040b0ab456e92b7dfd5d9a636a4" + }, + { + "m_Id": "77fa18f03d944a35b1e7817552c8dd4a" + }, + { + "m_Id": "b448a23f9f09460994f0296f1f58a2b0" + }, + { + "m_Id": "ecb3cc7643b545c3b78349bdcae92f63" + }, + { + "m_Id": "57f34c151af34548b981f67f69fb01bb" + }, + { + "m_Id": "b133d79ba4bc41af8ed5110288bf16ff" + }, + { + "m_Id": "7bb3ca3024ad410f8014cc5f609eb114" + }, + { + "m_Id": "2c96c5f6712447e58eda432b764d07ce" + }, + { + "m_Id": "c63eb0c45cd446faafe694bb84a8a9d3" + }, + { + "m_Id": "dfa2b3edff80416fa8545965c3c47d3d" + }, + { + "m_Id": "771f758c8e0a4c748ab647b72a32c4a7" + }, + { + "m_Id": "636eb21b6031474cad03acd4b63413f7" + }, + { + "m_Id": "8757abe351fc4351abd6115a14dba130" + }, + { + "m_Id": "03edec114129436fb01015f07ff7f10a" + }, + { + "m_Id": "eb913c79adc9470ebeaf8aa017b929c9" + }, + { + "m_Id": "610f0dc568cd4d1fa7ea371be712a923" + }, + { + "m_Id": "db3ecb1c0e884596b20f467abfe7a56f" + }, + { + "m_Id": "a267acde60024329b4e0936179de7717" + }, + { + "m_Id": "ba9a2ca04ce041e38e549ca34918e30c" + }, + { + "m_Id": "11f64b30d68944d484c6e3b1280bff61" + }, + { + "m_Id": "e8ce99114fb74093bd17f882bd54ab1a" + }, + { + "m_Id": "0d8c3a1c09f24db4a28644998f76c89c" + }, + { + "m_Id": "1c5c2d9dd3c94f899456f0e784281ca4" + }, + { + "m_Id": "54048a36c65a48d08ec402c82a41df42" + }, + { + "m_Id": "84e2db014c35493eb0bf3d5ef8777478" + }, + { + "m_Id": "68eaf5df825b4d698f15a6b079db429a" + }, + { + "m_Id": "6ce2ce6219d94187b54d78ffcef3de1b" + }, + { + "m_Id": "16d1bef854c747fe9cdfd2a58fc23658" + }, + { + "m_Id": "24040992221045bb9d22da9a78437197" + }, + { + "m_Id": "e83457a070b141b5b171a895bf0d6389" + }, + { + "m_Id": "b39562c3120349b784d90f66734f0158" + }, + { + "m_Id": "581bb0c3846648a68b3050d26967d45f" + }, + { + "m_Id": "2d0bbca38ec145e2a4b4886f01ab4c47" + }, + { + "m_Id": "035426df75f84f88aca26e0e30c92b50" + }, + { + "m_Id": "a8f71db37bcf409dafa6c9b01bb96169" + }, + { + "m_Id": "e2923f4949d54387b5b24c430a889827" + }, + { + "m_Id": "cb66babc65414b46b1a10ba32a89a0d1" + }, + { + "m_Id": "b6468f11990d4fc29393e12aac937398" + }, + { + "m_Id": "d33a9109fde648d3b070274381ab59db" + }, + { + "m_Id": "e8d324bebd9f46c381e4e35fd38365a8" + }, + { + "m_Id": "9b2840bea8984c22acc50b45cb5c235e" + }, + { + "m_Id": "bb7674282a934e3b9bfb057277071aa7" + }, + { + "m_Id": "9900fba29f7c4a8e9ef63caa3cdecb4a" + }, + { + "m_Id": "9d897128ed844e848e23acd66dcf0292" + }, + { + "m_Id": "0672160770494af3894dcee104613b09" + }, + { + "m_Id": "b95fc0c69dfd41f4b2aa0d3dd326f562" + }, + { + "m_Id": "c586ec91ca9043a99c6359e8137eea8f" + }, + { + "m_Id": "d4ff3f6694b74efeafa02a530afce2cb" + }, + { + "m_Id": "bd06c49ec440472da7f53fde41efa972" + }, + { + "m_Id": "809df95983ad4f6a9b642ce84a9e74a7" + }, + { + "m_Id": "5d141c63b25f4a7a99aaffe9c41c7764" + }, + { + "m_Id": "293e9cc943084a00acd57b6d72c2f5d4" + }, + { + "m_Id": "114e1cd7bdae4a49874cda3f289705fa" + }, + { + "m_Id": "06db988d9f42411085151074e35e62d5" + }, + { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + { + "m_Id": "a5c994c3937e4e72b2438108ca0aad92" + }, + { + "m_Id": "d7de083c00574d7ea0b9e8975d5884a2" + }, + { + "m_Id": "152dd0d71e5a424f905fbeab3716865d" + }, + { + "m_Id": "9be492b061b948c8bf9969a7a476da96" + }, + { + "m_Id": "cd561be7e62240d38868b7451e936e0d" + }, + { + "m_Id": "df4ccb6d2f8546a1bdbc71c6c1056889" + }, + { + "m_Id": "d6bc16c340e9496cb653d57ae3dc4bc8" + }, + { + "m_Id": "7cf4aa7f3d0843eb91ce7a7522346507" + }, + { + "m_Id": "2dc0377e855949349c7a1052f7e3ff6c" + }, + { + "m_Id": "988c622f16f64a9898a8f3b255c84e8c" + }, + { + "m_Id": "cc2850d6d22e4a27a1bfbab840ba8ee2" + }, + { + "m_Id": "a31359da93cd43489c8a0ddc522c1e34" + }, + { + "m_Id": "5260828f1a9340bba0850b529eab555e" + }, + { + "m_Id": "50f7611ca222462baa2a9012071e7778" + }, + { + "m_Id": "731dfbff54a24314bd72456fc99c3562" + }, + { + "m_Id": "4298618b682246f99867908047bc271b" + }, + { + "m_Id": "33043e5554f244929df218ab57af3cfc" + }, + { + "m_Id": "e8d3757d40534b0d9cfdd2b8b5a4cf83" + }, + { + "m_Id": "52c19609cc8a4131bcbf17dda5e26142" + }, + { + "m_Id": "2194115e286743ada70d9049f07ad41d" + }, + { + "m_Id": "1d8e668bfc6c4ea18688cd09eab94678" + }, + { + "m_Id": "3cb17257805c480796eb3ceff99ed6a4" + }, + { + "m_Id": "54e30d3dc23846a28a0785e6e37720bc" + }, + { + "m_Id": "1f5759f25d314870a5cb410b559352d5" + }, + { + "m_Id": "466e79255cd74b99b006246159b7b833" + }, + { + "m_Id": "91ac88e441ea4086b40ddd4e5ed59c4b" + }, + { + "m_Id": "d37bee9cd4134c5ca141c7f949fc58a6" + }, + { + "m_Id": "18e91d5645e54d158188690d59870efa" + }, + { + "m_Id": "5b26a590f6aa45b99a84a717567a74b0" + }, + { + "m_Id": "5d86eb16a23243f39224b9973e3615ec" + }, + { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + { + "m_Id": "398e5b93f4414662bb436629815c19ea" + }, + { + "m_Id": "f04debede3c04da5aed9738b7794df17" + }, + { + "m_Id": "d4286b4dc1df42dc979af37ce8aef9ca" + }, + { + "m_Id": "53c9b32bb86548ceab5b2f2560048435" + }, + { + "m_Id": "338235ab890b4109bbe2f473272220c6" + }, + { + "m_Id": "c29b0cea9eb84998b2acfd23fd90641f" + }, + { + "m_Id": "c610a3df043749feab182161248812e2" + }, + { + "m_Id": "c803ee7f88a642ffbed90a2fd404725d" + }, + { + "m_Id": "df8c993165174790994c76c5dca0f8d9" + }, + { + "m_Id": "7355ce0418844781b97d72f5fed7f562" + }, + { + "m_Id": "cedd32ee0b4a419c939d17bacfb00ddd" + }, + { + "m_Id": "8047ad5c75004738994941835120ea73" + }, + { + "m_Id": "97e8a63e6ff046e687f550cc272c90d5" + }, + { + "m_Id": "a7c7c5e2c93045f9a142370141145621" + }, + { + "m_Id": "f4c239ca699c45978efc6a982f332c0f" + }, + { + "m_Id": "9c03ea90ae63433ca68e8b90c41e67c2" + }, + { + "m_Id": "759c527e9c344f7a95d77bbc7ed03237" + }, + { + "m_Id": "ba7ecde994b4474184c1c30ed4439bb3" + }, + { + "m_Id": "9ecb55f770a6449c8eaa8094328a5b01" + }, + { + "m_Id": "5da67c276d8a460a841c0a5d31161498" + }, + { + "m_Id": "caacc7bfacaa462cb79b1ca76d8eb93c" + }, + { + "m_Id": "c4c0321734e54e6a933fc90e3ce39e4f" + }, + { + "m_Id": "05fef445d84f45099a37dc423d62c85c" + }, + { + "m_Id": "b973ca0e4efb4dc2a0a905de3b1e5122" + }, + { + "m_Id": "86714225715947dd992fa9d9be01d513" + }, + { + "m_Id": "ca921050c00748e698611b527784ba96" + }, + { + "m_Id": "76520b7680d54ea7a3c2403da786ac5f" + }, + { + "m_Id": "9f2c61fddaff41df8764adeb9008f2fa" + }, + { + "m_Id": "93b4253497d147e8a714cf655533b4af" + }, + { + "m_Id": "19c06bb6934942279021be4aad3bc800" + }, + { + "m_Id": "9df7360a64294d7fb33e4bb464809bcc" + }, + { + "m_Id": "0ef1cc6563684f1fa5db8e87d52f8242" + }, + { + "m_Id": "fa5a99d79ecc4d7b88b9216911a4bf65" + }, + { + "m_Id": "f457d96fdf854621bcb3f3c9e069a416" + }, + { + "m_Id": "df859d80fdd14c57a04ec5a5108850a4" + }, + { + "m_Id": "a8ffdecf1edb4fbaa321c4099d17ea2e" + }, + { + "m_Id": "32267f216a9b418a9ef8e39620e4cd64" + }, + { + "m_Id": "a1d1982804614a6897989321f580888e" + }, + { + "m_Id": "c607f6a6bc884e7eb0be0be94eb1f485" + }, + { + "m_Id": "7f4c33107f064c7da4d5577b6541188d" + }, + { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + { + "m_Id": "c86c6b544c324d2a8d95e0f1dfd9b04d" + }, + { + "m_Id": "f952e2fe6b574b30b3434961f7285c33" + }, + { + "m_Id": "f83296f7700c4b0fa56a9338aa03745c" + }, + { + "m_Id": "7e67cced55a64807a6feaeb890265768" + }, + { + "m_Id": "62fa6369499147408c57f36563e87f9b" + }, + { + "m_Id": "0c624a0937e3404cbc1703c449651c0b" + }, + { + "m_Id": "318498c50d1d4e88b71c684d578ac0ca" + }, + { + "m_Id": "9408a018d7914d50b1b5af63a7699f0e" + }, + { + "m_Id": "e8eeaf53ed7e44cf9b859265dbcceec8" + }, + { + "m_Id": "2cc830dd4c1246d8a15eebc1551e48a5" + }, + { + "m_Id": "9a9e8eeb778a4deda769a91dfd275c3e" + }, + { + "m_Id": "600ec9368ad542db87fde9875fb144b9" + }, + { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + { + "m_Id": "7cff04c6100a49b6b46466becdc0bc2e" + }, + { + "m_Id": "7ffcf46e2d4c484d8296f6511a9c96d6" + }, + { + "m_Id": "081b33fe14b24902a4ac42e2316af506" + }, + { + "m_Id": "dbf32d2b6dbf4d619266bf52e18df460" + }, + { + "m_Id": "1c74b97048a049e79c38adc0357e2e1a" + }, + { + "m_Id": "f36b4e9d8dff4b5f88080db09748b890" + }, + { + "m_Id": "9104f2d7ad4e471b8749ef629ed1088e" + }, + { + "m_Id": "7c648c100c234e14ad1502e9bf0e2e08" + }, + { + "m_Id": "133ea222657e40e884b5ddfbb3456b1c" + }, + { + "m_Id": "1f38e8b86a0e424ebecd2ae31b59454e" + }, + { + "m_Id": "febc32f50e9745a794212c04541033c3" + }, + { + "m_Id": "48e1f0f7e59646d1a499fe64fa9ee1f5" + }, + { + "m_Id": "bfbacbfd6c6949fdad622227b8cb79d5" + }, + { + "m_Id": "cfe6ffa13ac44ec4adfc8ed3f865384c" + }, + { + "m_Id": "92a44c53f868404b9129d791d8f34404" + }, + { + "m_Id": "11732bb4207c4a17b58e5e5d34692f53" + }, + { + "m_Id": "04c233b8a56947ea97945e19370b1e21" + } + ], + "m_GroupDatas": [ + { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + { + "m_Id": "cd30fe948eb24cfe871b8fdea40a16f9" + }, + { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + } + ], + "m_StickyNoteDatas": [ + { + "m_Id": "0a8f4c0a31d8483a8f9725a7b2572428" + }, + { + "m_Id": "01c67512dfaf4dae8794fa0297a97629" + }, + { + "m_Id": "87e965ed28a34e348c8ab3c9e0287604" + }, + { + "m_Id": "741ca17a7fa54a4aba2b338e42afbcef" + }, + { + "m_Id": "4d7fdfabdc4e43b8b1b65c4e1f9104e3" + }, + { + "m_Id": "c60ef5f687f04a1f9bc0bab1ac390d44" + } + ], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "035426df75f84f88aca26e0e30c92b50" + }, + "m_SlotId": 4 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a8f71db37bcf409dafa6c9b01bb96169" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "03edec114129436fb01015f07ff7f10a" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ba9a2ca04ce041e38e549ca34918e30c" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "04c233b8a56947ea97945e19370b1e21" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "11732bb4207c4a17b58e5e5d34692f53" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "05fef445d84f45099a37dc423d62c85c" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "54e30d3dc23846a28a0785e6e37720bc" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "0672160770494af3894dcee104613b09" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "bd06c49ec440472da7f53fde41efa972" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "06db988d9f42411085151074e35e62d5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7c648c100c234e14ad1502e9bf0e2e08" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "06db988d9f42411085151074e35e62d5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "081b33fe14b24902a4ac42e2316af506" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7cff04c6100a49b6b46466becdc0bc2e" + }, + "m_SlotId": -725852216 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "0c624a0937e3404cbc1703c449651c0b" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "62fa6369499147408c57f36563e87f9b" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "0d8c3a1c09f24db4a28644998f76c89c" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1c5c2d9dd3c94f899456f0e784281ca4" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "0ef1cc6563684f1fa5db8e87d52f8242" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "df859d80fdd14c57a04ec5a5108850a4" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "11732bb4207c4a17b58e5e5d34692f53" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9b2840bea8984c22acc50b45cb5c235e" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "11f64b30d68944d484c6e3b1280bff61" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "e8ce99114fb74093bd17f882bd54ab1a" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "133ea222657e40e884b5ddfbb3456b1c" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "600ec9368ad542db87fde9875fb144b9" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "152dd0d71e5a424f905fbeab3716865d" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f36b4e9d8dff4b5f88080db09748b890" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "16d1bef854c747fe9cdfd2a58fc23658" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "731dfbff54a24314bd72456fc99c3562" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "18e91d5645e54d158188690d59870efa" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "5b26a590f6aa45b99a84a717567a74b0" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "19c06bb6934942279021be4aad3bc800" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9df7360a64294d7fb33e4bb464809bcc" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1c5c2d9dd3c94f899456f0e784281ca4" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "318498c50d1d4e88b71c684d578ac0ca" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1c5c2d9dd3c94f899456f0e784281ca4" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "eb913c79adc9470ebeaf8aa017b929c9" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1c74b97048a049e79c38adc0357e2e1a" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2da8f941d9cf4a7797b3a250c322261d" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1d8e668bfc6c4ea18688cd09eab94678" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "3cb17257805c480796eb3ceff99ed6a4" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1f38e8b86a0e424ebecd2ae31b59454e" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7cff04c6100a49b6b46466becdc0bc2e" + }, + "m_SlotId": -1226117840 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1f5759f25d314870a5cb410b559352d5" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "05fef445d84f45099a37dc423d62c85c" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "33043e5554f244929df218ab57af3cfc" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "4298618b682246f99867908047bc271b" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "e8ce99114fb74093bd17f882bd54ab1a" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2194115e286743ada70d9049f07ad41d" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "3cb17257805c480796eb3ceff99ed6a4" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "24040992221045bb9d22da9a78437197" + }, + "m_SlotId": 5 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "581bb0c3846648a68b3050d26967d45f" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "24040992221045bb9d22da9a78437197" + }, + "m_SlotId": 6 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b39562c3120349b784d90f66734f0158" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "293e9cc943084a00acd57b6d72c2f5d4" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "5d141c63b25f4a7a99aaffe9c41c7764" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2c96c5f6712447e58eda432b764d07ce" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a84bc040b0ab456e92b7dfd5d9a636a4" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2cc830dd4c1246d8a15eebc1551e48a5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "133ea222657e40e884b5ddfbb3456b1c" + }, + "m_SlotId": -1162300524 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2cc830dd4c1246d8a15eebc1551e48a5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": -1162300524 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2d0bbca38ec145e2a4b4886f01ab4c47" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "035426df75f84f88aca26e0e30c92b50" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2dc0377e855949349c7a1052f7e3ff6c" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "6396afda9540464580bb27eab9db11a2" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "32267f216a9b418a9ef8e39620e4cd64" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c607f6a6bc884e7eb0be0be94eb1f485" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "325e14ba71ba4c1ab846128cc0cb3655" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a84bc040b0ab456e92b7dfd5d9a636a4" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "33043e5554f244929df218ab57af3cfc" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "91ac88e441ea4086b40ddd4e5ed59c4b" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "33043e5554f244929df218ab57af3cfc" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ba7ecde994b4474184c1c30ed4439bb3" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "338235ab890b4109bbe2f473272220c6" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "91ac88e441ea4086b40ddd4e5ed59c4b" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "398e5b93f4414662bb436629815c19ea" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f04debede3c04da5aed9738b7794df17" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "3cb17257805c480796eb3ceff99ed6a4" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "d4286b4dc1df42dc979af37ce8aef9ca" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "4298618b682246f99867908047bc271b" + }, + "m_SlotId": 4 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "48e1f0f7e59646d1a499fe64fa9ee1f5" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "466e79255cd74b99b006246159b7b833" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a7c7c5e2c93045f9a142370141145621" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "48e1f0f7e59646d1a499fe64fa9ee1f5" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1c74b97048a049e79c38adc0357e2e1a" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "48e1f0f7e59646d1a499fe64fa9ee1f5" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7bb3ca3024ad410f8014cc5f609eb114" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "48e1f0f7e59646d1a499fe64fa9ee1f5" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "bfbacbfd6c6949fdad622227b8cb79d5" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "50f7611ca222462baa2a9012071e7778" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "dfa2b3edff80416fa8545965c3c47d3d" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "5260828f1a9340bba0850b529eab555e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "84e2db014c35493eb0bf3d5ef8777478" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "52c19609cc8a4131bcbf17dda5e26142" + }, + "m_SlotId": 4 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a31359da93cd43489c8a0ddc522c1e34" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "53c9b32bb86548ceab5b2f2560048435" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ca921050c00748e698611b527784ba96" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "53c9b32bb86548ceab5b2f2560048435" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "d4286b4dc1df42dc979af37ce8aef9ca" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "54e30d3dc23846a28a0785e6e37720bc" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "86714225715947dd992fa9d9be01d513" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "57f34c151af34548b981f67f69fb01bb" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ecb3cc7643b545c3b78349bdcae92f63" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "581bb0c3846648a68b3050d26967d45f" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "636eb21b6031474cad03acd4b63413f7" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "581bb0c3846648a68b3050d26967d45f" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "db3ecb1c0e884596b20f467abfe7a56f" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "5b26a590f6aa45b99a84a717567a74b0" + }, + "m_SlotId": 4 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "5d86eb16a23243f39224b9973e3615ec" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "5d141c63b25f4a7a99aaffe9c41c7764" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b133d79ba4bc41af8ed5110288bf16ff" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "5d86eb16a23243f39224b9973e3615ec" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a7c7c5e2c93045f9a142370141145621" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "5da67c276d8a460a841c0a5d31161498" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "466e79255cd74b99b006246159b7b833" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "600ec9368ad542db87fde9875fb144b9" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7cf4aa7f3d0843eb91ce7a7522346507" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "600ec9368ad542db87fde9875fb144b9" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9a9e8eeb778a4deda769a91dfd275c3e" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "600ec9368ad542db87fde9875fb144b9" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9be492b061b948c8bf9969a7a476da96" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "610f0dc568cd4d1fa7ea371be712a923" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "febc32f50e9745a794212c04541033c3" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b973ca0e4efb4dc2a0a905de3b1e5122" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c29b0cea9eb84998b2acfd23fd90641f" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c610a3df043749feab182161248812e2" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c803ee7f88a642ffbed90a2fd404725d" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "62fa6369499147408c57f36563e87f9b" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7e67cced55a64807a6feaeb890265768" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "636eb21b6031474cad03acd4b63413f7" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9c03ea90ae63433ca68e8b90c41e67c2" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "636eb21b6031474cad03acd4b63413f7" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "e0d099b286e74cdd8eef478c2ba6a46d" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "67cd62080df840ec941b6cf2653b199f" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a84bc040b0ab456e92b7dfd5d9a636a4" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "68eaf5df825b4d698f15a6b079db429a" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "50f7611ca222462baa2a9012071e7778" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "6ce2ce6219d94187b54d78ffcef3de1b" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "16d1bef854c747fe9cdfd2a58fc23658" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "731dfbff54a24314bd72456fc99c3562" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "54048a36c65a48d08ec402c82a41df42" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7355ce0418844781b97d72f5fed7f562" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "8047ad5c75004738994941835120ea73" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "76520b7680d54ea7a3c2403da786ac5f" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "338235ab890b4109bbe2f473272220c6" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "76520b7680d54ea7a3c2403da786ac5f" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "86714225715947dd992fa9d9be01d513" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "771f758c8e0a4c748ab647b72a32c4a7" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "581bb0c3846648a68b3050d26967d45f" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "77fa18f03d944a35b1e7817552c8dd4a" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "57f34c151af34548b981f67f69fb01bb" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7c648c100c234e14ad1502e9bf0e2e08" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": -1226117840 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7c648c100c234e14ad1502e9bf0e2e08" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "133ea222657e40e884b5ddfbb3456b1c" + }, + "m_SlotId": -1226117840 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7cf4aa7f3d0843eb91ce7a7522346507" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2dc0377e855949349c7a1052f7e3ff6c" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7cff04c6100a49b6b46466becdc0bc2e" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "52c19609cc8a4131bcbf17dda5e26142" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7e67cced55a64807a6feaeb890265768" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f952e2fe6b574b30b3434961f7285c33" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7e67cced55a64807a6feaeb890265768" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f952e2fe6b574b30b3434961f7285c33" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7e67cced55a64807a6feaeb890265768" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f83296f7700c4b0fa56a9338aa03745c" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7f4c33107f064c7da4d5577b6541188d" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7ffcf46e2d4c484d8296f6511a9c96d6" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1f38e8b86a0e424ebecd2ae31b59454e" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "8047ad5c75004738994941835120ea73" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "97e8a63e6ff046e687f550cc272c90d5" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "809df95983ad4f6a9b642ce84a9e74a7" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "57f34c151af34548b981f67f69fb01bb" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "86714225715947dd992fa9d9be01d513" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "338235ab890b4109bbe2f473272220c6" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "8757abe351fc4351abd6115a14dba130" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a8f71db37bcf409dafa6c9b01bb96169" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9104f2d7ad4e471b8749ef629ed1088e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1c74b97048a049e79c38adc0357e2e1a" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "91ac88e441ea4086b40ddd4e5ed59c4b" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ba7ecde994b4474184c1c30ed4439bb3" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "92a44c53f868404b9129d791d8f34404" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "0672160770494af3894dcee104613b09" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "92a44c53f868404b9129d791d8f34404" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ecb3cc7643b545c3b78349bdcae92f63" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "93b4253497d147e8a714cf655533b4af" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a8ffdecf1edb4fbaa321c4099d17ea2e" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9408a018d7914d50b1b5af63a7699f0e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "133ea222657e40e884b5ddfbb3456b1c" + }, + "m_SlotId": -725852216 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9408a018d7914d50b1b5af63a7699f0e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": -725852216 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "97e8a63e6ff046e687f550cc272c90d5" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "76520b7680d54ea7a3c2403da786ac5f" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "988c622f16f64a9898a8f3b255c84e8c" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2dc0377e855949349c7a1052f7e3ff6c" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9900fba29f7c4a8e9ef63caa3cdecb4a" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c586ec91ca9043a99c6359e8137eea8f" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9a9e8eeb778a4deda769a91dfd275c3e" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "24040992221045bb9d22da9a78437197" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9b2840bea8984c22acc50b45cb5c235e" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "11f64b30d68944d484c6e3b1280bff61" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9be492b061b948c8bf9969a7a476da96" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "152dd0d71e5a424f905fbeab3716865d" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9c03ea90ae63433ca68e8b90c41e67c2" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "759c527e9c344f7a95d77bbc7ed03237" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9c03ea90ae63433ca68e8b90c41e67c2" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "759c527e9c344f7a95d77bbc7ed03237" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9c03ea90ae63433ca68e8b90c41e67c2" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f4c239ca699c45978efc6a982f332c0f" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9d897128ed844e848e23acd66dcf0292" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b6468f11990d4fc29393e12aac937398" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9df7360a64294d7fb33e4bb464809bcc" + }, + "m_SlotId": 7 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a8ffdecf1edb4fbaa321c4099d17ea2e" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9ecb55f770a6449c8eaa8094328a5b01" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "11f64b30d68944d484c6e3b1280bff61" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9f2c61fddaff41df8764adeb9008f2fa" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "76520b7680d54ea7a3c2403da786ac5f" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a1d1982804614a6897989321f580888e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "32267f216a9b418a9ef8e39620e4cd64" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a1d1982804614a6897989321f580888e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c607f6a6bc884e7eb0be0be94eb1f485" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a267acde60024329b4e0936179de7717" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b39562c3120349b784d90f66734f0158" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a31359da93cd43489c8a0ddc522c1e34" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "df4ccb6d2f8546a1bdbc71c6c1056889" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a5c994c3937e4e72b2438108ca0aad92" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "152dd0d71e5a424f905fbeab3716865d" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a7c7c5e2c93045f9a142370141145621" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f4c239ca699c45978efc6a982f332c0f" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a84bc040b0ab456e92b7dfd5d9a636a4" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "77fa18f03d944a35b1e7817552c8dd4a" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a8f71db37bcf409dafa6c9b01bb96169" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "03edec114129436fb01015f07ff7f10a" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a8ffdecf1edb4fbaa321c4099d17ea2e" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "32267f216a9b418a9ef8e39620e4cd64" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b133d79ba4bc41af8ed5110288bf16ff" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1c5c2d9dd3c94f899456f0e784281ca4" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b39562c3120349b784d90f66734f0158" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "5da67c276d8a460a841c0a5d31161498" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b39562c3120349b784d90f66734f0158" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "91c58898c6bb409395192a9efe525485" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b39562c3120349b784d90f66734f0158" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "ba9a2ca04ce041e38e549ca34918e30c" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b448a23f9f09460994f0296f1f58a2b0" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9d897128ed844e848e23acd66dcf0292" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b6468f11990d4fc29393e12aac937398" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "92a44c53f868404b9129d791d8f34404" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b95fc0c69dfd41f4b2aa0d3dd326f562" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9900fba29f7c4a8e9ef63caa3cdecb4a" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b973ca0e4efb4dc2a0a905de3b1e5122" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "05fef445d84f45099a37dc423d62c85c" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "ba7ecde994b4474184c1c30ed4439bb3" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "192a2fa94873447f8287e671a84cfef5" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "ba9a2ca04ce041e38e549ca34918e30c" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "11f64b30d68944d484c6e3b1280bff61" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "bb7674282a934e3b9bfb057277071aa7" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "62fa6369499147408c57f36563e87f9b" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "bd06c49ec440472da7f53fde41efa972" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "11732bb4207c4a17b58e5e5d34692f53" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "bfbacbfd6c6949fdad622227b8cb79d5" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "febc32f50e9745a794212c04541033c3" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c29b0cea9eb84998b2acfd23fd90641f" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "df8c993165174790994c76c5dca0f8d9" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c4c0321734e54e6a933fc90e3ce39e4f" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c586ec91ca9043a99c6359e8137eea8f" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "0672160770494af3894dcee104613b09" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c607f6a6bc884e7eb0be0be94eb1f485" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "114e1cd7bdae4a49874cda3f289705fa" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c610a3df043749feab182161248812e2" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7355ce0418844781b97d72f5fed7f562" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c63eb0c45cd446faafe694bb84a8a9d3" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c63eb0c45cd446faafe694bb84a8a9d3" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c803ee7f88a642ffbed90a2fd404725d" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedd32ee0b4a419c939d17bacfb00ddd" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "ca921050c00748e698611b527784ba96" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9f2c61fddaff41df8764adeb9008f2fa" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "caacc7bfacaa462cb79b1ca76d8eb93c" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cb66babc65414b46b1a10ba32a89a0d1" + }, + "m_SlotId": 5 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b6468f11990d4fc29393e12aac937398" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cc2850d6d22e4a27a1bfbab840ba8ee2" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "e12c5f6ea3ba4826bbd98bdadd9fdd60" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cd561be7e62240d38868b7451e936e0d" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "df4ccb6d2f8546a1bdbc71c6c1056889" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cedd32ee0b4a419c939d17bacfb00ddd" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "97e8a63e6ff046e687f550cc272c90d5" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cfe6ffa13ac44ec4adfc8ed3f865384c" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "11732bb4207c4a17b58e5e5d34692f53" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cfe6ffa13ac44ec4adfc8ed3f865384c" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "92a44c53f868404b9129d791d8f34404" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d33a9109fde648d3b070274381ab59db" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b95fc0c69dfd41f4b2aa0d3dd326f562" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d37bee9cd4134c5ca141c7f949fc58a6" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "5d86eb16a23243f39224b9973e3615ec" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d4286b4dc1df42dc979af37ce8aef9ca" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1f5759f25d314870a5cb410b559352d5" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d4ff3f6694b74efeafa02a530afce2cb" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "0672160770494af3894dcee104613b09" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d4ff3f6694b74efeafa02a530afce2cb" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c586ec91ca9043a99c6359e8137eea8f" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d6bc16c340e9496cb653d57ae3dc4bc8" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7cf4aa7f3d0843eb91ce7a7522346507" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d7de083c00574d7ea0b9e8975d5884a2" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9be492b061b948c8bf9969a7a476da96" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "db3ecb1c0e884596b20f467abfe7a56f" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "610f0dc568cd4d1fa7ea371be712a923" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "dbf32d2b6dbf4d619266bf52e18df460" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7cff04c6100a49b6b46466becdc0bc2e" + }, + "m_SlotId": -1162300524 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "df4ccb6d2f8546a1bdbc71c6c1056889" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cc2850d6d22e4a27a1bfbab840ba8ee2" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "df859d80fdd14c57a04ec5a5108850a4" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "32267f216a9b418a9ef8e39620e4cd64" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "df8c993165174790994c76c5dca0f8d9" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "8047ad5c75004738994941835120ea73" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e2923f4949d54387b5b24c430a889827" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cb66babc65414b46b1a10ba32a89a0d1" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e83457a070b141b5b171a895bf0d6389" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "24040992221045bb9d22da9a78437197" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e8ce99114fb74093bd17f882bd54ab1a" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "33043e5554f244929df218ab57af3cfc" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e8d324bebd9f46c381e4e35fd38365a8" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c586ec91ca9043a99c6359e8137eea8f" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e8d3757d40534b0d9cfdd2b8b5a4cf83" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1f38e8b86a0e424ebecd2ae31b59454e" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e8d3757d40534b0d9cfdd2b8b5a4cf83" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "52c19609cc8a4131bcbf17dda5e26142" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e8eeaf53ed7e44cf9b859265dbcceec8" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7c648c100c234e14ad1502e9bf0e2e08" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "eb913c79adc9470ebeaf8aa017b929c9" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9b2840bea8984c22acc50b45cb5c235e" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "ecb3cc7643b545c3b78349bdcae92f63" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "5d141c63b25f4a7a99aaffe9c41c7764" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f04debede3c04da5aed9738b7794df17" + }, + "m_SlotId": 5 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "61caa07ef72e430399ce13dc525088ed" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f36b4e9d8dff4b5f88080db09748b890" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9104f2d7ad4e471b8749ef629ed1088e" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f36b4e9d8dff4b5f88080db09748b890" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9104f2d7ad4e471b8749ef629ed1088e" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f36b4e9d8dff4b5f88080db09748b890" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9104f2d7ad4e471b8749ef629ed1088e" + }, + "m_SlotId": 3 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f457d96fdf854621bcb3f3c9e069a416" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "df859d80fdd14c57a04ec5a5108850a4" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f4c239ca699c45978efc6a982f332c0f" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "91ac88e441ea4086b40ddd4e5ed59c4b" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f83296f7700c4b0fa56a9338aa03745c" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "9900fba29f7c4a8e9ef63caa3cdecb4a" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f952e2fe6b574b30b3434961f7285c33" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f83296f7700c4b0fa56a9338aa03745c" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "fa5a99d79ecc4d7b88b9216911a4bf65" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f457d96fdf854621bcb3f3c9e069a416" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "febc32f50e9745a794212c04541033c3" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "eb913c79adc9470ebeaf8aa017b929c9" + }, + "m_SlotId": 2 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 3087.000244140625, + "y": 230.99998474121095 + }, + "m_Blocks": [ + { + "m_Id": "d62362e7b1db41b5b2850ca4f7727193" + }, + { + "m_Id": "84d55ba92e74430996e3472b42307dbe" + }, + { + "m_Id": "f99c7d64d64e494f9fa89870d003303e" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 3087.000244140625, + "y": 610.0 + }, + "m_Blocks": [ + { + "m_Id": "192a2fa94873447f8287e671a84cfef5" + }, + { + "m_Id": "6396afda9540464580bb27eab9db11a2" + }, + { + "m_Id": "91c58898c6bb409395192a9efe525485" + }, + { + "m_Id": "e0d099b286e74cdd8eef478c2ba6a46d" + }, + { + "m_Id": "2da8f941d9cf4a7797b3a250c322261d" + }, + { + "m_Id": "e12c5f6ea3ba4826bbd98bdadd9fdd60" + }, + { + "m_Id": "7bb3ca3024ad410f8014cc5f609eb114" + }, + { + "m_Id": "dfa2b3edff80416fa8545965c3c47d3d" + }, + { + "m_Id": "54048a36c65a48d08ec402c82a41df42" + }, + { + "m_Id": "84e2db014c35493eb0bf3d5ef8777478" + }, + { + "m_Id": "114e1cd7bdae4a49874cda3f289705fa" + }, + { + "m_Id": "c86c6b544c324d2a8d95e0f1dfd9b04d" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "UnityGLTF", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "de2d39e22ef549f58ed7b2a1f989a770" + }, + { + "m_Id": "2adddb3fba4f472caec286b8688d99fe" + }, + { + "m_Id": "d1ea4f0250a34d99863ee930d384b759" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0013a756c5cc437a94860bae95387f34", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "015d9ea60aeb4c768b0337edce093524", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "01c67512dfaf4dae8794fa0297a97629", + "m_Title": "TODO Eyeballed value", + "m_Content": "to match other viewer's refraction behaviour. Need to figure out proper IOR math.", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": -957.0, + "y": 340.0, + "width": 199.0, + "height": 100.0 + }, + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "020c5dc5e3174c27b7073ade9f5c58ca", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "02ea37d7654b45adb4b6519d05132bf0", + "m_Guid": { + "m_GuidSerialized": "f525b073-6205-4e1e-b42c-c0de11b433a2" + }, + "m_Name": "Transmission Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Transmission Map", + "m_DefaultReferenceName": "_Transmission_Map", + "m_OverrideReferenceName": "transmissionTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "03393b3bd7734b3fbfa803c2d160bccb", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "035426df75f84f88aca26e0e30c92b50", + "m_Group": { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1180.000244140625, + "y": 1432.000244140625, + "width": 182.99993896484376, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "6c8a437fd25b4f4081338f7eb41d4ea1" + }, + { + "m_Id": "ca1885fb0716432896b8315c89080433" + }, + { + "m_Id": "98cbaa17fc8b45cf9f425f6652e5db9c" + }, + { + "m_Id": "b483df628a7f4bd6830039508e1b6acf" + }, + { + "m_Id": "a6724ad4ae9e48d69a2d176e04851177" + }, + { + "m_Id": "af3117c8564c4293acd58e3b5cbf06cf" + }, + { + "m_Id": "1ac470cc22754cd9b15cd56f4c25921a" + }, + { + "m_Id": "52cba1718ced4455b5e42a41b2d8d60b" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.OneMinusNode", + "m_ObjectId": "03edec114129436fb01015f07ff7f10a", + "m_Group": { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + "m_Name": "One Minus", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -779.0001220703125, + "y": 1532.000244140625, + "width": 127.9998779296875, + "height": 94.0 + } + }, + "m_Slots": [ + { + "m_Id": "6dff5c5b0ba849b9bcfc2d3655edaab2" + }, + { + "m_Id": "063a4b41272d4df28a662aecc8da4296" + } + ], + "synonyms": [ + "complement", + "invert", + "opposite" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "04566dece18d4711bfc06aa4518e36ca", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1Node", + "m_ObjectId": "04c233b8a56947ea97945e19370b1e21", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Float", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -873.9999389648438, + "y": 762.0000610351563, + "width": 126.0, + "height": 76.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "c77833c1b72b4333b74989301fd1dabf" + }, + { + "m_Id": "dc0acde1526a451182f632f96ca2646d" + } + ], + "synonyms": [ + "Vector 1", + "1", + "v1", + "vec1", + "scalar" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": 0.0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "052134b472814ed68c616629c4360ad9", + "m_Id": 0, + "m_DisplayName": "Map Rotation", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "05fef445d84f45099a37dc423d62c85c", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 197.99990844726563, + "y": -1090.9998779296875, + "width": 125.99996948242188, + "height": 117.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "f18908317d754608806e71de985248b9" + }, + { + "m_Id": "c323a744d86d4d769d160712a9158dd2" + }, + { + "m_Id": "4bc66ccd038c44a5839aae3660fe2fa4" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "063a4b41272d4df28a662aecc8da4296", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "06436a6d60c047628fcffb972f451909", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0663969fd47346fabe593928bb40b508", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "0672160770494af3894dcee104613b09", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1053.0, + "y": 620.0000610351563, + "width": 129.99993896484376, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "358ab8c582a3446b8cdff5b42cc19b9e" + }, + { + "m_Id": "c05a67cff38b47e6a88db1388f2cfa69" + }, + { + "m_Id": "84b3e8fddeff40c299ca38a8358ee503" + }, + { + "m_Id": "d2335d7b864d436dad76102ef56d2f08" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "06db988d9f42411085151074e35e62d5", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1389.0, + "y": -343.99993896484377, + "width": 165.999755859375, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "5d74d6d78db64d4e9925acfe54a292ac" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "90e0e7e9f75044ad959e408da384de44" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "06f5499a20744baaaaaf8a9d5cfdb5d9", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "07d462669af14bb6967792667a6b3e52", + "m_Id": 2, + "m_DisplayName": "False", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "False", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "081b33fe14b24902a4ac42e2316af506", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1852.9996337890625, + "y": 2168.0, + "width": 198.9998779296875, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "53584f7d765e4dd4a2ec8102a0c56f9e" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "d4bf44ad812142cf81dd4619dbce963f" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "08508de7d4e94721a9b57624e0465c79", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "089c287022154caab52b6f24775cd9d5", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "08ceaef13e204b93b4c2c05c8109c018", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0904160ed2aa4a2c89fcf793b0a0b80c", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "091394b326f2467186083da0c670f363", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0918c40cbbb440ad9c220aeeec8be904", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "0931dd8172ef4f1db8b838afc383d8f0", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "09a523a3cc884f78b5114f79c5d82f87", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "0a8f4c0a31d8483a8f9725a7b2572428", + "m_Title": "TODO Roughness Mipmap Selection", + "m_Content": "Replace with proper logic- see https://github.com/mrdoob/three.js/blob/860af3c012915be534f8a5c37d745e2dff339e04/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js#L56", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": -296.0, + "y": 130.0, + "width": 200.0, + "height": 160.0 + }, + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0ae4bad09e0d40d58dacba0ec3ee265b", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "0ba1ce8088b04d97a412bc5a934a6921", + "m_Id": 0, + "m_DisplayName": "Roughness", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "0ba2ac3a5b6a4aa8add2b7bfa647a320", + "m_Guid": { + "m_GuidSerialized": "dcae7d13-3912-429a-94ee-a0dd4478d35a" + }, + "m_Name": "Iridescence Thickness Max", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Iridescence Thickness Max", + "m_DefaultReferenceName": "_Iridescence_Thickness_Max", + "m_OverrideReferenceName": "iridescenceThicknessMaximum", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 400.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0c027a63f6ee4a1f8744a43d2893937f", + "m_Id": 1, + "m_DisplayName": "Min", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Min", + "m_StageCapability": 3, + "m_Value": { + "x": 0.00009999999747378752, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1Node", + "m_ObjectId": "0c624a0937e3404cbc1703c449651c0b", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Float", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2341.0, + "y": 1112.0, + "width": 126.0, + "height": 77.0 + } + }, + "m_Slots": [ + { + "m_Id": "27a3f1d4e36d4c39b848b75e145ae907" + }, + { + "m_Id": "3756d174a86140e58bb5a7b83fdf57af" + } + ], + "synonyms": [ + "Vector 1", + "1", + "v1", + "vec1", + "scalar" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": 0.0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "0ca6948bbb5d4e47ad215994019d2c5c", + "m_Guid": { + "m_GuidSerialized": "737adc16-d348-4672-8ab9-ba2814a9c925" + }, + "m_Name": "Emissive Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Emissive Map", + "m_DefaultReferenceName": "_Emissive_Map", + "m_OverrideReferenceName": "emissiveTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 2, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0cdfa53d80ba4f22858aedf3a1e41997", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "0d495fd34a134a8885f72fea88aaeec4", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionNode", + "m_ObjectId": "0d8c3a1c09f24db4a28644998f76c89c", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Screen Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -516.0001220703125, + "y": -318.9999694824219, + "width": 145.00006103515626, + "height": 129.0 + } + }, + "m_Slots": [ + { + "m_Id": "e72ba189d0084f4599f95f4eab7675e2" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "0d9e08b324f540949fde247bf1d88329", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "0e4d2483a8b64fb7a756cb6a0f4419c4", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "0e9d77e393a94a7d99c112df9659e1d9", + "m_Id": 0, + "m_DisplayName": "Clearcoat Roughness", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "0ef1cc6563684f1fa5db8e87d52f8242", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1408.000244140625, + "y": 2353.000244140625, + "width": 151.0, + "height": 33.999755859375 + } + }, + "m_Slots": [ + { + "m_Id": "37283e18690e47c7ad820955a219d2d6" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "31516f3b61504a6080a15b03bfc5b3fa" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "0f0e66f956ae4391a5f9bdb15ea601ed", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0f51b843930a4f59bfa3a1b833a7a1c1", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector4ShaderProperty", + "m_ObjectId": "105a2c9d68ae4193ab40386151992454", + "m_Guid": { + "m_GuidSerialized": "7098c3c4-0621-43d8-b732-bef9cf52321f" + }, + "m_Name": "Occlusion Map Tiling/Offset", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Occlusion Map Tiling/Offset", + "m_DefaultReferenceName": "_Occlusion_Map_Tiling_Offset", + "m_OverrideReferenceName": "occlusionTexture_ST", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "114e1cd7bdae4a49874cda3f289705fa", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Specular", + "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": "e8f9eb2ade9a48349179367ad11f0312" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Specular" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BranchNode", + "m_ObjectId": "11732bb4207c4a17b58e5e5d34692f53", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Branch", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -659.9999389648438, + "y": 643.0, + "width": 171.99990844726563, + "height": 142.00006103515626 + } + }, + "m_Slots": [ + { + "m_Id": "6a6c473e8f964a69b518df249f7f016f" + }, + { + "m_Id": "9f3aec08fb344aff8341297b4a7afcc1" + }, + { + "m_Id": "07d462669af14bb6967792667a6b3e52" + }, + { + "m_Id": "b455ebafa50b46fd8e2abd989d6e5096" + } + ], + "synonyms": [ + "switch", + "if", + "else" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "117540daa4384de2800aa3d63387d273", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "11a6dfa971e2491b858e58a132539cbd", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "11f64b30d68944d484c6e3b1280bff61", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 671.0, + "y": 108.0000228881836, + "width": 130.0, + "height": 142.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "bd9da3a1b4354ba1b5d286ce6a887c0d" + }, + { + "m_Id": "7f3028a1768849919bc6d07042e472e1" + }, + { + "m_Id": "529dc0cf581b453599ec7393abe160ac" + }, + { + "m_Id": "c87d0fdf8b4148e395babe82e14c2b23" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "127cd56294514017bef8652af1bf619f", + "m_Id": 1, + "m_DisplayName": "Strength", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Strength", + "m_StageCapability": 3, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "129d3f0a44a042bdb79469ac71d7954e", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubGraphNode", + "m_ObjectId": "133ea222657e40e884b5ddfbb3456b1c", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "TextureTransform", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1244.0001220703125, + "y": 179.00003051757813, + "width": 256.0, + "height": 142.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "26939e4642e14845994f0842560530cf" + }, + { + "m_Id": "7940a2c35a6f451fbb1c7b9a1e6ee3c3" + }, + { + "m_Id": "8e42e5d757ae4d9e8fbcacfb9b205f12" + }, + { + "m_Id": "50d1728de38b4355b295d3a96f1c07f2" + }, + { + "m_Id": "d7bd8c290807474e92e099e90263d28c" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"8ecb70019a63796448768b1124086ef5\",\n \"type\": 3\n }\n}", + "m_PropertyGuids": [ + "83a6556e-d78a-45f4-b8a2-13076ccdab77", + "0c456893-e07e-4608-8121-3220a4f6c3be", + "b3d81d39-5c6c-4c82-9d1f-36795cedd43c" + ], + "m_PropertyIds": [ + -1226117840, + -725852216, + -1162300524 + ], + "m_Dropdowns": [], + "m_DropdownSelectedEntries": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "148b5c05a260452aa2e1ab778a38b697", + "m_Guid": { + "m_GuidSerialized": "0d75e076-39d4-41d0-945f-1bbd6610160f" + }, + "m_Name": "Specular Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Specular Map", + "m_DefaultReferenceName": "_Specular_Map", + "m_OverrideReferenceName": "specularTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "14c36ee1905d45bea204fee0d7ad5b56", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "14eb9f49890e4fdf8e6c058bfe728c2c", + "m_Guid": { + "m_GuidSerialized": "18d2d4e9-c6dd-42bf-93c8-949b286e09f8" + }, + "m_Name": "Enable Texture Transforms", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Texture Transforms", + "m_DefaultReferenceName": "_ENABLE_TEXTURE_TRANSFORMS", + "m_OverrideReferenceName": "_TEXTURE_TRANSFORM_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "152dd0d71e5a424f905fbeab3716865d", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1806.000244140625, + "y": 467.9999694824219, + "width": 129.9998779296875, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "a8c88eada3b147bb99a0e6d8c31b4d32" + }, + { + "m_Id": "bbcc7b25c5024b5a99a8d3635b345c9a" + }, + { + "m_Id": "1a2b98c1a77048b2ac106c559926b880" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "15542953c5da44938d1b2d164ee23d21", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "157938a58a294edf9235f315d02de558", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "16128b0e399944f593436a891d7c4268", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.OneMinusNode", + "m_ObjectId": "16d1bef854c747fe9cdfd2a58fc23658", + "m_Group": { + "m_Id": "cd30fe948eb24cfe871b8fdea40a16f9" + }, + "m_Name": "One Minus", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1686.0001220703125, + "y": 987.0001220703125, + "width": 127.9998779296875, + "height": 94.0 + } + }, + "m_Slots": [ + { + "m_Id": "15542953c5da44938d1b2d164ee23d21" + }, + { + "m_Id": "e85a349c4838415bb2bc248b71851b9e" + } + ], + "synonyms": [ + "complement", + "invert", + "opposite" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "16d9d5e8056544c480d8706a27f3408d", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "186af275bd5e4705b7452f33b7ac33c9", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "18e91d5645e54d158188690d59870efa", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -675.0001220703125, + "y": -1705.9998779296875, + "width": 170.0001220703125, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "bf6e751348af40b09ab1beefc3e198a3" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "50998a16883841b483e4d4e9aa26ce91" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "192a2fa94873447f8287e671a84cfef5", + "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": "6c366b0d6ec545c3832add909e3d1e89" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "1989f19083984f9482326d807005e07f", + "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.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "19ba635ae6f84c5db5f7d3388cc81a0c", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "19c06bb6934942279021be4aad3bc800", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1392.000244140625, + "y": 2091.000244140625, + "width": 155.9998779296875, + "height": 33.999755859375 + } + }, + "m_Slots": [ + { + "m_Id": "20b4c4a9ae9c4eb7b8b4aa1241c1ed88" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "148b5c05a260452aa2e1ab778a38b697" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "1a2b98c1a77048b2ac106c559926b880", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "1a5d204b45a44b6bac695a4ee5fa47c8", + "m_Guid": { + "m_GuidSerialized": "1cb1e4b5-a591-4a19-8fbf-37b1c7854c16" + }, + "m_Name": "Specular", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Specular", + "m_DefaultReferenceName": "_Specular", + "m_OverrideReferenceName": "specularFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 1.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1abd847191e84fa496a6007bd82bce71", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "1ac470cc22754cd9b15cd56f4c25921a", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "1bd126bc26d14fa9b0bd88cffc73922b", + "m_Guid": { + "m_GuidSerialized": "256454be-0a94-46d6-bcfd-213278456f0f" + }, + "m_Name": "Occlusion Strength", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Occlusion Strength", + "m_DefaultReferenceName": "_Occlusion_Strength", + "m_OverrideReferenceName": "occlusionStrength", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 1.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1c118ceca899417281996660dba51179", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": -1.0, + "y": -1.0, + "z": -1.0, + "w": -1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.AddNode", + "m_ObjectId": "1c5c2d9dd3c94f899456f0e784281ca4", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Add", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -200.00009155273438, + "y": -318.9999694824219, + "width": 130.00003051757813, + "height": 117.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "0ae4bad09e0d40d58dacba0ec3ee265b" + }, + { + "m_Id": "f06d1da8895d4d14a112cfd10a98f5b9" + }, + { + "m_Id": "51ca380064384ca48295c59412763c9b" + } + ], + "synonyms": [ + "addition", + "sum", + "plus" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "1c74b97048a049e79c38adc0357e2e1a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2504.0, + "y": 526.0, + "width": 130.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "d65c7f3ce06c46209d297e6f47331440" + }, + { + "m_Id": "b1bf60579c8945c38bb11404fd2cbeaf" + }, + { + "m_Id": "9b37501fa48e46a9ae606c9b1ede4351" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "1c85cc7a118048f08e2c25657db45472", + "m_Id": 0, + "m_DisplayName": "Occlusion Strength", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "1d6ef732e65245ee8396edf71d70ea2a", + "m_Id": 0, + "m_DisplayName": "Coat Smoothness", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "CoatSmoothness", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ViewDirectionNode", + "m_ObjectId": "1d8e668bfc6c4ea18688cd09eab94678", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "View Direction", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -691.0001220703125, + "y": -930.0, + "width": 206.0, + "height": 131.0 + } + }, + "m_Slots": [ + { + "m_Id": "f38b5f84784a44bba8b095f119f5b817" + } + ], + "synonyms": [ + "eye direction" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Space": 1 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1ec9000d27f6401e9f8c6c476ac034ab", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "1f0278f5e89c42f09d2980d99158f6d8", + "m_Id": 0, + "m_DisplayName": "Bent Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BentNormal", + "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_Space": 3 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "1f38e8b86a0e424ebecd2ae31b59454e", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "WorkaroundTilingOffset (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1998.0, + "y": 2024.9998779296875, + "width": 290.0, + "height": 118.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "de53a1b0c5fd4b3f8e3c6dfac8fb7c06" + }, + { + "m_Id": "ffd62819303245298f2ce3bae5bb3ecf" + }, + { + "m_Id": "e982cbfdd730435a8345775f11fe5a22" + }, + { + "m_Id": "244b9aa1f59f48e68ea606ce5b5e7659" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "WorkaroundTilingOffset", + "m_FunctionSource": "885a3662fbaba7c47979790356264411", + "m_FunctionBody": "#if UNITY_VERSION >= 202120\nTilingOffset = float4(1,1,0,0);\nTilingOffsetOther = Tex.scaleTranslate.xyzw;\n#else\nTilingOffset = LegacyST;\nTilingOffsetOther = LegacyST;\n#endif" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RemapNode", + "m_ObjectId": "1f5759f25d314870a5cb410b559352d5", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Remap", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -30.000030517578126, + "y": -1006.9999389648438, + "width": 185.99986267089845, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "3b8629432b0f46f88edf17b50cbc680a" + }, + { + "m_Id": "c3cbdfdb3bf7447ca35d4c9edcecebcc" + }, + { + "m_Id": "2a92a3c85aff416185d3183c4b7c3855" + }, + { + "m_Id": "e29d4765172340899774cd4b6096c21e" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "1fd92dcb775e44539582c91fa2d715ee", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1815.0001220703125, + "y": -259.0, + "width": 130.0, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "3b8f80eed15d468c858c1bb729f68b4b" + }, + { + "m_Id": "9966b44de47f44c09134230701fc17cc" + }, + { + "m_Id": "508110704c634983a721fe742b0dcafd" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "20b14d2ae2434cf38a81633609bf5f43", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "20b4c4a9ae9c4eb7b8b4aa1241c1ed88", + "m_Id": 0, + "m_DisplayName": "Specular Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "21805134879849a892ae13b1af742efb", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalVectorNode", + "m_ObjectId": "2194115e286743ada70d9049f07ad41d", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Normal Vector", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -691.0001220703125, + "y": -1066.9998779296875, + "width": 206.0, + "height": 130.99993896484376 + } + }, + "m_Slots": [ + { + "m_Id": "70d61a3f3082405191f5df2390764af9" + } + ], + "synonyms": [ + "surface direction" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Space": 1 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "2281665015fe4c11919ecd881ab1983a", + "m_Id": 0, + "m_DisplayName": "Enable Volume", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "22e2594d57b343e289589b707d5b84b7", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "23efdb16a1b54d0893e5663038644a17", + "m_Id": 0, + "m_DisplayName": "Thickness", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "24040992221045bb9d22da9a78437197", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1110.000244140625, + "y": 2399.000244140625, + "width": 182.9998779296875, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "f3a31bd864f24872bf8c137be5fae97b" + }, + { + "m_Id": "117540daa4384de2800aa3d63387d273" + }, + { + "m_Id": "8df7078bc2fe4b6f83ab4f8336aedcd9" + }, + { + "m_Id": "79cad36a2c4f4ef7b7b192caa5beea63" + }, + { + "m_Id": "7666c8d311ce42aeb7f67d1bf144b414" + }, + { + "m_Id": "c933cc851230433082c21bc81c69c766" + }, + { + "m_Id": "3894dcd80333404ea1aef6e3db100f89" + }, + { + "m_Id": "efad1b6a6a3f4570b83fb671df65e2dd" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "244b9aa1f59f48e68ea606ce5b5e7659", + "m_Id": 3, + "m_DisplayName": "TilingOffsetOther", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "TilingOffsetOther", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "24e2f46f6c574f538800b38b4ba356e2", + "m_Id": 0, + "m_DisplayName": "Occlusion Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "25aa3027d13042ddb02054db5def12d2", + "m_Guid": { + "m_GuidSerialized": "e251df02-ca79-4099-9ca5-d871b4ede296" + }, + "m_Name": "Clearcoat", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Clearcoat", + "m_DefaultReferenceName": "_Clearcoat", + "m_OverrideReferenceName": "clearcoatFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "2669daf3314b4ba38d4ba53a7c10490e", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "26939e4642e14845994f0842560530cf", + "m_Id": -1226117840, + "m_DisplayName": "Tiling/Offset", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Tiling_Offset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "274467a610184193b2536afea65a7547", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "2796de049db74614be6bfe0317d3403f", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Enable Vertex Colors", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1610.0001220703125, + "y": -102.99996948242188, + "width": 165.999755859375, + "height": 118.00001525878906 + } + }, + "m_Slots": [ + { + "m_Id": "5d7fea3e25aa4c32aa1b8057007a7cea" + }, + { + "m_Id": "eef506e16f0d4e7fabba8e363f9f7b5b" + }, + { + "m_Id": "0663969fd47346fabe593928bb40b508" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "97df40c83f5a4671a59db5b30b4c6316" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "27a3f1d4e36d4c39b848b75e145ae907", + "m_Id": 1, + "m_DisplayName": "X", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "X", + "m_StageCapability": 3, + "m_Value": 0.375, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "27be125aeff84fe2a6e34aae2b187134", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "27d7082e2df947fda1e760b5a4fc10a0", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "282dabc0bb484dedb2f8ac7596aeb8c8", + "m_Name": "KHR_materials_clearcoat", + "m_ChildObjectList": [ + { + "m_Id": "7e862501058a45c9ad78e01eefa90605" + }, + { + "m_Id": "25aa3027d13042ddb02054db5def12d2" + }, + { + "m_Id": "c5bd9f7925ac49c8913a839e2c3077a7" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "28634075b89e40ac96b72fd014371ef8", + "m_Id": 1, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "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_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "2896420937a94ab89b246fb3155919dc", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1Node", + "m_ObjectId": "293e9cc943084a00acd57b6d72c2f5d4", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Float", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -897.0000610351563, + "y": 249.0000457763672, + "width": 126.0, + "height": 77.00001525878906 + } + }, + "m_Slots": [ + { + "m_Id": "73e62a443d0f46488055a595f92f9809" + }, + { + "m_Id": "22e2594d57b343e289589b707d5b84b7" + } + ], + "synonyms": [ + "Vector 1", + "1", + "v1", + "vec1", + "scalar" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": 0.0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "29699c2a90c3455eaabef74da1f7bb75", + "m_Id": 0, + "m_DisplayName": "Attenuation Color", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "2a92a3c85aff416185d3183c4b7c3855", + "m_Id": 2, + "m_DisplayName": "Out Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "OutMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 400.0, + "y": 700.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDTarget", + "m_ObjectId": "2adddb3fba4f472caec286b8688d99fe", + "m_ActiveSubTarget": { + "m_Id": "ec903d4fe369487a99f1706f50daa8d5" + }, + "m_Datas": [ + { + "m_Id": "40f2bfb8172f4025bc600b8b6c4a9677" + }, + { + "m_Id": "c2bea0a6923d40e88c022e279ce22602" + }, + { + "m_Id": "c01b5bb817134989a3ddb326b67996b3" + }, + { + "m_Id": "56b8cfcfbe7e4700a8ee6c8920825400" + } + ], + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "2b0a026cebb0460a83c4e4d6e29e6e36", + "m_Guid": { + "m_GuidSerialized": "586ff43e-93b4-4b65-be46-570ccf4c4274" + }, + "m_Name": "Metallic", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Metallic", + "m_DefaultReferenceName": "_Metallic", + "m_OverrideReferenceName": "metallicFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "2b0fc694fb3743c0b9cc31c21bba5714", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "2b443f0dc6564eaeb251851c92c4a83e", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "2b965b0789be43df916141ecf106ead7", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "2be05efd171444038a2e4b7115af59e6", + "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.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "2c79750601184e18985cd440c80897ae", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": -1.0, + "y": -1.0, + "z": -1.0, + "w": -1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "2c96c5f6712447e58eda432b764d07ce", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1722.0001220703125, + "y": 40.0, + "width": 174.0, + "height": 34.00005340576172 + } + }, + "m_Slots": [ + { + "m_Id": "d87019dd0da84e03b03fc2582ccc036c" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "ff11e8a641984c798698ae35ab35028d" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "2cc830dd4c1246d8a15eebc1551e48a5", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 993.9998779296875, + "y": -160.9999542236328, + "width": 117.0003662109375, + "height": 33.99999237060547 + } + }, + "m_Slots": [ + { + "m_Id": "3c4d023c8c014e90b9e53d57f5fb3dd4" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "a31de1ea8ed447308eea30bd6fdac922" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "2d0bbca38ec145e2a4b4886f01ab4c47", + "m_Group": { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1407.0003662109375, + "y": 1467.000244140625, + "width": 179.0001220703125, + "height": 33.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "4d72a699610344de8f2c0353eec46538" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "02ea37d7654b45adb4b6519d05132bf0" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "2d11904296214e0482528ef79596b2e3", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 8.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "2da8f941d9cf4a7797b3a250c322261d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Emission", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -213.0, + "y": -90.0, + "width": 200.0, + "height": 41.0 + } + }, + "m_Slots": [ + { + "m_Id": "67a1696f35a4427bb6b7e3d7abcb235b" + } + ], + "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.NormalStrengthNode", + "m_ObjectId": "2dc0377e855949349c7a1052f7e3ff6c", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Normal Strength", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1806.000244140625, + "y": 270.9999694824219, + "width": 165.999755859375, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "f28fc0029f4b4f5a86aec6dcf12e3235" + }, + { + "m_Id": "127cd56294514017bef8652af1bf619f" + }, + { + "m_Id": "635584693fd64b7ab2ffe34dfa7c4d05" + } + ], + "synonyms": [ + "intensity" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector4ShaderProperty", + "m_ObjectId": "2ef8958a8ad04fc48a4990966c393b9a", + "m_Guid": { + "m_GuidSerialized": "42989d8e-f01d-4e05-bab8-5af5397c1e84" + }, + "m_Name": "Map Tiling/Offset", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Map Tiling/Offset", + "m_DefaultReferenceName": "_Map_Tiling_Offset", + "m_OverrideReferenceName": "baseColorTexture_ST", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "2f5958af84214a2a9295cb6bcdcdce59", + "m_Id": 2, + "m_DisplayName": "Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Max", + "m_StageCapability": 3, + "m_Value": { + "x": 100000.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "2f9e57151472466f97a76a28a5e644c1", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "2fda202634ff4882a800972055bdf4b4", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "3022d91828194f10a5b0b6cbaa4eeb86", + "m_Id": 0, + "m_DisplayName": "v", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "v", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "302d94653f844799b5f7e93c4d06ed3d", + "m_Guid": { + "m_GuidSerialized": "5b68bec3-f5ba-42d8-a542-6cb4184b3974" + }, + "m_Name": "Enable Transmission", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Transmission", + "m_DefaultReferenceName": "_ENABLE_TRANSMISSION", + "m_OverrideReferenceName": "_VOLUME_TRANSMISSION_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 2, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "309b1a22566d417d9cd49277b012681d", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3141c7e396c740b2a7bfd349dbf69ee7", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "31516f3b61504a6080a15b03bfc5b3fa", + "m_Guid": { + "m_GuidSerialized": "1944b66e-a094-4260-a469-a59fd1ebd7fd" + }, + "m_Name": "Specular Color", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Specular Color", + "m_DefaultReferenceName": "_Specular_Color", + "m_OverrideReferenceName": "specularColorFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 1.0 + }, + "isMainColor": false, + "m_ColorMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SceneColorNode", + "m_ObjectId": "318498c50d1d4e88b71c684d578ac0ca", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Scene Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 57.99995422363281, + "y": -311.0, + "width": 138.0000762939453, + "height": 77.0 + } + }, + "m_Slots": [ + { + "m_Id": "930533d9deee4c08a24d6384302978e6" + }, + { + "m_Id": "28634075b89e40ac96b72fd014371ef8" + } + ], + "synonyms": [ + "screen buffer" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "318b5ae978fa4468abc6503de868db1a", + "m_Name": "glTF PBR", + "m_ChildObjectList": [ + { + "m_Id": "86351816717b466c977fecf4d84eb6a2" + }, + { + "m_Id": "90e0e7e9f75044ad959e408da384de44" + }, + { + "m_Id": "2ef8958a8ad04fc48a4990966c393b9a" + }, + { + "m_Id": "cdce6996c9064903841175baee4ac9d8" + }, + { + "m_Id": "a31de1ea8ed447308eea30bd6fdac922" + }, + { + "m_Id": "851b64cc55064cc591c263711144feca" + }, + { + "m_Id": "2b0a026cebb0460a83c4e4d6e29e6e36" + }, + { + "m_Id": "dfd1443566c54067a2abb81aaa116653" + }, + { + "m_Id": "f22bfbc247554808a3b34bf10161a0ca" + }, + { + "m_Id": "7e5abe31e1414a91911f76fbf9030e2c" + }, + { + "m_Id": "1bd126bc26d14fa9b0bd88cffc73922b" + }, + { + "m_Id": "105a2c9d68ae4193ab40386151992454" + }, + { + "m_Id": "d4bf44ad812142cf81dd4619dbce963f" + }, + { + "m_Id": "5004252d15d04c2ea74cd947ee1f3b4f" + }, + { + "m_Id": "3ce6d25358cc421582e9a91b41d39fdf" + }, + { + "m_Id": "8a0fadc477234cbe95efb02754f32e2d" + }, + { + "m_Id": "80069515911646338233075f20ccb366" + }, + { + "m_Id": "0ca6948bbb5d4e47ad215994019d2c5c" + }, + { + "m_Id": "97df40c83f5a4671a59db5b30b4c6316" + }, + { + "m_Id": "14eb9f49890e4fdf8e6c058bfe728c2c" + }, + { + "m_Id": "302d94653f844799b5f7e93c4d06ed3d" + }, + { + "m_Id": "b3bf6e9825a34fe5ab67bdb85f17df32" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "32267f216a9b418a9ef8e39620e4cd64", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2299.0, + "y": 1971.0001220703125, + "width": 130.000244140625, + "height": 141.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "723ae2bbeeb04f64b6ac0220ddc23e42" + }, + { + "m_Id": "600416b79758427ba1cb38653adb94a4" + }, + { + "m_Id": "b99e94611bed4ed58bcc7a9c30d2772e" + }, + { + "m_Id": "633d1fe2ecbc4c87960ecd546f93a09f" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalVectorNode", + "m_ObjectId": "325e14ba71ba4c1ab846128cc0cb3655", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Normal Vector", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1754.0001220703125, + "y": -110.99996948242188, + "width": 206.0, + "height": 130.99998474121095 + } + }, + "m_Slots": [ + { + "m_Id": "e20db26f346a4bb099ddc66aeb89e2c9" + } + ], + "synonyms": [ + "surface direction" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Space": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "33043e5554f244929df218ab57af3cfc", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Enable Transmission", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2272.000244140625, + "y": -339.9999694824219, + "width": 209.999755859375, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "410fc9a66a3549da94914682cf00b21c" + }, + { + "m_Id": "f88c0608ebf34378b1b47854228e5c5f" + }, + { + "m_Id": "a713df93e6de4d2a8f9e725c6608431d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "302d94653f844799b5f7e93c4d06ed3d" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "33246ca622234bb39f7877b44232c6fc", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SaturationNode", + "m_ObjectId": "338235ab890b4109bbe2f473272220c6", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Saturation", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1392.0, + "y": -1350.0, + "width": 174.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "3415bbe6c0a64acd9bcc17eaddaf7f56" + }, + { + "m_Id": "e5ee984eddac42b1bd84a7086c09cd78" + }, + { + "m_Id": "bd16ba2efda642b9a1a4840ef69cefba" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "33b1cd1ec949420c9e2a20d559161330", + "m_Id": 0, + "m_DisplayName": "Occlusion Map Tiling/Offset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3413eb1f30734715b9b6fb7d98127f43", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "3415bbe6c0a64acd9bcc17eaddaf7f56", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "358ab8c582a3446b8cdff5b42cc19b9e", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "371e4a8bf3324d5795dbdcea706c56e5", + "m_Id": 0, + "m_DisplayName": "Metallic", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Metallic", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "37283e18690e47c7ad820955a219d2d6", + "m_Id": 0, + "m_DisplayName": "Specular Color", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "3756d174a86140e58bb5a7b83fdf57af", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "384aa946f7444341988f848a3c93d646", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "3894dcd80333404ea1aef6e3db100f89", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "398e5b93f4414662bb436629815c19ea", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -711.0, + "y": -1303.9998779296875, + "width": 225.9998779296875, + "height": 33.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "dcf55ee7a8a14405a1a6103001d64e2f" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "6d2dcf695f684b3d85b3bdc6615713d3" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3a190e9fe175446388ce351f08beb58f", + "m_Id": 2, + "m_DisplayName": "False", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "False", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3a23356b624540d9b7a1590a8d2b102e", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3ab0e1c0910a4589a2f567ca5702e122", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3ae5a9539a1a41dea40a61cd2e6dde6e", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3b013a1bf52b42fe8baee66c25bb2126", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3b36955447fd4def9a5a554266d5536b", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3b8629432b0f46f88edf17b50cbc680a", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": -1.0, + "y": -1.0, + "z": -1.0, + "w": -1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3b8f80eed15d468c858c1bb729f68b4b", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "3c4d023c8c014e90b9e53d57f5fb3dd4", + "m_Id": 0, + "m_DisplayName": "Map UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "3c72208ecc9f4632b650d1c06ac9c4d2", + "m_Guid": { + "m_GuidSerialized": "4f4e37c3-9500-4ab9-8923-0baecd2c44d3" + }, + "m_Name": "Transmission", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Transmission", + "m_DefaultReferenceName": "_Transmission", + "m_OverrideReferenceName": "transmissionFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DotProductNode", + "m_ObjectId": "3cb17257805c480796eb3ceff99ed6a4", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Dot Product", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -459.0000305175781, + "y": -1007.9999389648438, + "width": 128.00003051757813, + "height": 117.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "70115868dbf8439b82df3c5025cd877c" + }, + { + "m_Id": "b612580ec76540688e6c548f7e50e022" + }, + { + "m_Id": "ae993503b9444c58869120f95f7394d5" + } + ], + "synonyms": [ + "scalar product" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "3cd8d66635a942e290d51e6c8d1a7872", + "m_Id": 1, + "m_DisplayName": "", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "3ce6d25358cc421582e9a91b41d39fdf", + "m_Guid": { + "m_GuidSerialized": "fcfe6ce1-7d71-4f24-92cd-cd28aef76d92" + }, + "m_Name": "Normal Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Normal Map", + "m_DefaultReferenceName": "_Normal_Map", + "m_OverrideReferenceName": "normalTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 3 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "3ebd437ef6e34d89802a54c5ed7590db", + "m_Id": 0, + "m_DisplayName": "Attenuation Distance", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "3f4ae4edfaa34f4c8531bd854abd844a", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "40800dab9a0943108e25b3afdfbea00a", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDLitData", + "m_ObjectId": "40f2bfb8172f4025bc600b8b6c4a9677", + "m_RayTracing": false, + "m_MaterialType": 0, + "m_RefractionModel": 0, + "m_SSSTransmission": true, + "m_EnergyConservingSpecular": true, + "m_ClearCoat": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "410fc9a66a3549da94914682cf00b21c", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "41d7bbb28c084adea8a2c007184d3e38", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "420a0ae4dcdc4fa6a59f6ea13dbbe035", + "m_Id": 2, + "m_DisplayName": "Power", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Power", + "m_StageCapability": 3, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "4298618b682246f99867908047bc271b", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2099.000244140625, + "y": -190.99996948242188, + "width": 119.999755859375, + "height": 149.00006103515626 + } + }, + "m_Slots": [ + { + "m_Id": "954c85b2964d43ca90e1a13747a3eef1" + }, + { + "m_Id": "d48ccf4b057d459ea93e84d0e6d43e43" + }, + { + "m_Id": "54f1cc14614d4472912dcff46abb0198" + }, + { + "m_Id": "6c2acb01264e42bb889e20d3f76c9684" + }, + { + "m_Id": "58e4f80242c54853a51fb8f46c891318" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "42a32381d42e41b6a2b038d2d681eba2", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "42d01612a467484494e13af04de1b143", + "m_Guid": { + "m_GuidSerialized": "3afcd02f-1fd3-4930-aea6-93e3c8a08c5f" + }, + "m_Name": "Iridescence IOR", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Iridescence IOR", + "m_DefaultReferenceName": "_Iridescence_IOR", + "m_OverrideReferenceName": "iridescenceIor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 1.2999999523162842, + "m_FloatType": 1, + "m_RangeValues": { + "x": 1.0, + "y": 2.5 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "436c97ee0270458384ce4631bac29eb6", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "44819891fa5e4f05b89905255e52a361", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "45f08d4b02ab4efbb72633cafcfaa131", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.FresnelNode", + "m_ObjectId": "466e79255cd74b99b006246159b7b833", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Fresnel Effect", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 705.9998779296875, + "y": -870.0, + "width": 163.99993896484376, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "d439e7ac4eed401ab19a5db9740d11dd" + }, + { + "m_Id": "97ed6c1db4b94972a42fe1e7e24bcf68" + }, + { + "m_Id": "420a0ae4dcdc4fa6a59f6ea13dbbe035" + }, + { + "m_Id": "85a22e74dd8044e9b51c32fb182e3f1a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "472d45ed364f4a5987da3b1210416eae", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "478df15ef57d4a3187fe3424c761f0c7", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "4849b3a5f68e4bafa37b69999d921afd", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "485418fad1b24848b06ea90dc61e428c", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "48a77b32052846f09c49744640f1c4e9", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "48ae037d1cdf40a79177e5e96ce6fb3d", + "m_Title": "Specular", + "m_Position": { + "x": 1367.000244140625, + "y": 1667.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "48b85ee5e3874844bda0d352d462e17c", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RedirectNodeData", + "m_ObjectId": "48e1f0f7e59646d1a499fe64fa9ee1f5", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Redirect Node", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2293.0, + "y": 28.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "e90b82a061ba4892aefecb61a281d723" + }, + { + "m_Id": "5d492c5d0c4c4acb93eda416e5f9a694" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "48eac560f7a6421e9903059e33662055", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "492d5d149f4c4a7ca0c26f791e6704e6", + "m_Guid": { + "m_GuidSerialized": "130cd097-328c-42d7-9975-522653a599f1" + }, + "m_Name": "Attenuation Distance", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Attenuation Distance", + "m_DefaultReferenceName": "_Attenuation_Distance", + "m_OverrideReferenceName": "attenuationDistance", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0010000000474974514, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "4bc66ccd038c44a5839aae3660fe2fa4", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "4c8200d1e5f240aea818cc6ab001d632", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "4d3bb73e2b634b8b821eb74686beccd4", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "4d72a699610344de8f2c0353eec46538", + "m_Id": 0, + "m_DisplayName": "Transmission Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "4d7fdfabdc4e43b8b1b65c4e1f9104e3", + "m_Title": "Broken Texture Transform in SG", + "m_Content": "Turns out that _BaseMap_ST does not work in SG anymore UNLESS the texture explicitly has that toggle on, and then the transform can be reused for other textures...", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": 960.0, + "y": -384.0, + "width": 200.0, + "height": 160.0 + }, + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "4e455d381d794048bb64b988cef2e24a", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "4f10c66a3e6d41fa9c17259b0da33edf", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "5004252d15d04c2ea74cd947ee1f3b4f", + "m_Guid": { + "m_GuidSerialized": "811b80e4-c54d-417d-8dc6-8abb48a7fbc5" + }, + "m_Name": "Occlusion Map UV", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Occlusion Map UV", + "m_DefaultReferenceName": "_Occlusion_Map_UV", + "m_OverrideReferenceName": "occlusionTextureTexCoord", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 2, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "503eff2ab474419ab3e996e64e411b69", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "506bf201fc4142d480a46dd5f44c5884", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "508110704c634983a721fe742b0dcafd", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "50998a16883841b483e4d4e9aa26ce91", + "m_Guid": { + "m_GuidSerialized": "384fe643-fdaa-450d-8c3e-250263ae23f6" + }, + "m_Name": "Iridescence Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Iridescence Map", + "m_DefaultReferenceName": "_Iridescence_Map", + "m_OverrideReferenceName": "iridescenceTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "50d1728de38b4355b295d3a96f1c07f2", + "m_Id": 1, + "m_DisplayName": "Transformed_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Transformed_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "50f7611ca222462baa2a9012071e7778", + "m_Group": { + "m_Id": "cd30fe948eb24cfe871b8fdea40a16f9" + }, + "m_Name": "Enable Clearcoat", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1936.0, + "y": 869.0001831054688, + "width": 143.0, + "height": 117.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "45f08d4b02ab4efbb72633cafcfaa131" + }, + { + "m_Id": "5d4c6343b05d418bbc32a7f37c3f26ed" + }, + { + "m_Id": "2f9e57151472466f97a76a28a5e644c1" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "7e862501058a45c9ad78e01eefa90605" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "516df774111e40bea29ef1f9f567f13c", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "51ca380064384ca48295c59412763c9b", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "5260828f1a9340bba0850b529eab555e", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2821.00048828125, + "y": 1040.0001220703125, + "width": 140.99951171875, + "height": 33.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "b91488151b004cd2aa2ba7923db0e152" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "851b64cc55064cc591c263711144feca" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "529dc0cf581b453599ec7393abe160ac", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "52ad86c239f740608a41d0cf1d4aab20", + "m_Title": "Transmission", + "m_Position": { + "x": -1432.0, + "y": 1373.0003662109375 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "52c19609cc8a4131bcbf17dda5e26142", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1173.0003662109375, + "y": 2069.000244140625, + "width": 183.00018310546876, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "c22bbf41264143e690d1c9eea357c483" + }, + { + "m_Id": "d38f08916af4479ba71a15c0a309c43d" + }, + { + "m_Id": "6f8871c409c74f1bb3f183727640b6e8" + }, + { + "m_Id": "06436a6d60c047628fcffb972f451909" + }, + { + "m_Id": "9a3bb394d6ec4891a9cba4d5cde5a220" + }, + { + "m_Id": "8acbbab8c4a24947ab8ac6205571c94a" + }, + { + "m_Id": "974a5648658142479dd293dbc303a122" + }, + { + "m_Id": "5a278fd6f9504a91be41b1c288f4f702" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "52cba1718ced4455b5e42a41b2d8d60b", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "531b4076d6c0443986d3c456582c3460", + "m_Name": "KHR_materials_specular", + "m_ChildObjectList": [ + { + "m_Id": "87f49076b11a43f2bc2c05c9154c93d4" + }, + { + "m_Id": "1a5d204b45a44b6bac695a4ee5fa47c8" + }, + { + "m_Id": "148b5c05a260452aa2e1ab778a38b697" + }, + { + "m_Id": "31516f3b61504a6080a15b03bfc5b3fa" + }, + { + "m_Id": "8b08f9f87c4d417ea72f69104abe93df" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "53584f7d765e4dd4a2ec8102a0c56f9e", + "m_Id": 0, + "m_DisplayName": "Occlusion Map Rotation", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "539b06cf9457481282d249d654eb8740", + "m_Id": 0, + "m_DisplayName": "Iridescence", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "53c9b32bb86548ceab5b2f2560048435", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -690.0000610351563, + "y": -720.0, + "width": 156.99993896484376, + "height": 34.00006103515625 + } + }, + "m_Slots": [ + { + "m_Id": "887246a84e814042ba21984b7c5c1123" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "42d01612a467484494e13af04de1b143" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "53cfede5b4934d888883d61e9e49c628", + "m_Id": 2, + "m_DisplayName": "Out Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "OutMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 2.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "53e6e4fd5b7040cc8ca17980f41e3df4", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "54048a36c65a48d08ec402c82a41df42", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.CoatSmoothness", + "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": "1d6ef732e65245ee8396edf71d70ea2a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.CoatSmoothness" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "540fbe60da724a25863c84a28a7b19de", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "54272dba60bb489b8c64b04e510560cc", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "547571dcbd2140a0bee62584e58884ae", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "54e30d3dc23846a28a0785e6e37720bc", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Spectral (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 372.9999084472656, + "y": -1090.9998779296875, + "width": 208.00003051757813, + "height": 277.99993896484377 + } + }, + "m_Slots": [ + { + "m_Id": "cf3f322e39934fdbaa66e219748a2b1b" + }, + { + "m_Id": "999b803d7ace4709a4dc31d05c9e0f25" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "Spectral", + "m_FunctionSource": "885a3662fbaba7c47979790356264411", + "m_FunctionBody": "Enter function body here..." +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "54f1cc14614d4472912dcff46abb0198", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData", + "m_ObjectId": "56b8cfcfbe7e4700a8ee6c8920825400", + "m_MaterialNeedsUpdateHash": 529, + "m_SurfaceType": 0, +"m_TwoSided": true, + "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_CustomVelocity": false, + "m_Tessellation": false, + "m_TessellationMode": 0, + "m_TessellationFactorMinDistance": 20.0, + "m_TessellationFactorMaxDistance": 50.0, + "m_TessellationFactorTriangleSize": 100.0, + "m_TessellationShapeFactor": 0.75, + "m_TessellationBackFaceCullEpsilon": -0.25, + "m_TessellationMaxDisplacement": 0.009999999776482582, + "m_Version": 1, + "inspectorFoldoutMask": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "57b9bcce4ef34a04afc1cd3f4e183dc9", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "57f34c151af34548b981f67f69fb01bb", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1058.0, + "y": -92.99996185302735, + "width": 129.9998779296875, + "height": 117.99995422363281 + } + }, + "m_Slots": [ + { + "m_Id": "765c7dcbc3194092a0b6d17d3b0cc191" + }, + { + "m_Id": "a7ada2aa2ece41108c144d2baa843400" + }, + { + "m_Id": "478df15ef57d4a3187fe3424c761f0c7" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "581bb0c3846648a68b3050d26967d45f", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -717.0001220703125, + "y": 2529.0, + "width": 125.99993896484375, + "height": 118.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "8e5b3b953d0944d784b2f73adaf55428" + }, + { + "m_Id": "ebcb432791e545e3b5cdb618a6f98580" + }, + { + "m_Id": "c0b800a8b577453182963e3cc1fc7a12" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5832c178721b456596b0b98e27bf7edb", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "58a85f0a5d444b0c878b97c684eb7676", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "58d29ed6f30d4885996b1c2b1d967e6b", + "m_Guid": { + "m_GuidSerialized": "5e2f8016-c462-481e-87bc-4185285f1460" + }, + "m_Name": "Iridescence", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Iridescence", + "m_DefaultReferenceName": "_Iridescence", + "m_OverrideReferenceName": "iridescenceFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "58e4f80242c54853a51fb8f46c891318", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "58fcef95064d43539481018c3b71e3e1", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5931680f7ccf49c4bb700855be684150", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "594b54dda80f484f85784c252143d680", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "597e8aa92a6c43209a247f71fd2fe72f", + "m_Name": "KHR_materials_ior", + "m_ChildObjectList": [ + { + "m_Id": "ff11e8a641984c798698ae35ab35028d" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "59b8a05662ac4fc6aeb5b1647d80080a", + "m_Id": 1, + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "5a278fd6f9504a91be41b1c288f4f702", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "5a7f05fcf70e484d97982030a390cb3e", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "5b26a590f6aa45b99a84a717567a74b0", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -400.00018310546877, + "y": -1747.0, + "width": 183.00001525878907, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "aa2e642ca1cc4cb1b48566ecb6dc4a0f" + }, + { + "m_Id": "a57f6047cc4e4232a376e5c19a09c7aa" + }, + { + "m_Id": "b5ce0ae9ec7e427cbf911d5c0e9e812e" + }, + { + "m_Id": "42a32381d42e41b6a2b038d2d681eba2" + }, + { + "m_Id": "930a53d67a5848df90387a45b712875e" + }, + { + "m_Id": "472d45ed364f4a5987da3b1210416eae" + }, + { + "m_Id": "83d6e951e04a4db281ed0b7899e7f481" + }, + { + "m_Id": "4c8200d1e5f240aea818cc6ab001d632" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5b68c11c07d547ed9dcfaac2cc046c44", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "5c387032398b47d0b442326a29f497ce", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5ca8bbeec7774b4fb0301196692f327f", + "m_Id": -725852216, + "m_DisplayName": "Rotation", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Rotation", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "5d141c63b25f4a7a99aaffe9c41c7764", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -728.0000610351563, + "y": 116.0, + "width": 129.99993896484376, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "0f0e66f956ae4391a5f9bdb15ea601ed" + }, + { + "m_Id": "c118ae28deb94b2c9087cd33707ee34b" + }, + { + "m_Id": "3b36955447fd4def9a5a554266d5536b" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5d492c5d0c4c4acb93eda416e5f9a694", + "m_Id": 1, + "m_DisplayName": "", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5d4c6343b05d418bbc32a7f37c3f26ed", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "5d74d6d78db64d4e9925acfe54a292ac", + "m_Id": 0, + "m_DisplayName": "Base Color Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5d7fea3e25aa4c32aa1b8057007a7cea", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "5d86eb16a23243f39224b9973e3615ec", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -162.00018310546876, + "y": -1836.9998779296875, + "width": 126.00021362304688, + "height": 117.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "73595ed5587d4aacb975c3f0674961bb" + }, + { + "m_Id": "5c387032398b47d0b442326a29f497ce" + }, + { + "m_Id": "e3ae8cad9f8d4be8906c50ecd8601d5c" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "5d89c1f5111447cc976117bf944fa2f3", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5d9c257d0755494d9de2f7be32aa020d", + "m_Id": 0, + "m_DisplayName": "Smoothness", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Smoothness", + "m_StageCapability": 2, + "m_Value": 0.5, + "m_DefaultValue": 0.5, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubtractNode", + "m_ObjectId": "5da67c276d8a460a841c0a5d31161498", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Subtract", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 455.0, + "y": -644.0, + "width": 125.99993896484375, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "ca225faed728415d9517bb9e4a48c033" + }, + { + "m_Id": "b874136726cd40e8b6d2d98f625bab7e" + }, + { + "m_Id": "f6374e2356694f79a2ae4649a524f463" + } + ], + "synonyms": [ + "subtraction", + "remove", + "minus", + "take away" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "5eff4b6a6c9b419c8eaa49bb7efccb1e", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "6003b098c771400f96a76b0827b24a13", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "600416b79758427ba1cb38653adb94a4", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RedirectNodeData", + "m_ObjectId": "600ec9368ad542db87fde9875fb144b9", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Redirect Node", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1471.9998779296875, + "y": 382.0000915527344, + "width": 56.0001220703125, + "height": 23.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "e9caa412a5a24764a8cc4c746f7edcdc" + }, + { + "m_Id": "842e4508cd6846c191df41b48e1e4624" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "6082fea42d754443ae37cb0cecb9a02f", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "609285c40dd646329176a8c4d3cb8c4c", + "m_Name": "KHR_materials_transmission", + "m_ChildObjectList": [ + { + "m_Id": "3c72208ecc9f4632b650d1c06ac9c4d2" + }, + { + "m_Id": "02ea37d7654b45adb4b6519d05132bf0" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "610f0dc568cd4d1fa7ea371be712a923", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -150.0, + "y": 2.0000009536743166, + "width": 125.99992370605469, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "aa737ed29b1b48c9835f8beff57a8aec" + }, + { + "m_Id": "2d11904296214e0482528ef79596b2e3" + }, + { + "m_Id": "b5fdfd81a2464e01916672bfcb723de8" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "614b5b4a067946ceaed9319789d80138", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 1.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "61caa07ef72e430399ce13dc525088ed", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -156.0, + "y": -1470.0, + "width": 125.99996948242188, + "height": 142.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "68bc0219d63647f38da1124460292866" + }, + { + "m_Id": "4f10c66a3e6d41fa9c17259b0da33edf" + }, + { + "m_Id": "d2e54a101690459cb6f817a1835e8560" + }, + { + "m_Id": "cd7f2005366b49b49d812fc510316f20" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "62341c2af4b04863803ba8369da7ee0b", + "m_Guid": { + "m_GuidSerialized": "d63eaa7d-8a91-4235-b12d-4fb7dd889934" + }, + "m_Name": "Thickness", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Thickness", + "m_DefaultReferenceName": "_Thickness", + "m_OverrideReferenceName": "thicknessFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 10000.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "62618e344d6a43d1808eeed4e22ee21d", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "62695fc5dc364bf785f684a561a3ddca", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "62e9d751103b4c5589e69eebf69bbf2a", + "m_Id": 0, + "m_DisplayName": "Predicate", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Predicate", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "62fa6369499147408c57f36563e87f9b", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2173.0, + "y": 1049.0, + "width": 129.9998779296875, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "9ae243c87a164179871b9ffb282cf23e" + }, + { + "m_Id": "48a77b32052846f09c49744640f1c4e9" + }, + { + "m_Id": "bc40f37950614be8999aea81198fa25c" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "633d1fe2ecbc4c87960ecd546f93a09f", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "634a1285adea4cb7817514fae82f8b4f", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": -1.0, + "y": -1.0, + "z": -1.0, + "w": -1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "635584693fd64b7ab2ffe34dfa7c4d05", + "m_Id": 2, + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.OneMinusNode", + "m_ObjectId": "636eb21b6031474cad03acd4b63413f7", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "One Minus", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -539.0001220703125, + "y": 2529.0, + "width": 127.99984741210938, + "height": 94.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "04566dece18d4711bfc06aa4518e36ca" + }, + { + "m_Id": "aaa0a3a6b1f24183a1ad486843ee5d76" + } + ], + "synonyms": [ + "complement", + "invert", + "opposite" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "6396afda9540464580bb27eab9db11a2", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.NormalTS", + "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": "d4fb0b6904a34956a14ccb954a3cf564" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.NormalTS" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "65ab868df408437cafc09b4f8a7cd998", + "m_Id": 0, + "m_DisplayName": "Roughness-Metallic Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "67a1696f35a4427bb6b7e3d7abcb235b", + "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": 1, + "m_Type": "UnityEditor.ShaderGraph.ViewDirectionNode", + "m_ObjectId": "67cd62080df840ec941b6cf2653b199f", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "View Direction", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1754.0001220703125, + "y": -248.99998474121095, + "width": 206.0, + "height": 131.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "a2e5e4acd661494eace0ff5e08dd639d" + } + ], + "synonyms": [ + "eye direction" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Space": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "687e654c3f724ff986c6806df23ad6c7", + "m_Id": 0, + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "68bc0219d63647f38da1124460292866", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "68eaf5df825b4d698f15a6b079db429a", + "m_Group": { + "m_Id": "cd30fe948eb24cfe871b8fdea40a16f9" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1686.0001220703125, + "y": 906.0000610351563, + "width": 126.0, + "height": 34.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "d9ae07569f7b48debc16effc8d24fd71" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "25aa3027d13042ddb02054db5def12d2" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "69da7e2093d14bd582c3ea7e7f3be09d", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "6a6c473e8f964a69b518df249f7f016f", + "m_Id": 0, + "m_DisplayName": "Predicate", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Predicate", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "6a90c03346f74863b69dbf16495a3dd5", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": -1.0, + "y": -1.0, + "z": -1.0, + "w": -1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "6b41807fd9ec4ea3998966d6ad43532d", + "m_Id": -1162300524, + "m_DisplayName": "UV Channel", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_UV_Channel", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "6c2acb01264e42bb889e20d3f76c9684", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "6c366b0d6ec545c3832add909e3d1e89", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "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.Vector4MaterialSlot", + "m_ObjectId": "6c8a437fd25b4f4081338f7eb41d4ea1", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "6ce2ce6219d94187b54d78ffcef3de1b", + "m_Group": { + "m_Id": "cd30fe948eb24cfe871b8fdea40a16f9" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1442.0, + "y": 1025.0001220703125, + "width": 186.0001220703125, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "0e9d77e393a94a7d99c112df9659e1d9" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "c5bd9f7925ac49c8913a839e2c3077a7" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "6d2dcf695f684b3d85b3bdc6615713d3", + "m_Guid": { + "m_GuidSerialized": "5d20de67-3dd7-4298-b698-e43727dfbaff" + }, + "m_Name": "Iridescence Thickness Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Iridescence Thickness Map", + "m_DefaultReferenceName": "_Iridescence_Thickness_Map", + "m_OverrideReferenceName": "iridescenceThicknessTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "6d75cac715d1458fa26ab6c2ccd852dd", + "m_Id": 1, + "m_DisplayName": "In Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "InMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 750.0, + "y": 1500.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "6d9d970e9d054130ba8a65bc95d897ed", + "m_Name": "KHR_materials_volume", + "m_ChildObjectList": [ + { + "m_Id": "62341c2af4b04863803ba8369da7ee0b" + }, + { + "m_Id": "b4d8cf566d7d4d0d8a49901c25e25950" + }, + { + "m_Id": "d0fed3c5fc0f40768ab7ac9ec518b18d" + }, + { + "m_Id": "492d5d149f4c4a7ca0c26f791e6704e6" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "6dff5c5b0ba849b9bcfc2d3655edaab2", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "6f8871c409c74f1bb3f183727640b6e8", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "6fc4bc9235584b14a6a30b611e70d7d8", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "70115868dbf8439b82df3c5025cd877c", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "70d61a3f3082405191f5df2390764af9", + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "723ae2bbeeb04f64b6ac0220ddc23e42", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "72d0cdcf81384bcf8ed160aaeaf9c35c", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "731dfbff54a24314bd72456fc99c3562", + "m_Group": { + "m_Id": "cd30fe948eb24cfe871b8fdea40a16f9" + }, + "m_Name": "Enable Clearcoat", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1936.0, + "y": 987.0001220703125, + "width": 143.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "ccff5dbcc0c0429a8411f01d1ed6df75" + }, + { + "m_Id": "8423b5cfbdfc427fa8ca7b71bafd1227" + }, + { + "m_Id": "e2bb25c172f141fe8a8d5691791d1692" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "7e862501058a45c9ad78e01eefa90605" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SaturateNode", + "m_ObjectId": "7355ce0418844781b97d72f5fed7f562", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Saturate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 372.9999084472656, + "y": -1641.0, + "width": 128.00003051757813, + "height": 94.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "274467a610184193b2536afea65a7547" + }, + { + "m_Id": "27d7082e2df947fda1e760b5a4fc10a0" + } + ], + "synonyms": [ + "clamp" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "73595ed5587d4aacb975c3f0674961bb", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "73e62a443d0f46488055a595f92f9809", + "m_Id": 1, + "m_DisplayName": "X", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "X", + "m_StageCapability": 3, + "m_Value": 0.25, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "741ca17a7fa54a4aba2b338e42afbcef", + "m_Title": "TODO", + "m_Content": "Another empirically determined value, tested against different sample models...", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": -2317.0, + "y": 1181.0, + "width": 200.0, + "height": 160.0 + }, + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7469b59cafd741a68dd83cf2eb8b3f4b", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "746aab84a778449da4525f1d4c819ec7", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "74f230d072d44be694f768997578c434", + "m_Id": 0, + "m_DisplayName": "", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "7502a9caa98e45729c5647277396dbf5", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "75219a095c6d49a99ef383e4d4710281", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7582f079745745b9ae774f979b507822", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "7594756c6c0646608f479d09e217198f", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "759c527e9c344f7a95d77bbc7ed03237", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 895.9998779296875, + "y": -702.9999389648438, + "width": 130.0001220703125, + "height": 118.00006103515625 + } + }, + "m_Slots": [ + { + "m_Id": "3ae5a9539a1a41dea40a61cd2e6dde6e" + }, + { + "m_Id": "5a7f05fcf70e484d97982030a390cb3e" + }, + { + "m_Id": "82a4cf80ced24dab9e710bc42acaf689" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "75c93adcbeb6416eb3e773e44d900d4b", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 1.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "75e8d24724bd456e919aa87268c591df", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "760282c93700475d93b783b72005f9f6", + "m_Title": "Iridescence", + "m_Position": { + "x": -736.0, + "y": -1895.9998779296875 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "76520b7680d54ea7a3c2403da786ac5f", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 992.9999389648438, + "y": -1516.0, + "width": 125.99993896484375, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "48eac560f7a6421e9903059e33662055" + }, + { + "m_Id": "df0d11b3d5474b678f83c2e36318c262" + }, + { + "m_Id": "2b0fc694fb3743c0b9cc31c21bba5714" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "7655f9ea6a4d4b42bc8b1fdac118dcce", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "765c7dcbc3194092a0b6d17d3b0cc191", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7666c8d311ce42aeb7f67d1bf144b414", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7703801ed1ce4ac38240b01b97a89d59", + "m_Id": 0, + "m_DisplayName": "Coat Mask", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "CoatMask", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "771f758c8e0a4c748ab647b72a32c4a7", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -883.000244140625, + "y": 2623.000244140625, + "width": 133.00006103515626, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "0ba1ce8088b04d97a412bc5a934a6921" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "dfd1443566c54067a2abb81aaa116653" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalizeNode", + "m_ObjectId": "77fa18f03d944a35b1e7817552c8dd4a", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Normalize", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1232.0001220703125, + "y": -139.99996948242188, + "width": 132.0, + "height": 94.00001525878906 + } + }, + "m_Slots": [ + { + "m_Id": "d8b1a8ce81bc4f338fcee6de7ff97897" + }, + { + "m_Id": "089c287022154caab52b6f24775cd9d5" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "78d659d364a24b7ba6879080658e4ac7", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "792f7431361a41c3a492a3061eb0f246", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7940a2c35a6f451fbb1c7b9a1e6ee3c3", + "m_Id": -725852216, + "m_DisplayName": "Rotation", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Rotation", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "79cad36a2c4f4ef7b7b192caa5beea63", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "7bb3ca3024ad410f8014cc5f609eb114", + "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": "1989f19083984f9482326d807005e07f" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "7c648c100c234e14ad1502e9bf0e2e08", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "WorkaroundTilingOffset (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 954.0, + "y": -67.99999237060547, + "width": 245.0, + "height": 350.00006103515627 + } + }, + "m_Slots": [ + { + "m_Id": "9d69ad9719b94d2cb7e7c773b59d7e72" + }, + { + "m_Id": "f0f65d29632141f79fc03b9d502add5c" + }, + { + "m_Id": "92c68511a2ae4d24ad5f5adc3675cb30" + }, + { + "m_Id": "b0e0dc83764e475e8efc230baf922896" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "WorkaroundTilingOffset", + "m_FunctionSource": "885a3662fbaba7c47979790356264411", + "m_FunctionBody": "#if UNITY_VERSION >= 202120\nTilingOffset = float4(1,1,0,0);\nTilingOffsetOther = Tex.scaleTranslate.xyzw;\n#else\nTilingOffset = LegacyST;\nTilingOffsetOther = LegacyST;\n#endif" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDUnlitData", + "m_ObjectId": "7c6ec251c77e49c4a4887cf647d1f80e", + "m_EnableShadowMatte": false, + "m_DistortionOnly": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "7cf4aa7f3d0843eb91ce7a7522346507", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1603.0, + "y": 107.00000762939453, + "width": 183.0, + "height": 250.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "d3ace4f56a2146498cb5f6666c229092" + }, + { + "m_Id": "932fe5c2122446f78caf3bf1978edefe" + }, + { + "m_Id": "57b9bcce4ef34a04afc1cd3f4e183dc9" + }, + { + "m_Id": "eea8638059c54621b1300ebf899c3659" + }, + { + "m_Id": "62618e344d6a43d1808eeed4e22ee21d" + }, + { + "m_Id": "9b2b33c6db3f4cbda844bef7cafb86e3" + }, + { + "m_Id": "2fda202634ff4882a800972055bdf4b4" + }, + { + "m_Id": "0931dd8172ef4f1db8b838afc383d8f0" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 1, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubGraphNode", + "m_ObjectId": "7cff04c6100a49b6b46466becdc0bc2e", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "TextureTransform", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1608.999755859375, + "y": 2105.0, + "width": 255.9998779296875, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "8d7a33d491af4b8a9d833fdd101f04f6" + }, + { + "m_Id": "fb3537da18fa458885a082198a3f8a8f" + }, + { + "m_Id": "6b41807fd9ec4ea3998966d6ad43532d" + }, + { + "m_Id": "a691d9b4045f414cb3cf5f4954e98c6f" + }, + { + "m_Id": "9c6d8f01e50a49769acea34edff42dc5" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"8ecb70019a63796448768b1124086ef5\",\n \"type\": 3\n }\n}", + "m_PropertyGuids": [ + "83a6556e-d78a-45f4-b8a2-13076ccdab77", + "0c456893-e07e-4608-8121-3220a4f6c3be", + "b3d81d39-5c6c-4c82-9d1f-36795cedd43c" + ], + "m_PropertyIds": [ + -1226117840, + -725852216, + -1162300524 + ], + "m_Dropdowns": [], + "m_DropdownSelectedEntries": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "7d0f12322640404fabc3a8d92d461290", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1592.9998779296875, + "y": -366.0, + "width": 183.0, + "height": 250.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "2896420937a94ab89b246fb3155919dc" + }, + { + "m_Id": "20b14d2ae2434cf38a81633609bf5f43" + }, + { + "m_Id": "06f5499a20744baaaaaf8a9d5cfdb5d9" + }, + { + "m_Id": "85ec0cef04ec49ee885d4a3f4b44efa9" + }, + { + "m_Id": "9e3aebb69ef04f038b0047212dee79aa" + }, + { + "m_Id": "edee52016d324d04b248f4f255882edb" + }, + { + "m_Id": "afc7970b28824f77bf1194792fc8fa04" + }, + { + "m_Id": "7fcb59f8468e4ca8b44fa2a6355eb44a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "7d1a86132c7e4142bc72cfe87dcc59b6", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget", + "m_ObjectId": "7d54abc6a7ee4cc6a41cc270bf43ae06", + "m_WorkflowMode": 1, + "m_NormalDropOffSpace": 0, + "m_ClearCoat": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "7d936c8d597d47068058b1f217a97848", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "7e1ec34d620c4cfdab4e87bb4d732943", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "7e5abe31e1414a91911f76fbf9030e2c", + "m_Guid": { + "m_GuidSerialized": "beb46b6b-8d2c-4b7e-a60d-24fc97c96263" + }, + "m_Name": "Occlusion Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Occlusion Map", + "m_DefaultReferenceName": "_Occlusion_Map", + "m_OverrideReferenceName": "occlusionTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": true, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "7e67cced55a64807a6feaeb890265768", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2043.0001220703125, + "y": 1150.0, + "width": 120.0, + "height": 149.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "b642383ab30a4f728987830028ba8631" + }, + { + "m_Id": "7469b59cafd741a68dd83cf2eb8b3f4b" + }, + { + "m_Id": "959b780135da40b5aa93a3adbb8f0e3c" + }, + { + "m_Id": "384aa946f7444341988f848a3c93d646" + }, + { + "m_Id": "d6632ead518946c9a75250a42948db28" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "7e862501058a45c9ad78e01eefa90605", + "m_Guid": { + "m_GuidSerialized": "9472ed92-8e71-43da-8db1-7313be8b1f40" + }, + "m_Name": "Enable Clearcoat", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Clearcoat", + "m_DefaultReferenceName": "_ENABLE_CLEARCOAT", + "m_OverrideReferenceName": "_CLEARCOAT_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 2, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "7ee5fe24f6f44ce6bfb3745d56aaf7e4", + "m_Id": 0, + "m_DisplayName": "Normal Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "7f3028a1768849919bc6d07042e472e1", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.VertexColorNode", + "m_ObjectId": "7f4c33107f064c7da4d5577b6541188d", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Vertex Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1282.000244140625, + "y": -39.999942779541019, + "width": 117.9996337890625, + "height": 93.99991607666016 + } + }, + "m_Slots": [ + { + "m_Id": "7e1ec34d620c4cfdab4e87bb4d732943" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "7f64bbc2d78d4fb199ef542b88ad80bb", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "7fcb59f8468e4ca8b44fa2a6355eb44a", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "7ffcf46e2d4c484d8296f6511a9c96d6", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2265.0, + "y": 2105.0, + "width": 222.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "33b1cd1ec949420c9e2a20d559161330" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "105a2c9d68ae4193ab40386151992454" + } +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "80069515911646338233075f20ccb366", + "m_Guid": { + "m_GuidSerialized": "208be461-109f-4dea-8a16-883af1eb10da" + }, + "m_Name": "Emissive", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Emissive", + "m_DefaultReferenceName": "_Emissive", + "m_OverrideReferenceName": "emissiveFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 0.0, + "g": 0.0, + "b": 0.0, + "a": 0.0 + }, + "isMainColor": false, + "m_ColorMode": 1 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "8047ad5c75004738994941835120ea73", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 535.9998168945313, + "y": -1719.0, + "width": 126.00018310546875, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "e429afe93157489aa90e469a9f25cc4e" + }, + { + "m_Id": "091394b326f2467186083da0c670f363" + }, + { + "m_Id": "19ba635ae6f84c5db5f7d3388cc81a0c" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "80793d67625149c2bd02e6569ae356ad", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "80999d8d0212495380df897d34ef682d", + "m_Id": 0, + "m_DisplayName": "Ambient Occlusion", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Occlusion", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ObjectNode", + "m_ObjectId": "809df95983ad4f6a9b642ce84a9e74a7", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Object", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1197.0001220703125, + "y": -26.99999237060547, + "width": 97.0, + "height": 101.00004577636719 + } + }, + "m_Slots": [ + { + "m_Id": "75e8d24724bd456e919aa87268c591df" + }, + { + "m_Id": "a0d0ad8e4fbe41f790330d57bf793124" + } + ], + "synonyms": [ + "position", + "scale" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "82833388b8084a96a48b982674499f0a", + "m_Id": 2, + "m_DisplayName": "ior", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "ior", + "m_StageCapability": 3, + "m_Value": 1.5, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "82a4cf80ced24dab9e710bc42acaf689", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "83d6e951e04a4db281ed0b7899e7f481", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "83e25615846341f88aaeac2226fe9fe7", + "m_Id": 3, + "m_DisplayName": "Z", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Z", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [ + "Z" + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "8423b5cfbdfc427fa8ca7b71bafd1227", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8425b86d08614804b2191796e4d8b823", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "842e4508cd6846c191df41b48e1e4624", + "m_Id": 1, + "m_DisplayName": "", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "84b3e8fddeff40c299ca38a8358ee503", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "84d55ba92e74430996e3472b42307dbe", + "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": "2be05efd171444038a2e4b7115af59e6" + } + ], + "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.GroupData", + "m_ObjectId": "84e0b5a2ae6a46a785e5f8a97117454f", + "m_Title": "Volume", + "m_Position": { + "x": -2443.0, + "y": -405.9999694824219 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "84e2db014c35493eb0bf3d5ef8777478", + "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": "ecde0983554943cd81a917127fad3655" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "851b64cc55064cc591c263711144feca", + "m_Guid": { + "m_GuidSerialized": "bb5d1f8d-d033-480f-b48e-bc5fd655a7d7" + }, + "m_Name": "Alpha Cutoff", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Alpha Cutoff", + "m_DefaultReferenceName": "_Alpha_Cutoff", + "m_OverrideReferenceName": "alphaCutoff", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.5, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "85a22e74dd8044e9b51c32fb182e3f1a", + "m_Id": 3, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "85b9b98e0f974e0a9bac2d650ca54568", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "85ec0cef04ec49ee885d4a3f4b44efa9", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "860451bbde6d43ccab5afa88d7bf27e3", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "8622eda33b9a4421b54673eee6f28857", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "86351816717b466c977fecf4d84eb6a2", + "m_Guid": { + "m_GuidSerialized": "29a3b28d-65b6-4f84-938e-3006058d602b" + }, + "m_Name": "Base Color", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Base Color", + "m_DefaultReferenceName": "_Base_Color", + "m_OverrideReferenceName": "baseColorFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 1.0 + }, + "isMainColor": false, + "m_ColorMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "86714225715947dd992fa9d9be01d513", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1202.0, + "y": -1350.0, + "width": 130.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "f877dd882881459c9b9d7cc67e249fe3" + }, + { + "m_Id": "14c36ee1905d45bea204fee0d7ad5b56" + }, + { + "m_Id": "69da7e2093d14bd582c3ea7e7f3be09d" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "8757abe351fc4351abd6115a14dba130", + "m_Group": { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1141.0001220703125, + "y": 1714.0001220703125, + "width": 143.99981689453126, + "height": 34.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "8ff6ff1f11de4a6295096bcc4f38a9b3" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "3c72208ecc9f4632b650d1c06ac9c4d2" + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "87b808f5412f4fc3a450ebecdf23d83e", + "m_Guid": { + "m_GuidSerialized": "3bd62a69-6f74-4b38-b815-22f0301e3448" + }, + "m_Name": "Enable Iridescence", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Iridescence", + "m_DefaultReferenceName": "_ENABLE_IRIDESCENCE", + "m_OverrideReferenceName": "_IRIDESCENCE_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 2, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "87e965ed28a34e348c8ab3c9e0287604", + "m_Title": "Doesn't seem to work in URP?", + "m_Content": "Not sure why SG has the Specular Color node...", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": 1417.0, + "y": 1743.0, + "width": 200.0, + "height": 160.0 + }, + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "87f49076b11a43f2bc2c05c9154c93d4", + "m_Guid": { + "m_GuidSerialized": "76031980-aa6c-44a5-ab6c-9b17352aab62" + }, + "m_Name": "Enable Specular", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Specular", + "m_DefaultReferenceName": "_ENABLE_SPECULAR", + "m_OverrideReferenceName": "_SPECULAR_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 2, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "887246a84e814042ba21984b7c5c1123", + "m_Id": 0, + "m_DisplayName": "Iridescence IOR", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "88d293953f5048d79b620a70693b4764", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "88f2199c2da1413db8e5facdfb4e87b6", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "8a0fadc477234cbe95efb02754f32e2d", + "m_Guid": { + "m_GuidSerialized": "07b3bc00-bf3a-4796-9231-7483d18d3ccf" + }, + "m_Name": "Normal Scale", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Normal Scale", + "m_DefaultReferenceName": "_Normal_Scale", + "m_OverrideReferenceName": "normalScale", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 1.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "8a2675ba63f74138bbef91565890f1d4", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "8acbbab8c4a24947ab8ac6205571c94a", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "8b08f9f87c4d417ea72f69104abe93df", + "m_Guid": { + "m_GuidSerialized": "5f842ae2-6d61-4225-a336-68360c9de206" + }, + "m_Name": "Specular Color Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Specular Color Map", + "m_DefaultReferenceName": "_Specular_Color_Map", + "m_OverrideReferenceName": "specularColorTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8be5a7ef65294aec8c30a70c6f79f2a0", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "8d7a33d491af4b8a9d833fdd101f04f6", + "m_Id": -1226117840, + "m_DisplayName": "Tiling/Offset", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Tiling_Offset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8df7078bc2fe4b6f83ab4f8336aedcd9", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8e42e5d757ae4d9e8fbcacfb9b205f12", + "m_Id": -1162300524, + "m_DisplayName": "UV Channel", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_UV_Channel", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "8e5b3b953d0944d784b2f73adaf55428", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "8e6414766bc746bb8d1741abe87343b7", + "m_Id": 1, + "m_DisplayName": "In Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "InMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 100.0, + "y": 380.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8ea578918f054289b89ef073ad29fade", + "m_Id": 2, + "m_DisplayName": "Y", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Y", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [ + "Y" + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "8f17eb0f05754354824d445078b4a261", + "m_Id": 1, + "m_DisplayName": "In Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "InMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 2.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDUnlitSubTarget", + "m_ObjectId": "8f7106cb155b403ea6a8022400235d95" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8f75a22252ee427181198b520a65e118", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8ff6ff1f11de4a6295096bcc4f38a9b3", + "m_Id": 0, + "m_DisplayName": "Transmission", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "90e0e7e9f75044ad959e408da384de44", + "m_Guid": { + "m_GuidSerialized": "0d93659e-0928-436e-9073-e756de46db7d" + }, + "m_Name": "Base Color Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Base Color Map", + "m_DefaultReferenceName": "_Base_Color_Map", + "m_OverrideReferenceName": "baseColorTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": true, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3Node", + "m_ObjectId": "9104f2d7ad4e471b8749ef629ed1088e", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Vector 3", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2244.000244140625, + "y": 552.0000610351563, + "width": 127.999755859375, + "height": 124.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "be1e2461293748debcf328040ee8512a" + }, + { + "m_Id": "8ea578918f054289b89ef073ad29fade" + }, + { + "m_Id": "83e25615846341f88aaeac2226fe9fe7" + }, + { + "m_Id": "dfbd446e99f747c4937503d7e0fe34d7" + } + ], + "synonyms": [ + "3", + "v3", + "vec3", + "float3" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "91933686a113451b885a437cae1ee455", + "m_Id": 2, + "m_DisplayName": "Out Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "OutMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "91ac88e441ea4086b40ddd4e5ed59c4b", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2542.000244140625, + "y": -436.9999694824219, + "width": 130.0, + "height": 142.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "f2e3248c81dc49a59dfcecdaf4fd1ef4" + }, + { + "m_Id": "62695fc5dc364bf785f684a561a3ddca" + }, + { + "m_Id": "5931680f7ccf49c4bb700855be684150" + }, + { + "m_Id": "bc66d3d86c1641a283ddef733ed703b1" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "91c58898c6bb409395192a9efe525485", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Metallic", + "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": "371e4a8bf3324d5795dbdcea706c56e5" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Metallic" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "91ff645bccd44043ba32ecd58fb27796", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BranchNode", + "m_ObjectId": "92a44c53f868404b9129d791d8f34404", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Branch", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1243.0, + "y": 139.00001525878907, + "width": 170.0, + "height": 141.99998474121095 + } + }, + "m_Slots": [ + { + "m_Id": "62e9d751103b4c5589e69eebf69bbf2a" + }, + { + "m_Id": "d531cc6d567f4911aff80a0b28d0fb91" + }, + { + "m_Id": "3a190e9fe175446388ce351f08beb58f" + }, + { + "m_Id": "7594756c6c0646608f479d09e217198f" + } + ], + "synonyms": [ + "switch", + "if", + "else" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "92c68511a2ae4d24ad5f5adc3675cb30", + "m_Id": 2, + "m_DisplayName": "TilingOffset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "TilingOffset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot", + "m_ObjectId": "930533d9deee4c08a24d6384302978e6", + "m_Id": 0, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [], + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "930a53d67a5848df90387a45b712875e", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9326d82c079e47969a6075f80620f92c", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "932fe5c2122446f78caf3bf1978edefe", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "934381759c5947709a33fde75e0c5595", + "m_Id": 1, + "m_DisplayName": "Transformed_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Transformed_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "93b4253497d147e8a714cf655533b4af", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1392.000244140625, + "y": 2057.0, + "width": 120.999755859375, + "height": 34.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "c7c71d4c826b43ecb2df4db31aa9a734" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "1a5d204b45a44b6bac695a4ee5fa47c8" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "9408a018d7914d50b1b5af63a7699f0e", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 965.9998779296875, + "y": -208.99993896484376, + "width": 145.0003662109375, + "height": 33.99998474121094 + } + }, + "m_Slots": [ + { + "m_Id": "052134b472814ed68c616629c4360ad9" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "cdce6996c9064903841175baee4ac9d8" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "954c85b2964d43ca90e1a13747a3eef1", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "959b780135da40b5aa93a3adbb8f0e3c", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "974a5648658142479dd293dbc303a122", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "97a9164682334255847706dd504c5296", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "97df40c83f5a4671a59db5b30b4c6316", + "m_Guid": { + "m_GuidSerialized": "0ed3a523-c978-4e5c-bc38-732b77ffc1b4" + }, + "m_Name": "Enable Vertex Colors", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Vertex Colors", + "m_DefaultReferenceName": "_ENABLE_VERTEX_COLORS", + "m_OverrideReferenceName": "_VERTEX_COLORS_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [], + "m_Value": 1, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "97e8a63e6ff046e687f550cc272c90d5", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 686.9998168945313, + "y": -1641.0, + "width": 126.00018310546875, + "height": 118.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "436c97ee0270458384ce4631bac29eb6" + }, + { + "m_Id": "9e8455a1501a461a913dd91250bec058" + }, + { + "m_Id": "3141c7e396c740b2a7bfd349dbf69ee7" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ViewDirectionMaterialSlot", + "m_ObjectId": "97ed6c1db4b94972a42fe1e7e24bcf68", + "m_Id": 1, + "m_DisplayName": "View Dir", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "ViewDir", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "988c622f16f64a9898a8f3b255c84e8c", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1641.9998779296875, + "y": 371.9999694824219, + "width": 144.0001220703125, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "b5a1f9e7bce24ea6a778aa022e0b7107" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "8a0fadc477234cbe95efb02754f32e2d" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "98c9d09d29c048779209e551e2bd6808", + "m_Id": 0, + "m_DisplayName": "Iridescence Thickness Max", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "98cbaa17fc8b45cf9f425f6652e5db9c", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "98fd1ba94a44499a815aa81bfbd5bf2a", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DivideNode", + "m_ObjectId": "9900fba29f7c4a8e9ef63caa3cdecb4a", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Divide", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1609.0001220703125, + "y": 1020.0001220703125, + "width": 126.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "0918c40cbbb440ad9c220aeeec8be904" + }, + { + "m_Id": "f11545dd31fe4aac903fb724b1049589" + }, + { + "m_Id": "7502a9caa98e45729c5647277396dbf5" + } + ], + "synonyms": [ + "division", + "divided by" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "994a231649e24cdea0a4267c363616c1", + "m_Id": 0, + "m_DisplayName": "", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9966b44de47f44c09134230701fc17cc", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "999b803d7ace4709a4dc31d05c9e0f25", + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "99ab49f5c8914bc99262c2b1a8b20b1b", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "9a3bb394d6ec4891a9cba4d5cde5a220", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9a7364cdc5f548baba58b40b62366c1b", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RedirectNodeData", + "m_ObjectId": "9a9e8eeb778a4deda769a91dfd275c3e", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Redirect Node", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1653.9998779296875, + "y": 2329.0, + "width": 56.0001220703125, + "height": 24.0 + } + }, + "m_Slots": [ + { + "m_Id": "c32a656d07b14f089f1b8965fc7ed042" + }, + { + "m_Id": "b77e6afcd4d64a83b177ef7c6b78f777" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9ae243c87a164179871b9ffb282cf23e", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "9b2840bea8984c22acc50b45cb5c235e", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 468.9999084472656, + "y": 15.00003719329834, + "width": 130.00003051757813, + "height": 118.0000228881836 + } + }, + "m_Slots": [ + { + "m_Id": "a37b07e47fe34bb3b6521c781e3f830e" + }, + { + "m_Id": "e84a89cc58204cc08b68f15cb6469644" + }, + { + "m_Id": "186af275bd5e4705b7452f33b7ac33c9" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "9b2b33c6db3f4cbda844bef7cafb86e3", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 3 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9b37501fa48e46a9ae606c9b1ede4351", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "9be492b061b948c8bf9969a7a476da96", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1589.9998779296875, + "y": 529.0, + "width": 183.0, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "4849b3a5f68e4bafa37b69999d921afd" + }, + { + "m_Id": "c8f995e72d4a413dbb97541db3b1364a" + }, + { + "m_Id": "e4aa16bda9ed403a963ea1a80fbab307" + }, + { + "m_Id": "7582f079745745b9ae774f979b507822" + }, + { + "m_Id": "547571dcbd2140a0bee62584e58884ae" + }, + { + "m_Id": "97a9164682334255847706dd504c5296" + }, + { + "m_Id": "41d7bbb28c084adea8a2c007184d3e38" + }, + { + "m_Id": "cc96868a5ddb41dfae176d045401b30b" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "9beb407b09134070954f2a6b5c1167e6", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RedirectNodeData", + "m_ObjectId": "9c03ea90ae63433ca68e8b90c41e67c2", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Redirect Node", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 810.9999389648438, + "y": -644.0, + "width": 56.00006103515625, + "height": 24.0 + } + }, + "m_Slots": [ + { + "m_Id": "74f230d072d44be694f768997578c434" + }, + { + "m_Id": "d8e4a4ec868740879213fefdf37bf122" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "9c6d8f01e50a49769acea34edff42dc5", + "m_Id": 2, + "m_DisplayName": "Original_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Original_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "9d69ad9719b94d2cb7e7c773b59d7e72", + "m_Id": 0, + "m_DisplayName": "Tex", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tex", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ClampNode", + "m_ObjectId": "9d897128ed844e848e23acd66dcf0292", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Clamp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1734.0001220703125, + "y": 122.00000762939453, + "width": 140.0, + "height": 142.00006103515626 + } + }, + "m_Slots": [ + { + "m_Id": "2b443f0dc6564eaeb251851c92c4a83e" + }, + { + "m_Id": "bc336f8e4192409e85e657104f83db20" + }, + { + "m_Id": "d6e04d1403174ba59a165a417fa580e7" + }, + { + "m_Id": "b96f07fd463e44b2944e864b9f46fcdd" + } + ], + "synonyms": [ + "limit" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "9d9ec1e41629462ea79ba5faac892a56", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "9de5cc84d505425f959636a84b9fb32e", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "9df7360a64294d7fb33e4bb464809bcc", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1633.0, + "y": 2057.0, + "width": 183.0001220703125, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "88f2199c2da1413db8e5facdfb4e87b6" + }, + { + "m_Id": "0d495fd34a134a8885f72fea88aaeec4" + }, + { + "m_Id": "8f75a22252ee427181198b520a65e118" + }, + { + "m_Id": "8be5a7ef65294aec8c30a70c6f79f2a0" + }, + { + "m_Id": "9beb407b09134070954f2a6b5c1167e6" + }, + { + "m_Id": "f165be76156d439db6d70dd0c0f8aeac" + }, + { + "m_Id": "27be125aeff84fe2a6e34aae2b187134" + }, + { + "m_Id": "b06cc11888ac405c9e37b3394fc4e7df" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "9e3aebb69ef04f038b0047212dee79aa", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9e8455a1501a461a913dd91250bec058", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "9e96b6147ee14bd987ad3b95a36dd54b", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ColorNode", + "m_ObjectId": "9ecb55f770a6449c8eaa8094328a5b01", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 391.0, + "y": 145.0, + "width": 207.99993896484376, + "height": 127.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "7d936c8d597d47068058b1f217a97848" + } + ], + "synonyms": [ + "rgba" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Color": { + "color": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 1.0 + }, + "mode": 0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SaturateNode", + "m_ObjectId": "9f2c61fddaff41df8764adeb9008f2fa", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Saturate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 831.9998779296875, + "y": -1446.0, + "width": 128.00006103515626, + "height": 94.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "2b965b0789be43df916141ecf106ead7" + }, + { + "m_Id": "16128b0e399944f593436a891d7c4268" + } + ], + "synonyms": [ + "clamp" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "9f3aec08fb344aff8341297b4a7afcc1", + "m_Id": 1, + "m_DisplayName": "True", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "True", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "9f8ecc63ebc14541be764f25143dfc6b", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "a0d0ad8e4fbe41f790330d57bf793124", + "m_Id": 1, + "m_DisplayName": "Scale", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Scale", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "a0f839c542124faea4358fe4a8083771", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1440.000244140625, + "y": -81.99996185302735, + "width": 129.9998779296875, + "height": 118.00001525878906 + } + }, + "m_Slots": [ + { + "m_Id": "53e6e4fd5b7040cc8ca17980f41e3df4" + }, + { + "m_Id": "cf88e70b5d9849329c0adf3c779fd376" + }, + { + "m_Id": "be355e8ec4254b67ae45656d90d28beb" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ColorNode", + "m_ObjectId": "a1d1982804614a6897989321f580888e", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2039.0001220703125, + "y": 1844.0001220703125, + "width": 207.9998779296875, + "height": 127.0 + } + }, + "m_Slots": [ + { + "m_Id": "eb6c2f01ab604a8d8d7b5f3f6014cd60" + } + ], + "synonyms": [ + "rgba" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Color": { + "color": { + "r": 0.501960813999176, + "g": 0.501960813999176, + "b": 0.501960813999176, + "a": 1.0 + }, + "mode": 0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "a1dbcb7196b24ad58a8c4d5df27b9857", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "a267acde60024329b4e0936179de7717", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -875.000244140625, + "y": 2419.000244140625, + "width": 116.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "ca102540121f4ca08b644b0a4b57e591" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "2b0a026cebb0460a83c4e4d6e29e6e36" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "a2e5e4acd661494eace0ff5e08dd639d", + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "a2ef78d6824743a198815280b9909f75", + "m_Title": "Occlusion - Roughness - Metallic", + "m_Position": { + "x": -1460.9998779296875, + "y": 2000.000244140625 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubtractNode", + "m_ObjectId": "a31359da93cd43489c8a0ddc522c1e34", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Subtract", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -905.0003051757813, + "y": 2202.0, + "width": 126.00018310546875, + "height": 118.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "91ff645bccd44043ba32ecd58fb27796" + }, + { + "m_Id": "bb387fb4b90343dd90143b68aa0ff46e" + }, + { + "m_Id": "ec5e9c1cb4234532a591ae8350e54f6b" + } + ], + "synonyms": [ + "subtraction", + "remove", + "minus", + "take away" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "a31de1ea8ed447308eea30bd6fdac922", + "m_Guid": { + "m_GuidSerialized": "d2380b97-8e1a-45c1-b7dd-44313775399d" + }, + "m_Name": "Map UV", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Map UV", + "m_DefaultReferenceName": "_Map_UV", + "m_OverrideReferenceName": "baseColorTextureTexCoord", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 2, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "a348157c96404f4ea2f6ee572a33ad00", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "a355cb82f7304873aeec1b8ee5a7ea3c", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "a36398bcd51f42059d7ac89f9c7d9968", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "a37b07e47fe34bb3b6521c781e3f830e", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "a482fd18440e4922afab82f12dd388ad", + "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.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "a57f6047cc4e4232a376e5c19a09c7aa", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "a5c994c3937e4e72b2438108ca0aad92", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1641.9998779296875, + "y": 467.9999694824219, + "width": 123.000244140625, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "c06c0e4af2b94e46800d6f2a812dd535" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "80069515911646338233075f20ccb366" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "a6724ad4ae9e48d69a2d176e04851177", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "a691d9b4045f414cb3cf5f4954e98c6f", + "m_Id": 1, + "m_DisplayName": "Transformed_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Transformed_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "a713df93e6de4d2a8f9e725c6608431d", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "a7ada2aa2ece41108c144d2baa843400", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 1.0, + "e01": 1.0, + "e02": 1.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "a7c7c5e2c93045f9a142370141145621", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 916.9998168945313, + "y": -919.9999389648438, + "width": 126.00018310546875, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "d830bc88218e4b8aaa7492cec861f836" + }, + { + "m_Id": "bd174da5dda14614a244c9dee539fe7c" + }, + { + "m_Id": "c671902eeb2f4dfc8b004fe67f11f99e" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "a84bc040b0ab456e92b7dfd5d9a636a4", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Refract (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1476.0001220703125, + "y": -139.99996948242188, + "width": 201.0, + "height": 141.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "3022d91828194f10a5b0b6cbaa4eeb86" + }, + { + "m_Id": "d011b5d7d90a4a38a5e759e5e8aa69cd" + }, + { + "m_Id": "82833388b8084a96a48b982674499f0a" + }, + { + "m_Id": "de15cbb7c7504d0e833542b0c7787aae" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "Refract", + "m_FunctionSource": "885a3662fbaba7c47979790356264411", + "m_FunctionBody": "refractionVector = refract( - v, normalize( n ), 1 / ior );" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "a88f553fcc0246a2bc8a573e921ce351", + "m_Guid": { + "m_GuidSerialized": "ac1077ea-fcbf-4d39-a008-35c1954bff7b" + }, + "m_Name": "Iridescence Thickness Min", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Iridescence Thickness Min", + "m_DefaultReferenceName": "_Iridescence_Thickness_Min", + "m_OverrideReferenceName": "iridescenceThicknessMinimum", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 100.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "a8c88eada3b147bb99a0e6d8c31b4d32", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "a8f71db37bcf409dafa6c9b01bb96169", + "m_Group": { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -935.0003662109375, + "y": 1532.000244140625, + "width": 126.000244140625, + "height": 117.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "c7ed271715e047e0b2b5d2dd19399362" + }, + { + "m_Id": "5d89c1f5111447cc976117bf944fa2f3" + }, + { + "m_Id": "a355cb82f7304873aeec1b8ee5a7ea3c" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "a8ffdecf1edb4fbaa321c4099d17ea2e", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1856.0001220703125, + "y": 2032.0, + "width": 125.9998779296875, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "503eff2ab474419ab3e996e64e411b69" + }, + { + "m_Id": "bac8c4c2f8f84fa89e5d93dd4a38e134" + }, + { + "m_Id": "ef5def74039c401eb01dc879236239f3" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "a9e9943b5fc64ce892285c678459565d", + "m_Id": 1, + "m_DisplayName": "uv", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "uv", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "aa2e642ca1cc4cb1b48566ecb6dc4a0f", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "aa737ed29b1b48c9835f8beff57a8aec", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "aaa0a3a6b1f24183a1ad486843ee5d76", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "ae4d01f59f0b4282a27f160d6cadb664", + "m_Id": 0, + "m_DisplayName": "Emissive Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ae993503b9444c58869120f95f7394d5", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "af3117c8564c4293acd58e3b5cbf06cf", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "afc7970b28824f77bf1194792fc8fa04", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "b06cc11888ac405c9e37b3394fc4e7df", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "b0e0dc83764e475e8efc230baf922896", + "m_Id": 3, + "m_DisplayName": "TilingOffsetOther", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "TilingOffsetOther", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.TransformNode", + "m_ObjectId": "b133d79ba4bc41af8ed5110288bf16ff", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Transform", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -516.0001220703125, + "y": -170.99996948242188, + "width": 212.00006103515626, + "height": 157.00001525878907 + } + }, + "m_Slots": [ + { + "m_Id": "540fbe60da724a25863c84a28a7b19de" + }, + { + "m_Id": "59b8a05662ac4fc6aeb5b1647d80080a" + } + ], + "synonyms": [ + "world", + "tangent", + "object", + "view", + "screen", + "convert" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Conversion": { + "from": 2, + "to": 1 + }, + "m_ConversionType": 1 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "b1bf60579c8945c38bb11404fd2cbeaf", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "b1e0c67a17a641d8ae4b7bd056d70ab2", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "b39562c3120349b784d90f66734f0158", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -715.0001831054688, + "y": 2379.000244140625, + "width": 125.99993896484375, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "d3380b47b0fa4f5c873ddeb91f42d7ec" + }, + { + "m_Id": "9326d82c079e47969a6075f80620f92c" + }, + { + "m_Id": "8a2675ba63f74138bbef91565890f1d4" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.BooleanShaderProperty", + "m_ObjectId": "b3bf6e9825a34fe5ab67bdb85f17df32", + "m_Guid": { + "m_GuidSerialized": "8afa82b2-e899-4d34-be69-8af563228705" + }, + "m_Name": "Enable Volume", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Volume", + "m_DefaultReferenceName": "_Enable_Volume", + "m_OverrideReferenceName": "_VOLUME_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "b43ee4b8c16349e1a608f0614dfa31d7", + "m_Id": 0, + "m_DisplayName": "Map Tiling/Offset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "b448a23f9f09460994f0296f1f58a2b0", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2029.0001220703125, + "y": 159.00006103515626, + "width": 128.0, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "23efdb16a1b54d0893e5663038644a17" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "62341c2af4b04863803ba8369da7ee0b" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b455ebafa50b46fd8e2abd989d6e5096", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b483df628a7f4bd6830039508e1b6acf", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "b4d8cf566d7d4d0d8a49901c25e25950", + "m_Guid": { + "m_GuidSerialized": "fcd3c8ab-344d-43dc-ae90-2103a7328a6b" + }, + "m_Name": "Thickness Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Thickness Map", + "m_DefaultReferenceName": "_Thickness_Map", + "m_OverrideReferenceName": "thicknessTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "b4fa69b8f0b34d6793eaf9af18109b4d", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b50bcf227c134f89bfeb2a7af963271a", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b579868c840049e2b2c511a4221fcfa2", + "m_Id": -1162300524, + "m_DisplayName": "UV Channel", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_UV_Channel", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b5a1f9e7bce24ea6a778aa022e0b7107", + "m_Id": 0, + "m_DisplayName": "Normal Scale", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "b5c8bada19314a1fb0433aebf7aa091d", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b5ce0ae9ec7e427cbf911d5c0e9e812e", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "b5fdfd81a2464e01916672bfcb723de8", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b612580ec76540688e6c548f7e50e022", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b642383ab30a4f728987830028ba8631", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "b6468f11990d4fc29393e12aac937398", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1456.0001220703125, + "y": 247.00006103515626, + "width": 126.0, + "height": 117.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "157938a58a294edf9235f315d02de558" + }, + { + "m_Id": "9a7364cdc5f548baba58b40b62366c1b" + }, + { + "m_Id": "7d1a86132c7e4142bc72cfe87dcc59b6" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "b653ce49eb2f4940b5a479a84816c6ea", + "m_Id": -1226117840, + "m_DisplayName": "Tiling/Offset", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Tiling_Offset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b77e6afcd4d64a83b177ef7c6b78f777", + "m_Id": 1, + "m_DisplayName": "", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b874136726cd40e8b6d2d98f625bab7e", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b91488151b004cd2aa2ba7923db0e152", + "m_Id": 0, + "m_DisplayName": "Alpha Cutoff", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ClampNode", + "m_ObjectId": "b95fc0c69dfd41f4b2aa0d3dd326f562", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Clamp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1796.0001220703125, + "y": 950.0001220703125, + "width": 140.0, + "height": 141.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "98fd1ba94a44499a815aa81bfbd5bf2a" + }, + { + "m_Id": "0c027a63f6ee4a1f8744a43d2893937f" + }, + { + "m_Id": "2f5958af84214a2a9295cb6bcdcdce59" + }, + { + "m_Id": "08ceaef13e204b93b4c2c05c8109c018" + } + ], + "synonyms": [ + "limit" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b96f07fd463e44b2944e864b9f46fcdd", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "b973ca0e4efb4dc2a0a905de3b1e5122", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2.0001471042633058, + "y": -1303.9998779296875, + "width": 125.99996948242188, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "b1e0c67a17a641d8ae4b7bd056d70ab2" + }, + { + "m_Id": "d5f8926116d24082be2201fc96d9ac18" + }, + { + "m_Id": "72d0cdcf81384bcf8ed160aaeaf9c35c" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b99e94611bed4ed58bcc7a9c30d2772e", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "ba192fda4be64270a8cd43eee10f2542", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.75, + "y": 2.0, + "z": 2.0, + "w": 2.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "ba7ecde994b4474184c1c30ed4439bb3", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Enable Iridescence", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2712.0, + "y": -365.9999694824219, + "width": 153.999755859375, + "height": 118.00001525878906 + } + }, + "m_Slots": [ + { + "m_Id": "f2653bc7dd67466c9e11297c68a24b7a" + }, + { + "m_Id": "4e455d381d794048bb64b988cef2e24a" + }, + { + "m_Id": "e4e6e2cdbc804c208a673e676f5a2325" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "87b808f5412f4fc3a450ebecdf23d83e" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "ba9a2ca04ce041e38e549ca34918e30c", + "m_Group": { + "m_Id": "52ad86c239f740608a41d0cf1d4aab20" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -577.0001220703125, + "y": 1579.0001220703125, + "width": 125.99990844726563, + "height": 142.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "506bf201fc4142d480a46dd5f44c5884" + }, + { + "m_Id": "cec626b6a3964a5bb306b54570ea55ec" + }, + { + "m_Id": "0013a756c5cc437a94860bae95387f34" + }, + { + "m_Id": "309b1a22566d417d9cd49277b012681d" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "bac8c4c2f8f84fa89e5d93dd4a38e134", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "bb387fb4b90343dd90143b68aa0ff46e", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ObjectNode", + "m_ObjectId": "bb7674282a934e3b9bfb057277071aa7", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Object", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2418.0, + "y": 991.0, + "width": 97.0, + "height": 101.0 + } + }, + "m_Slots": [ + { + "m_Id": "48b85ee5e3874844bda0d352d462e17c" + }, + { + "m_Id": "d594f01d8a2048b280bcbe5757a463fc" + } + ], + "synonyms": [ + "position", + "scale" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "bb92d309e7b14e66a0f3e9d918405957", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "bbcc7b25c5024b5a99a8d3635b345c9a", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "bc336f8e4192409e85e657104f83db20", + "m_Id": 1, + "m_DisplayName": "Min", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Min", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "bc40f37950614be8999aea81198fa25c", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "bc66d3d86c1641a283ddef733ed703b1", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SaturateNode", + "m_ObjectId": "bd06c49ec440472da7f53fde41efa972", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Saturate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -880.0, + "y": 620.0000610351563, + "width": 132.0, + "height": 94.0 + } + }, + "m_Slots": [ + { + "m_Id": "0cdfa53d80ba4f22858aedf3a1e41997" + }, + { + "m_Id": "e8ff565725d649b9bc011a4b07b28ab4" + } + ], + "synonyms": [ + "clamp" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "bd16ba2efda642b9a1a4840ef69cefba", + "m_Id": 2, + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "bd174da5dda14614a244c9dee539fe7c", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "bd9da3a1b4354ba1b5d286ce6a887c0d", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "be1e2461293748debcf328040ee8512a", + "m_Id": 1, + "m_DisplayName": "X", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "X", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "be355e8ec4254b67ae45656d90d28beb", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "be820519ca45495286894ed58168bb3f", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "bf6e751348af40b09ab1beefc3e198a3", + "m_Id": 0, + "m_DisplayName": "Iridescence Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RedirectNodeData", + "m_ObjectId": "bfbacbfd6c6949fdad622227b8cb79d5", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Redirect Node", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -29.999963760375978, + "y": 144.99998474121095, + "width": 56.000091552734378, + "height": 24.000015258789064 + } + }, + "m_Slots": [ + { + "m_Id": "994a231649e24cdea0a4267c363616c1" + }, + { + "m_Id": "3cd8d66635a942e290d51e6c8d1a7872" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData", + "m_ObjectId": "c01b5bb817134989a3ddb326b67996b3", + "m_NormalDropOffSpace": 0, + "m_BlendPreserveSpecular": true, + "m_ReceiveDecals": true, + "m_ReceiveSSR": true, + "m_ReceiveSSRTransparent": false, + "m_SpecularAA": false, + "m_SpecularOcclusionMode": 1, + "m_OverrideBakedGI": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "c05a67cff38b47e6a88db1388f2cfa69", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "c06c0e4af2b94e46800d6f2a812dd535", + "m_Id": 0, + "m_DisplayName": "Emissive", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c0b800a8b577453182963e3cc1fc7a12", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c118ae28deb94b2c9087cd33707ee34b", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "c1f6d9e695904fea9b3abdc1e683f2c8", + "m_Title": "Base Color + Normal + Emission", + "m_Position": { + "x": 918.000244140625, + "y": -424.9999084472656 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "c22bbf41264143e690d1c9eea357c483", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RemapNode", + "m_ObjectId": "c29b0cea9eb84998b2acfd23fd90641f", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Remap", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 155.9998321533203, + "y": -1790.0, + "width": 186.00010681152345, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "1c118ceca899417281996660dba51179" + }, + { + "m_Id": "8e6414766bc746bb8d1741abe87343b7" + }, + { + "m_Id": "cb685705c40042d6b8fae4f7d6dc201f" + }, + { + "m_Id": "58a85f0a5d444b0c878b97c684eb7676" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData", + "m_ObjectId": "c2bea0a6923d40e88c022e279ce22602", + "m_Distortion": false, + "m_DistortionMode": 0, + "m_DistortionDepthTest": true, + "m_AddPrecomputedVelocity": false, + "m_TransparentWritesMotionVec": false, + "m_AlphaToMask": false, + "m_DepthOffset": false, + "m_ConservativeDepthOffset": 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.Vector1MaterialSlot", + "m_ObjectId": "c323423d86c74e2e8dfddfbc8c11240b", + "m_Id": 2, + "m_DisplayName": "lod", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "lod", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c323a744d86d4d769d160712a9158dd2", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "c32a656d07b14f089f1b8965fc7ed042", + "m_Id": 0, + "m_DisplayName": "", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c3706552a81044a1878841e7774c04d3", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "c3cbdfdb3bf7447ca35d4c9edcecebcc", + "m_Id": 1, + "m_DisplayName": "In Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "InMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": -1.0, + "y": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "c4c0321734e54e6a933fc90e3ce39e4f", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -526.0001831054688, + "y": -1433.0, + "width": 216.00009155273438, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "98c9d09d29c048779209e551e2bd6808" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "0ba2ac3a5b6a4aa8add2b7bfa647a320" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.LerpNode", + "m_ObjectId": "c586ec91ca9043a99c6359e8137eea8f", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Lerp", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1418.0001220703125, + "y": 747.0000610351563, + "width": 130.0, + "height": 142.00006103515626 + } + }, + "m_Slots": [ + { + "m_Id": "485418fad1b24848b06ea90dc61e428c" + }, + { + "m_Id": "0904160ed2aa4a2c89fcf793b0a0b80c" + }, + { + "m_Id": "85b9b98e0f974e0a9bac2d650ca54568" + }, + { + "m_Id": "9de5cc84d505425f959636a84b9fb32e" + } + ], + "synonyms": [ + "mix", + "blend", + "linear interpolate" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "c5bd9f7925ac49c8913a839e2c3077a7", + "m_Guid": { + "m_GuidSerialized": "2fcbe861-1a11-491e-81e6-4d05dbdbc659" + }, + "m_Name": "Clearcoat Roughness", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Clearcoat Roughness", + "m_DefaultReferenceName": "_Clearcoat_Roughness", + "m_OverrideReferenceName": "clearcoatRoughnessFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c5e0d784d1404e4d9786ffd3188e5c6b", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "c607f6a6bc884e7eb0be0be94eb1f485", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Enable Specular", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2464.000244140625, + "y": 1726.0001220703125, + "width": 138.999755859375, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "9d9ec1e41629462ea79ba5faac892a56" + }, + { + "m_Id": "16d9d5e8056544c480d8706a27f3408d" + }, + { + "m_Id": "df5cd3a418df4cc297d9eb5987a7cd94" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "87f49076b11a43f2bc2c05c9154c93d4" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.StickyNoteData", + "m_ObjectId": "c60ef5f687f04a1f9bc0bab1ac390d44", + "m_Title": "TODO", + "m_Content": "At some point we want to support specifying all texture STs anyways, but that requires support in three.js as well, otherwise it's pretty confusing.", + "m_TextSize": 0, + "m_Theme": 0, + "m_Position": { + "serializedVersion": "2", + "x": 1170.0, + "y": -385.0, + "width": 200.0, + "height": 160.0 + }, + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RemapNode", + "m_ObjectId": "c610a3df043749feab182161248812e2", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Remap", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 155.9998321533203, + "y": -1641.0, + "width": 186.00010681152345, + "height": 142.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "2c79750601184e18985cd440c80897ae" + }, + { + "m_Id": "cd1e3d729eef44e2a0ba226ad84080d5" + }, + { + "m_Id": "91933686a113451b885a437cae1ee455" + }, + { + "m_Id": "a1dbcb7196b24ad58a8c4d5df27b9857" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "c63eb0c45cd446faafe694bb84a8a9d3", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1282.000244140625, + "y": -101.99993896484375, + "width": 133.9996337890625, + "height": 33.99998474121094 + } + }, + "m_Slots": [ + { + "m_Id": "3f4ae4edfaa34f4c8531bd854abd844a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "86351816717b466c977fecf4d84eb6a2" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c671902eeb2f4dfc8b004fe67f11f99e", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c77833c1b72b4333b74989301fd1dabf", + "m_Id": 1, + "m_DisplayName": "X", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "X", + "m_StageCapability": 3, + "m_Value": 1.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c78fbc91f53e4c20ac98cc737d0e4976", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c7c71d4c826b43ecb2df4db31aa9a734", + "m_Id": 0, + "m_DisplayName": "Specular", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c7ed271715e047e0b2b5d2dd19399362", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RemapNode", + "m_ObjectId": "c803ee7f88a642ffbed90a2fd404725d", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Remap", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 155.9998321533203, + "y": -1492.0, + "width": 186.00010681152345, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "6a90c03346f74863b69dbf16495a3dd5" + }, + { + "m_Id": "6d75cac715d1458fa26ab6c2ccd852dd" + }, + { + "m_Id": "fe1a6bec3d65460d870dc16698549e49" + }, + { + "m_Id": "08508de7d4e94721a9b57624e0465c79" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "c86c6b544c324d2a8d95e0f1dfd9b04d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BentNormal", + "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": "1f0278f5e89c42f09d2980d99158f6d8" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BentNormal" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "c87d0fdf8b4148e395babe82e14c2b23", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "c88524ed5e284fd9bb3bac7dfb3d45b0", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c8f995e72d4a413dbb97541db3b1364a", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "c933cc851230433082c21bc81c69c766", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "c93e4b88b9c84eab8a5110a07a6abdb6", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c9ac78df51124cd0b8a2d98de9490d35", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ca102540121f4ca08b644b0a4b57e591", + "m_Id": 0, + "m_DisplayName": "Metallic", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ca1885fb0716432896b8315c89080433", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "ca225faed728415d9517bb9e4a48c033", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 2.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RemapNode", + "m_ObjectId": "ca921050c00748e698611b527784ba96", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Remap", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 616.9998779296875, + "y": -1446.0, + "width": 186.00006103515626, + "height": 142.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "634a1285adea4cb7817514fae82f8b4f" + }, + { + "m_Id": "8f17eb0f05754354824d445078b4a261" + }, + { + "m_Id": "53cfede5b4934d888883d61e9e49c628" + }, + { + "m_Id": "1ec9000d27f6401e9f8c6c476ac034ab" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "caacc7bfacaa462cb79b1ca76d8eb93c", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -526.0001831054688, + "y": -1466.9998779296875, + "width": 213.0, + "height": 33.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "d78fe57b6aaa47af9f63d5d7de97e232" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "a88f553fcc0246a2bc8a573e921ce351" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "cb66babc65414b46b1a10ba32a89a0d1", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2067.0, + "y": 291.00006103515627, + "width": 182.9998779296875, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "9e96b6147ee14bd987ad3b95a36dd54b" + }, + { + "m_Id": "be820519ca45495286894ed58168bb3f" + }, + { + "m_Id": "a36398bcd51f42059d7ac89f9c7d9968" + }, + { + "m_Id": "bb92d309e7b14e66a0f3e9d918405957" + }, + { + "m_Id": "792f7431361a41c3a492a3061eb0f246" + }, + { + "m_Id": "dc91e6d79a5041bcba630f8e0f4469b8" + }, + { + "m_Id": "54272dba60bb489b8c64b04e510560cc" + }, + { + "m_Id": "516df774111e40bea29ef1f9f567f13c" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "cb685705c40042d6b8fae4f7d6dc201f", + "m_Id": 2, + "m_DisplayName": "Out Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "OutMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.AddNode", + "m_ObjectId": "cc2850d6d22e4a27a1bfbab840ba8ee2", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Add", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -595.0003051757813, + "y": 2059.0, + "width": 126.00018310546875, + "height": 118.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "dbd4fbf35c274449af3e55605e2be983" + }, + { + "m_Id": "3ab0e1c0910a4589a2f567ca5702e122" + }, + { + "m_Id": "c93e4b88b9c84eab8a5110a07a6abdb6" + } + ], + "synonyms": [ + "addition", + "sum", + "plus" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "cc96868a5ddb41dfae176d045401b30b", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "ccff5dbcc0c0429a8411f01d1ed6df75", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "cd1e3d729eef44e2a0ba226ad84080d5", + "m_Id": 1, + "m_DisplayName": "In Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "InMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 380.0, + "y": 750.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "cd30fe948eb24cfe871b8fdea40a16f9", + "m_Title": "Clearcoat", + "m_Position": { + "x": 1416.9998779296875, + "y": 810.000244140625 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "cd561be7e62240d38868b7451e936e0d", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -954.0003662109375, + "y": 2143.0, + "width": 175.000244140625, + "height": 34.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "1c85cc7a118048f08e2c25657db45472" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "1bd126bc26d14fa9b0bd88cffc73922b" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "cd7f2005366b49b49d812fc510316f20", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "cdce6996c9064903841175baee4ac9d8", + "m_Guid": { + "m_GuidSerialized": "21264b96-4ab0-4b81-9342-9b4c470cf357" + }, + "m_Name": "Map Rotation", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Map Rotation", + "m_DefaultReferenceName": "_Map_Rotation", + "m_OverrideReferenceName": "baseColorTextureRotation", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "cec626b6a3964a5bb306b54570ea55ec", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SaturateNode", + "m_ObjectId": "cedd32ee0b4a419c939d17bacfb00ddd", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Saturate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 372.9999084472656, + "y": -1492.0, + "width": 128.00003051757813, + "height": 94.0 + } + }, + "m_Slots": [ + { + "m_Id": "8622eda33b9a4421b54673eee6f28857" + }, + { + "m_Id": "1abd847191e84fa496a6007bd82bce71" + } + ], + "synonyms": [ + "clamp" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubGraphNode", + "m_ObjectId": "cedfea913c474bd2bb71209c662e46b5", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "TextureTransform", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1272.0, + "y": -262.0, + "width": 256.0, + "height": 142.0 + } + }, + "m_Slots": [ + { + "m_Id": "b653ce49eb2f4940b5a479a84816c6ea" + }, + { + "m_Id": "5ca8bbeec7774b4fb0301196692f327f" + }, + { + "m_Id": "b579868c840049e2b2c511a4221fcfa2" + }, + { + "m_Id": "934381759c5947709a33fde75e0c5595" + }, + { + "m_Id": "fa713a0965784318898f7198633adc19" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"8ecb70019a63796448768b1124086ef5\",\n \"type\": 3\n }\n}", + "m_PropertyGuids": [ + "83a6556e-d78a-45f4-b8a2-13076ccdab77", + "0c456893-e07e-4608-8121-3220a4f6c3be", + "b3d81d39-5c6c-4c82-9d1f-36795cedd43c" + ], + "m_PropertyIds": [ + -1226117840, + -725852216, + -1162300524 + ], + "m_Dropdowns": [], + "m_DropdownSelectedEntries": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "cf3f322e39934fdbaa66e219748a2b1b", + "m_Id": 0, + "m_DisplayName": "wavelength", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "wavelength", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "cf88e70b5d9849329c0adf3c779fd376", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "cfe6ffa13ac44ec4adfc8ed3f865384c", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1485.0, + "y": 139.00001525878907, + "width": 155.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "2281665015fe4c11919ecd881ab1983a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "b3bf6e9825a34fe5ab67bdb85f17df32" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "d011b5d7d90a4a38a5e759e5e8aa69cd", + "m_Id": 1, + "m_DisplayName": "n", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "n", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "d0fed3c5fc0f40768ab7ac9ec518b18d", + "m_Guid": { + "m_GuidSerialized": "65ecefec-a04a-441f-b091-869990519e45" + }, + "m_Name": "Attenuation Color", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Attenuation Color", + "m_DefaultReferenceName": "_Attenuation_Color", + "m_OverrideReferenceName": "attenuationColor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 0.0 + }, + "isMainColor": false, + "m_ColorMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d1e3d0be67f14b4f958e895bf25c597d", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "d1ea4f0250a34d99863ee930d384b759", + "m_ActiveSubTarget": { + "m_Id": "7d54abc6a7ee4cc6a41cc270bf43ae06" + }, + "m_AllowMaterialOverride": true, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": true, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_CustomEditorGUI": "UnityGLTF.PBRGraphUniversalGUI", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d2335d7b864d436dad76102ef56d2f08", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "d24df57c38d047819986b997b0c4045c", + "m_Id": 0, + "m_DisplayName": "Specular Color Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d2e54a101690459cb6f817a1835e8560", + "m_Id": 2, + "m_DisplayName": "T", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "T", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "d2f2eacbae84474bae0bdb99abc6a0e6", + "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.DynamicValueMaterialSlot", + "m_ObjectId": "d3380b47b0fa4f5c873ddeb91f42d7ec", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "d33a9109fde648d3b070274381ab59db", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2162.0, + "y": 985.9999389648438, + "width": 184.9998779296875, + "height": 34.00018310546875 + } + }, + "m_Slots": [ + { + "m_Id": "3ebd437ef6e34d89802a54c5ed7590db" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "492d5d149f4c4a7ca0c26f791e6704e6" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "d37bee9cd4134c5ca141c7f949fc58a6", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -485.0001220703125, + "y": -1798.9998779296875, + "width": 136.00003051757813, + "height": 33.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "539b06cf9457481282d249d654eb8740" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "58d29ed6f30d4885996b1c2b1d967e6b" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d38f08916af4479ba71a15c0a309c43d", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "d3ace4f56a2146498cb5f6666c229092", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "d4286b4dc1df42dc979af37ce8aef9ca", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -295.0001220703125, + "y": -1007.9999389648438, + "width": 125.99996948242188, + "height": 117.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "40800dab9a0943108e25b3afdfbea00a" + }, + { + "m_Id": "c88524ed5e284fd9bb3bac7dfb3d45b0" + }, + { + "m_Id": "c3706552a81044a1878841e7774c04d3" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "d439e7ac4eed401ab19a5db9740d11dd", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d48ccf4b057d459ea93e84d0e6d43e43", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "d4bf44ad812142cf81dd4619dbce963f", + "m_Guid": { + "m_GuidSerialized": "341250d9-85fe-493a-8ed1-8fa3549f914c" + }, + "m_Name": "Occlusion Map Rotation", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Occlusion Map Rotation", + "m_DefaultReferenceName": "_Occlusion_Map_Rotation", + "m_OverrideReferenceName": "occlusionTextureRotation", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "d4fb0b6904a34956a14ccb954a3cf564", + "m_Id": 0, + "m_DisplayName": "Normal (Tangent Space)", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "NormalTS", + "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_Space": 3 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ColorNode", + "m_ObjectId": "d4ff3f6694b74efeafa02a530afce2cb", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1738.0001220703125, + "y": 620.0000610351563, + "width": 208.0, + "height": 127.0 + } + }, + "m_Slots": [ + { + "m_Id": "b5c8bada19314a1fb0433aebf7aa091d" + } + ], + "synonyms": [ + "rgba" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Color": { + "color": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 0.0 + }, + "mode": 0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d531cc6d567f4911aff80a0b28d0fb91", + "m_Id": 1, + "m_DisplayName": "True", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "True", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "d594f01d8a2048b280bcbe5757a463fc", + "m_Id": 1, + "m_DisplayName": "Scale", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Scale", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "d5f8926116d24082be2201fc96d9ac18", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.004999999888241291, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d62362e7b1db41b5b2850ca4f7727193", + "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": "a482fd18440e4922afab82f12dd388ad" + } + ], + "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.DynamicValueMaterialSlot", + "m_ObjectId": "d65c7f3ce06c46209d297e6f47331440", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d6632ead518946c9a75250a42948db28", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "d6bc16c340e9496cb653d57ae3dc4bc8", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1423.0, + "y": 125.00003051757813, + "width": 147.0001220703125, + "height": 33.99998474121094 + } + }, + "m_Slots": [ + { + "m_Id": "7ee5fe24f6f44ce6bfb3745d56aaf7e4" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "3ce6d25358cc421582e9a91b41d39fdf" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d6e04d1403174ba59a165a417fa580e7", + "m_Id": 2, + "m_DisplayName": "Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Max", + "m_StageCapability": 3, + "m_Value": { + "x": 100000.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d78fe57b6aaa47af9f63d5d7de97e232", + "m_Id": 0, + "m_DisplayName": "Iridescence Thickness Min", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "d7bd8c290807474e92e099e90263d28c", + "m_Id": 2, + "m_DisplayName": "Original_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Original_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "d7de083c00574d7ea0b9e8975d5884a2", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1341.000244140625, + "y": 543.9999389648438, + "width": 155.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "ae4d01f59f0b4282a27f160d6cadb664" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "0ca6948bbb5d4e47ad215994019d2c5c" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "d830bc88218e4b8aaa7492cec861f836", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d87019dd0da84e03b03fc2582ccc036c", + "m_Id": 0, + "m_DisplayName": "Index of Refraction", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "d8b1a8ce81bc4f338fcee6de7ff97897", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "d8e4a4ec868740879213fefdf37bf122", + "m_Id": 1, + "m_DisplayName": "", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d9ae07569f7b48debc16effc8d24fd71", + "m_Id": 0, + "m_DisplayName": "Clearcoat", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PowerNode", + "m_ObjectId": "db3ecb1c0e884596b20f467abfe7a56f", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Power", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -367.0000915527344, + "y": 2.0000009536743166, + "width": 126.00007629394531, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "5b68c11c07d547ed9dcfaac2cc046c44" + }, + { + "m_Id": "ba192fda4be64270a8cd43eee10f2542" + }, + { + "m_Id": "0f51b843930a4f59bfa3a1b833a7a1c1" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "dbd4fbf35c274449af3e55605e2be983", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "dbf32d2b6dbf4d619266bf52e18df460", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1824.9996337890625, + "y": 2223.0, + "width": 170.9998779296875, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "fbec003798024db4a852c31854ab5787" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "5004252d15d04c2ea74cd947ee1f3b4f" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInLitSubTarget", + "m_ObjectId": "dbfb5df95252469d938040e1ba4d8f60", + "m_WorkflowMode": 1, + "m_NormalDropOffSpace": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "dc0acde1526a451182f632f96ca2646d", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "dc91e6d79a5041bcba630f8e0f4469b8", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "dcf55ee7a8a14405a1a6103001d64e2f", + "m_Id": 0, + "m_DisplayName": "Iridescence Thickness Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "de15cbb7c7504d0e833542b0c7787aae", + "m_Id": 3, + "m_DisplayName": "refractionVector", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "refractionVector", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInTarget", + "m_ObjectId": "de2d39e22ef549f58ed7b2a1f989a770", + "m_ActiveSubTarget": { + "m_Id": "dbfb5df95252469d938040e1ba4d8f60" + }, + "m_AllowMaterialOverride": true, + "m_SurfaceType": 0, + "m_ZWriteControl": 0, + "m_ZTestMode": 4, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CustomEditorGUI": "UnityGLTF.PBRGraphGUI" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "de53a1b0c5fd4b3f8e3c6dfac8fb7c06", + "m_Id": 0, + "m_DisplayName": "Tex", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tex", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "df0d11b3d5474b678f83c2e36318c262", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "df4ccb6d2f8546a1bdbc71c6c1056889", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -756.000244140625, + "y": 2143.0, + "width": 125.99993896484375, + "height": 118.000244140625 + } + }, + "m_Slots": [ + { + "m_Id": "015d9ea60aeb4c768b0337edce093524" + }, + { + "m_Id": "6082fea42d754443ae37cb0cecb9a02f" + }, + { + "m_Id": "e210aa52911f43f2a7974a916aa36358" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "df5cd3a418df4cc297d9eb5987a7cd94", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "df859d80fdd14c57a04ec5a5108850a4", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1852.000244140625, + "y": 2252.0, + "width": 129.999755859375, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "c5e0d784d1404e4d9786ffd3188e5c6b" + }, + { + "m_Id": "78d659d364a24b7ba6879080658e4ac7" + }, + { + "m_Id": "58fcef95064d43539481018c3b71e3e1" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SaturateNode", + "m_ObjectId": "df8c993165174790994c76c5dca0f8d9", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Saturate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 372.9999084472656, + "y": -1790.0, + "width": 128.00003051757813, + "height": 94.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "860451bbde6d43ccab5afa88d7bf27e3" + }, + { + "m_Id": "99ab49f5c8914bc99262c2b1a8b20b1b" + } + ], + "synonyms": [ + "clamp" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "dfa2b3edff80416fa8545965c3c47d3d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.CoatMask", + "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": "7703801ed1ce4ac38240b01b97a89d59" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.CoatMask" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "dfbd446e99f747c4937503d7e0fe34d7", + "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": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "dfd1443566c54067a2abb81aaa116653", + "m_Guid": { + "m_GuidSerialized": "ed71249e-8c11-4329-83ec-63add2072e72" + }, + "m_Name": "Roughness", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Roughness", + "m_DefaultReferenceName": "_Roughness", + "m_OverrideReferenceName": "roughnessFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "e0d099b286e74cdd8eef478c2ba6a46d", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Smoothness", + "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": "5d9c257d0755494d9de2f7be32aa020d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Smoothness" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "e11aaf40898d48b8917f9b63c07a2487", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "e12c5f6ea3ba4826bbd98bdadd9fdd60", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Occlusion", + "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": "80999d8d0212495380df897d34ef682d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Occlusion" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "e20db26f346a4bb099ddc66aeb89e2c9", + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "e210aa52911f43f2a7974a916aa36358", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e2923f4949d54387b5b24c430a889827", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2296.0, + "y": 331.0000305175781, + "width": 163.0, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "edcb87b3e54a42e2a9f7781e8ca4b537" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "b4d8cf566d7d4d0d8a49901c25e25950" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e29d4765172340899774cd4b6096c21e", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e2bb25c172f141fe8a8d5691791d1692", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "e3ae8cad9f8d4be8906c50ecd8601d5c", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "e429afe93157489aa90e469a9f25cc4e", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "e4aa16bda9ed403a963ea1a80fbab307", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "e4de574702ff4d609c5db42514c255ce", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e4e6e2cdbc804c208a673e676f5a2325", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "e5ee984eddac42b1bd84a7086c09cd78", + "m_Id": 1, + "m_DisplayName": "Saturation", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Saturation", + "m_StageCapability": 3, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "e72ba189d0084f4599f95f4eab7675e2", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "e8083d985ee345de96422aa7f416003c", + "m_Name": "KHR_materials_iridescence", + "m_ChildObjectList": [ + { + "m_Id": "87b808f5412f4fc3a450ebecdf23d83e" + }, + { + "m_Id": "58d29ed6f30d4885996b1c2b1d967e6b" + }, + { + "m_Id": "50998a16883841b483e4d4e9aa26ce91" + }, + { + "m_Id": "42d01612a467484494e13af04de1b143" + }, + { + "m_Id": "a88f553fcc0246a2bc8a573e921ce351" + }, + { + "m_Id": "0ba2ac3a5b6a4aa8add2b7bfa647a320" + }, + { + "m_Id": "6d2dcf695f684b3d85b3bdc6615713d3" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e83457a070b141b5b171a895bf0d6389", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1436.000244140625, + "y": 2436.000244140625, + "width": 213.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "65ab868df408437cafc09b4f8a7cd998" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "f22bfbc247554808a3b34bf10161a0ca" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "e84a89cc58204cc08b68f15cb6469644", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e85a349c4838415bb2bc248b71851b9e", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "e8ce99114fb74093bd17f882bd54ab1a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2099.000244140625, + "y": -412.9999694824219, + "width": 129.999755859375, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "129d3f0a44a042bdb79469ac71d7954e" + }, + { + "m_Id": "b4fa69b8f0b34d6793eaf9af18109b4d" + }, + { + "m_Id": "33246ca622234bb39f7877b44232c6fc" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e8d324bebd9f46c381e4e35fd38365a8", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1837.0001220703125, + "y": 811.0000610351563, + "width": 169.0, + "height": 33.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "29699c2a90c3455eaabef74da1f7bb75" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "d0fed3c5fc0f40768ab7ac9ec518b18d" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e8d3757d40534b0d9cfdd2b8b5a4cf83", + "m_Group": { + "m_Id": "a2ef78d6824743a198815280b9909f75" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -2204.0, + "y": 1946.9998779296875, + "width": 161.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "24e2f46f6c574f538800b38b4ba356e2" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "7e5abe31e1414a91911f76fbf9030e2c" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e8eeaf53ed7e44cf9b859265dbcceec8", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 943.0001220703125, + "y": -256.0, + "width": 168.0001220703125, + "height": 33.99998474121094 + } + }, + "m_Slots": [ + { + "m_Id": "b43ee4b8c16349e1a608f0614dfa31d7" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "2ef8958a8ad04fc48a4990966c393b9a" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "e8f9eb2ade9a48349179367ad11f0312", + "m_Id": 0, + "m_DisplayName": "Specular Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Specular", + "m_StageCapability": 2, + "m_Value": { + "x": 1.0, + "y": 0.0, + "z": 0.0 + }, + "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.DynamicVectorMaterialSlot", + "m_ObjectId": "e8ff565725d649b9bc011a4b07b28ab4", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e90b82a061ba4892aefecb61a281d723", + "m_Id": 0, + "m_DisplayName": "", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "e982cbfdd730435a8345775f11fe5a22", + "m_Id": 2, + "m_DisplayName": "TilingOffset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "TilingOffset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e9caa412a5a24764a8cc4c746f7edcdc", + "m_Id": 0, + "m_DisplayName": "", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "eb6c2f01ab604a8d8d7b5f3f6014cd60", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "eb913c79adc9470ebeaf8aa017b929c9", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "SampleSceneColor (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 58.0, + "y": -216.00001525878907, + "width": 263.0, + "height": 117.99999237060547 + } + }, + "m_Slots": [ + { + "m_Id": "a9e9943b5fc64ce892285c678459565d" + }, + { + "m_Id": "c323423d86c74e2e8dfddfbc8c11240b" + }, + { + "m_Id": "687e654c3f724ff986c6806df23ad6c7" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "SampleSceneColor", + "m_FunctionSource": "885a3662fbaba7c47979790356264411", + "m_FunctionBody": "color = SAMPLE_TEXTURE2D_X(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv)).rgb;" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "ebcb432791e545e3b5cdb618a6f98580", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "ec5e9c1cb4234532a591ae8350e54f6b", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDLitSubTarget", + "m_ObjectId": "ec903d4fe369487a99f1706f50daa8d5" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "ecb3cc7643b545c3b78349bdcae92f63", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -897.0000610351563, + "y": 116.0, + "width": 130.0, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "020c5dc5e3174c27b7073ade9f5c58ca" + }, + { + "m_Id": "75219a095c6d49a99ef383e4d4710281" + }, + { + "m_Id": "3a23356b624540d9b7a1590a8d2b102e" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ecde0983554943cd81a917127fad3655", + "m_Id": 0, + "m_DisplayName": "Alpha Clip Threshold", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "AlphaClipThreshold", + "m_StageCapability": 2, + "m_Value": 0.5, + "m_DefaultValue": 0.5, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "edcb87b3e54a42e2a9f7781e8ca4b537", + "m_Id": 0, + "m_DisplayName": "Thickness Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "edee52016d324d04b248f4f255882edb", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "ee3162b846874c188ae85f05e8ff57f5", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "eea8638059c54621b1300ebf899c3659", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "eef506e16f0d4e7fabba8e363f9f7b5b", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "ef5def74039c401eb01dc879236239f3", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "efad1b6a6a3f4570b83fb671df65e2dd", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "f04debede3c04da5aed9738b7794df17", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -416.9999694824219, + "y": -1342.0, + "width": 182.99977111816407, + "height": 251.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "03393b3bd7734b3fbfa803c2d160bccb" + }, + { + "m_Id": "80793d67625149c2bd02e6569ae356ad" + }, + { + "m_Id": "9f8ecc63ebc14541be764f25143dfc6b" + }, + { + "m_Id": "c9ac78df51124cd0b8a2d98de9490d35" + }, + { + "m_Id": "5832c178721b456596b0b98e27bf7edb" + }, + { + "m_Id": "44819891fa5e4f05b89905255e52a361" + }, + { + "m_Id": "5eff4b6a6c9b419c8eaa49bb7efccb1e" + }, + { + "m_Id": "0e4d2483a8b64fb7a756cb6a0f4419c4" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f06d1da8895d4d14a112cfd10a98f5b9", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "f0f65d29632141f79fc03b9d502add5c", + "m_Id": 1, + "m_DisplayName": "LegacyST", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "LegacyST", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f11545dd31fe4aac903fb724b1049589", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 2.0, + "y": 2.0, + "z": 2.0, + "w": 2.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "f165be76156d439db6d70dd0c0f8aeac", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "f18908317d754608806e71de985248b9", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "f22bfbc247554808a3b34bf10161a0ca", + "m_Guid": { + "m_GuidSerialized": "264aa6ca-59cb-453a-8986-c33ec5082256" + }, + "m_Name": "Roughness-Metallic Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Roughness-Metallic Map", + "m_DefaultReferenceName": "_Roughness_Metallic_Map", + "m_OverrideReferenceName": "metallicRoughnessTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f2653bc7dd67466c9e11297c68a24b7a", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "f28fc0029f4b4f5a86aec6dcf12e3235", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f2e3248c81dc49a59dfcecdaf4fd1ef4", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "f36b4e9d8dff4b5f88080db09748b890", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2099.0, + "y": 552.0000610351563, + "width": 120.000244140625, + "height": 148.99993896484376 + } + }, + "m_Slots": [ + { + "m_Id": "f44cdee701ac4e1ca2c6490c1b920d84" + }, + { + "m_Id": "0d9e08b324f540949fde247bf1d88329" + }, + { + "m_Id": "594b54dda80f484f85784c252143d680" + }, + { + "m_Id": "e4de574702ff4d609c5db42514c255ce" + }, + { + "m_Id": "c78fbc91f53e4c20ac98cc737d0e4976" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot", + "m_ObjectId": "f38b5f84784a44bba8b095f119f5b817", + "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": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "f3a31bd864f24872bf8c137be5fae97b", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f44cdee701ac4e1ca2c6490c1b920d84", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "f457d96fdf854621bcb3f3c9e069a416", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1633.0, + "y": 2355.0, + "width": 183.0001220703125, + "height": 251.0 + } + }, + "m_Slots": [ + { + "m_Id": "88d293953f5048d79b620a70693b4764" + }, + { + "m_Id": "11a6dfa971e2491b858e58a132539cbd" + }, + { + "m_Id": "21805134879849a892ae13b1af742efb" + }, + { + "m_Id": "8425b86d08614804b2191796e4d8b823" + }, + { + "m_Id": "4d3bb73e2b634b8b821eb74686beccd4" + }, + { + "m_Id": "2669daf3314b4ba38d4ba53a7c10490e" + }, + { + "m_Id": "6fc4bc9235584b14a6a30b611e70d7d8" + }, + { + "m_Id": "e11aaf40898d48b8917f9b63c07a2487" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "f4c239ca699c45978efc6a982f332c0f", + "m_Group": { + "m_Id": "760282c93700475d93b783b72005f9f6" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1094.9998779296875, + "y": -801.9999389648438, + "width": 130.0001220703125, + "height": 117.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "3413eb1f30734715b9b6fb7d98127f43" + }, + { + "m_Id": "614b5b4a067946ceaed9319789d80138" + }, + { + "m_Id": "6003b098c771400f96a76b0827b24a13" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f6374e2356694f79a2ae4649a524f463", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MaximumNode", + "m_ObjectId": "f83296f7700c4b0fa56a9338aa03745c", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Maximum", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1752.0001220703125, + "y": 1170.0, + "width": 126.0, + "height": 118.0001220703125 + } + }, + "m_Slots": [ + { + "m_Id": "a348157c96404f4ea2f6ee572a33ad00" + }, + { + "m_Id": "09a523a3cc884f78b5114f79c5d82f87" + }, + { + "m_Id": "3b013a1bf52b42fe8baee66c25bb2126" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "f877dd882881459c9b9d7cc67e249fe3", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f88c0608ebf34378b1b47854228e5c5f", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MaximumNode", + "m_ObjectId": "f952e2fe6b574b30b3434961f7285c33", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Maximum", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -1907.0001220703125, + "y": 1150.0, + "width": 126.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "b50bcf227c134f89bfeb2a7af963271a" + }, + { + "m_Id": "7655f9ea6a4d4b42bc8b1fdac118dcce" + }, + { + "m_Id": "d1e3d0be67f14b4f958e895bf25c597d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "f99c7d64d64e494f9fa89870d003303e", + "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": "d2f2eacbae84474bae0bdb99abc6a0e6" + } + ], + "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.PropertyNode", + "m_ObjectId": "fa5a99d79ecc4d7b88b9216911a4bf65", + "m_Group": { + "m_Id": "48ae037d1cdf40a79177e5e96ce6fb3d" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1408.000244140625, + "y": 2399.0, + "width": 179.9998779296875, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "d24df57c38d047819986b997b0c4045c" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "8b08f9f87c4d417ea72f69104abe93df" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "fa713a0965784318898f7198633adc19", + "m_Id": 2, + "m_DisplayName": "Original_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Original_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "fb3537da18fa458885a082198a3f8a8f", + "m_Id": -725852216, + "m_DisplayName": "Rotation", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Rotation", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "fbec003798024db4a852c31854ab5787", + "m_Id": 0, + "m_DisplayName": "Occlusion Map UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "fe1a6bec3d65460d870dc16698549e49", + "m_Id": 2, + "m_DisplayName": "Out Min Max", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "OutMinMax", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "febc32f50e9745a794212c04541033c3", + "m_Group": { + "m_Id": "84e0b5a2ae6a46a785e5f8a97117454f" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 57.999935150146487, + "y": 1.999994158744812, + "width": 126.0, + "height": 118.00000762939453 + } + }, + "m_Slots": [ + { + "m_Id": "ee3162b846874c188ae85f05e8ff57f5" + }, + { + "m_Id": "75c93adcbeb6416eb3e773e44d900d4b" + }, + { + "m_Id": "746aab84a778449da4525f1d4c819ec7" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "ff11e8a641984c798698ae35ab35028d", + "m_Guid": { + "m_GuidSerialized": "2e1eef7c-4140-4146-a9cb-58af9faee917" + }, + "m_Name": "Index of Refraction", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Index of Refraction", + "m_DefaultReferenceName": "_Index_of_Refraction", + "m_OverrideReferenceName": "ior", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 1.5, + "m_FloatType": 1, + "m_RangeValues": { + "x": 1.0, + "y": 2.5 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "ffd62819303245298f2ce3bae5bb3ecf", + "m_Id": 1, + "m_DisplayName": "LegacyST", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "LegacyST", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph.meta new file mode 100644 index 0000000..f9f5394 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 478ce3626be7a5f4ea58d6b13f05a2e4 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc new file mode 100644 index 0000000..dafee8a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc @@ -0,0 +1,119 @@ +#ifndef UNITY_DECLARE_OPAQUE_TEXTURE_INCLUDED_2 +#define UNITY_DECLARE_OPAQUE_TEXTURE_INCLUDED_2 +#ifdef SHADERGRAPH_PREVIEW + +void SampleSceneColor2_float(float2 uv, float lod, out float3 color) +{ + color = float3(1,1,1); +} + +void SampleSceneColor2_half(half2 uv, half lod, out half3 color) +{ + color = half3(1,1,1); +} + +#else +// Needed to comment this out due to IN-4055 - can't build with this include being present here +// For code changes, comment this out so autocomplete etc. work, but remember to comment it again +// #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + +// TODO figure out how we can differentiate between BiRP/URP/HDRP here +#define USE_CAMERA_OPAQUE + +#if defined(USE_CAMERA_OPAQUE) +float4 _CameraOpaqueTexture_TexelSize; +TEXTURE2D_X(_CameraOpaqueTexture); +SAMPLER(sampler_CameraOpaqueTexture); +#endif + +// for future use +// float applyIorToRoughness( const in float roughness, const in float ior ) { +// // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and +// // an IOR of 1.5 results in the default amount of microfacet refraction. +// return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); +// } + +void SampleSceneColor_float(float2 uv, float lod, out float3 color) +{ + #define REQUIRE_OPAQUE_TEXTURE // seems we need to define this ourselves? HDSceneColorNode does that as well + +#if defined(USE_CAMERA_OPAQUE) + color = SAMPLE_TEXTURE2D_X_LOD(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, UnityStereoTransformScreenSpaceTex(uv), lod).rgb; +#else + // For HDRP, from HDSceneColorNode + #if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT) && (SHADERPASS != SHADERPASS_PATH_TRACING) && (SHADERPASS != SHADERPASS_RAYTRACING_VISIBILITY) && (SHADERPASS != SHADERPASS_RAYTRACING_FORWARD) + color = SampleCameraColor(uv, lod) * 1.0; // GetInverseCurrentExposureMultiplier() + #else + color = float3(0.0, 0.0, 0.0); + #endif +#endif +} + +void SampleSceneColor_half(float2 uv, float lod, out float3 color) +{ + SampleSceneColor_float(uv, lod, color); +} + +#endif + +void Refract_float(float3 v, float3 n, float ior, out float3 refractionVector) +{ + refractionVector = refract( - v, normalize( n ), 1 / ior ); +} + +void Refract_half(half3 v, half3 n, half ior, out half3 refractionVector) +{ + refractionVector = refract( - v, normalize( n ), 1 / ior ); +} + +inline half3 bump3y (half3 x, half3 yoffset) +{ + float3 y = 1 - x * x; + y = saturate(y-yoffset); + return y; +} + +void Spectral_float(float wavelength, out half3 color) +{ + // Based on GPU Gems + // Optimised by Alan Zucconi + // w: [400, 700] + // x: [0, 1] + half x = ((wavelength - 400.0)/ 300.0) % 1.0; + + const float3 c1 = float3(3.54585104, 2.93225262, 2.41593945); + const float3 x1 = float3(0.69549072, 0.49228336, 0.27699880); + const float3 y1 = float3(0.02312639, 0.15225084, 0.52607955); + + const float3 c2 = float3(3.90307140, 3.21182957, 3.96587128); + const float3 x2 = float3(0.11748627, 0.86755042, 0.66077860); + const float3 y2 = float3(0.84897130, 0.88445281, 0.73949448); + + color = + bump3y(c1 * (x - x1), y1) + + bump3y(c2 * (x - x2), y2) ; +} + +#endif + +void WorkaroundTilingOffset_float(UnityTexture2D Tex, float4 LegacyST, out float4 TilingOffset, out float4 TilingOffsetOther) +{ + #if UNITY_VERSION >= 202120 + TilingOffset = float4(1,1,0,0); + TilingOffsetOther = Tex.scaleTranslate.xyzw; + #else + TilingOffset = LegacyST; + TilingOffsetOther = LegacyST; + #endif +} + +void WorkaroundTilingOffset_half(UnityTexture2D Tex, half4 LegacyST, out half4 TilingOffset, out half4 TilingOffsetOther) +{ + #if UNITY_VERSION >= 202120 + TilingOffset = half4(1,1,0,0); + TilingOffsetOther = Tex.scaleTranslate.xyzw; + #else + TilingOffset = LegacyST; + TilingOffsetOther = LegacyST; + #endif +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc.meta new file mode 100644 index 0000000..7171a4c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 885a3662fbaba7c47979790356264411 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph new file mode 100644 index 0000000..d4db29d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph @@ -0,0 +1,2267 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "74da93b1c1b740f5b5bf686f5114a33f", + "m_Properties": [ + { + "m_Id": "5198662644484802838c4372a52c2e59" + }, + { + "m_Id": "d13055b530284fba835fc40fb2321e21" + }, + { + "m_Id": "80834d18d9b74a0983272b823dcc3dc8" + } + ], + "m_Keywords": [ + { + "m_Id": "56d9a937ceac4565b9af6f99ea5e08d7" + } + ], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "e29eacd144ac4330962bdf5c5dd1148e" + } + ], + "m_Nodes": [ + { + "m_Id": "27b8e9e16e03474f92d540ae01c669d7" + }, + { + "m_Id": "f0d3ab8b87c4459d8a6d9162da0b7386" + }, + { + "m_Id": "1f365fcb3d6c4f91afec6de02fa9af4a" + }, + { + "m_Id": "bb441583f9a440d1af1c6c1fac1e8b97" + }, + { + "m_Id": "ce532b1860ba4e13ba3beedb56ac3147" + }, + { + "m_Id": "cec0b1eea33d45689082c00097725185" + }, + { + "m_Id": "c687d7776d5046cca5a3e61041819449" + }, + { + "m_Id": "72c185b8fbb94e8da02477ad50bb7857" + }, + { + "m_Id": "772e21e2ba714d92bc5aa9b55c1374b3" + }, + { + "m_Id": "e3711e5cd9f243f29056fede88f0e6dc" + }, + { + "m_Id": "8cb960f8b87a4e12b9ebf3d2f11bac93" + }, + { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + { + "m_Id": "b2acc63d54bf4eda8c78cdebf728ca84" + }, + { + "m_Id": "3c5d3225d5394b25a9317d3afaa5c184" + }, + { + "m_Id": "8d756796d33e4103ae33adc35f4abc4f" + }, + { + "m_Id": "f547c315a4e64fb58050d96baebaffae" + }, + { + "m_Id": "d8f8412f9a9c4488891fa54ee86d3c58" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1f365fcb3d6c4f91afec6de02fa9af4a" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "72c185b8fbb94e8da02477ad50bb7857" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1f365fcb3d6c4f91afec6de02fa9af4a" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "e3711e5cd9f243f29056fede88f0e6dc" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "27b8e9e16e03474f92d540ae01c669d7" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "72c185b8fbb94e8da02477ad50bb7857" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "d8f8412f9a9c4488891fa54ee86d3c58" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "3c5d3225d5394b25a9317d3afaa5c184" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "f0d3ab8b87c4459d8a6d9162da0b7386" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "72c185b8fbb94e8da02477ad50bb7857" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cec0b1eea33d45689082c00097725185" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "772e21e2ba714d92bc5aa9b55c1374b3" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "d8f8412f9a9c4488891fa54ee86d3c58" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "8cb960f8b87a4e12b9ebf3d2f11bac93" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "8d756796d33e4103ae33adc35f4abc4f" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c687d7776d5046cca5a3e61041819449" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b2acc63d54bf4eda8c78cdebf728ca84" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "bb441583f9a440d1af1c6c1fac1e8b97" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "772e21e2ba714d92bc5aa9b55c1374b3" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c687d7776d5046cca5a3e61041819449" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cec0b1eea33d45689082c00097725185" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "ce532b1860ba4e13ba3beedb56ac3147" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2595e7e856bb4c47ae37c43a792180bc" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cec0b1eea33d45689082c00097725185" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "772e21e2ba714d92bc5aa9b55c1374b3" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "d8f8412f9a9c4488891fa54ee86d3c58" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "27b8e9e16e03474f92d540ae01c669d7" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e3711e5cd9f243f29056fede88f0e6dc" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cec0b1eea33d45689082c00097725185" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f0d3ab8b87c4459d8a6d9162da0b7386" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1f365fcb3d6c4f91afec6de02fa9af4a" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f0d3ab8b87c4459d8a6d9162da0b7386" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1f365fcb3d6c4f91afec6de02fa9af4a" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f0d3ab8b87c4459d8a6d9162da0b7386" + }, + "m_SlotId": 3 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "bb441583f9a440d1af1c6c1fac1e8b97" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f0d3ab8b87c4459d8a6d9162da0b7386" + }, + "m_SlotId": 4 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "bb441583f9a440d1af1c6c1fac1e8b97" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f547c315a4e64fb58050d96baebaffae" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b2acc63d54bf4eda8c78cdebf728ca84" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Sub Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "27b8e9e16e03474f92d540ae01c669d7" + }, + "m_ActiveTargets": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "028d4df8f48c4a68b9d5933f510b9d32", + "m_Id": 0, + "m_DisplayName": "Tiling/Offset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "06cc40560bf949aba8f6d7a0466c1778", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0f52f105b2314b15ba0796e0ab69eb15", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "10bf0ff8c9c545da8ff6bc8d07f52235", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "1adc33d5a71a46618871eeb77776d2b3", + "m_Id": 2, + "m_DisplayName": "Rotation", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Rotation", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "1d24fdf3c309414d889eb8f58ffe0b35", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2Node", + "m_ObjectId": "1f365fcb3d6c4f91afec6de02fa9af4a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Vector 2", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -190.25, + "y": 15.0, + "width": 128.0, + "height": 101.0 + } + }, + "m_Slots": [ + { + "m_Id": "d8e3e5bc2fa44c75bcc758e7bbd87af4" + }, + { + "m_Id": "20e10a03f99f4a8f9226d22170cf40e3" + }, + { + "m_Id": "7cb54dec1a8f4802ac1240d4e98bacc8" + } + ], + "synonyms": [ + "2", + "v2", + "vec2", + "float2" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": { + "x": 0.0, + "y": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "20e10a03f99f4a8f9226d22170cf40e3", + "m_Id": 2, + "m_DisplayName": "Y", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Y", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [ + "Y" + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BranchNode", + "m_ObjectId": "2595e7e856bb4c47ae37c43a792180bc", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Branch", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -239.25, + "y": -262.0, + "width": 208.0, + "height": 326.0 + } + }, + "m_Slots": [ + { + "m_Id": "68e43fe9ddf94959a1ef6ca1c8ca5973" + }, + { + "m_Id": "e355968fbbd641d6bbbe2b2402ef37c8" + }, + { + "m_Id": "40375ee59cfc47f7abdc55e25bc9e2d7" + }, + { + "m_Id": "f0909f6c702d4051944e25894100ecca" + } + ], + "synonyms": [ + "switch", + "if", + "else" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode", + "m_ObjectId": "27b8e9e16e03474f92d540ae01c669d7", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Output", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 767.0001220703125, + "y": -155.99998474121095, + "width": 142.99993896484376, + "height": 100.99995422363281 + } + }, + "m_Slots": [ + { + "m_Id": "95bd13d1c6ec4064964cbd8740f3b9b3" + }, + { + "m_Id": "39b56c9b7fd04a0b9aef46ea6f38e902" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "IsFirstSlotValid": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "2962234def254d959e631a1d73e8804a", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "38f27185fcf44147a58c26469a1ebb77", + "m_Id": 3, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "39b56c9b7fd04a0b9aef46ea6f38e902", + "m_Id": 2, + "m_DisplayName": "Original_UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Original_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "3a2ca143fa7c416db187740179c9de72", + "m_Id": 1, + "m_DisplayName": "X", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "X", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "3c5d3225d5394b25a9317d3afaa5c184", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -532.25, + "y": 130.5, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "028d4df8f48c4a68b9d5933f510b9d32" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "5198662644484802838c4372a52c2e59" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "40375ee59cfc47f7abdc55e25bc9e2d7", + "m_Id": 2, + "m_DisplayName": "False", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "False", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "4236b1dd63bc4c92a3a106c05c18c00d", + "m_Id": 0, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "436f1b378dd34d8eb1006e0c8465fb3a", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.5, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "47ca78a594d241eaa93b0e3977c4d26a", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "4e9c77fa8b084fd58866a854282c68a1", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 1.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector4ShaderProperty", + "m_ObjectId": "5198662644484802838c4372a52c2e59", + "m_Guid": { + "m_GuidSerialized": "83a6556e-d78a-45f4-b8a2-13076ccdab77" + }, + "m_Name": "Tiling/Offset", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Tiling/Offset", + "m_DefaultReferenceName": "_Tiling_Offset", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "56d9a937ceac4565b9af6f99ea5e08d7", + "m_Guid": { + "m_GuidSerialized": "edf63907-814a-426f-93e5-ed40f270dcbd" + }, + "m_Name": "Enable Texture Transform", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Texture Transform", + "m_DefaultReferenceName": "_ENABLE_TEXTURE_TRANSFORM", + "m_OverrideReferenceName": "_TEXTURE_TRANSFORM_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5bfc323d88eb40faad9e6714526b2429", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BooleanMaterialSlot", + "m_ObjectId": "68e43fe9ddf94959a1ef6ca1c8ca5973", + "m_Id": 0, + "m_DisplayName": "Predicate", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Predicate", + "m_StageCapability": 3, + "m_Value": false, + "m_DefaultValue": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "72c185b8fbb94e8da02477ad50bb7857", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -31.25, + "y": -73.9998779296875, + "width": 130.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "ba2585563f464982861c7ac20cb49e93" + }, + { + "m_Id": "7710fe404353448187f2d480d1a88997" + }, + { + "m_Id": "d14af0d3bd4d49889802d5d9a64ad95b" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "7710fe404353448187f2d480d1a88997", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.AddNode", + "m_ObjectId": "772e21e2ba714d92bc5aa9b55c1374b3", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Add", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 335.749755859375, + "y": 161.0, + "width": 130.000244140625, + "height": 118.00006103515625 + } + }, + "m_Slots": [ + { + "m_Id": "b5c9181a2b274bba9d5cab7692cc137c" + }, + { + "m_Id": "5bfc323d88eb40faad9e6714526b2429" + }, + { + "m_Id": "cd15f14d506943aeb5b6abd9abfa4ab4" + } + ], + "synonyms": [ + "addition", + "sum", + "plus" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "7cb54dec1a8f4802ac1240d4e98bacc8", + "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 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "7fdbc456a47947898cd9119006ac64e1", + "m_Id": 0, + "m_DisplayName": "Rotation", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "80834d18d9b74a0983272b823dcc3dc8", + "m_Guid": { + "m_GuidSerialized": "b3d81d39-5c6c-4c82-9d1f-36795cedd43c" + }, + "m_Name": "UV Channel", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "UV Channel", + "m_DefaultReferenceName": "_UV_Channel", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "88f4af515d8847e1b14f56d6f5e16728", + "m_Id": 2, + "m_DisplayName": "Y", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Y", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [ + "Y" + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVNode", + "m_ObjectId": "8cb960f8b87a4e12b9ebf3d2f11bac93", + "m_Group": { + "m_Id": "" + }, + "m_Name": "UV", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -473.25, + "y": -114.0, + "width": 145.0, + "height": 129.0 + } + }, + "m_Slots": [ + { + "m_Id": "e2bc47ca951847188484ace4c549e067" + } + ], + "synonyms": [ + "texcoords", + "coords", + "coordinates" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_OutputChannel": 1 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "8d756796d33e4103ae33adc35f4abc4f", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -181.25, + "y": 342.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "7fdbc456a47947898cd9119006ac64e1" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "d13055b530284fba835fc40fb2321e21" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "8f88c20b213a43798210afd7090ac266", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "95bd13d1c6ec4064964cbd8740f3b9b3", + "m_Id": 1, + "m_DisplayName": "Transformed_UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Transformed_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "990625fe709045eba64aabc6c046c994", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "a04e9adef398411caaa05e94df4a7ec7", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ComparisonNode", + "m_ObjectId": "b2acc63d54bf4eda8c78cdebf728ca84", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Comparison", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -473.25, + "y": -410.0, + "width": 145.0, + "height": 136.0 + } + }, + "m_Slots": [ + { + "m_Id": "d512aa6b75e349629f86bc138fff3f35" + }, + { + "m_Id": "436f1b378dd34d8eb1006e0c8465fb3a" + }, + { + "m_Id": "47ca78a594d241eaa93b0e3977c4d26a" + } + ], + "synonyms": [ + "equal", + "greater than", + "less than" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_ComparisonType": 3 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "b5509161f6d5453b81572144b8e2fdfe", + "m_Id": 1, + "m_DisplayName": "Center", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Center", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "b5c9181a2b274bba9d5cab7692cc137c", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b5f46849e6c7440eb06c4e2b26aed709", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "ba2585563f464982861c7ac20cb49e93", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2Node", + "m_ObjectId": "bb441583f9a440d1af1c6c1fac1e8b97", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Vector 2", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -190.25, + "y": 127.0, + "width": 128.0, + "height": 101.0 + } + }, + "m_Slots": [ + { + "m_Id": "3a2ca143fa7c416db187740179c9de72" + }, + { + "m_Id": "88f4af515d8847e1b14f56d6f5e16728" + }, + { + "m_Id": "e80fddfff6834cc6a81a8403d7c587e1" + } + ], + "synonyms": [ + "2", + "v2", + "vec2", + "float2" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Value": { + "x": 0.0, + "y": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NegateNode", + "m_ObjectId": "c687d7776d5046cca5a3e61041819449", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Negate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -31.25, + "y": 295.0, + "width": 128.0, + "height": 94.0 + } + }, + "m_Slots": [ + { + "m_Id": "ce1381546b704878bc8be3d5947cbaa3" + }, + { + "m_Id": "db9fd4bffbb94177940807a87690f081" + } + ], + "synonyms": [ + "invert", + "opposite" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "c8baf59d193f4527b0f3d43ebf44086a", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "cd15f14d506943aeb5b6abd9abfa4ab4", + "m_Id": 2, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "ce1381546b704878bc8be3d5947cbaa3", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVNode", + "m_ObjectId": "ce532b1860ba4e13ba3beedb56ac3147", + "m_Group": { + "m_Id": "" + }, + "m_Name": "UV", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -473.25, + "y": -262.0, + "width": 145.0, + "height": 129.0 + } + }, + "m_Slots": [ + { + "m_Id": "8f88c20b213a43798210afd7090ac266" + } + ], + "synonyms": [ + "texcoords", + "coords", + "coordinates" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_OutputChannel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.RotateNode", + "m_ObjectId": "cec0b1eea33d45689082c00097725185", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Rotate", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 141.75, + "y": 28.0001220703125, + "width": 163.999755859375, + "height": 177.0 + } + }, + "m_Slots": [ + { + "m_Id": "4236b1dd63bc4c92a3a106c05c18c00d" + }, + { + "m_Id": "b5509161f6d5453b81572144b8e2fdfe" + }, + { + "m_Id": "1adc33d5a71a46618871eeb77776d2b3" + }, + { + "m_Id": "38f27185fcf44147a58c26469a1ebb77" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Unit": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "d13055b530284fba835fc40fb2321e21", + "m_Guid": { + "m_GuidSerialized": "0c456893-e07e-4608-8121-3220a4f6c3be" + }, + "m_Name": "Rotation", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Rotation", + "m_DefaultReferenceName": "_Rotation", + "m_OverrideReferenceName": "", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "d14af0d3bd4d49889802d5d9a64ad95b", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d512aa6b75e349629f86bc138fff3f35", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d8e3e5bc2fa44c75bcc758e7bbd87af4", + "m_Id": 1, + "m_DisplayName": "X", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "X", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "d8f8412f9a9c4488891fa54ee86d3c58", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Enable Texture Transform", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 504.00006103515627, + "y": -274.0000305175781, + "width": 194.00006103515626, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "0f52f105b2314b15ba0796e0ab69eb15" + }, + { + "m_Id": "1d24fdf3c309414d889eb8f58ffe0b35" + }, + { + "m_Id": "c8baf59d193f4527b0f3d43ebf44086a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "56d9a937ceac4565b9af6f99ea5e08d7" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "db9fd4bffbb94177940807a87690f081", + "m_Id": 1, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "e29eacd144ac4330962bdf5c5dd1148e", + "m_Name": "", + "m_ChildObjectList": [ + { + "m_Id": "5198662644484802838c4372a52c2e59" + }, + { + "m_Id": "d13055b530284fba835fc40fb2321e21" + }, + { + "m_Id": "80834d18d9b74a0983272b823dcc3dc8" + }, + { + "m_Id": "56d9a937ceac4565b9af6f99ea5e08d7" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "e2bc47ca951847188484ace4c549e067", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "e355968fbbd641d6bbbe2b2402ef37c8", + "m_Id": 1, + "m_DisplayName": "True", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "True", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "e3711e5cd9f243f29056fede88f0e6dc", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -31.25, + "y": 169.0, + "width": 130.0, + "height": 118.0 + } + }, + "m_Slots": [ + { + "m_Id": "a04e9adef398411caaa05e94df4a7ec7" + }, + { + "m_Id": "4e9c77fa8b084fd58866a854282c68a1" + }, + { + "m_Id": "06cc40560bf949aba8f6d7a0466c1778" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "e80fddfff6834cc6a81a8403d7c587e1", + "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 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ece58ca0fadd4ef1a29ca4fac17ed864", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "f0909f6c702d4051944e25894100ecca", + "m_Id": 3, + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "f0d3ab8b87c4459d8a6d9162da0b7386", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -382.25, + "y": 56.0, + "width": 120.0, + "height": 149.0 + } + }, + "m_Slots": [ + { + "m_Id": "10bf0ff8c9c545da8ff6bc8d07f52235" + }, + { + "m_Id": "ece58ca0fadd4ef1a29ca4fac17ed864" + }, + { + "m_Id": "2962234def254d959e631a1d73e8804a" + }, + { + "m_Id": "990625fe709045eba64aabc6c046c994" + }, + { + "m_Id": "b5f46849e6c7440eb06c4e2b26aed709" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "f547c315a4e64fb58050d96baebaffae", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -729.0, + "y": -371.0, + "width": 137.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "fef788eec75446eb81447e789a89a4e3" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "80834d18d9b74a0983272b823dcc3dc8" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "fef788eec75446eb81447e789a89a4e3", + "m_Id": 0, + "m_DisplayName": "UV Channel", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph.meta new file mode 100644 index 0000000..2d6fc30 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/TextureTransform.shadersubgraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 8ecb70019a63796448768b1124086ef5 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph new file mode 100644 index 0000000..c9a6339 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph @@ -0,0 +1,2657 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "91e2a81f19de4249bc97ceec39ed3170", + "m_Properties": [ + { + "m_Id": "86351816717b466c977fecf4d84eb6a2" + }, + { + "m_Id": "90e0e7e9f75044ad959e408da384de44" + }, + { + "m_Id": "851b64cc55064cc591c263711144feca" + }, + { + "m_Id": "cdce6996c9064903841175baee4ac9d8" + }, + { + "m_Id": "2ef8958a8ad04fc48a4990966c393b9a" + }, + { + "m_Id": "a31de1ea8ed447308eea30bd6fdac922" + } + ], + "m_Keywords": [ + { + "m_Id": "97df40c83f5a4671a59db5b30b4c6316" + }, + { + "m_Id": "14eb9f49890e4fdf8e6c058bfe728c2c" + } + ], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "7f64bbc2d78d4fb199ef542b88ad80bb" + }, + { + "m_Id": "318b5ae978fa4468abc6503de868db1a" + } + ], + "m_Nodes": [ + { + "m_Id": "d62362e7b1db41b5b2850ca4f7727193" + }, + { + "m_Id": "84d55ba92e74430996e3472b42307dbe" + }, + { + "m_Id": "f99c7d64d64e494f9fa89870d003303e" + }, + { + "m_Id": "192a2fa94873447f8287e671a84cfef5" + }, + { + "m_Id": "7bb3ca3024ad410f8014cc5f609eb114" + }, + { + "m_Id": "c63eb0c45cd446faafe694bb84a8a9d3" + }, + { + "m_Id": "84e2db014c35493eb0bf3d5ef8777478" + }, + { + "m_Id": "06db988d9f42411085151074e35e62d5" + }, + { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + { + "m_Id": "5260828f1a9340bba0850b529eab555e" + }, + { + "m_Id": "4298618b682246f99867908047bc271b" + }, + { + "m_Id": "7f4c33107f064c7da4d5577b6541188d" + }, + { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + { + "m_Id": "9408a018d7914d50b1b5af63a7699f0e" + }, + { + "m_Id": "e8eeaf53ed7e44cf9b859265dbcceec8" + }, + { + "m_Id": "2cc830dd4c1246d8a15eebc1551e48a5" + }, + { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + { + "m_Id": "10edc8dd4a624dd3948bb0398fd8d026" + } + ], + "m_GroupDatas": [ + { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + } + ], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "06db988d9f42411085151074e35e62d5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "10edc8dd4a624dd3948bb0398fd8d026" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "06db988d9f42411085151074e35e62d5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "10edc8dd4a624dd3948bb0398fd8d026" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": -1226117840 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "192a2fa94873447f8287e671a84cfef5" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "4298618b682246f99867908047bc271b" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2cc830dd4c1246d8a15eebc1551e48a5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": -1162300524 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "4298618b682246f99867908047bc271b" + }, + "m_SlotId": 4 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7bb3ca3024ad410f8014cc5f609eb114" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "5260828f1a9340bba0850b529eab555e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "84e2db014c35493eb0bf3d5ef8777478" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "1fd92dcb775e44539582c91fa2d715ee" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "7f4c33107f064c7da4d5577b6541188d" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "9408a018d7914d50b1b5af63a7699f0e" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": -725852216 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c63eb0c45cd446faafe694bb84a8a9d3" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2796de049db74614be6bfe0317d3403f" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c63eb0c45cd446faafe694bb84a8a9d3" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "a0f839c542124faea4358fe4a8083771" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "cedfea913c474bd2bb71209c662e46b5" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "7d0f12322640404fabc3a8d92d461290" + }, + "m_SlotId": 2 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e8eeaf53ed7e44cf9b859265dbcceec8" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "10edc8dd4a624dd3948bb0398fd8d026" + }, + "m_SlotId": 1 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 3087.000244140625, + "y": 230.99998474121095 + }, + "m_Blocks": [ + { + "m_Id": "d62362e7b1db41b5b2850ca4f7727193" + }, + { + "m_Id": "84d55ba92e74430996e3472b42307dbe" + }, + { + "m_Id": "f99c7d64d64e494f9fa89870d003303e" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 3087.000244140625, + "y": 610.0 + }, + "m_Blocks": [ + { + "m_Id": "192a2fa94873447f8287e671a84cfef5" + }, + { + "m_Id": "7bb3ca3024ad410f8014cc5f609eb114" + }, + { + "m_Id": "84e2db014c35493eb0bf3d5ef8777478" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "UnityGLTF", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "de2d39e22ef549f58ed7b2a1f989a770" + }, + { + "m_Id": "2adddb3fba4f472caec286b8688d99fe" + }, + { + "m_Id": "d1ea4f0250a34d99863ee930d384b759" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "052134b472814ed68c616629c4360ad9", + "m_Id": 0, + "m_DisplayName": "Map Rotation", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "0663969fd47346fabe593928bb40b508", + "m_Id": 2, + "m_DisplayName": "Off", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Off", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "06db988d9f42411085151074e35e62d5", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1082.0, + "y": -476.9999694824219, + "width": 166.0, + "height": 34.0 + } + }, + "m_Slots": [ + { + "m_Id": "5d74d6d78db64d4e9925acfe54a292ac" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "90e0e7e9f75044ad959e408da384de44" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "06f5499a20744baaaaaf8a9d5cfdb5d9", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode", + "m_ObjectId": "10edc8dd4a624dd3948bb0398fd8d026", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "WorkaroundTilingOffset (Custom Function)", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1343.0, + "y": -467.0, + "width": 290.0, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "cfb8a383070e44878950e7e04e3584c3" + }, + { + "m_Id": "316408503a1c4bf1855f35bee234497f" + }, + { + "m_Id": "256500dbf5bc4f45bc4e68f684b06a0f" + }, + { + "m_Id": "50edcffe9c0640d3b92d873168dc8a4a" + } + ], + "synonyms": [ + "code", + "HLSL" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SourceType": 0, + "m_FunctionName": "WorkaroundTilingOffset", + "m_FunctionSource": "885a3662fbaba7c47979790356264411", + "m_FunctionBody": "#if UNITY_VERSION >= 202120\nTilingOffset = float4(1,1,0,0);\nTilingOffsetOther = Tex.scaleTranslate.xyzw;\n#else\nTilingOffset = LegacyST;\nTilingOffsetOther = LegacyST;\n#endif" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "14eb9f49890e4fdf8e6c058bfe728c2c", + "m_Guid": { + "m_GuidSerialized": "18d2d4e9-c6dd-42bf-93c8-949b286e09f8" + }, + "m_Name": "Enable Texture Transforms", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Texture Transforms", + "m_DefaultReferenceName": "_ENABLE_TEXTURE_TRANSFORMS", + "m_OverrideReferenceName": "_TEXTURE_TRANSFORM_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [], + "m_Value": 0, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "192a2fa94873447f8287e671a84cfef5", + "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": "6c366b0d6ec545c3832add909e3d1e89" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "1989f19083984f9482326d807005e07f", + "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.ShaderGraph.MultiplyNode", + "m_ObjectId": "1fd92dcb775e44539582c91fa2d715ee", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1903.0, + "y": -318.99993896484377, + "width": 130.0001220703125, + "height": 118.00003051757813 + } + }, + "m_Slots": [ + { + "m_Id": "3b8f80eed15d468c858c1bb729f68b4b" + }, + { + "m_Id": "9966b44de47f44c09134230701fc17cc" + }, + { + "m_Id": "508110704c634983a721fe742b0dcafd" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "20b14d2ae2434cf38a81633609bf5f43", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "256500dbf5bc4f45bc4e68f684b06a0f", + "m_Id": 2, + "m_DisplayName": "TilingOffset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "TilingOffset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.KeywordNode", + "m_ObjectId": "2796de049db74614be6bfe0317d3403f", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Enable Vertex Colors", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1698.0, + "y": -162.99996948242188, + "width": 166.0, + "height": 117.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "5d7fea3e25aa4c32aa1b8057007a7cea" + }, + { + "m_Id": "eef506e16f0d4e7fabba8e363f9f7b5b" + }, + { + "m_Id": "0663969fd47346fabe593928bb40b508" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Keyword": { + "m_Id": "97df40c83f5a4671a59db5b30b4c6316" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "2896420937a94ab89b246fb3155919dc", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDTarget", + "m_ObjectId": "2adddb3fba4f472caec286b8688d99fe", + "m_ActiveSubTarget": { + "m_Id": "8f7106cb155b403ea6a8022400235d95" + }, + "m_Datas": [ + { + "m_Id": "c2bea0a6923d40e88c022e279ce22602" + }, + { + "m_Id": "56b8cfcfbe7e4700a8ee6c8920825400" + }, + { + "m_Id": "7c6ec251c77e49c4a4887cf647d1f80e" + } + ], + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "2be05efd171444038a2e4b7115af59e6", + "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.ShaderGraph.PropertyNode", + "m_ObjectId": "2cc830dd4c1246d8a15eebc1551e48a5", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1082.0, + "y": -220.99998474121095, + "width": 176.0001220703125, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "3c4d023c8c014e90b9e53d57f5fb3dd4" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "a31de1ea8ed447308eea30bd6fdac922" + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector4ShaderProperty", + "m_ObjectId": "2ef8958a8ad04fc48a4990966c393b9a", + "m_Guid": { + "m_GuidSerialized": "42989d8e-f01d-4e05-bab8-5af5397c1e84" + }, + "m_Name": "Map Tiling/Offset", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Map Tiling/Offset", + "m_DefaultReferenceName": "_Map_Tiling_Offset", + "m_OverrideReferenceName": "baseColorTexture_ST", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "316408503a1c4bf1855f35bee234497f", + "m_Id": 1, + "m_DisplayName": "LegacyST", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "LegacyST", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "318b5ae978fa4468abc6503de868db1a", + "m_Name": "glTF PBR", + "m_ChildObjectList": [ + { + "m_Id": "86351816717b466c977fecf4d84eb6a2" + }, + { + "m_Id": "90e0e7e9f75044ad959e408da384de44" + }, + { + "m_Id": "2ef8958a8ad04fc48a4990966c393b9a" + }, + { + "m_Id": "cdce6996c9064903841175baee4ac9d8" + }, + { + "m_Id": "a31de1ea8ed447308eea30bd6fdac922" + }, + { + "m_Id": "851b64cc55064cc591c263711144feca" + }, + { + "m_Id": "97df40c83f5a4671a59db5b30b4c6316" + }, + { + "m_Id": "14eb9f49890e4fdf8e6c058bfe728c2c" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "3b8f80eed15d468c858c1bb729f68b4b", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "3c4d023c8c014e90b9e53d57f5fb3dd4", + "m_Id": 0, + "m_DisplayName": "Map UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "3f4ae4edfaa34f4c8531bd854abd844a", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDLitData", + "m_ObjectId": "40f2bfb8172f4025bc600b8b6c4a9677", + "m_RayTracing": false, + "m_MaterialType": 0, + "m_RefractionModel": 0, + "m_SSSTransmission": true, + "m_EnergyConservingSpecular": true, + "m_ClearCoat": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "4298618b682246f99867908047bc271b", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2099.000244140625, + "y": -190.99996948242188, + "width": 119.999755859375, + "height": 149.00006103515626 + } + }, + "m_Slots": [ + { + "m_Id": "954c85b2964d43ca90e1a13747a3eef1" + }, + { + "m_Id": "d48ccf4b057d459ea93e84d0e6d43e43" + }, + { + "m_Id": "54f1cc14614d4472912dcff46abb0198" + }, + { + "m_Id": "6c2acb01264e42bb889e20d3f76c9684" + }, + { + "m_Id": "58e4f80242c54853a51fb8f46c891318" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "508110704c634983a721fe742b0dcafd", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "50edcffe9c0640d3b92d873168dc8a4a", + "m_Id": 3, + "m_DisplayName": "TilingOffsetOther", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "TilingOffsetOther", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "5260828f1a9340bba0850b529eab555e", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 2821.00048828125, + "y": 1040.0001220703125, + "width": 140.99951171875, + "height": 33.9998779296875 + } + }, + "m_Slots": [ + { + "m_Id": "b91488151b004cd2aa2ba7923db0e152" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "851b64cc55064cc591c263711144feca" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "53e6e4fd5b7040cc8ca17980f41e3df4", + "m_Id": 0, + "m_DisplayName": "A", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "54f1cc14614d4472912dcff46abb0198", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData", + "m_ObjectId": "56b8cfcfbe7e4700a8ee6c8920825400", + "m_MaterialNeedsUpdateHash": 529, + "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_CustomVelocity": false, + "m_Tessellation": false, + "m_TessellationMode": 0, + "m_TessellationFactorMinDistance": 20.0, + "m_TessellationFactorMaxDistance": 50.0, + "m_TessellationFactorTriangleSize": 100.0, + "m_TessellationShapeFactor": 0.75, + "m_TessellationBackFaceCullEpsilon": -0.25, + "m_TessellationMaxDisplacement": 0.009999999776482582, + "m_Version": 1, + "inspectorFoldoutMask": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "58e4f80242c54853a51fb8f46c891318", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5ca8bbeec7774b4fb0301196692f327f", + "m_Id": -725852216, + "m_DisplayName": "Rotation", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Rotation", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot", + "m_ObjectId": "5d74d6d78db64d4e9925acfe54a292ac", + "m_Id": 0, + "m_DisplayName": "Base Color Map", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "5d7fea3e25aa4c32aa1b8057007a7cea", + "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, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInUnlitSubTarget", + "m_ObjectId": "643c6f6393984e12a7f9d46bdf4b0d0c" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "6c2acb01264e42bb889e20d3f76c9684", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "6c366b0d6ec545c3832add909e3d1e89", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "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.BlockNode", + "m_ObjectId": "7bb3ca3024ad410f8014cc5f609eb114", + "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": "1989f19083984f9482326d807005e07f" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDUnlitData", + "m_ObjectId": "7c6ec251c77e49c4a4887cf647d1f80e", + "m_EnableShadowMatte": false, + "m_DistortionOnly": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "7d0f12322640404fabc3a8d92d461290", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1681.0, + "y": -425.99993896484377, + "width": 183.0, + "height": 250.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "2896420937a94ab89b246fb3155919dc" + }, + { + "m_Id": "20b14d2ae2434cf38a81633609bf5f43" + }, + { + "m_Id": "06f5499a20744baaaaaf8a9d5cfdb5d9" + }, + { + "m_Id": "85ec0cef04ec49ee885d4a3f4b44efa9" + }, + { + "m_Id": "9e3aebb69ef04f038b0047212dee79aa" + }, + { + "m_Id": "edee52016d324d04b248f4f255882edb" + }, + { + "m_Id": "afc7970b28824f77bf1194792fc8fa04" + }, + { + "m_Id": "7fcb59f8468e4ca8b44fa2a6355eb44a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "7e1ec34d620c4cfdab4e87bb4d732943", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.VertexColorNode", + "m_ObjectId": "7f4c33107f064c7da4d5577b6541188d", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Vertex Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1370.0, + "y": -99.9999771118164, + "width": 118.000244140625, + "height": 94.00008392333985 + } + }, + "m_Slots": [ + { + "m_Id": "7e1ec34d620c4cfdab4e87bb4d732943" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "7f64bbc2d78d4fb199ef542b88ad80bb", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "7fcb59f8468e4ca8b44fa2a6355eb44a", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "84d55ba92e74430996e3472b42307dbe", + "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": "2be05efd171444038a2e4b7115af59e6" + } + ], + "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.BlockNode", + "m_ObjectId": "84e2db014c35493eb0bf3d5ef8777478", + "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": "ecde0983554943cd81a917127fad3655" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "851b64cc55064cc591c263711144feca", + "m_Guid": { + "m_GuidSerialized": "bb5d1f8d-d033-480f-b48e-bc5fd655a7d7" + }, + "m_Name": "Alpha Cutoff", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Alpha Cutoff", + "m_DefaultReferenceName": "_Alpha_Cutoff", + "m_OverrideReferenceName": "alphaCutoff", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.5, + "m_FloatType": 1, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "85ec0cef04ec49ee885d4a3f4b44efa9", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty", + "m_ObjectId": "86351816717b466c977fecf4d84eb6a2", + "m_Guid": { + "m_GuidSerialized": "29a3b28d-65b6-4f84-938e-3006058d602b" + }, + "m_Name": "Base Color", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Base Color", + "m_DefaultReferenceName": "_Base_Color", + "m_OverrideReferenceName": "baseColorFactor", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "r": 1.0, + "g": 1.0, + "b": 1.0, + "a": 1.0 + }, + "isMainColor": false, + "m_ColorMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDUnlitSubTarget", + "m_ObjectId": "8f7106cb155b403ea6a8022400235d95" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "90e0e7e9f75044ad959e408da384de44", + "m_Guid": { + "m_GuidSerialized": "0d93659e-0928-436e-9073-e756de46db7d" + }, + "m_Name": "Base Color Map", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Base Color Map", + "m_DefaultReferenceName": "_Base_Color_Map", + "m_OverrideReferenceName": "baseColorTexture", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": true, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot", + "m_ObjectId": "934381759c5947709a33fde75e0c5595", + "m_Id": 1, + "m_DisplayName": "Transformed_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Transformed_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "9408a018d7914d50b1b5af63a7699f0e", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1054.0001220703125, + "y": -269.0, + "width": 204.0, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "052134b472814ed68c616629c4360ad9" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "cdce6996c9064903841175baee4ac9d8" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "954c85b2964d43ca90e1a13747a3eef1", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.ShaderKeyword", + "m_ObjectId": "97df40c83f5a4671a59db5b30b4c6316", + "m_Guid": { + "m_GuidSerialized": "0ed3a523-c978-4e5c-bc38-732b77ffc1b4" + }, + "m_Name": "Enable Vertex Colors", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Enable Vertex Colors", + "m_DefaultReferenceName": "_ENABLE_VERTEX_COLORS", + "m_OverrideReferenceName": "_VERTEX_COLORS_ON", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_KeywordType": 0, + "m_KeywordDefinition": 0, + "m_KeywordScope": 0, + "m_KeywordStages": 63, + "m_Entries": [], + "m_Value": 1, + "m_IsEditable": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "9966b44de47f44c09134230701fc17cc", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "9e3aebb69ef04f038b0047212dee79aa", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", + "m_ObjectId": "a0f839c542124faea4358fe4a8083771", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Multiply", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1528.000244140625, + "y": -141.9999237060547, + "width": 129.999755859375, + "height": 117.99996948242188 + } + }, + "m_Slots": [ + { + "m_Id": "53e6e4fd5b7040cc8ca17980f41e3df4" + }, + { + "m_Id": "cf88e70b5d9849329c0adf3c779fd376" + }, + { + "m_Id": "be355e8ec4254b67ae45656d90d28beb" + } + ], + "synonyms": [ + "multiplication", + "times", + "x" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "a31de1ea8ed447308eea30bd6fdac922", + "m_Guid": { + "m_GuidSerialized": "d2380b97-8e1a-45c1-b7dd-44313775399d" + }, + "m_Name": "Map UV", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Map UV", + "m_DefaultReferenceName": "_Map_UV", + "m_OverrideReferenceName": "baseColorTextureTexCoord", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 2, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "a482fd18440e4922afab82f12dd388ad", + "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.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "afc7970b28824f77bf1194792fc8fa04", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "b43ee4b8c16349e1a608f0614dfa31d7", + "m_Id": 0, + "m_DisplayName": "Map Tiling/Offset", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b579868c840049e2b2c511a4221fcfa2", + "m_Id": -1162300524, + "m_DisplayName": "UV Channel", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_UV_Channel", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "b653ce49eb2f4940b5a479a84816c6ea", + "m_Id": -1226117840, + "m_DisplayName": "Tiling/Offset", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "_Tiling_Offset", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "b91488151b004cd2aa2ba7923db0e152", + "m_Id": 0, + "m_DisplayName": "Alpha Cutoff", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "be355e8ec4254b67ae45656d90d28beb", + "m_Id": 2, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "e00": 0.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 0.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 0.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 0.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData", + "m_ObjectId": "c01b5bb817134989a3ddb326b67996b3", + "m_NormalDropOffSpace": 0, + "m_BlendPreserveSpecular": true, + "m_ReceiveDecals": true, + "m_ReceiveSSR": true, + "m_ReceiveSSRTransparent": false, + "m_SpecularAA": false, + "m_SpecularOcclusionMode": 1, + "m_OverrideBakedGI": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.GroupData", + "m_ObjectId": "c1f6d9e695904fea9b3abdc1e683f2c8", + "m_Title": "Base Color + Normal + Emission", + "m_Position": { + "x": 1006.0, + "y": -485.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData", + "m_ObjectId": "c2bea0a6923d40e88c022e279ce22602", + "m_Distortion": false, + "m_DistortionMode": 0, + "m_DistortionDepthTest": true, + "m_AddPrecomputedVelocity": false, + "m_TransparentWritesMotionVec": false, + "m_AlphaToMask": false, + "m_DepthOffset": false, + "m_ConservativeDepthOffset": 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.PropertyNode", + "m_ObjectId": "c63eb0c45cd446faafe694bb84a8a9d3", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1370.0, + "y": -161.9999237060547, + "width": 134.000244140625, + "height": 33.99993896484375 + } + }, + "m_Slots": [ + { + "m_Id": "3f4ae4edfaa34f4c8531bd854abd844a" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "86351816717b466c977fecf4d84eb6a2" + } +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", + "m_ObjectId": "cdce6996c9064903841175baee4ac9d8", + "m_Guid": { + "m_GuidSerialized": "21264b96-4ab0-4b81-9342-9b4c470cf357" + }, + "m_Name": "Map Rotation", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Map Rotation", + "m_DefaultReferenceName": "_Map_Rotation", + "m_OverrideReferenceName": "baseColorTextureRotation", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": 0.0, + "m_FloatType": 0, + "m_RangeValues": { + "x": 0.0, + "y": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SubGraphNode", + "m_ObjectId": "cedfea913c474bd2bb71209c662e46b5", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "TextureTransform", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1377.0, + "y": -328.9999694824219, + "width": 256.0, + "height": 141.99998474121095 + } + }, + "m_Slots": [ + { + "m_Id": "b653ce49eb2f4940b5a479a84816c6ea" + }, + { + "m_Id": "5ca8bbeec7774b4fb0301196692f327f" + }, + { + "m_Id": "b579868c840049e2b2c511a4221fcfa2" + }, + { + "m_Id": "934381759c5947709a33fde75e0c5595" + }, + { + "m_Id": "fa713a0965784318898f7198633adc19" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedSubGraph": "{\n \"subGraph\": {\n \"fileID\": -5475051401550479605,\n \"guid\": \"8ecb70019a63796448768b1124086ef5\",\n \"type\": 3\n }\n}", + "m_PropertyGuids": [ + "83a6556e-d78a-45f4-b8a2-13076ccdab77", + "0c456893-e07e-4608-8121-3220a4f6c3be", + "b3d81d39-5c6c-4c82-9d1f-36795cedd43c" + ], + "m_PropertyIds": [ + -1226117840, + -725852216, + -1162300524 + ], + "m_Dropdowns": [], + "m_DropdownSelectedEntries": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot", + "m_ObjectId": "cf88e70b5d9849329c0adf3c779fd376", + "m_Id": 1, + "m_DisplayName": "B", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": { + "e00": 2.0, + "e01": 2.0, + "e02": 2.0, + "e03": 2.0, + "e10": 2.0, + "e11": 2.0, + "e12": 2.0, + "e13": 2.0, + "e20": 2.0, + "e21": 2.0, + "e22": 2.0, + "e23": 2.0, + "e30": 2.0, + "e31": 2.0, + "e32": 2.0, + "e33": 2.0 + }, + "m_DefaultValue": { + "e00": 1.0, + "e01": 0.0, + "e02": 0.0, + "e03": 0.0, + "e10": 0.0, + "e11": 1.0, + "e12": 0.0, + "e13": 0.0, + "e20": 0.0, + "e21": 0.0, + "e22": 1.0, + "e23": 0.0, + "e30": 0.0, + "e31": 0.0, + "e32": 0.0, + "e33": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "cfb8a383070e44878950e7e04e3584c3", + "m_Id": 0, + "m_DisplayName": "Tex", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tex", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "d1ea4f0250a34d99863ee930d384b759", + "m_ActiveSubTarget": { + "m_Id": "d540221bfe644d0c8d8de4c01449dee6" + }, + "m_AllowMaterialOverride": true, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": true, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_CustomEditorGUI": "UnityGLTF.PBRGraphUniversalGUI", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "d2f2eacbae84474bae0bdb99abc6a0e6", + "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.Vector1MaterialSlot", + "m_ObjectId": "d48ccf4b057d459ea93e84d0e6d43e43", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "d540221bfe644d0c8d8de4c01449dee6" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d62362e7b1db41b5b2850ca4f7727193", + "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": "a482fd18440e4922afab82f12dd388ad" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInTarget", + "m_ObjectId": "de2d39e22ef549f58ed7b2a1f989a770", + "m_ActiveSubTarget": { + "m_Id": "643c6f6393984e12a7f9d46bdf4b0d0c" + }, + "m_AllowMaterialOverride": true, + "m_SurfaceType": 0, + "m_ZWriteControl": 0, + "m_ZTestMode": 4, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": true, + "m_CustomEditorGUI": "UnityGLTF.PBRGraphGUI" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PropertyNode", + "m_ObjectId": "e8eeaf53ed7e44cf9b859265dbcceec8", + "m_Group": { + "m_Id": "c1f6d9e695904fea9b3abdc1e683f2c8" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 1031.0001220703125, + "y": -316.0, + "width": 227.0, + "height": 33.999969482421878 + } + }, + "m_Slots": [ + { + "m_Id": "b43ee4b8c16349e1a608f0614dfa31d7" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "2ef8958a8ad04fc48a4990966c393b9a" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDLitSubTarget", + "m_ObjectId": "ec903d4fe369487a99f1706f50daa8d5" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "ecde0983554943cd81a917127fad3655", + "m_Id": 0, + "m_DisplayName": "Alpha Clip Threshold", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "AlphaClipThreshold", + "m_StageCapability": 2, + "m_Value": 0.5, + "m_DefaultValue": 0.5, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "edee52016d324d04b248f4f255882edb", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "eef506e16f0d4e7fabba8e363f9f7b5b", + "m_Id": 1, + "m_DisplayName": "On", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "On", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "f99c7d64d64e494f9fa89870d003303e", + "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": "d2f2eacbae84474bae0bdb99abc6a0e6" + } + ], + "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.Vector4MaterialSlot", + "m_ObjectId": "fa713a0965784318898f7198633adc19", + "m_Id": 2, + "m_DisplayName": "Original_UV", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Original_UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph.meta new file mode 100644 index 0000000..81d92c3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/ShaderGraph/UnlitGraph.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 59541e6caf586ca4f96ccf48a4813a51 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc new file mode 100644 index 0000000..a92b55a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc @@ -0,0 +1,272 @@ +// Upgrade NOTE: replaced 'UNITY_INSTANCE_ID' with 'UNITY_VERTEX_INPUT_INSTANCE_ID' + +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +#ifndef UNITY_STANDARD_INPUT_INCLUDED +#define UNITY_STANDARD_INPUT_INCLUDED + +#include "UnityCG.cginc" +#include "UnityStandardConfig.cginc" +#include "UnityPBSLighting.cginc" // TBD: remove +#include "UnityStandardUtils.cginc" + +//--------------------------------------- +// Directional lightmaps & Parallax require tangent space too +#if (_NORMALMAP || DIRLIGHTMAP_COMBINED || _PARALLAXMAP) + #define _TANGENT_TO_WORLD 1 +#endif + +#if (_DETAIL_MULX2 || _DETAIL_MUL || _DETAIL_ADD || _DETAIL_LERP) + #define _DETAIL 1 +#endif + +//--------------------------------------- +half4 _Color; +half _Cutoff; + +sampler2D _MainTex; +float4 _MainTex_ST; + +sampler2D _DetailAlbedoMap; +float4 _DetailAlbedoMap_ST; + +sampler2D _BumpMap; +half _BumpScale; + +sampler2D _DetailMask; +sampler2D _DetailNormalMap; +half _DetailNormalMapScale; + +sampler2D _SpecGlossMap; +sampler2D _MetallicGlossMap; +half _Metallic; +half _Glossiness; + +sampler2D _OcclusionMap; +half _OcclusionStrength; + +sampler2D _ParallaxMap; +half _Parallax; +half _UVSec; + +half4 _EmissionColor; +sampler2D _EmissionMap; +float4 _EmissionMap_ST; + +//------------------------------------------------------------------------------------- +// Input functions + +struct VertexInput +{ + float4 vertex : POSITION; + half3 normal : NORMAL; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; +#if defined(DYNAMICLIGHTMAP_ON) || defined(UNITY_PASS_META) + float2 uv2 : TEXCOORD2; +#endif +#ifdef _TANGENT_TO_WORLD + half4 tangent : TANGENT; +#endif +#if defined(UNITY_VERTEX_INPUT_INSTANCE_ID) + UNITY_VERTEX_INPUT_INSTANCE_ID +#else + UNITY_VERTEX_INPUT_INSTANCE_ID +#endif +}; + +float4 TexCoords(VertexInput v) +{ + float4 texcoord; + texcoord.xy = TRANSFORM_TEX(v.uv0, _MainTex); // Always source from uv0 + texcoord.zw = TRANSFORM_TEX(((_UVSec == 0) ? v.uv0 : v.uv1), _DetailAlbedoMap); + return texcoord; +} + +half DetailMask(float2 uv) +{ + return tex2D (_DetailMask, uv).a; +} + +#if defined(VERTEX_COLOR_ON) +half3 Albedo(float4 texcoords, half4 color) +#else +half3 Albedo(float4 texcoords) +#endif +{ + half3 albedo = _Color.rgb * tex2D(_MainTex, texcoords.xy).rgb; + +#if _DETAIL + #if (SHADER_TARGET < 30) + // SM20: instruction count limitation + // SM20: no detail mask + half mask = 1; + #else + half mask = DetailMask(texcoords.xy); + #endif + half3 detailAlbedo = tex2D (_DetailAlbedoMap, texcoords.zw).rgb; + #if _DETAIL_MULX2 + albedo *= LerpWhiteTo (detailAlbedo * unity_ColorSpaceDouble.rgb, mask); + #elif _DETAIL_MUL + albedo *= LerpWhiteTo (detailAlbedo, mask); + #elif _DETAIL_ADD + albedo += detailAlbedo * mask; + #elif _DETAIL_LERP + albedo = lerp (albedo, detailAlbedo, mask); + #endif +#endif + return albedo; +} + +half Alpha(float2 uv) +{ +#if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) + return _Color.a; +#else + return tex2D(_MainTex, uv).a * _Color.a; +#endif +} + +half Occlusion(float2 uv) +{ +#if (SHADER_TARGET < 30) + // SM20: instruction count limitation + // SM20: simpler occlusion + return tex2D(_OcclusionMap, uv).r; +#else + half occ = tex2D(_OcclusionMap, uv).r; + return LerpOneTo (occ, _OcclusionStrength); +#endif +} + +half4 SpecularGloss(float2 uv) +{ + half4 sg; +#ifdef _SPECGLOSSMAP + #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) + sg.rgb = tex2D(_SpecGlossMap, uv).rgb; + sg.a = tex2D(_MainTex, uv).a; + #else + sg = tex2D(_SpecGlossMap, uv); + #endif + sg *= half4(_SpecColor.rgb, _Glossiness); +#else + sg.rgb = _SpecColor.rgb; + #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + sg.a = tex2D(_MainTex, uv).a * _Glossiness; + #else + sg.a = _Glossiness; + #endif +#endif + return sg; +} + +half2 MetallicGloss(float2 uv) +{ + half2 mg; + +#ifdef _METALLICGLOSSMAP + #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + mg.r = tex2D(_MetallicGlossMap, uv).b; + mg.g = tex2D(_MainTex, uv).a; + #else + mg = tex2D(_MetallicGlossMap, uv).bg; + #endif + mg *= half2(_Metallic, _Glossiness); +#else + mg.r = _Metallic; + #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A + mg.g = tex2D(_MainTex, uv).a * _Glossiness; + #else + mg.g = _Glossiness; + #endif +#endif + // it's roughness, not glossiness. invert it + mg.g = 1.0f - mg.g; + return mg; +} + +half2 MetallicRough(float2 uv) +{ + half2 mg; + +#if UNITY_SETUP_BRDF_INPUT == MetallicSetup + #ifdef _METALLICGLOSSMAP + mg = half2(_Metallic, _Glossiness) * tex2D(_MetallicGlossMap, uv).bg; + #else + mg = half2(_Metallic, _Glossiness); + #endif +#else + #ifdef _SPECGLOSSMAP + mg.r = _Metallic; + mg.g = 1.0f - _Glossiness * tex2D(_SpecGlossMap, uv).a; + #else + mg = half2(Metallic, 1.0f - _Glossiness); + #endif +#endif + return mg; +} + +half3 Emission(float2 uv) +{ +#ifndef _EMISSION + return 0; +#else + return tex2D(_EmissionMap, TRANSFORM_TEX(uv, _EmissionMap)).rgb * _EmissionColor.rgb; +#endif +} + +// see this link regarding unpacking instructions: +// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/material.normalTextureInfo.schema.json#L13 +half3 UnpackScaleNormalGLTF(half4 packednormal, half bumpScale) +{ + float3 normal = packednormal.xyz * 2.0 - 1.0; + normal.xy *= bumpScale; + return normalize(normal); +} + +#ifdef _NORMALMAP +half3 NormalInTangentSpace(float4 texcoords) +{ + half3 normalTangent = UnpackScaleNormalGLTF(tex2D (_BumpMap, texcoords.xy), _BumpScale); + +#if _DETAIL && defined(UNITY_ENABLE_DETAIL_NORMALMAP) + half mask = DetailMask(texcoords.xy); + half3 detailNormalTangent = UnpackScaleNormal(tex2D (_DetailNormalMap, texcoords.zw), _DetailNormalMapScale); + #if _DETAIL_LERP + normalTangent = lerp( + normalTangent, + detailNormalTangent, + mask); + #else + normalTangent = lerp( + normalTangent, + BlendNormals(normalTangent, detailNormalTangent), + mask); + #endif +#endif + + return normalTangent; +} +#endif + +float4 Parallax (float4 texcoords, half3 viewDir) +{ +// D3D9/SM30 supports up to 16 samplers, skip the parallax map in case we exceed the limit +#define EXCEEDS_D3D9_SM3_MAX_SAMPLER_COUNT (defined(LIGHTMAP_ON) && defined(SHADOWS_SHADOWMASK) && defined(SHADOWS_SCREEN) && defined(_NORMALMAP) && \ + defined(_EMISSION) && defined(_DETAIL) && (defined(_METALLICGLOSSMAP) || defined(_SPECGLOSSMAP))) + +#if !defined(_PARALLAXMAP) || (SHADER_TARGET < 30) || (defined(SHADER_API_D3D9) && EXCEEDS_D3D9_SM3_MAX_SAMPLER_COUNT) + // SM20: instruction count limitation + // SM20: no parallax + return texcoords; +#else + half h = tex2D (_ParallaxMap, texcoords.xy).g; + float2 offset = ParallaxOffset1Step (h, _Parallax, viewDir); + return float4(texcoords.xy + offset, texcoords.zw + offset); +#endif + +#undef EXCEEDS_D3D9_SM3_MAX_SAMPLER_COUNT +} + +#endif // UNITY_STANDARD_INPUT_INCLUDED diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc.meta new file mode 100644 index 0000000..ac009b5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardInput.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2e41f417e6564ab40b7c213e7ebe5183 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc new file mode 100644 index 0000000..382b0ff --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc @@ -0,0 +1,191 @@ +// Upgrade NOTE: replaced 'UNITY_INSTANCE_ID' with 'UNITY_VERTEX_INPUT_INSTANCE_ID' + +// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) + +#ifndef UNITY_STANDARD_SHADOW_INCLUDED +#define UNITY_STANDARD_SHADOW_INCLUDED + +// NOTE: had to split shadow functions into separate file, +// otherwise compiler gives trouble with LIGHTING_COORDS macro (in UnityStandardCore.cginc) + + +#include "UnityCG.cginc" +#include "UnityStandardConfig.cginc" +#include "UnityStandardUtils.cginc" + +#if (defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)) && defined(UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS) + #define UNITY_STANDARD_USE_DITHER_MASK 1 +#endif + +// Need to output UVs in shadow caster, since we need to sample texture and do clip/dithering based on it +#if defined(_ALPHATEST_ON) || defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) +#define UNITY_STANDARD_USE_SHADOW_UVS 1 +#endif + +// Has a non-empty shadow caster output struct (it's an error to have empty structs on some platforms...) +#if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS) +#define UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT 1 +#endif + +#ifdef UNITY_STEREO_INSTANCING_ENABLED +#define UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT 1 +#endif + + +half4 _Color; +half _Cutoff; +sampler2D _MainTex; +float4 _MainTex_ST; +#ifdef UNITY_STANDARD_USE_DITHER_MASK +sampler3D _DitherMaskLOD; +#endif + +// Handle PremultipliedAlpha from Fade or Transparent shading mode +half4 _SpecColor; +half _Metallic; +#ifdef _SPECGLOSSMAP +sampler2D _SpecGlossMap; +#endif +#ifdef _METALLICGLOSSMAP +sampler2D _MetallicGlossMap; +#endif + +#if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP) +sampler2D _ParallaxMap; +half _Parallax; +#endif + +half MetallicSetup_ShadowGetOneMinusReflectivity(half2 uv) +{ + half metallicity = _Metallic; + #ifdef _METALLICGLOSSMAP + metallicity *= tex2D(_MetallicGlossMap, uv).b; + #endif + return OneMinusReflectivityFromMetallic(metallicity); +} + +half SpecularSetup_ShadowGetOneMinusReflectivity(half2 uv) +{ + half3 specColor = _SpecColor.rgb; + #ifdef _SPECGLOSSMAP + specColor *= tex2D(_SpecGlossMap, uv).rgb; + #endif + return (1 - SpecularStrength(specColor)); +} + +// SHADOW_ONEMINUSREFLECTIVITY(): workaround to get one minus reflectivity based on UNITY_SETUP_BRDF_INPUT +#define SHADOW_JOIN2(a, b) a##b +#define SHADOW_JOIN(a, b) SHADOW_JOIN2(a,b) +#define SHADOW_ONEMINUSREFLECTIVITY SHADOW_JOIN(UNITY_SETUP_BRDF_INPUT, _ShadowGetOneMinusReflectivity) + +struct VertexInput +{ + float4 vertex : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; + #if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP) + half4 tangent : TANGENT; + #endif + #if defined(UNITY_VERTEX_INPUT_INSTANCE_ID) + UNITY_VERTEX_INPUT_INSTANCE_ID + #else + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif +}; + +#ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT +struct VertexOutputShadowCaster +{ + V2F_SHADOW_CASTER_NOPOS + #if defined(UNITY_STANDARD_USE_SHADOW_UVS) + float2 tex : TEXCOORD1; + + #if defined(_PARALLAXMAP) + half4 tangentToWorldAndParallax[3]: TEXCOORD2; // [3x3:tangentToWorld | 1x3:viewDirForParallax] + #endif + #endif +}; +#endif + +#ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT +struct VertexOutputStereoShadowCaster +{ + UNITY_VERTEX_OUTPUT_STEREO +}; +#endif + +// We have to do these dances of outputting SV_POSITION separately from the vertex shader, +// and inputting VPOS in the pixel shader, since they both map to "POSITION" semantic on +// some platforms, and then things don't go well. + + +void vertShadowCaster (VertexInput v, + #ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT + out VertexOutputShadowCaster o, + #endif + #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT + out VertexOutputStereoShadowCaster os, + #endif + out float4 opos : SV_POSITION) +{ + UNITY_SETUP_INSTANCE_ID(v); + #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(os); + #endif + TRANSFER_SHADOW_CASTER_NOPOS(o,opos) + #if defined(UNITY_STANDARD_USE_SHADOW_UVS) + o.tex = TRANSFORM_TEX(v.uv0, _MainTex); + + #ifdef _PARALLAXMAP + TANGENT_SPACE_ROTATION; + half3 viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex)); + o.tangentToWorldAndParallax[0].w = viewDirForParallax.x; + o.tangentToWorldAndParallax[1].w = viewDirForParallax.y; + o.tangentToWorldAndParallax[2].w = viewDirForParallax.z; + #endif + #endif +} + +half4 fragShadowCaster ( +#ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT + VertexOutputShadowCaster i +#endif +#ifdef UNITY_STANDARD_USE_DITHER_MASK + , UNITY_VPOS_TYPE vpos : VPOS +#endif + ) : SV_Target +{ + #if defined(UNITY_STANDARD_USE_SHADOW_UVS) + #if defined(_PARALLAXMAP) && (SHADER_TARGET >= 30) + //On d3d9 parallax can also be disabled on the fwd pass when too many sampler are used. See EXCEEDS_D3D9_SM3_MAX_SAMPLER_COUNT. Ideally we should account for that here as well. + half3 viewDirForParallax = normalize( half3(i.tangentToWorldAndParallax[0].w,i.tangentToWorldAndParallax[1].w,i.tangentToWorldAndParallax[2].w) ); + fixed h = tex2D (_ParallaxMap, i.tex.xy).g; + half2 offset = ParallaxOffset1Step (h, _Parallax, viewDirForParallax); + i.tex.xy += offset; + #endif + + half alpha = tex2D(_MainTex, i.tex).a * _Color.a; + #if defined(_ALPHATEST_ON) + clip (alpha - _Cutoff); + #endif + #if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) + #if defined(_ALPHAPREMULTIPLY_ON) + half outModifiedAlpha; + PreMultiplyAlpha(half3(0, 0, 0), alpha, SHADOW_ONEMINUSREFLECTIVITY(i.tex), outModifiedAlpha); + alpha = outModifiedAlpha; + #endif + #if defined(UNITY_STANDARD_USE_DITHER_MASK) + // Use dither mask for alpha blended shadows, based on pixel position xy + // and alpha level. Our dither texture is 4x4x16. + half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25,alpha*0.9375)).a; + clip (alphaRef - 0.01); + #else + clip (alpha - _Cutoff); + #endif + #endif + #endif // #if defined(UNITY_STANDARD_USE_SHADOW_UVS) + + SHADOW_CASTER_FRAGMENT(i) +} + +#endif // UNITY_STANDARD_SHADOW_INCLUDED diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc.meta new file mode 100644 index 0000000..c2a428d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/UnityStandardShadow.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 186b7b45309a8964e99df9437a41271e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader b/Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader new file mode 100644 index 0000000..6fb6bb3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader @@ -0,0 +1,63 @@ +Shader "GLTF/Unlit" +{ + Properties + { + _Color("Base Color Factor", Color) = (1,1,1,1) + _MainTex("Base Color Texture", 2D) = "white" {} + } + SubShader + { + Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} + + Lighting Off + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 color : COLOR; + UNITY_FOG_COORDS(1) + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + float4 _Color; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + fixed4 col = tex2D(_MainTex, i.uv) * _Color * i.color; + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } + FallBack "Unlit/Color" +} diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader.meta new file mode 100644 index 0000000..fb6f18e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/Unlit.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4d20effaf200f604db8b73f8e6a2e386 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc b/Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc new file mode 100644 index 0000000..032fbbe --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc @@ -0,0 +1,134 @@ +#ifndef VERTEX_COLOR_INCLUDED +#define VERTEX_COLOR_INCLUDED + +#include "UnityCG.cginc" +#include "UnityStandardInput.cginc" +#include "UnityStandardCoreForward.cginc" + +// Structure for holding the return type of vertBase and the color information. For vertBase definition see +// C:\Program Files\Unity\Hub\Editor\2018.4.14f1\Editor\Data\CGIncludes\UnityStandardCoreForward.cginc +struct WrappedVertexOutput { +#if UNITY_STANDARD_SIMPLE + VertexOutputBaseSimple innerValue; +#else + VertexOutputForwardBase innerValue; +#endif + fixed4 color : COLOR; +}; + +// Simple replacement for vertBase that captures the additional color information needed later +WrappedVertexOutput vert_vcol(appdata_full v) +{ + // Save the color information + WrappedVertexOutput o; + o.color = v.color; + + // Forward this call to the default vertBase + VertexInput vi + UNITY_TRANSFER_INSTANCE_ID(v, vi); + vi.vertex = v.vertex; + vi.normal = v.normal; + vi.uv0 = v.texcoord; + vi.uv1 = v.texcoord1; +#if defined(DYNAMICLIGHTMAP_ON) || defined(UNITY_PASS_META) + vi.uv2 = v.tetcoord2; +#endif +#ifdef _TANGENT_TO_WORLD + vi.tangent = v.tangent; +#endif + o.innerValue = vertBase(vi); + + return o; +} + +#if UNITY_STANDARD_SIMPLE +half4 frag_vcol(WrappedVertexOutput wvo) : SV_Target +{ + // Put the original output from vertBase in a variable called 'i' so the code can be cleanly + // copy/pasted, as well as for any macros (e.g. FRAGMENT_SETUP) that assume that naming convention. + VertexOutputBaseSimple i = wvo.innerValue; + + // The following section is copied from the fragBase implementation, found in + // C:\Program Files\Unity\Hub\Editor\2018.4.14f1\Editor\Data\CGIncludes\UnityStandardCoreForwardSimple.cginc, + // with the name fragForwardBaseSimpleInternal. It has been modified to + // include a section to modify the diffColor after it is calculated but before + // it is used in the remaining calculations. + UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy); + + FragmentCommonData s = FragmentSetupSimple(i); + + UnityLight mainLight = MainLightSimple(i, s); + +#if !defined(LIGHTMAP_ON) && defined(_NORMALMAP) + half ndotl = saturate(dot(s.tangentSpaceNormal, i.tangentSpaceLightDir)); +#else + half ndotl = saturate(dot(s.normalWorld, mainLight.dir)); +#endif + + //we can't have worldpos here (not enough interpolator on SM 2.0) so no shadow fade in that case. + half shadowMaskAttenuation = UnitySampleBakedOcclusion(i.ambientOrLightmapUV, 0); + half realtimeShadowAttenuation = SHADOW_ATTENUATION(i); + half atten = UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, 0); + + // Start: Modified section + s.diffColor.x *= wvo.color.x; + s.diffColor.y *= wvo.color.y; + s.diffColor.z *= wvo.color.z; + s.alpha *= wvo.color.a; + // End: Modified section + + half occlusion = Occlusion(i.tex.xy); + half rl = dot(REFLECTVEC_FOR_SPECULAR(i, s), LightDirForSpecular(i, mainLight)); + + UnityGI gi = FragmentGI(s, occlusion, i.ambientOrLightmapUV, atten, mainLight); + half3 attenuatedLightColor = gi.light.color * ndotl; + + half3 c = BRDF3_Indirect(s.diffColor, s.specColor, gi.indirect, PerVertexGrazingTerm(i, s), PerVertexFresnelTerm(i)); + c += BRDF3DirectSimple(s.diffColor, s.specColor, s.smoothness, rl) * attenuatedLightColor; + c += Emission(i.tex.xy); + + UNITY_APPLY_FOG(i.fogCoord, c); + + return OutputForward(half4(c, 1), s.alpha); +} +#else +half4 frag_vcol(WrappedVertexOutput wvo) : SV_Target +{ + // Put the original output from vertBase in a variable called 'i' so the code can be cleanly + // copy/pasted, as well as for any macros (e.g. FRAGMENT_SETUP) that assume that naming convention. + VertexOutputForwardBase i = wvo.innerValue; + + // The following section is copied from the fragBase implementation, found in + // C:\Program Files\Unity\Hub\Editor\2018.4.14f1\Editor\Data\CGIncludes\UnityStandardCore.cginc, + // with the name fragForwardBaseInternal. It has been modified to + // include a section to modify the diffColor after it is calculated but before + // it is used in the remaining calculations. + UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy); + + FRAGMENT_SETUP(s) + + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + UnityLight mainLight = MainLight(); + UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld); + + // Start: Modified section + s.diffColor.x *= wvo.color.x; + s.diffColor.y *= wvo.color.y; + s.diffColor.z *= wvo.color.z; + s.alpha *= wvo.color.a; + // End: Modified section + + half occlusion = Occlusion(i.tex.xy); + UnityGI gi = FragmentGI(s, occlusion, i.ambientOrLightmapUV, atten, mainLight); + + half4 c = UNITY_BRDF_PBS(s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, gi.light, gi.indirect); + c.rgb += Emission(i.tex.xy); + + UNITY_EXTRACT_FOG_FROM_EYE_VEC(i); + UNITY_APPLY_FOG(_unity_fogCoord, c.rgb); + return OutputForward(c, s.alpha); +} +#endif +#endif diff --git a/Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc.meta b/Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc.meta new file mode 100644 index 0000000..fd59d28 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/Shaders/VertexColor.cginc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a7df7fe42cec8834bbf64612f5d683b0 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef b/Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef new file mode 100644 index 0000000..41fa4fa --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef @@ -0,0 +1,62 @@ +{ + "name": "UnityGLTFScripts", + "rootNamespace": "", + "references": [ + "GLTFSerialization", + "Unity.Timeline", + "Ktx", + "UnityGLTF.Helpers", + "Unity.InputSystem", + "Unity.Animation.Rigging" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.atteneder.ktx", + "expression": "1.0.0", + "define": "HAVE_KTX" + }, + { + "name": "com.unity.timeline", + "expression": "1.0.0", + "define": "HAVE_TIMELINE" + }, + { + "name": "com.unity.modules.physics", + "expression": "1.0.0", + "define": "UNITY_PHYSICS" + }, + { + "name": "com.unity.modules.unitywebrequest", + "expression": "1.0.0", + "define": "UNITY_WEBREQUEST" + }, + { + "name": "com.unity.modules.imgui", + "expression": "1.0.0", + "define": "UNITY_IMGUI" + }, + { + "name": "com.unity.modules.animation", + "expression": "1.0.0", + "define": "UNITY_ANIMATION" + }, + { + "name": "com.unity.modules.imageconversion", + "expression": "1.0.0", + "define": "UNITY_IMAGECONVERSION" + }, + { + "name": "com.unity.inputsystem", + "expression": "1.0.0", + "define": "HAVE_INPUTSYSTEM" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef.meta b/Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef.meta new file mode 100644 index 0000000..5ef7d04 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Runtime/UnityGLTFScripts.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 18d18f811ba286c49814567a3cfba688 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes.meta new file mode 100644 index 0000000..ba02057 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e2ebae7806e1bc64b947089670fa2e6e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity new file mode 100644 index 0000000..733da46 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &10002063 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &328853373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328853379} + - component: {fileID: 328853378} + - component: {fileID: 328853377} + - component: {fileID: 328853376} + - component: {fileID: 328853375} + - component: {fileID: 328853374} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &328853374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &328853375 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!124 &328853376 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!92 &328853377 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!20 &328853378 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &328853379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &979359784 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 979359786} + - component: {fileID: 979359785} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &979359785 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &979359786 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1667736112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1667736114} + - component: {fileID: 1667736113} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1667736113 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1667736114 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity.meta new file mode 100644 index 0000000..5d946f8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AnimatedCube.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fb84f951a6d047a42954ae48b885521d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity new file mode 100644 index 0000000..117f399 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity @@ -0,0 +1,525 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &307803099 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 307803105} + - component: {fileID: 307803104} + - component: {fileID: 307803103} + - component: {fileID: 307803102} + - component: {fileID: 307803101} + - component: {fileID: 307803100} + m_Layer: 0 + m_Name: MainCamera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &307803100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 307803099} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &307803101 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 307803099} + m_Enabled: 1 +--- !u!124 &307803102 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 307803099} + m_Enabled: 1 +--- !u!92 &307803103 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 307803099} + m_Enabled: 1 +--- !u!20 &307803104 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 307803099} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &307803105 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 307803099} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &333812304 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 333812306} + - component: {fileID: 333812305} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &333812305 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 333812304} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &333812306 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 333812304} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1098265473 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1098265475} + - component: {fileID: 1098265474} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1098265474 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1098265473} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1098265475 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1098265473} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1653655791 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/BoomBox/glTF/BoomBox.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + m_RemovedComponents: + - {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1653655792 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1000013594771676, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + m_PrefabInstance: {fileID: 1653655791} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1653655794 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1653655792} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0fec5969022b49741878ab5b33c551bf, type: 3} + m_Name: + m_EditorClassIdentifier: + asset0Path: BoomBox/glTF/BoomBox.gltf + asset1Path: Lantern/glTF/Lantern.gltf + Multithreaded: 1 + MaximumLod: 300 +--- !u!1 &1986779721 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1986779725} + - component: {fileID: 1986779724} + - component: {fileID: 1986779723} + - component: {fileID: 1986779722} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1986779722 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986779721} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1986779723 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986779721} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1986779724 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986779721} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1986779725 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986779721} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity.meta new file mode 100644 index 0000000..afd8591 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/AssetMergeTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bd1231aa6ce5b384c81e0045766c6db2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity new file mode 100644 index 0000000..35b2ce2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity @@ -0,0 +1,375 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &361668280 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 361668281} + - component: {fileID: 361668282} + m_Layer: 0 + m_Name: BenchmarkRunner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &361668281 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361668280} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &361668282 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361668280} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2978836e0eec3a64c96abe7acbc0e0fb, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUrls: + - http://localhost:8080/BoomBox/glTF/BoomBox.gltf + - http://localhost:8080/Lantern/glTF/Lantern.gltf + - http://localhost:8080/Corset/glTF/Corset.gltf + NumberOfIterations: 5 + SaveCSV: 1 +--- !u!1 &1248756964 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1248756969} + - component: {fileID: 1248756968} + - component: {fileID: 1248756967} + - component: {fileID: 1248756966} + - component: {fileID: 1248756965} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1248756965 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1248756964} + m_Enabled: 1 +--- !u!124 &1248756966 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1248756964} + m_Enabled: 1 +--- !u!92 &1248756967 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1248756964} + m_Enabled: 1 +--- !u!20 &1248756968 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1248756964} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1248756969 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1248756964} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1767769692 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1767769694} + - component: {fileID: 1767769693} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1767769693 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767769692} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1767769694 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767769692} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1962933998 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1962934000} + - component: {fileID: 1962933999} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1962933999 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1962933998} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1962934000 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1962933998} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity.meta new file mode 100644 index 0000000..7e117b0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Benchmark.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e67b7ff194f3d0c4bbd1c24f3fcf7d09 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity new file mode 100644 index 0000000..fe52ded --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity @@ -0,0 +1,507 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &189454042 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/BoomBox/glTF-Binary/BoomBox.glb + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/BoomBox/glTF-Binary/BoomBox.glb + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &908017463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 908017465} + - component: {fileID: 908017464} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &908017464 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &908017465 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1742858399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1742858401} + - component: {fileID: 1742858400} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1742858400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1742858399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1742858401 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1742858399} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity.meta new file mode 100644 index 0000000..88e0d0f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBoomBoxTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7bdca45e8c776c540bb1483ed5848eec +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity new file mode 100644 index 0000000..7755d3c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &908017463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 908017465} + - component: {fileID: 908017464} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &908017464 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &908017465 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1001 &1461980088 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 0.02 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 0.02 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 0.02 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Buggy/glTF-Binary/Buggy.glb + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Buggy/glTF-Binary/Buggy.glb + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1742858399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1742858401} + - component: {fileID: 1742858400} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1742858400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1742858399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1742858401 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1742858399} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity.meta new file mode 100644 index 0000000..4f6abe1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryBuggyTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1ad808956b95f394da8643e3a2b516a0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity new file mode 100644 index 0000000..dc7563a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity @@ -0,0 +1,507 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &182776192 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Corset/glTF-Binary/Corset.glb + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Corset/glTF-Binary/Corset.glb + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1044806827 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1742858401} + - component: {fileID: 1742858400} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1290886834 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1290886836} + - component: {fileID: 1290886835} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1290886835 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1290886834} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1290886836 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1290886834} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1742858400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1044806827} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1742858401 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1044806827} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity.meta new file mode 100644 index 0000000..3f52e2a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryCorsetTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ba9f47b2af06bd44c8fb7877bae29e16 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity new file mode 100644 index 0000000..6368396 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &328853373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328853379} + - component: {fileID: 328853378} + - component: {fileID: 328853377} + - component: {fileID: 328853376} + - component: {fileID: 328853375} + - component: {fileID: 328853374} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &328853374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &328853375 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!124 &328853376 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!92 &328853377 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!20 &328853378 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &328853379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &436629916 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 436629918} + - component: {fileID: 436629917} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &436629917 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 436629916} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &436629918 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 436629916} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1001 &959455602 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Lantern/glTF-Binary/Lantern.glb + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Lantern/glTF-Binary/Lantern.glb + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1643659068 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1643659070} + - component: {fileID: 1643659069} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1643659069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1643659068} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1643659070 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1643659068} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity.meta new file mode 100644 index 0000000..ea7cc6b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BinaryLanternTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6061c6963fb64694891664b8fc1674f9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity new file mode 100644 index 0000000..2910717 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity @@ -0,0 +1,507 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &358204559 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 358204561} + - component: {fileID: 358204560} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &358204560 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358204559} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &358204561 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358204559} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &683563953 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 683563959} + - component: {fileID: 683563958} + - component: {fileID: 683563957} + - component: {fileID: 683563956} + - component: {fileID: 683563955} + - component: {fileID: 683563954} + m_Layer: 0 + m_Name: MainCamera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &683563954 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &683563955 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 +--- !u!124 &683563956 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 +--- !u!92 &683563957 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 +--- !u!20 &683563958 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &683563959 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1656007881 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1656007883} + - component: {fileID: 1656007882} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1656007882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1656007881} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1656007883 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1656007881} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1835019344 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/BoomBoxWithAxes/glTF/BoomBoxWithAxes.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/BoomBoxWithAxes/glTF/BoomBoxWithAxes.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity.meta new file mode 100644 index 0000000..0dacd6b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BoomBoxTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f14687e9e9c77e541a4594944cace7b3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity new file mode 100644 index 0000000..071bd6d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &908017463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 908017465} + - component: {fileID: 908017464} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &908017464 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &908017465 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1001 &1461980088 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 0.02 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 0.02 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 0.02 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Buggy/glTF/Buggy.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Buggy/glTF/Buggy.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1742858399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1742858401} + - component: {fileID: 1742858400} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1742858400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1742858399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1742858401 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1742858399} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity.meta new file mode 100644 index 0000000..e349353 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/BuggyTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9765b46364f55db4da07dbf1c868e131 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity new file mode 100644 index 0000000..d179980 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity @@ -0,0 +1,518 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &57913627 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/Constant/Constant.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFConstant + value: + objectReference: {fileID: 4800000, guid: ede6e66a96bc7164abd2a9217b5a8b4c, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/Constant/Constant.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &415601759 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 415601764} + - component: {fileID: 415601763} + - component: {fileID: 415601762} + - component: {fileID: 415601761} + - component: {fileID: 415601760} + - component: {fileID: 415601765} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &415601760 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415601759} + m_Enabled: 1 +--- !u!124 &415601761 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415601759} + m_Enabled: 1 +--- !u!92 &415601762 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415601759} + m_Enabled: 1 +--- !u!20 &415601763 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415601759} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &415601764 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415601759} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -4.1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &415601765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415601759} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!1 &492783221 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 492783223} + - component: {fileID: 492783222} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &492783222 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 492783221} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &492783223 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 492783221} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &968481391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 968481393} + - component: {fileID: 968481392} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &968481392 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 968481391} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &968481393 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 968481391} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &976094672 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 976094676} + - component: {fileID: 976094675} + - component: {fileID: 976094674} + - component: {fileID: 976094673} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &976094673 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976094672} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &976094674 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976094672} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &976094675 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976094672} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &976094676 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 976094672} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity.meta new file mode 100644 index 0000000..9ea4887 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ConstantTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a5d0e8576c725bc42928c6b760ab9401 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity new file mode 100644 index 0000000..a5c683b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity @@ -0,0 +1,507 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1430240377 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1430240379} + - component: {fileID: 1430240378} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1430240378 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1430240377} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1430240379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1430240377} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2033690683 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2033690685} + - component: {fileID: 2033690684} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2033690684 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2033690683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &2033690685 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2033690683} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &2124777145 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Corset/glTF/Corset.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Corset/glTF/Corset.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity.meta new file mode 100644 index 0000000..a085221 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/CorsetTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b6ecc977ff0c9bc4d9c08e000d5ad2bc +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor.meta new file mode 100644 index 0000000..4043dc0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ddf7bbf31c43504480e64df86035eed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs new file mode 100644 index 0000000..86f28e3 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs @@ -0,0 +1,176 @@ +using Newtonsoft.Json; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using UnityEditor; +using UnityEngine; +using UnityGLTF.Loader; + +namespace UnityGLTF +{ + [CustomEditor(typeof(SampleModelList))] + public class SampleModelListInspector : Editor + { + private List models = null; + private bool requestedModelList = false; + private Vector2 scrollPosition = Vector2.zero; + + public override void OnInspectorGUI() + { + DrawDefaultInspector(); + serializedObject.ApplyModifiedProperties(); + + bool enabled = true; + var targetObject = serializedObject.targetObject as SampleModelList; + + if (targetObject != null) + { + enabled = targetObject.enabled; + } + + bool shouldShowList = Application.isPlaying && enabled; + + if (!shouldShowList) + { + models = null; + requestedModelList = false; + scrollPosition = Vector2.zero; + } + else + { + if (!requestedModelList) + { + requestedModelList = true; + + DownloadSampleModelList(); + } + + EditorGUILayout.LabelField("Models:"); + + if (models != null) + { + using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition)) + { + scrollPosition = scrollView.scrollPosition; + + foreach (var model in models) + { + DrawModel(model); + } + } + } + } + } + + private void DrawModel(SampleModel model) + { + using (var horizontal = new EditorGUILayout.HorizontalScope()) + { + if (model.Expanded) + { + GUILayout.Label(model.Name); + + foreach (var variant in model.Variants) + { + DrawModelLoadButton(variant.Name, variant.ModelFilePath); + } + } + else + { + DrawModelLoadButton(model.Name, model.DefaultFilePath); + } + + if (model.Variants.Count > 1) + { + model.Expanded = DrawExpandCollapseButton(model.Expanded, model.Variants.Count); + } + } + } + + private bool DrawExpandCollapseButton(bool expanded, int count) + { + string expandCollapseText = expanded ? "-" : "+"; + string buttonText = $"{expandCollapseText} ({count})"; + var buttonPressed = GUILayout.Button(buttonText, GUILayout.Width(40)); + + if (buttonPressed) + { + return !expanded; + } + else + { + return expanded; + } + } + + private void DrawModelLoadButton(string title, string modelRelativePath) + { + var currentModelPath = serializedObject.FindProperty(SampleModelList.ModelRelativePathFieldName).stringValue; + bool focused = currentModelPath == modelRelativePath; + + GUIStyle style = new GUIStyle(GUI.skin.button); + if (focused) + { + style.fontStyle = FontStyle.Bold; + } + + var buttonPressed = GUILayout.Button(title, style); + + if (buttonPressed) + { + LoadModel(modelRelativePath); + } + } + + private void LoadModel(string relativePath) + { + serializedObject.FindProperty(SampleModelList.ModelRelativePathFieldName).stringValue = relativePath; + serializedObject.FindProperty(SampleModelList.LoadThisFrameFieldName).boolValue = true; + serializedObject.ApplyModifiedProperties(); + } + + private async void DownloadSampleModelList() + { + var pathRoot = serializedObject.FindProperty(SampleModelList.PathRootFieldName).stringValue; + var manifestRelativePath = serializedObject.FindProperty(SampleModelList.ManifestRelativePathFieldName).stringValue; + + var loader = new WebRequestLoader(pathRoot); + Stream stream; + try + { + stream = await loader.LoadStreamAsync(manifestRelativePath); + } + catch (HttpRequestException) + { + Debug.LogError($"Failed to download sample model list manifest from: {pathRoot}{manifestRelativePath}", serializedObject.targetObject); + throw; + } + + var jsonReader = CreateJsonReaderFromStream(stream); + jsonReader.Read(); + var listType = SampleModelListParser.DetermineListSource(jsonReader); + + jsonReader = CreateJsonReaderFromStream(stream); + jsonReader.Read(); + + + if (listType == SampleModelListParser.ListType.SampleModels) + { + models = SampleModelListParser.ParseSampleModels(jsonReader); + } + else + { + models = SampleModelListParser.ParseAssetGeneratorModels(jsonReader); + } + } + + private JsonReader CreateJsonReaderFromStream(Stream stream) + { + stream.Seek(0, SeekOrigin.Begin); + + var streamReader = new StreamReader(stream); + + return new JsonTextReader(streamReader); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs.meta new file mode 100644 index 0000000..61712a2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f28130cf15191b44ea20112e38fb9a6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs new file mode 100644 index 0000000..6b7a939 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs @@ -0,0 +1,329 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace UnityGLTF +{ + public class SampleModelVariant + { + public SampleModelVariant(string name, string modelFilePath) + { + Name = name; + ModelFilePath = modelFilePath; + } + + public string Name { get; } + public string ModelFilePath { get; } + } + + public class SampleModel + { + public string Name; + public string ScreenshotPath; + public List Variants; + public string DefaultFilePath => Variants[0].ModelFilePath; + public bool Expanded = false; + } + + public static class SampleModelListParser + { + public enum ListType + { + SampleModels, + AssetGenerator + } + + public static ListType DetermineListSource(JsonReader reader) + { + ParseStartArray(reader, "models"); + ParseStartObject(reader, "modelOrFolder"); + + if (reader.TokenType != JsonToken.PropertyName) + { + throw new Exception("Failed to parse first property to determine list type"); + } + + string firstProperty = reader.Value.ToString(); + + switch (firstProperty.ToLowerInvariant()) + { + case "folder": + case "id": + case "models": + return ListType.AssetGenerator; + + case "name": + case "screenshot": + case "variants": + return ListType.SampleModels; + + default: + throw new FormatException("Error parsing json to determine list type"); + } + } + + public static List ParseAssetGeneratorModels(JsonReader reader) + { + var models = new List(); + + ParseStartArray(reader, "folders"); + + while (reader.TokenType != JsonToken.EndArray) + { + ParseAssetGeneratorFolder(reader, models); + } + + ParseEndArray(reader, "folders"); + + return models; + } + + private static void ParseAssetGeneratorFolder(JsonReader reader, IList models) + { + string folderName = null; + + ParseStartObject(reader, "folder"); + + while (reader.TokenType != JsonToken.EndObject) + { + if (reader.TokenType != JsonToken.PropertyName) + { + throw new Exception("Failed to parse folder property"); + } + var propertyName = reader.Value.ToString().ToLowerInvariant(); + reader.Read(); + + switch (propertyName) + { + case "folder": + folderName = ParsePropertyValueAsString(reader, propertyName); + break; + case "id": + // There will be a number. Read that and ignore it. + reader.Read(); + break; + case "models": + Debug.Assert(!string.IsNullOrEmpty(folderName), "Asset generator list should have folder listed before models."); + ParseAssetGeneratorModels(reader, models, folderName); + break; + } + } + + ParseEndObject(reader, "folder"); + } + + private static void ParseAssetGeneratorModels(JsonReader reader, IList models, string folderName) + { + ParseStartArray(reader, "models"); + + while (reader.TokenType != JsonToken.EndArray) + { + models.Add(ParseAssetGeneratorModel(reader, folderName)); + } + + ParseEndArray(reader, "models"); + } + + private static SampleModel ParseAssetGeneratorModel(JsonReader reader, string folderName) + { + var result = new SampleModel(); + result.Variants = new List(); + + ParseStartObject(reader, "model"); + + while (reader.TokenType != JsonToken.EndObject) + { + if (reader.TokenType != JsonToken.PropertyName) + { + throw new Exception("Failed to parse model property"); + } + var propertyName = reader.Value.ToString().ToLowerInvariant(); + reader.Read(); + + switch (propertyName) + { + case "filename": + var fileName = ParsePropertyValueAsString(reader, propertyName); + result.Name = fileName; + result.Variants.Add(new SampleModelVariant(result.Name, $"{folderName}/{fileName}")); + break; + case "loadable": + // There will be a bool. Read that and ignore it. + reader.Read(); + break; + case "sampleimagename": + result.ScreenshotPath = ParsePropertyValueAsString(reader, propertyName); + break; + case "camera": + ParseCamera(reader); + break; + } + } + + ParseEndObject(reader, "model"); + + return result; + } + + private static void ParseCamera(JsonReader reader) + { + ParseStartObject(reader, "camera"); + + ParseToken(reader, JsonToken.PropertyName, "translation"); + ParseStartArray(reader, "translation"); + while (reader.TokenType != JsonToken.EndArray) + { + reader.Read(); + } + ParseEndArray(reader, "translation"); + + ParseEndObject(reader, "camera"); + } + + private static void ParseToken(JsonReader reader, JsonToken expectedTokenType, string expectedString) + { + if (reader.TokenType != expectedTokenType + || reader.Value.ToString().ToLowerInvariant() != expectedString) + { + throw new Exception($"Failed to parse {expectedString}"); + } + reader.Read(); + } + + public static List ParseSampleModels(JsonReader reader) + { + var models = new List(); + + ParseStartArray(reader, "models"); + + while (reader.TokenType != JsonToken.EndArray) + { + models.Add(ParseSampleModel(reader)); + } + + ParseEndArray(reader, "models"); + + return models; + } + + private static SampleModel ParseSampleModel(JsonReader reader) + { + var result = new SampleModel(); + + ParseStartObject(reader, "model"); + + while (reader.TokenType != JsonToken.EndObject) + { + if (reader.TokenType != JsonToken.PropertyName) + { + throw new Exception("Failed to parse model property"); + } + var propertyName = reader.Value.ToString().ToLowerInvariant(); + reader.Read(); + + switch (propertyName) + { + case "name": + result.Name = ParsePropertyValueAsString(reader, propertyName); + break; + case "screenshot": + result.ScreenshotPath = ParsePropertyValueAsString(reader, propertyName); + break; + case "variants": + Debug.Assert(!string.IsNullOrEmpty(result.Name), "Model index should have a name before a list of variants."); + result.Variants = ParseVariants(reader, result.Name); + break; + } + } + + ParseEndObject(reader, "model"); + + return result; + } + + private static string ParsePropertyValueAsString(JsonReader reader, string propertyName) + { + if (reader.TokenType != JsonToken.String) + { + throw new Exception($"Failed to parse string value for {propertyName}"); + } + var result = reader.Value.ToString(); + + reader.Read(); + + return result; + } + + private static List ParseVariants(JsonReader reader, string modelName) + { + var variants = new List(); + + ParseStartObject(reader, "variants"); + + while (reader.TokenType != JsonToken.EndObject) + { + variants.Add(ParseVariant(reader, modelName)); + } + + ParseEndObject(reader, "variants"); + + return variants; + } + + private static SampleModelVariant ParseVariant(JsonReader reader, string modelName) + { + if (reader.TokenType != JsonToken.PropertyName) + { + throw new Exception("Failed to parse model variant name"); + } + string variantType = reader.Value.ToString(); + reader.Read(); + + if (reader.TokenType != JsonToken.String) + { + throw new Exception("Failed to parse model variant filename"); + } + string variantName = reader.Value.ToString(); + reader.Read(); + + return new SampleModelVariant(variantType, $"{modelName}/{variantType}/{variantName}"); + } + + private static void ParseStartObject(JsonReader reader, string objectName) + { + if (reader.TokenType != JsonToken.StartObject) + { + throw new Exception($"Failed to parse {objectName} start"); + } + reader.Read(); + } + + private static void ParseEndObject(JsonReader reader, string objectName) + { + if (reader.TokenType != JsonToken.EndObject) + { + throw new Exception($"Failed to parse {objectName} end"); + } + reader.Read(); + } + + private static void ParseStartArray(JsonReader reader, string objectName) + { + if (reader.TokenType != JsonToken.StartArray) + { + throw new Exception($"Failed to parse {objectName} start"); + } + reader.Read(); + } + + private static void ParseEndArray(JsonReader reader, string objectName) + { + if (reader.TokenType != JsonToken.EndArray) + { + throw new Exception($"Failed to parse {objectName} end"); + } + reader.Read(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs.meta new file mode 100644 index 0000000..0adfd8a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/SampleModelListParser.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59a81a17ba63ebb4a9897bfeb7693a26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef new file mode 100644 index 0000000..6da670f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef @@ -0,0 +1,23 @@ +{ + "name": "UnityGLTF.Samples.Misc.Editor", + "rootNamespace": "", + "references": [ + "UnityGLTF.Samples.Misc", + "UnityGLTFScripts", + "UnityEditor.TestRunner", + "UnityEngine.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "Newtonsoft.Json.dll" + ], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef.meta new file mode 100644 index 0000000..e0ce209 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Editor/UnityGLTF.Samples.Misc.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0ac8d19e05d7cac4c96014c85320bcb0 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity new file mode 100644 index 0000000..d15107e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity @@ -0,0 +1,955 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &16045204 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 16045209} + - component: {fileID: 16045208} + - component: {fileID: 16045207} + - component: {fileID: 16045206} + - component: {fileID: 16045205} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &16045205 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16045204} + m_Enabled: 1 +--- !u!124 &16045206 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16045204} + m_Enabled: 1 +--- !u!92 &16045207 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16045204} + m_Enabled: 1 +--- !u!20 &16045208 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16045204} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &16045209 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 16045204} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &171165375 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 171165376} + - component: {fileID: 171165379} + - component: {fileID: 171165378} + - component: {fileID: 171165377} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &171165376 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171165375} + m_LocalRotation: {x: -0, y: -0, z: 0.22258633, w: 0.974913} + m_LocalPosition: {x: 0.872, y: 0.75, z: -1.199} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 696459834} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 25.722002} +--- !u!23 &171165377 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171165375} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cf392602be42ff24690a5ef39a3abc13, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!136 &171165378 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171165375} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.5 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &171165379 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 171165375} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &322990269 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 322990271} + - component: {fileID: 322990270} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &322990270 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322990269} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &322990271 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322990269} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &578016859 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 578016861} + - component: {fileID: 578016860} + m_Layer: 0 + m_Name: TestExportScene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &578016860 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 578016859} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7538181ffb49fb8459d770ff26ed0c0e, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &578016861 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 578016859} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 696459834} + - {fileID: 1330640425} + - {fileID: 1224927894} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &696459833 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 696459834} + m_Layer: 0 + m_Name: TestNode + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &696459834 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 696459833} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1921302747} + - {fileID: 1543270391} + - {fileID: 1310634125} + - {fileID: 171165376} + - {fileID: 779185756} + m_Father: {fileID: 578016861} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &779185755 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 696459834} + m_Modifications: + - target: {fileID: 100004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_Name + value: d8 (1) + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalPosition.x + value: -1.881427 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalPosition.y + value: 0.315 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalPosition.z + value: 1.059433 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.x + value: -0.7069834 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7072302 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -89.98 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalScale.x + value: 100.00006 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalScale.y + value: 99.99998 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalScale.z + value: 100.00006 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} +--- !u!4 &779185756 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, + type: 3} + m_PrefabInstance: {fileID: 779185755} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1224927893 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 578016861} + m_Modifications: + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalPosition.x + value: -1.244 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalPosition.y + value: -0.094 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalPosition.z + value: -1.301 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.x + value: -0.6955708 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.y + value: 0.45544925 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.z + value: 0.55213785 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalRotation.w + value: 0.06237793 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -143.863 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 61.73 + objectReference: {fileID: 0} + - target: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 44.366 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, type: 3} +--- !u!4 &1224927894 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400004, guid: 78f6fd4e1f591d348a0e9cb0cec70f1e, + type: 3} + m_PrefabInstance: {fileID: 1224927893} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1310634124 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1310634125} + - component: {fileID: 1310634128} + - component: {fileID: 1310634127} + - component: {fileID: 1310634126} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1310634125 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1310634124} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.68, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 696459834} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1310634126 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1310634124} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1310634127 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1310634124} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1310634128 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1310634124} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1330640421 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1330640425} + - component: {fileID: 1330640424} + - component: {fileID: 1330640423} + - component: {fileID: 1330640422} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1330640422 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1330640421} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 4c385da771fe80b44ae83f94d0b06416, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!65 &1330640423 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1330640421} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1330640424 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1330640421} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1330640425 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1330640421} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 1.857} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 578016861} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1543270390 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1543270391} + - component: {fileID: 1543270394} + - component: {fileID: 1543270393} + - component: {fileID: 1543270392} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1543270391 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1543270390} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.62, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 696459834} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1543270392 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1543270390} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 9a5c359792450dc4b9abe336d3803be5, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!135 &1543270393 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1543270390} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1543270394 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1543270390} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1921302746 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1921302747} + - component: {fileID: 1921302750} + - component: {fileID: 1921302749} + - component: {fileID: 1921302748} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1921302747 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1921302746} + m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 696459834} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 45, z: 0} +--- !u!23 &1921302748 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1921302746} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!65 &1921302749 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1921302746} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1921302750 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1921302746} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity.meta new file mode 100644 index 0000000..50fe469 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/ExportTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1492280843c14944f8919eda7fa0fb58 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity new file mode 100644 index 0000000..7bad189 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity @@ -0,0 +1,476 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &908017463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 908017465} + - component: {fileID: 908017464} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &908017464 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &908017465 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 908017463} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1001 &1461980088 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: https://rawgit.com/sbtron/BabylonJS-glTFLoader/master/src/models/2.0/png/FarmLandDiorama/glTF/FarmLandDiorama.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: https://rawgit.com/sbtron/BabylonJS-glTFLoader/master/src/models/2.0/png/FarmLandDiorama/glTF/FarmLandDiorama.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity.meta new file mode 100644 index 0000000..6a8ffc0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/FarmlandDioramaTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: df36c2dfaf0bc35488e81c2faf022bd5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity new file mode 100644 index 0000000..39577e5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity @@ -0,0 +1,508 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030528, g: 0.49799836, b: 0.5628034, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &328853373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328853379} + - component: {fileID: 328853378} + - component: {fileID: 328853377} + - component: {fileID: 328853376} + - component: {fileID: 328853375} + - component: {fileID: 328853374} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &328853374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 2.5, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &328853375 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!124 &328853376 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!92 &328853377 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!20 &328853378 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &328853379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.5, z: -5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1039131111 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1039131113} + - component: {fileID: 1039131112} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1039131112 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039131111} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1039131113 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039131111} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1667736112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1667736114} + - component: {fileID: 1667736113} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1667736113 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1667736114 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_LocalRotation: {x: 0.16373174, y: 0.49098268, z: -0.09453057, w: 0.85040694} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 60, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &2057340142 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1000013594771676, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_Name + value: GLTF + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Lantern/glTF-pbrSpecularGlossiness/Lantern.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity.meta new file mode 100644 index 0000000..50c49ae --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternSpecGlossTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3d986f306d83ee14d96b5fb1c7e86169 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity new file mode 100644 index 0000000..7a87aa1 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &10002063 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Lantern/glTF/Lantern.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Lantern/glTF/Lantern.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &328853373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328853379} + - component: {fileID: 328853378} + - component: {fileID: 328853377} + - component: {fileID: 328853376} + - component: {fileID: 328853375} + - component: {fileID: 328853374} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &328853374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &328853375 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!124 &328853376 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!92 &328853377 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!20 &328853378 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &328853379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &979359784 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 979359786} + - component: {fileID: 979359785} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &979359785 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &979359786 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1667736112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1667736114} + - component: {fileID: 1667736113} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1667736113 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1667736114 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity.meta new file mode 100644 index 0000000..e11a48e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/LanternTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5a247e41f19cb4f40b0fe8392fd4901f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials.meta new file mode 100644 index 0000000..7fbc7e0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e0ff2e592f454da438dc0892b73cb272 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat new file mode 100644 index 0000000..2c9061f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat @@ -0,0 +1,86 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ConstantMat + m_Shader: {fileID: 4800000, guid: ede6e66a96bc7164abd2a9217b5a8b4c, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _LightMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EmissionUV: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _LightUV: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _AmbientFactor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0.2869213, g: 0.6985294, b: 0.27222103, a: 1} + - _LightmapFactor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat.meta new file mode 100644 index 0000000..b5ea76f --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/ConstantMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c385da771fe80b44ae83f94d0b06416 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat new file mode 100644 index 0000000..89783ef --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: GLTFStandardMaterial + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat.meta new file mode 100644 index 0000000..c2c8a26 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/GLTFStandardMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4f9dcff77c12f5d4d921f2e37119feed +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat new file mode 100644 index 0000000..95daf62 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Material.001 + m_Shader: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicRoughnessMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cull: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Roughness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.03254065, g: 0.062342405, b: 0.8000001, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat.meta new file mode 100644 index 0000000..8c2293d --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/Material.001.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4a17babde6711a49a45783889680696 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat new file mode 100644 index 0000000..57caedf --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TestMaterial1 + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _EMISSION + m_LightmapFlags: 1 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 1 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.4894882, g: 0.3114187, b: 0.9411765, a: 1} + - _EmissionColor: {r: 0.8014706, g: 0.10607699, b: 0.10607699, a: 1} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat.meta new file mode 100644 index 0000000..bea0129 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/TestMaterial1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9a5c359792450dc4b9abe336d3803be5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat new file mode 100644 index 0000000..ac8b556 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat @@ -0,0 +1,78 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: UnityStandardMaterial + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _ALPHAPREMULTIPLY_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 0 + m_Colors: + - _Color: {r: 1, g: 0, b: 0, a: 0.938} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat.meta new file mode 100644 index 0000000..313dc3e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Materials/UnityStandardMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf392602be42ff24690a5ef39a3abc13 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models.meta new file mode 100644 index 0000000..610a8cf --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c24f84562f8757440a0f8b47f09614c7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx new file mode 100644 index 0000000000000000000000000000000000000000..01a9d1c484cd8e727bb4cc4ff33d91a1d5646776 GIT binary patch literal 17244 zcmc&+3v?XSc^=u8CHa9LJe;IFmWL4rTb41z53u!?wXt4!WyN-UfYI(q8hf>~o!zyi zK&adVnx4Y}hn%*FNeXFAIi_iOgpeMZ(>OrD0S9Q>nj~#+!k*hLUb0}#E3q|`@L{>$v zZCJM+w{t_0M*dveu&!agEG z8m%Db6uNO>?2qB(aopaLPABcSSYdZ0Q*g zs`PFYR2ieZjcZop-U1kD`;inB|3DcowUkmfnKFK%W)uK^2Tx; zP%A@Ix0%Vt%zaiOz{d3mYTCT0tUSvMjeMtq?w8VhGzhxP{K{DQ9~F9+M920JB)HgI zLYjFUyp8JUm8ci^P(8Cw)6T#O)9!)@46JmqxwL;Yv28J~ulmN-Z$EX#@n^ns?6Iql zT=U_-{k5Xw%oq4}J8F$ywyJRr{zcX(UxUXr&cd=M_*xt@*f}P-JXAYJ?iDdBn?*3o zd|Zt{E#@OXV^2oo@kPqJz(ML2IN-J1Ww)nW#_fy0mw3M|`a&q%4a8?{Qqqwzk+Z=2~<;TSs z#^c4~7C0-8drEPyky3LL@q$++O`kzq3*Bm|e@oVKUzY%Fdj ztxhwZ#r{FNC!8G87IE2|8yiyQZbuK=siqecN;7`JQ|RY;LCzlSB1BJmR+mJhd$x=X z+1Q}loFoK-lNjP^+m_ZC=Pz&L!cY>Gx<~?*#4R`=BR!k)Tve*OewyCLQx z65PVor!{zApjwFzYV1lJN-r@a`*EvJW}x(7r;v;avy6d<5-DSxi^~>a*p`$%26M#s zmf8M5>~CKJ8s~`hY}9UZoNO=rpxaMV>emTvO7pf^!4seXokQcjxn%N5#w68zR^NmU(zW1#)oIMi z@!`;y+1_kwFS-~995JYEz|o&#_NPOvh@H(3E7nU3tlf^Yw^SS`(j!;`+Idhd$*ECY z!?fiV%Net>?nE6D5YlLCi@RZsVlAuO9xF5Y8z!}?`ILJI!2gTN{k4K?$5>DbPs$Mfj0FVw8&Hq7`3khUA2qifE2c7x6YAQje=~Kt?)tziW@NiZY0& z&mlW$XD5VBha5*e6oSSO(d-+F`D)2bo3$as&qQLQX2RK@3F7+~#kW%O!I6w@R@}k{ zQ;8FlVcNHrOAlfE*S&}{Nj6l+Sz8r`%b7W*9ZOxZ4R$EZi3qJ_8O06)XjHYY0{Q~QR8GgfxGhW;G|{0Rw6 zTY13!_C9CYxUUuCGLJ&?Ju`V5kb_VWQ7JDiqHt#J`EBUj%Wl{j|>alTlIb5{`O z93(+yq&3F_rQKYKGf>*`N}PexKBhRe;O8xK zEkyZ^Q&Z2hTo!yF?Y2^txvyxBgPSZ}QZab;z;ao6jAd13irp(flWd>2`fikGm4?!n@N_(!5lVlv%WDQ)=3sK(RC(5z~3i)PPwm=~-K{=Evxk_r1z8y`CTCSZHPc#7u#U~Y)7N*obTHeRL z4nF$W7C9O-DaAJf7pp>fFaR{1hn;FtNwIdZ4xm%?Qjj#z!N$sQ1)A?p?-DB)pn(J(hjYqS2Np0@0`mN85>`7|z;@VyeASyvw3iw4uh z{*=P*k=S_VDqt%=2m`G-RNloN05mP2wrb|gaQ=3@zTIY~Myyaf>@Uh=gxXx|FDWZW zsC{*B2@G@m?B?=ld5lnVdAB@9sJU#6NPTR8L6H8?|Rv+0wP20E)r4OWB+HL0&wgb6jNpDUPkn3#H;MLx!gU!o;7k_@+m>MxU; z2?7ZUM)}Ls8g%1KT%w23#PknPs=p4EMMK_a^BD( zmB)c&qt5r>?GB{}wQqt_b2bL~D0C478PkwsYsUqMEx&?+6iLlg!vm$y*+B` z?;^}nJJhD-(nVCciCLOfwwv;^1mZ!(-+?~Jghx}2Kcdo06V>^0T>_VXL{X3zA=;`{ z7!h>bRP_=aAJKYPFtg3%ze76GRP!jjM2RR?W+}y0bXpx%^jOXv#?y5FsFNBw7YttW zRqJlU%M*gH!GY=1t}I=mcqOWY0dL31A#fj4?DdkJ>h8g-HM`rKP|yEU78nS`2Tn}2 zT5(`Z&c9>K&SbDmWhI~Rg_nC3-KrU*lSR1zW0Hrbz01^IVEPbGHQft-%F}{F>A?5m zv7|WiMZ)*JHwxOt%Ss%jQch37g_7nXgw`q2w4tRA?U}kQM@8%-LvcxxUSh%tk+9cx<{V1V?6Dom?xE6Mb|Yy2MAh^4ua9; z>#N};Kap@!W%L1Z(TW{wE+#^AU55jRj5ByIt`I|ML;#=VpGEWz)oSFs@ytI!lG(V2 zC}k}4z0&S}@xFOfv=O7u66=jBU$@B9`0DymAXI^Zv~{dZbtcUb`6`gz$7nOve0#BX zQ=I=6ol4HCwEbe-Km@l1g9XVR)Zm z-;SH76v3Uiu0==I#uo|+nwo7~p0vNGnzSFd6u*x?w14Dp{P(B+^62&}x>MirQ;6S3 zzjuFhvv+^@YAJdTZY=G0k`p6NiUL~WA}_b;JZ#P4ul%O^zmbx2y0dV6h-<2r*B{`T z0h`yjJcE-^3;Wr3zZ#1+tL{jQSQ)#PG-wg=SCW&RFw`a&25IKwc&4$S<)tDi>PU(p zEH|AfNQ@t;Aq1~y0Sg`PXdQFJXDK9Kt{|EFU4UIHja-c%hGP>G-`Dfg??vcqo$#q< zyJDkMAIX1mGL@0bzTI}QkiV(uyK$#RN}EaGp3n|WJzf>R_15%`oB#9JA0KdcRqg4W zb?|5RCN4hm^T_*?r$2l8()-)~a(&k&PoH`92X}ryes0ai>WgkSjyyZ7Ygvu)wNDKn z079WXj_ky9#`APFd3mr3TBdar6xFHjE&xT4qG+p@WHN^DpgyC>xu*py zXd!xqmkl^lPlpxT5_Hsg;%02lhK){9)SkoI_NH4crYq+6hJx}rLIT`dxl5?FKv&OY z3W(dM{OF(3>lD&*o3#PwF(M_z9K@&|usDA!Xry}-0^Vh)k?4Q=NZ#BZ2|Jc=VBe2_ zMxBETa0QM+?0aU8iR=ThZz=vT_TgjgHKpR8h>)bjhq$V|ApR2oc}x8r1eIrl((z9b z+zE!j_&2$#Jk9Y5HO=_(V zl2@RTvQy;1}qyDe-Jd% zVTDjRDjp3xmN%o~^9QJlGb%=K;J<+5H(Z;ZI>l;-A@YAFq_SwkO^2E0wJ3yo8qKTj zBs%Y4iCr~ci2NEjxF>euKpIXb30?R5VRe1IF*$g&T>%%$iti~@_0Y{Fcvf}4oy`hU zySM>UV8j44B|RS}^<8(^DlIsS-&QDBNfb&};f*r&>1&4o;VF4uq4*{C)^BQkb)s*; z+$;a%$d^iV@CrLM0m=z8Vk24p)}f5a%HBz}GWl_r=^-@5?lHJ`qhp=0Ly?olW+(Dyz-1nK(= zTHh3XKdid^`hHQ}4Xf{2Em{`nWtZK5cQrq|hRQF%AMdWr1ifD|_BU)Qh@RIv7tc+q zgLSn9zFId`E~?sN8t>F4{a!PuRP!0_1eh2)TX7&D@j=0>LRYAWTyx|>`BBG?w;vT3 zNBODx1;`I65giP8jPo8|h>{p)bbm+1n^bL-c!UEVyPSdqe#l}T8hwL*o@gZMK*P{EuRAh_fT^|)#2 z<0KHN4h@T2CCR*9 zHBbMQl4Rb7kSBY#B$-!8%#*!UlFY02b$g>P!PL0j`={VN7A}lt7bBj`6Jw^!Y$esDT~YZLLvftWX0#-eEZMqUOo2r!;kO#;IkLLf8`xh gDER-D`2TAEvFq+VKYQ=Tcl`Rz1;5DMyJG(T0MCuGEC2ui literal 0 HcmV?d00001 diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx.meta new file mode 100644 index 0000000..343b871 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Models/d8.fbx.meta @@ -0,0 +1,108 @@ +fileFormatVersion: 2 +guid: 78f6fd4e1f591d348a0e9cb0cec70f1e +ModelImporter: + serializedVersion: 23 + fileIDToRecycleName: + 100000: Cone + 100002: Cone.001 + 100004: //RootNode + 400000: Cone + 400002: Cone.001 + 400004: //RootNode + 2300000: Cone + 2300002: Cone.001 + 3300000: Cone + 3300002: Cone.001 + 4300000: Cone + 4300002: Cone.001 + externalObjects: + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Material.001 + second: {fileID: 2100000, guid: e4a17babde6711a49a45783889680696, type: 2} + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + materialLocation: 0 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + importVisibility: 0 + importBlendShapes: 1 + importCameras: 0 + importLights: 0 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + preserveHierarchy: 0 + indexFormat: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + previousCalculatedGlobalScale: 1 + hasPreviousCalculatedGlobalScale: 0 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 0 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 1 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity new file mode 100644 index 0000000..e3f9d3e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity @@ -0,0 +1,491 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &750635813 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 750635817} + - component: {fileID: 750635816} + - component: {fileID: 750635815} + - component: {fileID: 750635814} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &750635814 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 750635813} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &750635815 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 750635813} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &750635816 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 750635813} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &750635817 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 750635813} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &758867165 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 758867171} + - component: {fileID: 758867170} + - component: {fileID: 758867169} + - component: {fileID: 758867168} + - component: {fileID: 758867167} + - component: {fileID: 758867166} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &758867166 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 758867165} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &758867167 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 758867165} + m_Enabled: 1 +--- !u!124 &758867168 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 758867165} + m_Enabled: 1 +--- !u!92 &758867169 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 758867165} + m_Enabled: 1 +--- !u!20 &758867170 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 758867165} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &758867171 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 758867165} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &804702897 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 804702899} + - component: {fileID: 804702898} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &804702898 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 804702897} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &804702899 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 804702897} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1647343056 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1647343058} + - component: {fileID: 1647343057} + m_Layer: 0 + m_Name: GLTF + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1647343057 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1647343056} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e2719fa7e09cf264492f3aa25409f37e, type: 3} + m_Name: + m_EditorClassIdentifier: + SceneIndex: 0 + Url: http://localhost:8080/MultiScene/glTF/MultiScene.gltf +--- !u!4 &1647343058 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1647343056} + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!1 &2030039726 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2030039728} + - component: {fileID: 2030039727} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2030039727 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2030039726} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &2030039728 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2030039726} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 13.331022, y: 30.760239, z: 29.008717} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity.meta new file mode 100644 index 0000000..7c82e40 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/MultiSceneTest.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ab0db09fd0021d64fb65b2f685d534ae +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity new file mode 100644 index 0000000..603a72e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &10002063 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/Lantern/glTF/Lantern.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/DamagedHelmet/glTF-Binary/DamagedHelmet.glb + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &328853373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328853379} + - component: {fileID: 328853378} + - component: {fileID: 328853377} + - component: {fileID: 328853376} + - component: {fileID: 328853375} + - component: {fileID: 328853374} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &328853374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &328853375 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!124 &328853376 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!92 &328853377 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!20 &328853378 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &328853379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &979359784 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 979359786} + - component: {fileID: 979359785} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &979359785 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &979359786 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1667736112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1667736114} + - component: {fileID: 1667736113} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1667736113 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1667736114 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity.meta new file mode 100644 index 0000000..d818247 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SciFiHelmetTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d57d27a96f86ef04a925a0d66ff55d5e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts.meta new file mode 100644 index 0000000..8ed8bcf --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3762d3d344c0ba84d89e58f7b36435af +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs new file mode 100644 index 0000000..ed4aa10 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs @@ -0,0 +1,17 @@ +using System.IO; +using UnityEngine; + +namespace UnityGLTF.Examples +{ + public class GLTFExporterTest : MonoBehaviour + { + // Use this for initialization + void Awake() + { + var exporter = new GLTFSceneExporter(new[] {transform}, new ExportOptions()); + var appPath = Application.dataPath; + var wwwPath = appPath.Substring(0, appPath.LastIndexOf("Assets")) + "www"; + exporter.SaveGLTFandBin(Path.Combine(wwwPath, "TestScene"), "TestScene"); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs.meta new file mode 100644 index 0000000..c297b0e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/GLTFExporterTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7538181ffb49fb8459d770ff26ed0c0e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs new file mode 100644 index 0000000..0e65959 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections; +using UnityEngine; +using UnityGLTF.Loader; + +namespace UnityGLTF.Examples +{ + public class MultiSceneComponent : MonoBehaviour + { + public int SceneIndex = 0; + public string Url; + + private GLTFSceneImporter _importer; + private ImportOptions _importOptions; + private string _fileName; + + void Start() + { + Debug.Log("Hit spacebar to change the scene."); + Uri uri = new Uri(Url); + var directoryPath = URIHelper.AbsoluteUriPath(uri); + _importOptions = new ImportOptions + { + DataLoader = new WebRequestLoader(directoryPath), + AsyncCoroutineHelper = gameObject.AddComponent(), + }; + _fileName = URIHelper.GetFileFromUri(uri); + + LoadScene(SceneIndex); + } + + void Update() + { + if (Input.GetKeyDown("space")) + { + SceneIndex = SceneIndex == 0 ? 1 : 0; + Debug.LogFormat("Loading scene {0}", SceneIndex); + LoadScene(SceneIndex); + } + } + + async void LoadScene(int SceneIndex) + { + foreach (Transform child in transform) + { + GameObject.Destroy(child.gameObject); + } + + _importer = new GLTFSceneImporter( + _fileName, + _importOptions + ); + + _importer.SceneParent = gameObject.transform; + await _importer.LoadSceneAsync(SceneIndex); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs.meta new file mode 100644 index 0000000..b807fc8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/MultiSceneComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2719fa7e09cf264492f3aa25409f37e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs new file mode 100644 index 0000000..373b149 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs @@ -0,0 +1,113 @@ +using UnityEngine; + +// Taken from http://wiki.unity3d.com/index.php?title=MouseOrbitImproved +namespace UnityGLTF.Examples +{ + [RequireComponent(typeof(Camera))] + [AddComponentMenu("Camera-Control/Mouse Orbit with zoom")] + public class OrbitCameraController : MonoBehaviour + { + public Vector3 targetPosition = Vector3.zero; + public float distance = 5.0f; + public float xSpeed = 120.0f; + public float ySpeed = 120.0f; + public float zoomSpeed = 0.8f; + + public float yMinLimit = -85f; + public float yMaxLimit = 85f; + + public float distanceMin = .5f; + public float distanceMax = 150f; + + private Camera _camera; + + private Rigidbody cameraRigidBody; + + private float x = 0.0f; + private float y = 0.0f; + private Vector3 prevMousePosition; + + Quaternion rotation; + + // Use this for initialization + void Start() + { + _camera = GetComponent(); + + Vector3 angles = transform.eulerAngles; + x = angles.y; + y = angles.x; + rotation = Quaternion.Euler(y, x, 0); + + prevMousePosition = Input.mousePosition; + + cameraRigidBody = GetComponent(); + + // Make the rigid body not change rotation + if (cameraRigidBody != null) + { + cameraRigidBody.freezeRotation = true; + } + } + + void LateUpdate() + { + var height = Display.main.renderingHeight; + var width = Display.main.renderingWidth; + + if (Input.GetMouseButton(0)) + { + x += Input.GetAxis("Mouse X") * xSpeed * 0.06f; + y -= Input.GetAxis("Mouse Y") * ySpeed * 0.06f; + + y = ClampAngle(y, yMinLimit, yMaxLimit); + + rotation = Quaternion.Euler(y, x, 0); + } + else if (Input.GetMouseButton(1)) + { + var prevMouseWorldPosition = ProjectScreenPointToTargetPlane(prevMousePosition); + var mouseWorldPosition = ProjectScreenPointToTargetPlane(Input.mousePosition); + + targetPosition += prevMouseWorldPosition - mouseWorldPosition; + } + + var mouseOverRenderArea = + Input.mousePosition.x >= 0 && + Input.mousePosition.x <= width && + Input.mousePosition.y >= 0 && + Input.mousePosition.y <= height; + + if (Input.GetMouseButton(0) || mouseOverRenderArea) + { + distance = Mathf.Clamp(distance * Mathf.Exp(-Input.GetAxis("Mouse ScrollWheel") * zoomSpeed), distanceMin, distanceMax); + } + + Vector3 negDistance = new Vector3(0.0f, 0.0f, -distance); + Vector3 position = rotation * negDistance + targetPosition; + + transform.rotation = rotation; + transform.position = position; + + prevMousePosition = Input.mousePosition; + } + + private Vector3 ProjectScreenPointToTargetPlane(Vector3 screenPosition) + { + var ray = _camera.ScreenPointToRay(screenPosition); + var planeDistance = distance / Mathf.Cos(Mathf.Deg2Rad * Vector3.Angle(_camera.transform.forward, ray.direction)); + + return _camera.transform.position + (ray.direction * planeDistance); + } + + public static float ClampAngle(float angle, float min, float max) + { + if (angle < -360F) + angle += 360F; + if (angle > 360F) + angle -= 360F; + return Mathf.Clamp(angle, min, max); + } + } +} + diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs.meta new file mode 100644 index 0000000..3e756a7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/OrbitCameraController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70ff706d2c89cc247a850af95597fcbb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs new file mode 100644 index 0000000..103c74b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.IO; +using System.Threading.Tasks; +using GLTF; +using GLTF.Schema; +using UnityEngine; +using UnityGLTF; +using UnityGLTF.Loader; + +namespace UnityGLTF +{ + public class RootMergeComponent : MonoBehaviour + { + public string asset0Path; + public string asset1Path; + public bool Multithreaded = true; + + public int MaximumLod = 300; + + // todo undo +#if !WINDOWS_UWP + private async Task Start() + { + var fullPath0 = Application.streamingAssetsPath + Path.DirectorySeparatorChar + asset0Path; + IDataLoader loader0 = new FileLoader(URIHelper.GetDirectoryName(fullPath0)); + + var fullPath1 = Application.streamingAssetsPath + Path.DirectorySeparatorChar + asset1Path; + IDataLoader loader1 = new FileLoader(URIHelper.GetDirectoryName(fullPath1)); + + var asset0Stream = await loader0.LoadStreamAsync(Path.GetFileName(asset0Path)); + GLTFRoot asset0Root; + GLTFParser.ParseJson(asset0Stream, out asset0Root); + + var asset1Stream = await loader1.LoadStreamAsync(Path.GetFileName(asset1Path)); + GLTFRoot asset1Root; + GLTFParser.ParseJson(asset1Stream, out asset1Root); + + string newPath = "../../" + URIHelper.GetDirectoryName(asset0Path); + + int previousBufferCount = asset1Root.Buffers.Count; + int previousImageCount = asset1Root.Images.Count; + int previousSceneCounter = asset1Root.Scenes.Count; + GLTFHelpers.MergeGLTF(asset1Root, asset0Root); + + for (int i = previousBufferCount; i < asset1Root.Buffers.Count; ++i) + { + GLTF.Schema.GLTFBuffer buffer = asset1Root.Buffers[i]; + if (!URIHelper.IsBase64Uri(buffer.Uri)) + { + buffer.Uri = newPath + buffer.Uri; + } + } + + for (int i = previousImageCount; i < asset1Root.Images.Count; ++i) + { + GLTFImage image = asset1Root.Images[i]; + if (!URIHelper.IsBase64Uri(image.Uri)) + { + image.Uri = newPath + image.Uri; + } + } + + foreach (NodeId node in asset1Root.Scenes[asset0Root.Scene.Id + previousSceneCounter].Nodes) + { + node.Value.Translation.X += 5f; + asset1Root.Scene.Value.Nodes.Add(node); + } + GLTFSceneImporter importer = new GLTFSceneImporter( + asset1Root, + null, + new ImportOptions + { + DataLoader = loader1, + AsyncCoroutineHelper = gameObject.AddComponent() + }); + + importer.MaximumLod = MaximumLod; + importer.IsMultithreaded = Multithreaded; + await importer.LoadSceneAsync(-1); + } +#endif + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs.meta new file mode 100644 index 0000000..0a641e0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/RootMergeComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0fec5969022b49741878ab5b33c551bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs new file mode 100644 index 0000000..03dbb89 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs @@ -0,0 +1,48 @@ +using UnityEngine; +using UnityGLTF; + +public class SampleModelList : MonoBehaviour +{ + public static string LoaderFieldName => nameof(loader); + public static string PathRootFieldName => nameof(pathRoot); + public static string ManifestRelativePathFieldName => nameof(manifestRelativePath); + public static string ModelRelativePathFieldName => nameof(modelRelativePath); + public static string LoadThisFrameFieldName => nameof(loadThisFrame); + + [SerializeField] + private GLTFComponent loader = null; + + [SerializeField] + private string pathRoot = "http://localhost:8080/glTF-Sample-Models/2.0/"; + +// Disable "unused private field" because it is accessed by SampleModelListInspector using serialization. +#pragma warning disable 414 + [SerializeField] + private string manifestRelativePath = "model-index.json"; +#pragma warning restore 414 + + [SerializeField] + private string modelRelativePath = null; + + [SerializeField] + private bool loadThisFrame = false; + + private async void Update() + { + if (loadThisFrame) + { + loadThisFrame = false; + + var path = pathRoot + modelRelativePath; + + Debug.Log(path, this); + + if (loader.LastLoadedScene != null) + { + Destroy(loader.LastLoadedScene); + } + loader.GLTFUri = path; + await loader.Load(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs.meta new file mode 100644 index 0000000..ba6d16c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SampleModelList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: df99c459245b3cd40be06aca24a19170 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs new file mode 100644 index 0000000..f778b4e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs @@ -0,0 +1,238 @@ +// MIT License - Copyright (c) 2016 Can Güney Aksakalli +using UnityEngine; +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Threading; + +namespace UnityGLTF.Examples +{ + class SimpleHTTPServer + { + private readonly string[] _indexFiles = + { + "index.html", + "index.htm", + "default.html", + "default.htm" + }; + +#if !WINDOWS_UWP + private static IDictionary _mimeTypeMappings = + new Dictionary(StringComparer.InvariantCultureIgnoreCase) + { +#else + private static IDictionary _mimeTypeMappings = +new Dictionary(StringComparer.OrdinalIgnoreCase) { +#endif + + #region extension to MIME type list + + {".asf", "video/x-ms-asf"}, + {".asx", "video/x-ms-asf"}, + {".avi", "video/x-msvideo"}, + {".bin", "application/octet-stream"}, + {".cco", "application/x-cocoa"}, + {".crt", "application/x-x509-ca-cert"}, + {".css", "text/css"}, + {".deb", "application/octet-stream"}, + {".der", "application/x-x509-ca-cert"}, + {".dll", "application/octet-stream"}, + {".dmg", "application/octet-stream"}, + {".ear", "application/java-archive"}, + {".eot", "application/octet-stream"}, + {".exe", "application/octet-stream"}, + {".flv", "video/x-flv"}, + {".gif", "image/gif"}, + {".gltf", "model/gltf+json"}, + {".glb", "model/gltf-binary"}, + {".hqx", "application/mac-binhex40"}, + {".htc", "text/x-component"}, + {".htm", "text/html"}, + {".html", "text/html"}, + {".ico", "image/x-icon"}, + {".img", "application/octet-stream"}, + {".iso", "application/octet-stream"}, + {".jar", "application/java-archive"}, + {".jardiff", "application/x-java-archive-diff"}, + {".jng", "image/x-jng"}, + {".jnlp", "application/x-java-jnlp-file"}, + {".jpeg", "image/jpeg"}, + {".jpg", "image/jpeg"}, + {".js", "application/x-javascript"}, + {".json", "application/json"}, + {".mml", "text/mathml"}, + {".mng", "video/x-mng"}, + {".mov", "video/quicktime"}, + {".mp3", "audio/mpeg"}, + {".mpeg", "video/mpeg"}, + {".mpg", "video/mpeg"}, + {".msi", "application/octet-stream"}, + {".msm", "application/octet-stream"}, + {".msp", "application/octet-stream"}, + {".pdb", "application/x-pilot"}, + {".pdf", "application/pdf"}, + {".pem", "application/x-x509-ca-cert"}, + {".pl", "application/x-perl"}, + {".pm", "application/x-perl"}, + {".png", "image/png"}, + {".prc", "application/x-pilot"}, + {".ra", "audio/x-realaudio"}, + {".rar", "application/x-rar-compressed"}, + {".rpm", "application/x-redhat-package-manager"}, + {".rss", "text/xml"}, + {".run", "application/x-makeself"}, + {".sea", "application/x-sea"}, + {".shtml", "text/html"}, + {".sit", "application/x-stuffit"}, + {".swf", "application/x-shockwave-flash"}, + {".tcl", "application/x-tcl"}, + {".tk", "application/x-tcl"}, + {".txt", "text/plain"}, + {".war", "application/java-archive"}, + {".wbmp", "image/vnd.wap.wbmp"}, + {".wmv", "video/x-ms-wmv"}, + {".xml", "text/xml"}, + {".xpi", "application/x-xpinstall"}, + {".zip", "application/zip"}, + + #endregion + }; + private Thread _serverThread; + private string _rootDirectory; +#if !WINDOWS_UWP + private HttpListener _listener; +#endif + private int _port = default; + + public int Port + { + get { return _port; } + private set { } + } + + /// + /// Construct server with given port. + /// + /// Directory path to serve. + /// Port of the server. + public SimpleHTTPServer(string path, int port) + { + this.Initialize(path, port); + } + + /// + /// Construct server with suitable port. + /// + /// Directory path to serve. + public SimpleHTTPServer(string path) + { +#if !WINDOWS_UWP + //get an empty port + TcpListener l = new TcpListener(IPAddress.Loopback, 0); + l.Start(); + int port = ((IPEndPoint)l.LocalEndpoint).Port; + l.Stop(); + this.Initialize(path, port); +#endif + } + + /// + /// Stop server and dispose all functions. + /// + public void Stop() + { +#if !WINDOWS_UWP + _serverThread.Abort(); + _listener.Stop(); +#endif + } + + private void Listen() + { +#if !WINDOWS_UWP + _listener = new HttpListener(); + _listener.Prefixes.Add("http://*:" + _port.ToString() + "/"); + _listener.Start(); + while (true) + { + try + { + HttpListenerContext context = _listener.GetContext(); + Process(context); + } + catch (Exception) + { + } + } +#endif + } + +#if !WINDOWS_UWP + private void Process(HttpListenerContext context) + { + string filename = context.Request.Url.AbsolutePath; + Console.WriteLine(filename); + filename = filename.Substring(1); + + if (string.IsNullOrEmpty(filename)) + { + foreach (string indexFile in _indexFiles) + { + if (File.Exists(Path.Combine(_rootDirectory, indexFile))) + { + filename = indexFile; + break; + } + } + } + + filename = Path.Combine(_rootDirectory, filename); + if (File.Exists(filename)) + { + context.Response.StatusCode = (int)HttpStatusCode.OK; + + try + { + Stream input = File.OpenRead(filename); + + //Adding permanent http response headers + string mime; + context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) + ? mime + : "application/octet-stream"; + context.Response.ContentLength64 = input.Length; + context.Response.AddHeader("Date", DateTime.Now.ToString("r")); + context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); + + input.CopyTo(context.Response.OutputStream); + input.Close(); + } + catch (Exception e) + { + Debug.LogException(e); + context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; + } + } + else + { + context.Response.StatusCode = (int)HttpStatusCode.NotFound; + } + + context.Response.Close(); + } +#endif + + private void Initialize(string path, int port) + { +#if !WINDOWS_UWP + this._rootDirectory = path; + this._port = port; + _serverThread = new Thread(this.Listen); + _serverThread.Start(); +#endif + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs.meta new file mode 100644 index 0000000..41f72c8 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/SimpleWebServer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 019611993d8c07549bf0ca9c4154daef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef new file mode 100644 index 0000000..ec0b0cc --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef @@ -0,0 +1,16 @@ +{ + "name": "UnityGLTF.Samples.Misc", + "references": [ + "UnityGLTFScripts", + "GLTFSerialization" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef.meta new file mode 100644 index 0000000..07658c4 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/UnityGLTF.Samples.Misc.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ff6a9cbb30169964fb1b3d77c5a53088 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs new file mode 100644 index 0000000..dec398b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs @@ -0,0 +1,60 @@ +using UnityEngine; + +namespace UnityGLTF.Examples +{ + public class VisualizeMeshAttributes : MonoBehaviour + { + [SerializeField] private MeshFilter Mesh = default; + [SerializeField] private float NormalScale = 0.1f; + [SerializeField] private float TangentScale = 0.1f; + [SerializeField] private bool VisualizeTangents = false; + [SerializeField] private bool VisualizeNormals = false; + + private Vector3[] vertices; + private Vector3[] normals; + private Vector4[] tangents; + + void OnEnable() + { + if (Mesh != null && Mesh.mesh != null) + { + vertices = Mesh.mesh.vertices; + normals = Mesh.mesh.normals; + tangents = Mesh.mesh.tangents; + } + } + + // Update is called once per frame + void Update() + { + if (vertices != null) + { + int numVerts = vertices.Length; + for (int vertexIndex = 0; vertexIndex < numVerts; vertexIndex++) + { + var vertexTransformed = this.transform.TransformPoint(vertices[vertexIndex]); + + if (VisualizeNormals && normals != null) + { + var normalTransformed = this.transform.InverseTransformVector(normals[vertexIndex]); + Debug.DrawLine(vertexTransformed, vertexTransformed + normalTransformed * NormalScale * 0.5f, + Color.green); + Debug.DrawLine(vertexTransformed + normalTransformed * NormalScale * 0.5f, + vertexTransformed + normalTransformed * NormalScale * 1.0f, Color.blue); + } + + if (VisualizeTangents && tangents != null) + { + var tangentTransformed = this.transform.TransformVector( + tangents[vertexIndex].w * new Vector3(tangents[vertexIndex].x, tangents[vertexIndex].y, + tangents[vertexIndex].z)); + Debug.DrawLine(vertexTransformed, vertexTransformed + tangentTransformed * TangentScale * 0.5f, + Color.black); + Debug.DrawLine(vertexTransformed + tangentTransformed * TangentScale * 0.5f, + vertexTransformed + tangentTransformed * TangentScale * 1.0f, Color.white); + } + } + } + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs.meta new file mode 100644 index 0000000..a759f35 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/VisualizeMeshAttributes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 62a324520be0e6045bc06e4d89e950de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs new file mode 100644 index 0000000..487d972 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace UnityGLTF.Examples +{ + public class WebServerComponent : MonoBehaviour + { + private SimpleHTTPServer _server; + + void Start() + { + var appPath = Application.dataPath; + var wwwPath = appPath.Substring(0, appPath.LastIndexOf("Assets")) + "www"; + _server = new SimpleHTTPServer(wwwPath, 8080); + Debug.Log("Starting web server..."); + } + + private void OnDestroy() + { + _server.Stop(); + } + } +} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs.meta new file mode 100644 index 0000000..021ef6e --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/Scripts/WebServerComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 946dbe02f30bd734c901251fcc62a97a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 100 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity new file mode 100644 index 0000000..5fbbaf6 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity @@ -0,0 +1,608 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &10002063 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1000013594771676, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_Name + value: GLTFRiggedSimple + objectReference: {fileID: 0} + - target: {fileID: 1000013594771676, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/RiggedSimple/glTF/RiggedSimple.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1001 &34862859 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1000013594771676, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_Name + value: GLTFMonster + objectReference: {fileID: 0} + - target: {fileID: 1000013594771676, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/AnimatedCube/glTF/AnimatedCube.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/Monster/glTF/Monster.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &328853373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328853379} + - component: {fileID: 328853378} + - component: {fileID: 328853377} + - component: {fileID: 328853376} + - component: {fileID: 328853375} + - component: {fileID: 328853374} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &328853374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &328853375 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!124 &328853376 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!92 &328853377 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 +--- !u!20 &328853378 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &328853379 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328853373} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &979359784 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 979359786} + - component: {fileID: 979359785} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &979359785 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &979359786 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 979359784} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1667736112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1667736114} + - component: {fileID: 1667736113} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1667736113 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1667736114 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1667736112} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity.meta new file mode 100644 index 0000000..19a90c7 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/SkinnedAnimationTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 99b419859af06014699108078f89d05e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity new file mode 100644 index 0000000..9ea304a --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity @@ -0,0 +1,460 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &312208302 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 312208308} + - component: {fileID: 312208307} + - component: {fileID: 312208306} + - component: {fileID: 312208305} + - component: {fileID: 312208304} + - component: {fileID: 312208303} + m_Layer: 0 + m_Name: MainCamera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &312208303 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &312208304 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 +--- !u!124 &312208305 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 +--- !u!92 &312208306 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 +--- !u!20 &312208307 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &312208308 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &447203720 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 447203724} + - component: {fileID: 447203723} + - component: {fileID: 447203722} + - component: {fileID: 447203721} + m_Layer: 0 + m_Name: Floor (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &447203721 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &447203722 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &447203723 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &447203724 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1590283291 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1590283293} + - component: {fileID: 1590283292} + m_Layer: 0 + m_Name: Light (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1590283292 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1590283291} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1590283293 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1590283291} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1924572384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1924572386} + - component: {fileID: 1924572385} + m_Layer: 0 + m_Name: GLTF + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1924572385 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924572384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9087a95f22bcee64ebc45f6deec08714, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUri: BoomBox/gltf-Binary/BoomBox.glb + Multithreaded: 0 + UseStream: 1 + AppendStreamingAssets: 1 + PlayAnimationOnLoad: 1 + Factory: {fileID: 0} + loadOnStart: 1 + MaterialsOnly: 0 + RetryCount: 10 + RetryTimeout: 2 + MaximumLod: 300 + Timeout: 8 + Collider: 0 + shaderOverride: {fileID: 0} +--- !u!4 &1924572386 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924572384} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 10, y: 10, z: 10} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity.meta new file mode 100644 index 0000000..2e2e74b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamBinaryTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 784bcaf2fa75ed34bb4e98852b512da2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity new file mode 100644 index 0000000..1e0ef2c --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity @@ -0,0 +1,460 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &312208302 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 312208308} + - component: {fileID: 312208307} + - component: {fileID: 312208306} + - component: {fileID: 312208305} + - component: {fileID: 312208304} + - component: {fileID: 312208303} + m_Layer: 0 + m_Name: MainCamera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &312208303 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &312208304 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 +--- !u!124 &312208305 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 +--- !u!92 &312208306 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 +--- !u!20 &312208307 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &312208308 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312208302} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &447203720 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 447203724} + - component: {fileID: 447203723} + - component: {fileID: 447203722} + - component: {fileID: 447203721} + m_Layer: 0 + m_Name: Floor (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &447203721 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &447203722 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &447203723 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &447203724 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 447203720} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1590283291 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1590283293} + - component: {fileID: 1590283292} + m_Layer: 0 + m_Name: Light (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1590283292 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1590283291} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1590283293 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1590283291} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1924572384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1924572386} + - component: {fileID: 1924572385} + m_Layer: 0 + m_Name: GLTF + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1924572385 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924572384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9087a95f22bcee64ebc45f6deec08714, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUri: BoomBox/glTF/BoomBox.gltf + Multithreaded: 0 + UseStream: 1 + AppendStreamingAssets: 1 + PlayAnimationOnLoad: 1 + Factory: {fileID: 0} + loadOnStart: 1 + MaterialsOnly: 0 + RetryCount: 10 + RetryTimeout: 2 + MaximumLod: 300 + Timeout: 8 + Collider: 0 + shaderOverride: {fileID: 0} +--- !u!4 &1924572386 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924572384} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 10, y: 10, z: 10} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity.meta new file mode 100644 index 0000000..a411445 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/StreamTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5f234a304e97dc74390efd8821b1ca5c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity new file mode 100644 index 0000000..319033b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity @@ -0,0 +1,519 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &358204559 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 358204561} + - component: {fileID: 358204560} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &358204560 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358204559} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &358204561 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358204559} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &683563953 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 683563959} + - component: {fileID: 683563958} + - component: {fileID: 683563957} + - component: {fileID: 683563956} + - component: {fileID: 683563955} + - component: {fileID: 683563954} + m_Layer: 0 + m_Name: MainCamera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &683563954 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &683563955 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 +--- !u!124 &683563956 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 +--- !u!92 &683563957 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 +--- !u!20 &683563958 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &683563959 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683563953} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1656007881 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1656007883} + - component: {fileID: 1656007882} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1656007882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1656007881} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1656007883 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1656007881} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1835019344 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/TestScene/TestScene.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFConstant + value: + objectReference: {fileID: 4800000, guid: ede6e66a96bc7164abd2a9217b5a8b4c, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFStandard + value: + objectReference: {fileID: 4800000, guid: a5732b1b5b2e36d47a3da75e187eba06, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/TestScene/TestScene.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity.meta new file mode 100644 index 0000000..1a610e0 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TestSceneScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a098a7e6ffdf4eb4696cb0674a36abf4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity new file mode 100644 index 0000000..c555611 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity @@ -0,0 +1,532 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &194823117 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 194823121} + - component: {fileID: 194823120} + - component: {fileID: 194823119} + - component: {fileID: 194823118} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &194823118 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 194823117} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &194823119 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 194823117} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &194823120 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 194823117} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &194823121 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 194823117} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &816130868 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 816130870} + - component: {fileID: 816130869} + m_Layer: 0 + m_Name: GLTF + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &816130869 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816130868} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9087a95f22bcee64ebc45f6deec08714, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUri: http://localhost:8080/EXT_texture_transform/pyramid.gltf + Multithreaded: 1 + UseStream: 0 + AppendStreamingAssets: 1 + PlayAnimationOnLoad: 1 + Factory: {fileID: 0} + loadOnStart: 1 + MaterialsOnly: 0 + RetryCount: 10 + RetryTimeout: 2 + MaximumLod: 300 + Timeout: 8 + Collider: 0 + shaderOverride: {fileID: 0} +--- !u!4 &816130870 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816130868} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1191630373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1191630375} + - component: {fileID: 1191630374} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1191630374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1191630373} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1191630375 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1191630373} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1347932295 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1347932297} + - component: {fileID: 1347932296} + m_Layer: 0 + m_Name: GLTF2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1347932296 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1347932295} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9087a95f22bcee64ebc45f6deec08714, type: 3} + m_Name: + m_EditorClassIdentifier: + GLTFUri: http://localhost:8080/EXT_texture_transform/quad.gltf + Multithreaded: 1 + UseStream: 0 + AppendStreamingAssets: 1 + PlayAnimationOnLoad: 1 + Factory: {fileID: 0} + loadOnStart: 1 + MaterialsOnly: 0 + RetryCount: 10 + RetryTimeout: 2 + MaximumLod: 300 + Timeout: 8 + Collider: 0 + shaderOverride: {fileID: 0} +--- !u!4 &1347932297 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1347932295} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -4.6} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1844349481 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1844349486} + - component: {fileID: 1844349485} + - component: {fileID: 1844349484} + - component: {fileID: 1844349483} + - component: {fileID: 1844349482} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1844349482 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844349481} + m_Enabled: 1 +--- !u!124 &1844349483 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844349481} + m_Enabled: 1 +--- !u!92 &1844349484 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844349481} + m_Enabled: 1 +--- !u!20 &1844349485 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844349481} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1844349486 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844349481} + m_LocalRotation: {x: 0.12426477, y: -0, z: -0, w: 0.99224913} + m_LocalPosition: {x: -0.38, y: 1.67, z: -7.33} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 14.277, y: 0, z: 0} +--- !u!1 &2123236622 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2123236624} + - component: {fileID: 2123236623} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &2123236623 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2123236622} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &2123236624 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2123236622} + m_LocalRotation: {x: 0.40821788, y: 0.23456976, z: -0.10938167, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50.000004, y: 30, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity.meta new file mode 100644 index 0000000..cff16ac --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TextureTransformTest.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 02a966d1c55ae1042b47fa54f4a7716a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity new file mode 100644 index 0000000..dcb6320 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity @@ -0,0 +1,513 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &178362980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 178362984} + - component: {fileID: 178362983} + - component: {fileID: 178362982} + - component: {fileID: 178362981} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &178362981 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 178362980} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &178362982 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 178362980} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &178362983 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 178362980} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &178362984 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 178362980} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &805193140 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 805193142} + - component: {fileID: 805193141} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &805193141 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 805193140} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &805193142 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 805193140} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &953641229 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 953641231} + - component: {fileID: 953641230} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &953641230 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 953641229} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &953641231 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 953641229} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1001 &1500858477 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/TestScene/TestScene.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFConstant + value: + objectReference: {fileID: 4800000, guid: ede6e66a96bc7164abd2a9217b5a8b4c, type: 3} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/TestScene/TestScene.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1778956315 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1778956320} + - component: {fileID: 1778956319} + - component: {fileID: 1778956318} + - component: {fileID: 1778956317} + - component: {fileID: 1778956316} + - component: {fileID: 1778956321} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1778956316 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778956315} + m_Enabled: 1 +--- !u!124 &1778956317 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778956315} + m_Enabled: 1 +--- !u!92 &1778956318 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778956315} + m_Enabled: 1 +--- !u!20 &1778956319 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778956315} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1778956320 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778956315} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1778956321 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778956315} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity.meta new file mode 100644 index 0000000..35849d9 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TransformTest.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a6ef8add669c8c9459978f2bc1eba0e5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity new file mode 100644 index 0000000..4f80e73 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity @@ -0,0 +1,509 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.45030326, g: 0.49799633, b: 0.5628027, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 0 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &182776192 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: http://localhost:8080/glTF-Sample-Models/2.0/TriangleWithoutIndices/glTF/TriangleWithoutIndices.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: http://localhost:8080/glTF-Sample-Models/2.0/TriangleWithoutIndices/glTF/TriangleWithoutIndices.gltf + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1044806827 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1742858401} + - component: {fileID: 1742858400} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1290886834 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1290886836} + - component: {fileID: 1290886835} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1290886835 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1290886834} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1290886836 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1290886834} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} +--- !u!1 &1513217566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1513217572} + - component: {fileID: 1513217571} + - component: {fileID: 1513217570} + - component: {fileID: 1513217569} + - component: {fileID: 1513217568} + - component: {fileID: 1513217567} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1513217567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -20 + yMaxLimit: 80 + distanceMin: 0.5 + distanceMax: 15 +--- !u!81 &1513217568 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!124 &1513217569 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!92 &1513217570 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 +--- !u!20 &1513217571 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1513217572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1513217566} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1742858400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1044806827} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 946dbe02f30bd734c901251fcc62a97a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1742858401 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1044806827} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1904599574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904599578} + - component: {fileID: 1904599577} + - component: {fileID: 1904599576} + - component: {fileID: 1904599575} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1904599575 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &1904599576 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &1904599577 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1904599578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904599574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity.meta new file mode 100644 index 0000000..abd39b2 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/TriangleWithoutIndicesTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2f9c33a560f6fbc4e84417bce6daa904 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity new file mode 100644 index 0000000..a1ce6a5 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity @@ -0,0 +1,469 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &360634774 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 360634778} + - component: {fileID: 360634777} + - component: {fileID: 360634776} + - component: {fileID: 360634775} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &360634775 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 360634774} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!64 &360634776 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 360634774} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Convex: 0 + m_CookingOptions: 14 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &360634777 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 360634774} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &360634778 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 360634774} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.778, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &481748067 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000011406631220, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Multithreaded + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: UseStream + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: Url + value: /gltf/BoomBox.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: GLTFUri + value: BoomBox/gltf/BoomBox.gltf + objectReference: {fileID: 0} + - target: {fileID: 114000010638385648, guid: 5255039e40b37b14fbcc0b72a30fc62e, + type: 3} + propertyPath: AppendStreamingAssets + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5255039e40b37b14fbcc0b72a30fc62e, type: 3} +--- !u!1 &1650054226 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 100002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1650054232} + - component: {fileID: 1650054231} + - component: {fileID: 1650054230} + - component: {fileID: 1650054229} + - component: {fileID: 1650054228} + - component: {fileID: 1650054227} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1650054227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650054226} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 70ff706d2c89cc247a850af95597fcbb, type: 3} + m_Name: + m_EditorClassIdentifier: + targetPosition: {x: 0, y: 0, z: 0} + distance: 5 + xSpeed: 120 + ySpeed: 120 + zoomSpeed: 0.8 + yMinLimit: -85 + yMaxLimit: 85 + distanceMin: 0.5 + distanceMax: 150 +--- !u!81 &1650054228 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 8100000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650054226} + m_Enabled: 1 +--- !u!124 &1650054229 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 12400000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650054226} + m_Enabled: 1 +--- !u!92 &1650054230 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 9200000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650054226} + m_Enabled: 1 +--- !u!20 &1650054231 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 2000000, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650054226} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.62552905, g: 0.684092, b: 0.7761194, a: 0.019607844} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.02 + far clip plane: 400 + field of view: 60 + orthographic: 0 + orthographic size: 100 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1650054232 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 400002, guid: 49a0e923d39ec3c4c8bb97699e2f2903, + type: 2} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1650054226} + m_LocalRotation: {x: -0, y: 1, z: -0, w: -0.000000063325004} + m_LocalPosition: {x: 0, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1690206989 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1690206991} + - component: {fileID: 1690206990} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1690206990 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1690206989} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1.3 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1690206991 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1690206989} + m_LocalRotation: {x: 0.048932634, y: 0.9485057, z: -0.18261904, w: 0.2541514} + m_LocalPosition: {x: 3.56, y: 5.64, z: 6.41} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 21.796001, y: 150, z: 0} diff --git a/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity.meta b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity.meta new file mode 100644 index 0000000..3ca6502 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/Samples~/Sample Scenes/UWPTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9754353895356ff4ea70dce4d6df4d75 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UnityGLTF/package.json b/Assets/Plugins/UnityGLTF/package.json new file mode 100644 index 0000000..347ea6b --- /dev/null +++ b/Assets/Plugins/UnityGLTF/package.json @@ -0,0 +1,25 @@ +{ + "name": "org.khronos.unitygltf", + "displayName": "UnityGLTF", + "version": "1.24.0-pre.2", + "unity": "2019.4", + "description": "Unity3D library for importing and exporting GLTF 2.0 assets. https://github.com/KhronosGroup/UnityGLTF", + "keywords": [ + "gltf", + "khronos", + "runtime", + "loader" + ], + "author": "Khronos Group", + "samples": [ + { + "displayName": "Sample Scenes", + "description": "Various scenes showing GLTF functionality.", + "path": "Samples~/Sample Scenes" + } + ], + "dependencies": { + "com.unity.nuget.newtonsoft-json": "2.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } +} diff --git a/Assets/Plugins/UnityGLTF/package.json.meta b/Assets/Plugins/UnityGLTF/package.json.meta new file mode 100644 index 0000000..ed5a550 --- /dev/null +++ b/Assets/Plugins/UnityGLTF/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5d230786f392e6a49bce07ef5f1fcfff +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 0356d16..37fa6b3 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.unity.nuget.newtonsoft-json": "2.0.0", "com.unity.formats.fbx": "5.0.0", "com.unity.ide.rider": "2.0.7", "com.unity.ide.visualstudio": "2.0.16", @@ -9,7 +10,6 @@ "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.4.8", "com.unity.ugui": "1.0.0", - "org.khronos.unitygltf": "https://github.com/prefrontalcortex/UnityGLTF.git?path=/UnityGLTF/Assets/UnityGLTF", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 97e9bc7..f180e52 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -51,7 +51,7 @@ }, "com.unity.nuget.newtonsoft-json": { "version": "2.0.0", - "depth": 1, + "depth": 0, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" @@ -106,16 +106,6 @@ "com.unity.modules.imgui": "1.0.0" } }, - "org.khronos.unitygltf": { - "version": "https://github.com/prefrontalcortex/UnityGLTF.git?path=/UnityGLTF/Assets/UnityGLTF", - "depth": 0, - "source": "git", - "dependencies": { - "com.unity.nuget.newtonsoft-json": "2.0.0", - "com.unity.modules.imageconversion": "1.0.0" - }, - "hash": "e8c3e656f2aa962a80cc026ca86d4f8f8906fd54" - }, "com.unity.modules.ai": { "version": "1.0.0", "depth": 0,