├── .gitattributes ├── .gitignore ├── Assets ├── Demo.meta ├── Demo │ ├── Materials.meta │ ├── Materials │ │ ├── Background.mat │ │ ├── Background.mat.meta │ │ ├── EnvMapShader.shader │ │ ├── EnvMapShader.shader.meta │ │ ├── Thickness.mat │ │ ├── Thickness.mat.meta │ │ ├── Translucent.mat │ │ └── Translucent.mat.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── Test.unity │ │ └── Test.unity.meta │ ├── Test Meshes.meta │ ├── Test Meshes │ │ ├── buddha.fbx │ │ ├── buddha.fbx.meta │ │ ├── test2.fbx │ │ └── test2.fbx.meta │ ├── Textures.meta │ ├── Textures │ │ ├── Env.meta │ │ ├── Env │ │ │ ├── Materials.meta │ │ │ ├── Materials │ │ │ │ ├── Prefiltered3.mat │ │ │ │ └── Prefiltered3.mat.meta │ │ │ ├── Prefiltered3.asset │ │ │ └── Prefiltered3.asset.meta │ │ ├── ggx_brdf.asset │ │ └── ggx_brdf.asset.meta │ ├── TranslucentMeshes.meta │ └── TranslucentMeshes │ │ ├── buddha.asset │ │ └── buddha.asset.meta ├── SHTranslucency.meta └── SHTranslucency │ ├── Editor.meta │ ├── Editor │ ├── ThicknessCompute.cs │ └── ThicknessCompute.cs.meta │ ├── Resources.meta │ ├── Resources │ ├── Shaders.meta │ └── Shaders │ │ ├── MonteCarloProject.shader │ │ ├── MonteCarloProject.shader.meta │ │ ├── Reduce_MC_1024.compute │ │ ├── Reduce_MC_1024.compute.meta │ │ ├── Reduce_Uniform.compute │ │ ├── Reduce_Uniform.compute.meta │ │ ├── SH_Utils.cginc │ │ ├── SH_Utils.cginc.meta │ │ ├── Thickness.shader │ │ ├── Thickness.shader.meta │ │ ├── TranslucentShader.shader │ │ └── TranslucentShader.shader.meta │ ├── Scripts.meta │ └── Scripts │ ├── SphericalHarmonics.cs │ └── SphericalHarmonics.cs.meta ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset ├── UnityPackageManager └── manifest.json └── docs ├── LICENSE.md ├── README.md └── animated.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | /.hg/ 8 | 9 | # Visual Studio 2015 cache directory 10 | /.vs/ 11 | 12 | # Autogenerated VS/MD/Consulo solution and project files 13 | ExportedObj/ 14 | .consulo/ 15 | *.csproj 16 | *.unityproj 17 | *.sln 18 | *.suo 19 | *.tmp 20 | *.user 21 | *.userprefs 22 | *.pidb 23 | *.booproj 24 | *.svd 25 | *.pdb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | 30 | # Unity3D Generated File On Crash Reports 31 | sysinfo.txt 32 | 33 | # Builds 34 | *.apk 35 | *.unitypackage 36 | .hgignore 37 | -------------------------------------------------------------------------------- /Assets/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c860040de19c4c44ab4280ce212d330b 3 | folderAsset: yes 4 | timeCreated: 1519597274 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2a1c1959ab0c454dae21514c7639d62 3 | folderAsset: yes 4 | timeCreated: 1519031901 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/Background.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Background 10 | m_Shader: {fileID: 4800000, guid: 2483585ea018d9243bdcb1789068fd55, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _EnvMap: 42 | m_Texture: {fileID: 8900000, guid: 6b82e4ec31dca604ea4ce3e466a5a366, type: 2} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MainTex: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _MetallicGlossMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _OcclusionMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | - _ParallaxMap: 58 | m_Texture: {fileID: 0} 59 | m_Scale: {x: 1, y: 1} 60 | m_Offset: {x: 0, y: 0} 61 | m_Floats: 62 | - _BumpScale: 1 63 | - _Cutoff: 0.5 64 | - _DetailNormalMapScale: 1 65 | - _DstBlend: 0 66 | - _GlossMapScale: 1 67 | - _Glossiness: 0.5 68 | - _GlossyReflections: 1 69 | - _LodLevel: 1.48 70 | - _Metallic: 0 71 | - _Mode: 0 72 | - _OcclusionStrength: 1 73 | - _Parallax: 0.02 74 | - _SmoothnessTextureChannel: 0 75 | - _SpecularHighlights: 1 76 | - _SrcBlend: 1 77 | - _UVSec: 0 78 | - _ZWrite: 1 79 | m_Colors: 80 | - _Color: {r: 1, g: 1, b: 1, a: 1} 81 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 82 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/Background.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32b70be67dcb5f9479d3ea0674f94687 3 | timeCreated: 1520895294 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/EnvMapShader.shader: -------------------------------------------------------------------------------- 1 | Shader "PBR/EnvMapShader" 2 | { 3 | Properties 4 | { 5 | _EnvMap ("Texture", Cube) = "white" {} 6 | _LodLevel("Lod Level", Int) = 0 7 | } 8 | SubShader 9 | { 10 | Tags { "Queue"="Background" } 11 | LOD 100 12 | 13 | Pass 14 | { 15 | ZWrite Off 16 | Cull Off 17 | 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | 22 | #include "UnityCG.cginc" 23 | 24 | struct appdata 25 | { 26 | float4 vertex : POSITION; 27 | float3 uv : TEXCOORD0; 28 | }; 29 | 30 | struct v2f 31 | { 32 | float4 vertex : SV_POSITION; 33 | float3 uv : TEXCOORD0; 34 | }; 35 | 36 | samplerCUBE _EnvMap; 37 | int _LodLevel; 38 | 39 | v2f vert (appdata v) 40 | { 41 | v2f o; 42 | o.vertex = UnityObjectToClipPos(v.vertex); 43 | o.uv = v.uv; 44 | return o; 45 | } 46 | 47 | fixed4 frag (v2f i) : SV_Target 48 | { 49 | return texCUBElod(_EnvMap, float4(i.uv, _LodLevel)); 50 | } 51 | ENDCG 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/EnvMapShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2483585ea018d9243bdcb1789068fd55 3 | timeCreated: 1520895287 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/Thickness.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Thickness 10 | m_Shader: {fileID: 4800000, guid: df183f07f4b3bf64d96ce13a99360c06, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/Thickness.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9eb6c1a53999c4d4c94345b7abd6c2a5 3 | timeCreated: 1519031912 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/Translucent.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Translucent 10 | m_Shader: {fileID: 4800000, guid: 3b2daade16b947441b65552274567509, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BRDF: 22 | m_Texture: {fileID: 2800000, guid: ce89cc35bbdc43c48be49306baffa32b, type: 2} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _BumpMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailAlbedoMap: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailMask: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _DetailNormalMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _EmissionMap: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _Envmap: 46 | m_Texture: {fileID: 8900000, guid: 6b82e4ec31dca604ea4ce3e466a5a366, type: 2} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _MainTex: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _MetallicGlossMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | - _OcclusionMap: 58 | m_Texture: {fileID: 0} 59 | m_Scale: {x: 1, y: 1} 60 | m_Offset: {x: 0, y: 0} 61 | - _ParallaxMap: 62 | m_Texture: {fileID: 0} 63 | m_Scale: {x: 1, y: 1} 64 | m_Offset: {x: 0, y: 0} 65 | m_Floats: 66 | - _BumpScale: 1 67 | - _Cutoff: 0.5 68 | - _DetailNormalMapScale: 1 69 | - _DstBlend: 0 70 | - _GlossMapScale: 1 71 | - _Glossiness: 0.5 72 | - _GlossyReflections: 1 73 | - _Metallic: 0 74 | - _Metalness: 0.029 75 | - _Mode: 0 76 | - _OcclusionStrength: 1 77 | - _Parallax: 0.02 78 | - _PointLightHardness: 59.2 79 | - _PointLightIntensity: 1.6 80 | - _Refraction: 1.025 81 | - _RefractionRoughness: 1.31 82 | - _Roughness: 0.06 83 | - _SmoothnessTextureChannel: 0 84 | - _SpecularHighlights: 1 85 | - _SpecularIntensity: 0.59 86 | - _SpecularPower: 28.15 87 | - _SrcBlend: 1 88 | - _ThicknessPower: 2.49 89 | - _UVSec: 0 90 | - _ZWrite: 1 91 | m_Colors: 92 | - _Absorption: {r: 1, g: 0.6413792, b: 0, a: 0.79} 93 | - _Additive: {r: 0, g: 0, b: 0, a: 0} 94 | - _Color: {r: 1, g: 1, b: 1, a: 1} 95 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 96 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/Translucent.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ebaef73cbad3d04d944f80eb228602f 3 | timeCreated: 1519075938 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cdd35baa9f3ba504bb8423598ca531ab 3 | folderAsset: yes 4 | timeCreated: 1519115620 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Scenes/Test.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 2100000, guid: 32b70be67dcb5f9479d3ea0674f94687, type: 2} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.8713151, g: 0.8305793, b: 0.79889566, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &1430144318 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 1430144323} 124 | - component: {fileID: 1430144322} 125 | - component: {fileID: 1430144321} 126 | - component: {fileID: 1430144320} 127 | - component: {fileID: 1430144319} 128 | m_Layer: 0 129 | m_Name: Main Camera 130 | m_TagString: MainCamera 131 | m_Icon: {fileID: 0} 132 | m_NavMeshLayer: 0 133 | m_StaticEditorFlags: 0 134 | m_IsActive: 1 135 | --- !u!81 &1430144319 136 | AudioListener: 137 | m_ObjectHideFlags: 0 138 | m_PrefabParentObject: {fileID: 0} 139 | m_PrefabInternal: {fileID: 0} 140 | m_GameObject: {fileID: 1430144318} 141 | m_Enabled: 1 142 | --- !u!124 &1430144320 143 | Behaviour: 144 | m_ObjectHideFlags: 0 145 | m_PrefabParentObject: {fileID: 0} 146 | m_PrefabInternal: {fileID: 0} 147 | m_GameObject: {fileID: 1430144318} 148 | m_Enabled: 1 149 | --- !u!92 &1430144321 150 | Behaviour: 151 | m_ObjectHideFlags: 0 152 | m_PrefabParentObject: {fileID: 0} 153 | m_PrefabInternal: {fileID: 0} 154 | m_GameObject: {fileID: 1430144318} 155 | m_Enabled: 1 156 | --- !u!20 &1430144322 157 | Camera: 158 | m_ObjectHideFlags: 0 159 | m_PrefabParentObject: {fileID: 0} 160 | m_PrefabInternal: {fileID: 0} 161 | m_GameObject: {fileID: 1430144318} 162 | m_Enabled: 1 163 | serializedVersion: 2 164 | m_ClearFlags: 1 165 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 166 | m_NormalizedViewPortRect: 167 | serializedVersion: 2 168 | x: 0 169 | y: 0 170 | width: 1 171 | height: 1 172 | near clip plane: 0.3 173 | far clip plane: 1000 174 | field of view: 52 175 | orthographic: 0 176 | orthographic size: 5 177 | m_Depth: -1 178 | m_CullingMask: 179 | serializedVersion: 2 180 | m_Bits: 4294967295 181 | m_RenderingPath: -1 182 | m_TargetTexture: {fileID: 0} 183 | m_TargetDisplay: 0 184 | m_TargetEye: 3 185 | m_HDR: 1 186 | m_AllowMSAA: 1 187 | m_AllowDynamicResolution: 0 188 | m_ForceIntoRT: 0 189 | m_OcclusionCulling: 1 190 | m_StereoConvergence: 10 191 | m_StereoSeparation: 0.022 192 | --- !u!4 &1430144323 193 | Transform: 194 | m_ObjectHideFlags: 0 195 | m_PrefabParentObject: {fileID: 0} 196 | m_PrefabInternal: {fileID: 0} 197 | m_GameObject: {fileID: 1430144318} 198 | m_LocalRotation: {x: -0.007518867, y: 0.9924778, z: -0.08770328, w: -0.085085854} 199 | m_LocalPosition: {x: 0.52990645, y: 0.5545525, z: 3.0678134} 200 | m_LocalScale: {x: 1, y: 1, z: 1} 201 | m_Children: [] 202 | m_Father: {fileID: 0} 203 | m_RootOrder: 0 204 | m_LocalEulerAnglesHint: {x: 10.1, y: -158.8, z: 0} 205 | --- !u!1 &1505188676 206 | GameObject: 207 | m_ObjectHideFlags: 0 208 | m_PrefabParentObject: {fileID: 0} 209 | m_PrefabInternal: {fileID: 0} 210 | serializedVersion: 5 211 | m_Component: 212 | - component: {fileID: 1505188679} 213 | - component: {fileID: 1505188678} 214 | - component: {fileID: 1505188677} 215 | m_Layer: 0 216 | m_Name: buddha 217 | m_TagString: Untagged 218 | m_Icon: {fileID: 0} 219 | m_NavMeshLayer: 0 220 | m_StaticEditorFlags: 0 221 | m_IsActive: 1 222 | --- !u!23 &1505188677 223 | MeshRenderer: 224 | m_ObjectHideFlags: 0 225 | m_PrefabParentObject: {fileID: 0} 226 | m_PrefabInternal: {fileID: 0} 227 | m_GameObject: {fileID: 1505188676} 228 | m_Enabled: 1 229 | m_CastShadows: 1 230 | m_ReceiveShadows: 1 231 | m_DynamicOccludee: 1 232 | m_MotionVectors: 1 233 | m_LightProbeUsage: 1 234 | m_ReflectionProbeUsage: 1 235 | m_Materials: 236 | - {fileID: 2100000, guid: 1ebaef73cbad3d04d944f80eb228602f, type: 2} 237 | m_StaticBatchInfo: 238 | firstSubMesh: 0 239 | subMeshCount: 0 240 | m_StaticBatchRoot: {fileID: 0} 241 | m_ProbeAnchor: {fileID: 0} 242 | m_LightProbeVolumeOverride: {fileID: 0} 243 | m_ScaleInLightmap: 1 244 | m_PreserveUVs: 0 245 | m_IgnoreNormalsForChartDetection: 0 246 | m_ImportantGI: 0 247 | m_StitchLightmapSeams: 0 248 | m_SelectedEditorRenderState: 3 249 | m_MinimumChartSize: 4 250 | m_AutoUVMaxDistance: 0.5 251 | m_AutoUVMaxAngle: 89 252 | m_LightmapParameters: {fileID: 0} 253 | m_SortingLayerID: 0 254 | m_SortingLayer: 0 255 | m_SortingOrder: 0 256 | --- !u!33 &1505188678 257 | MeshFilter: 258 | m_ObjectHideFlags: 0 259 | m_PrefabParentObject: {fileID: 0} 260 | m_PrefabInternal: {fileID: 0} 261 | m_GameObject: {fileID: 1505188676} 262 | m_Mesh: {fileID: 4300000, guid: 3fc149b5389d658409339c90cd0d92f0, type: 2} 263 | --- !u!4 &1505188679 264 | Transform: 265 | m_ObjectHideFlags: 0 266 | m_PrefabParentObject: {fileID: 0} 267 | m_PrefabInternal: {fileID: 0} 268 | m_GameObject: {fileID: 1505188676} 269 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 270 | m_LocalPosition: {x: 0, y: -1.28, z: 0} 271 | m_LocalScale: {x: 1, y: 1, z: 1} 272 | m_Children: [] 273 | m_Father: {fileID: 0} 274 | m_RootOrder: 1 275 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 276 | -------------------------------------------------------------------------------- /Assets/Demo/Scenes/Test.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fe15defdfdb3484c8275e305c2b304c 3 | timeCreated: 1519080671 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Demo/Test Meshes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ffcaff7ca50188240a2b04986c3a2945 3 | folderAsset: yes 4 | timeCreated: 1519115620 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Test Meshes/buddha.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Translucency/b04ec0b37b6598e157d4682d21aa05861d745a7e/Assets/Demo/Test Meshes/buddha.fbx -------------------------------------------------------------------------------- /Assets/Demo/Test Meshes/buddha.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ab1e1e9e7f64b743af5e307e726738a 3 | timeCreated: 1519081519 4 | licenseType: Free 5 | ModelImporter: 6 | serializedVersion: 21 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 400000: //RootNode 10 | 2300000: //RootNode 11 | 3300000: //RootNode 12 | 4300000: buddha 13 | materials: 14 | importMaterials: 0 15 | materialName: 0 16 | materialSearch: 1 17 | animations: 18 | legacyGenerateAnimations: 4 19 | bakeSimulation: 0 20 | resampleCurves: 1 21 | optimizeGameObjects: 0 22 | motionNodeName: 23 | rigImportErrors: 24 | rigImportWarnings: 25 | animationImportErrors: 26 | animationImportWarnings: 27 | animationRetargetingWarnings: 28 | animationDoRetargetingWarnings: 0 29 | animationCompression: 1 30 | animationRotationError: 0.5 31 | animationPositionError: 0.5 32 | animationScaleError: 0.5 33 | animationWrapMode: 0 34 | extraExposedTransformPaths: [] 35 | extraUserProperties: [] 36 | clipAnimations: [] 37 | isReadable: 1 38 | meshes: 39 | lODScreenPercentages: [] 40 | globalScale: 1 41 | meshCompression: 0 42 | addColliders: 0 43 | importVisibility: 1 44 | importBlendShapes: 1 45 | importCameras: 1 46 | importLights: 1 47 | swapUVChannels: 0 48 | generateSecondaryUV: 0 49 | useFileUnits: 1 50 | optimizeMeshForGPU: 1 51 | keepQuads: 0 52 | weldVertices: 1 53 | secondaryUVAngleDistortion: 8 54 | secondaryUVAreaDistortion: 15.000001 55 | secondaryUVHardAngle: 88 56 | secondaryUVPackMargin: 4 57 | useFileScale: 1 58 | tangentSpace: 59 | normalSmoothAngle: 60 60 | normalImportMode: 0 61 | tangentImportMode: 3 62 | normalCalculationMode: 4 63 | importAnimation: 1 64 | copyAvatar: 0 65 | humanDescription: 66 | serializedVersion: 2 67 | human: [] 68 | skeleton: [] 69 | armTwist: 0.5 70 | foreArmTwist: 0.5 71 | upperLegTwist: 0.5 72 | legTwist: 0.5 73 | armStretch: 0.05 74 | legStretch: 0.05 75 | feetSpacing: 0 76 | rootMotionBoneName: 77 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 78 | hasTranslationDoF: 0 79 | hasExtraRoot: 0 80 | skeletonHasParents: 1 81 | lastHumanDescriptionAvatarSource: {instanceID: 0} 82 | animationType: 0 83 | humanoidOversampling: 1 84 | additionalBone: 0 85 | userData: 86 | assetBundleName: 87 | assetBundleVariant: 88 | -------------------------------------------------------------------------------- /Assets/Demo/Test Meshes/test2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Translucency/b04ec0b37b6598e157d4682d21aa05861d745a7e/Assets/Demo/Test Meshes/test2.fbx -------------------------------------------------------------------------------- /Assets/Demo/Test Meshes/test2.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cfc632b15f2959a408e68674ce99cc48 3 | timeCreated: 1519049655 4 | licenseType: Free 5 | ModelImporter: 6 | serializedVersion: 21 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 400000: //RootNode 10 | 2300000: //RootNode 11 | 3300000: //RootNode 12 | 4300000: Cube 13 | materials: 14 | importMaterials: 0 15 | materialName: 0 16 | materialSearch: 1 17 | animations: 18 | legacyGenerateAnimations: 4 19 | bakeSimulation: 0 20 | resampleCurves: 1 21 | optimizeGameObjects: 0 22 | motionNodeName: 23 | rigImportErrors: 24 | rigImportWarnings: 25 | animationImportErrors: 26 | animationImportWarnings: 27 | animationRetargetingWarnings: 28 | animationDoRetargetingWarnings: 0 29 | animationCompression: 1 30 | animationRotationError: 0.5 31 | animationPositionError: 0.5 32 | animationScaleError: 0.5 33 | animationWrapMode: 0 34 | extraExposedTransformPaths: [] 35 | extraUserProperties: [] 36 | clipAnimations: [] 37 | isReadable: 1 38 | meshes: 39 | lODScreenPercentages: [] 40 | globalScale: 1 41 | meshCompression: 0 42 | addColliders: 0 43 | importVisibility: 1 44 | importBlendShapes: 1 45 | importCameras: 1 46 | importLights: 1 47 | swapUVChannels: 0 48 | generateSecondaryUV: 0 49 | useFileUnits: 1 50 | optimizeMeshForGPU: 1 51 | keepQuads: 0 52 | weldVertices: 1 53 | secondaryUVAngleDistortion: 8 54 | secondaryUVAreaDistortion: 15.000001 55 | secondaryUVHardAngle: 88 56 | secondaryUVPackMargin: 4 57 | useFileScale: 1 58 | tangentSpace: 59 | normalSmoothAngle: 60 60 | normalImportMode: 0 61 | tangentImportMode: 3 62 | normalCalculationMode: 4 63 | importAnimation: 1 64 | copyAvatar: 0 65 | humanDescription: 66 | serializedVersion: 2 67 | human: [] 68 | skeleton: [] 69 | armTwist: 0.5 70 | foreArmTwist: 0.5 71 | upperLegTwist: 0.5 72 | legTwist: 0.5 73 | armStretch: 0.05 74 | legStretch: 0.05 75 | feetSpacing: 0 76 | rootMotionBoneName: 77 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 78 | hasTranslationDoF: 0 79 | hasExtraRoot: 0 80 | skeletonHasParents: 1 81 | lastHumanDescriptionAvatarSource: {instanceID: 0} 82 | animationType: 0 83 | humanoidOversampling: 1 84 | additionalBone: 0 85 | userData: 86 | assetBundleName: 87 | assetBundleVariant: 88 | -------------------------------------------------------------------------------- /Assets/Demo/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ffe67a114d15cc4790f81dd2bf424ce 3 | folderAsset: yes 4 | timeCreated: 1519597274 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Textures/Env.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0f24f01273f22143b45b8290309aaf0 3 | folderAsset: yes 4 | timeCreated: 1519682506 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Textures/Env/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5390688262044eb4a9ded7cd44c427ad 3 | folderAsset: yes 4 | timeCreated: 1520029149 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Textures/Env/Materials/Prefiltered3.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Prefiltered3 10 | m_Shader: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _Tex: 22 | m_Texture: {fileID: 8900000, guid: 6b82e4ec31dca604ea4ce3e466a5a366, type: 2} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | m_Floats: 26 | - _Exposure: 1 27 | - _Rotation: 0 28 | m_Colors: 29 | - _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 30 | -------------------------------------------------------------------------------- /Assets/Demo/Textures/Env/Materials/Prefiltered3.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77f03b9e116c2e64b9b427b74632a336 3 | timeCreated: 1520189780 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Textures/Env/Prefiltered3.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b82e4ec31dca604ea4ce3e466a5a366 3 | timeCreated: 1520189776 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Textures/ggx_brdf.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce89cc35bbdc43c48be49306baffa32b 3 | timeCreated: 1520189012 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/TranslucentMeshes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 000e32224fd267245882a0e98746e44f 3 | folderAsset: yes 4 | timeCreated: 1519115620 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/TranslucentMeshes/buddha.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3fc149b5389d658409339c90cd0d92f0 3 | timeCreated: 1525558182 4 | licenseType: Free 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 4300000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/SHTranslucency.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c32c4be1e4daed4ab98551cc1acd05d 3 | folderAsset: yes 4 | timeCreated: 1518891720 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ee130159bbd54f44a5649b5545d5d9d 3 | folderAsset: yes 4 | timeCreated: 1518891749 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Editor/ThicknessCompute.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public class ThicknessCompute : EditorWindow 7 | { 8 | //PUBLIC FIELDS 9 | public MeshFilter to_compute; 10 | 11 | //PRIVATE FIELDS 12 | private SerializedObject so; 13 | private SerializedProperty sp_to_compute; 14 | 15 | [MenuItem("Window/ThicknessCompute")] 16 | public static void ShowWindow() 17 | { 18 | ThicknessCompute window = (ThicknessCompute)EditorWindow.GetWindow(typeof(ThicknessCompute)); 19 | window.Show(); 20 | } 21 | 22 | private void OnFocus() 23 | { 24 | Initialize(); 25 | } 26 | 27 | private void OnEnable() 28 | { 29 | Initialize(); 30 | } 31 | 32 | private void Initialize() 33 | { 34 | if (so == null) 35 | { 36 | so = new SerializedObject(this); 37 | sp_to_compute = so.FindProperty("to_compute"); 38 | } 39 | } 40 | 41 | private void OnGUI() 42 | { 43 | EditorGUILayout.PropertyField(sp_to_compute); 44 | so.ApplyModifiedProperties(); 45 | EditorGUILayout.Space(); 46 | 47 | if (to_compute != null && GUILayout.Button("Compute Thickness")) 48 | { 49 | //create the folder with saved mesh assets 50 | if (!AssetDatabase.IsValidFolder("Assets/TranslucentMeshes")) 51 | { 52 | AssetDatabase.CreateFolder("Assets", "TranslucentMeshes"); 53 | } 54 | 55 | GameObject tmp_camera_object = new GameObject("tmp_camera"); 56 | Camera tmp_camera = tmp_camera_object.AddComponent(); 57 | tmp_camera.clearFlags = CameraClearFlags.Color; 58 | tmp_camera.backgroundColor = Color.black; 59 | tmp_camera.nearClipPlane = 0.01f; 60 | tmp_camera.farClipPlane = 300; 61 | 62 | GameObject clone = Instantiate(to_compute.gameObject); 63 | Mesh mesh = Instantiate(to_compute.sharedMesh); 64 | Vector3[] vertices = mesh.vertices; 65 | Vector3[] normals = mesh.normals; 66 | Vector2[] uv2 = new Vector2[mesh.vertexCount]; 67 | Vector2[] uv3 = new Vector2[mesh.vertexCount]; 68 | Vector2[] uv4 = new Vector2[mesh.vertexCount]; 69 | Color[] colors = new Color[mesh.vertexCount]; 70 | 71 | //temporary storage for the sh coefficients 72 | Vector4[] coefficients = new Vector4[9]; 73 | 74 | //64x64 cubemap should be enough 75 | Cubemap thickness_cubemap = new Cubemap(128, TextureFormat.RGBA32, false); //TODO: usare formato float 76 | 77 | for (int v = 0; v < mesh.vertexCount; ++v) 78 | { 79 | //vertices in the mesh are in local space, transform to world coordinate 80 | Vector3 vertex_world_position = vertices[v];// clone.transform.localToWorldMatrix.MultiplyPoint(vertices[v]); //TODO: al posto di lavorare in world space, lavorare in local 81 | Vector3 world_normal = normals[v];// clone.transform.localToWorldMatrix.MultiplyVector(normals[v]); 82 | tmp_camera.transform.position = vertex_world_position - world_normal * 0.011f; 83 | tmp_camera.RenderToCubemap(thickness_cubemap); 84 | 85 | //project the cubemap to the spherical harmonic basis 86 | SphericalHarmonics.GPU_Project_Uniform_9Coeff(thickness_cubemap, coefficients); 87 | 88 | //put 4 coefficients in the vertex color, 2 in the uv2 and 2 in the uv3 and 1 in uv4 89 | colors[v] = new Color(coefficients[0].x, coefficients[1].x, coefficients[2].x, coefficients[3].x); 90 | uv2[v] = new Vector2(coefficients[4].x, coefficients[5].x); 91 | uv3[v] = new Vector2(coefficients[6].x, coefficients[7].x); 92 | uv4[v] = new Vector2(coefficients[8].x, 0); 93 | 94 | for (int i = 0; i < 9; ++i) 95 | coefficients[i] = Vector4.zero; 96 | } 97 | 98 | mesh.colors = colors; 99 | mesh.uv2 = uv2; 100 | mesh.uv3 = uv3; 101 | mesh.uv4 = uv4; 102 | mesh.UploadMeshData(true); 103 | 104 | //save the mesh 105 | AssetDatabase.CreateAsset(mesh, "Assets/TranslucentMeshes/" + to_compute.name + ".asset"); 106 | 107 | clone.GetComponent().sharedMesh = mesh; 108 | 109 | Object.DestroyImmediate(tmp_camera_object); 110 | 111 | to_compute.gameObject.SetActive(false); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Editor/ThicknessCompute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96f2298032b2a1249898450b7d0dda59 3 | timeCreated: 1518891780 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4afc6006c6f2094995e1802b8370007 3 | folderAsset: yes 4 | timeCreated: 1518891737 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8801480d2f036e64bbac602b71383cd7 3 | folderAsset: yes 4 | timeCreated: 1518891743 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/MonteCarloProject.shader: -------------------------------------------------------------------------------- 1 | Shader "SH/MonteCarloProject" 2 | { 3 | Properties 4 | { 5 | } 6 | SubShader 7 | { 8 | Tags { "RenderType" = "Opaque" } 9 | LOD 100 10 | 11 | Pass //y0 12 | { 13 | CGPROGRAM 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | 17 | #include "UnityCG.cginc" 18 | #include "SH_Utils.cginc" 19 | 20 | #define PI 3.1415927 21 | 22 | struct v2f 23 | { 24 | float4 pos : SV_POSITION; 25 | half2 uv : TEXCOORD0; 26 | }; 27 | 28 | sampler2D random_samples; 29 | samplerCUBE input_cubemap; 30 | 31 | v2f vert(appdata_img v) 32 | { 33 | v2f_img o; 34 | o.pos = UnityObjectToClipPos(v.vertex); 35 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(-0.6666, 0.6666, 0, 0); 36 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 37 | return o; 38 | } 39 | 40 | fixed4 frag(v2f i) : SV_Target 41 | { 42 | float2 random = tex2D(random_samples, i.uv).xy; 43 | float phi = 2 * PI * random.x; 44 | float cos_theta = 2 * random.y - 1; 45 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 46 | 47 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 48 | float sh = Y0(v); 49 | float4 proj = texCUBE(input_cubemap, v) * sh; 50 | proj.a = 1; 51 | return proj; 52 | } 53 | ENDCG 54 | } 55 | 56 | //-------------------------------------------------------------------------------------------- 57 | 58 | Pass //y1 59 | { 60 | CGPROGRAM 61 | #pragma vertex vert 62 | #pragma fragment frag 63 | 64 | #include "UnityCG.cginc" 65 | #include "SH_Utils.cginc" 66 | 67 | #define PI 3.1415927 68 | 69 | struct v2f 70 | { 71 | float4 pos : SV_POSITION; 72 | half2 uv : TEXCOORD0; 73 | }; 74 | 75 | sampler2D random_samples; 76 | samplerCUBE input_cubemap; 77 | 78 | v2f vert(appdata_img v) 79 | { 80 | v2f_img o; 81 | o.pos = UnityObjectToClipPos(v.vertex); 82 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(0, 0.6666, 0, 0); 83 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 84 | return o; 85 | } 86 | 87 | fixed4 frag(v2f i) : SV_Target 88 | { 89 | float2 random = tex2D(random_samples, i.uv).xy; 90 | float phi = 2 * PI * random.x; 91 | float cos_theta = 2 * random.y - 1; 92 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 93 | 94 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 95 | float sh = Y1(v); 96 | float4 proj = texCUBE(input_cubemap, v) * sh; 97 | proj.a = 1; 98 | return proj; 99 | } 100 | ENDCG 101 | } 102 | 103 | //-------------------------------------------------------------------------------------------- 104 | 105 | Pass //y2 106 | { 107 | CGPROGRAM 108 | #pragma vertex vert 109 | #pragma fragment frag 110 | 111 | #include "UnityCG.cginc" 112 | #include "SH_Utils.cginc" 113 | 114 | #define PI 3.1415927 115 | 116 | struct v2f 117 | { 118 | float4 pos : SV_POSITION; 119 | half2 uv : TEXCOORD0; 120 | }; 121 | 122 | sampler2D random_samples; 123 | samplerCUBE input_cubemap; 124 | 125 | v2f vert(appdata_img v) 126 | { 127 | v2f_img o; 128 | o.pos = UnityObjectToClipPos(v.vertex); 129 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(0.6666, 0.6666, 0, 0); 130 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 131 | return o; 132 | } 133 | 134 | fixed4 frag(v2f i) : SV_Target 135 | { 136 | float2 random = tex2D(random_samples, i.uv).xy; 137 | float phi = 2 * PI * random.x; 138 | float cos_theta = 2 * random.y - 1; 139 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 140 | 141 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 142 | float sh = Y2(v); 143 | float4 proj = texCUBE(input_cubemap, v) * sh; 144 | proj.a = 1; 145 | return proj; 146 | } 147 | ENDCG 148 | } 149 | 150 | //-------------------------------------------------------------------------------------------- 151 | 152 | Pass //y3 153 | { 154 | CGPROGRAM 155 | #pragma vertex vert 156 | #pragma fragment frag 157 | 158 | #include "UnityCG.cginc" 159 | #include "SH_Utils.cginc" 160 | 161 | #define PI 3.1415927 162 | 163 | struct v2f 164 | { 165 | float4 pos : SV_POSITION; 166 | half2 uv : TEXCOORD0; 167 | }; 168 | 169 | sampler2D random_samples; 170 | samplerCUBE input_cubemap; 171 | 172 | v2f vert(appdata_img v) 173 | { 174 | v2f_img o; 175 | o.pos = UnityObjectToClipPos(v.vertex); 176 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(-0.6666, 0, 0, 0); 177 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 178 | return o; 179 | } 180 | 181 | fixed4 frag(v2f i) : SV_Target 182 | { 183 | float2 random = tex2D(random_samples, i.uv).xy; 184 | float phi = 2 * PI * random.x; 185 | float cos_theta = 2 * random.y - 1; 186 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 187 | 188 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 189 | float sh = Y3(v); 190 | float4 proj = texCUBE(input_cubemap, v) * sh; 191 | proj.a = 1; 192 | return proj; 193 | } 194 | ENDCG 195 | } 196 | 197 | //-------------------------------------------------------------------------------------------- 198 | 199 | Pass //y4 200 | { 201 | CGPROGRAM 202 | #pragma vertex vert 203 | #pragma fragment frag 204 | 205 | #include "UnityCG.cginc" 206 | #include "SH_Utils.cginc" 207 | 208 | #define PI 3.1415927 209 | 210 | struct v2f 211 | { 212 | float4 pos : SV_POSITION; 213 | half2 uv : TEXCOORD0; 214 | }; 215 | 216 | sampler2D random_samples; 217 | samplerCUBE input_cubemap; 218 | 219 | v2f vert(appdata_img v) 220 | { 221 | v2f_img o; 222 | o.pos = UnityObjectToClipPos(v.vertex); 223 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(0, 0, 0, 0); 224 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 225 | return o; 226 | } 227 | 228 | fixed4 frag(v2f i) : SV_Target 229 | { 230 | float2 random = tex2D(random_samples, i.uv).xy; 231 | float phi = 2 * PI * random.x; 232 | float cos_theta = 2 * random.y - 1; 233 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 234 | 235 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 236 | float sh = Y4(v); 237 | float4 proj = texCUBE(input_cubemap, v) * sh; 238 | proj.a = 1; 239 | return proj; 240 | } 241 | ENDCG 242 | } 243 | 244 | //-------------------------------------------------------------------------------------------- 245 | 246 | Pass //y5 247 | { 248 | CGPROGRAM 249 | #pragma vertex vert 250 | #pragma fragment frag 251 | 252 | #include "UnityCG.cginc" 253 | #include "SH_Utils.cginc" 254 | 255 | #define PI 3.1415927 256 | 257 | struct v2f 258 | { 259 | float4 pos : SV_POSITION; 260 | half2 uv : TEXCOORD0; 261 | }; 262 | 263 | sampler2D random_samples; 264 | samplerCUBE input_cubemap; 265 | 266 | v2f vert(appdata_img v) 267 | { 268 | v2f_img o; 269 | o.pos = UnityObjectToClipPos(v.vertex); 270 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(0.6666, 0, 0, 0); 271 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 272 | return o; 273 | } 274 | 275 | fixed4 frag(v2f i) : SV_Target 276 | { 277 | float2 random = tex2D(random_samples, i.uv).xy; 278 | float phi = 2 * PI * random.x; 279 | float cos_theta = 2 * random.y - 1; 280 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 281 | 282 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 283 | float sh = Y5(v); 284 | float4 proj = texCUBE(input_cubemap, v) * sh; 285 | proj.a = 1; 286 | return proj; 287 | } 288 | ENDCG 289 | } 290 | 291 | //-------------------------------------------------------------------------------------------- 292 | 293 | Pass //y6 294 | { 295 | CGPROGRAM 296 | #pragma vertex vert 297 | #pragma fragment frag 298 | 299 | #include "UnityCG.cginc" 300 | #include "SH_Utils.cginc" 301 | 302 | #define PI 3.1415927 303 | 304 | struct v2f 305 | { 306 | float4 pos : SV_POSITION; 307 | half2 uv : TEXCOORD0; 308 | }; 309 | 310 | sampler2D random_samples; 311 | samplerCUBE input_cubemap; 312 | 313 | v2f vert(appdata_img v) 314 | { 315 | v2f_img o; 316 | o.pos = UnityObjectToClipPos(v.vertex); 317 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(-0.6666, -0.6666, 0, 0); 318 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 319 | return o; 320 | } 321 | 322 | fixed4 frag(v2f i) : SV_Target 323 | { 324 | float2 random = tex2D(random_samples, i.uv).xy; 325 | float phi = 2 * PI * random.x; 326 | float cos_theta = 2 * random.y - 1; 327 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 328 | 329 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 330 | float sh = Y6(v); 331 | float4 proj = texCUBE(input_cubemap, v) * sh; 332 | proj.a = 1; 333 | return proj; 334 | } 335 | ENDCG 336 | } 337 | 338 | //-------------------------------------------------------------------------------------------- 339 | 340 | Pass //y7 341 | { 342 | CGPROGRAM 343 | #pragma vertex vert 344 | #pragma fragment frag 345 | 346 | #include "UnityCG.cginc" 347 | #include "SH_Utils.cginc" 348 | 349 | #define PI 3.1415927 350 | 351 | struct v2f 352 | { 353 | float4 pos : SV_POSITION; 354 | half2 uv : TEXCOORD0; 355 | }; 356 | 357 | sampler2D random_samples; 358 | samplerCUBE input_cubemap; 359 | 360 | v2f vert(appdata_img v) 361 | { 362 | v2f_img o; 363 | o.pos = UnityObjectToClipPos(v.vertex); 364 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(0, -0.6666, 0, 0); 365 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 366 | return o; 367 | } 368 | 369 | fixed4 frag(v2f i) : SV_Target 370 | { 371 | float2 random = tex2D(random_samples, i.uv).xy; 372 | float phi = 2 * PI * random.x; 373 | float cos_theta = 2 * random.y - 1; 374 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 375 | 376 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 377 | float sh = Y7(v); 378 | float4 proj = texCUBE(input_cubemap, v) * sh; 379 | proj.a = 1; 380 | return proj; 381 | } 382 | ENDCG 383 | } 384 | 385 | //-------------------------------------------------------------------------------------------- 386 | 387 | Pass //y8 388 | { 389 | CGPROGRAM 390 | #pragma vertex vert 391 | #pragma fragment frag 392 | 393 | #include "UnityCG.cginc" 394 | #include "SH_Utils.cginc" 395 | 396 | #define PI 3.1415927 397 | 398 | struct v2f 399 | { 400 | float4 pos : SV_POSITION; 401 | half2 uv : TEXCOORD0; 402 | }; 403 | 404 | sampler2D random_samples; 405 | samplerCUBE input_cubemap; 406 | 407 | v2f vert(appdata_img v) 408 | { 409 | v2f_img o; 410 | o.pos = UnityObjectToClipPos(v.vertex); 411 | o.pos = o.pos * float4(0.3333, 0.3333, 1, 1) + float4(0.6666, -0.6666, 0, 0); 412 | o.uv = o.pos.xy * 0.5 + 0.5;// MultiplyUV(UNITY_MATRIX_TEXTURE0, v.texcoord); 413 | return o; 414 | } 415 | 416 | fixed4 frag(v2f i) : SV_Target 417 | { 418 | float2 random = tex2D(random_samples, i.uv).xy; 419 | float phi = 2 * PI * random.x; 420 | float cos_theta = 2 * random.y - 1; 421 | float sin_theta = sqrt(1 - cos_theta * cos_theta); 422 | 423 | float3 v = float3(sin_theta * cos(phi), sin_theta * sin(phi), cos_theta); 424 | float sh = Y8(v); 425 | float4 proj = texCUBE(input_cubemap, v) * sh; 426 | proj.a = 1; 427 | return proj; 428 | } 429 | ENDCG 430 | } 431 | } 432 | } 433 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/MonteCarloProject.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9558f627308cbc49948430e224cbeab 3 | timeCreated: 1518903532 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/Reduce_MC_1024.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel Reduce_MC_1024 2 | 3 | #define PI 3.1415927 4 | 5 | Texture2D input_data; 6 | RWBuffer coefficients_buffer; 7 | 8 | struct CS_INPUT 9 | { 10 | uint3 Gid : SV_GroupID; 11 | uint3 GTid : SV_GroupThreadID; 12 | uint3 DTid : SV_DispatchThreadID; 13 | uint GI : SV_GroupIndex; 14 | }; 15 | 16 | groupshared float4 groupMem[1024]; 17 | 18 | [numthreads(32,32,1)] 19 | void Reduce_MC_1024(CS_INPUT input) 20 | { 21 | //read the input 22 | groupMem[input.GI] = input_data[input.DTid.xy]; 23 | 24 | GroupMemoryBarrierWithGroupSync(); 25 | 26 | if (input.GI < 512) 27 | groupMem[input.GI] += groupMem[input.GI + 512]; 28 | 29 | GroupMemoryBarrierWithGroupSync(); 30 | 31 | if (input.GI < 256) 32 | groupMem[input.GI] += groupMem[input.GI + 256]; 33 | 34 | GroupMemoryBarrierWithGroupSync(); 35 | 36 | if (input.GI < 128) 37 | groupMem[input.GI] += groupMem[input.GI + 128]; 38 | 39 | GroupMemoryBarrierWithGroupSync(); 40 | 41 | if (input.GI < 64) 42 | groupMem[input.GI] += groupMem[input.GI + 64]; 43 | 44 | GroupMemoryBarrierWithGroupSync(); 45 | 46 | if (input.GI < 32) 47 | groupMem[input.GI] += groupMem[input.GI + 32]; 48 | 49 | GroupMemoryBarrierWithGroupSync(); 50 | 51 | if (input.GI < 16) 52 | groupMem[input.GI] += groupMem[input.GI + 16]; 53 | 54 | GroupMemoryBarrierWithGroupSync(); 55 | 56 | if (input.GI < 8) 57 | groupMem[input.GI] += groupMem[input.GI + 8]; 58 | 59 | GroupMemoryBarrierWithGroupSync(); 60 | 61 | if (input.GI < 4) 62 | groupMem[input.GI] += groupMem[input.GI + 4]; 63 | 64 | GroupMemoryBarrierWithGroupSync(); 65 | 66 | if (input.GI < 2) 67 | groupMem[input.GI] += groupMem[input.GI + 2]; 68 | 69 | GroupMemoryBarrierWithGroupSync(); 70 | 71 | if (input.GI == 0) 72 | { 73 | uint flatten_group_id = input.Gid.y * 3 + input.Gid.x; 74 | coefficients_buffer[flatten_group_id] = (groupMem[0] + groupMem[1]) * 4 * PI * 0.0009765625; // 0.0009765625 = 1 / 1024 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/Reduce_MC_1024.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 610e75233048a1149905ffb34c7dedb4 3 | timeCreated: 1518903532 4 | licenseType: Free 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/Reduce_Uniform.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel sh_0 2 | #pragma kernel sh_1 3 | #pragma kernel sh_2 4 | #pragma kernel sh_3 5 | #pragma kernel sh_4 6 | #pragma kernel sh_5 7 | #pragma kernel sh_6 8 | #pragma kernel sh_7 9 | #pragma kernel sh_8 10 | #pragma kernel Reduce 11 | 12 | #include "SH_Utils.cginc" 13 | 14 | Texture2DArray input_data; 15 | RWBuffer output_buffer; 16 | RWBuffer coefficients; 17 | Buffer input_buffer; 18 | 19 | uint ceiled_size; 20 | uint input_size; 21 | uint row_size; 22 | uint face_size; 23 | uint coeff; 24 | 25 | struct CS_INPUT 26 | { 27 | uint3 Gid : SV_GroupID; 28 | uint3 GTid : SV_GroupThreadID; 29 | uint3 DTid : SV_DispatchThreadID; 30 | uint GI : SV_GroupIndex; 31 | }; 32 | 33 | groupshared float4 groupMem[384]; 34 | 35 | void first_reduction(CS_INPUT input, uint coefficient) 36 | { 37 | GroupMemoryBarrierWithGroupSync(); 38 | 39 | uint flatGI = input.GI % 64; 40 | 41 | if (flatGI < 32) 42 | groupMem[input.GI] += groupMem[input.GI + 32]; 43 | 44 | GroupMemoryBarrierWithGroupSync(); 45 | 46 | if (flatGI < 16) 47 | groupMem[input.GI] += groupMem[input.GI + 16]; 48 | 49 | GroupMemoryBarrierWithGroupSync(); 50 | 51 | if (flatGI < 8) 52 | groupMem[input.GI] += groupMem[input.GI + 8]; 53 | 54 | GroupMemoryBarrierWithGroupSync(); 55 | 56 | if (flatGI < 4) 57 | groupMem[input.GI] += groupMem[input.GI + 4]; 58 | 59 | GroupMemoryBarrierWithGroupSync(); 60 | 61 | if (flatGI < 2) 62 | groupMem[input.GI] += groupMem[input.GI + 2]; 63 | 64 | GroupMemoryBarrierWithGroupSync(); 65 | 66 | if (flatGI < 1) 67 | groupMem[input.GI] += groupMem[input.GI + 1]; 68 | 69 | GroupMemoryBarrierWithGroupSync(); 70 | 71 | if (flatGI < 1) 72 | { 73 | float4 output = groupMem[input.GI]; 74 | uint index = input.Gid.x + input.Gid.y * row_size + input.DTid.z * face_size; 75 | output_buffer[index] = output; 76 | 77 | if (input.GI == 0 && input_size <= 8) 78 | { 79 | float4 output = (groupMem[0] + groupMem[64] + groupMem[128] + groupMem[192] + groupMem[256] + groupMem[320]); 80 | coefficients[coefficient] = output; 81 | } 82 | } 83 | } 84 | 85 | [numthreads(8, 8, 6)] 86 | void sh_0(CS_INPUT input) 87 | { 88 | if (input.DTid.x < input_size && input.DTid.y < input_size) 89 | { 90 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 91 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 92 | float dw = DifferentialSolidAngle(input_size, uv); 93 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 94 | float sh = Y0(dir); 95 | groupMem[input.GI] = loaded * dw * sh; 96 | } 97 | else 98 | groupMem[input.GI] = float4(0, 0, 0, 0); 99 | 100 | first_reduction(input, 0); 101 | } 102 | 103 | [numthreads(8, 8, 6)] 104 | void sh_1(CS_INPUT input) 105 | { 106 | if (input.DTid.x < input_size && input.DTid.y < input_size) 107 | { 108 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 109 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 110 | float dw = DifferentialSolidAngle(input_size, uv); 111 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 112 | float sh = Y1(dir); 113 | groupMem[input.GI] = loaded * dw * sh; 114 | } 115 | else 116 | groupMem[input.GI] = float4(0, 0, 0, 0); 117 | 118 | first_reduction(input, 1); 119 | } 120 | 121 | [numthreads(8, 8, 6)] 122 | void sh_2(CS_INPUT input) 123 | { 124 | if (input.DTid.x < input_size && input.DTid.y < input_size) 125 | { 126 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 127 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 128 | float dw = DifferentialSolidAngle(input_size, uv); 129 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 130 | float sh = Y2(dir); 131 | groupMem[input.GI] = loaded * dw * sh; 132 | } 133 | else 134 | groupMem[input.GI] = float4(0, 0, 0, 0); 135 | 136 | first_reduction(input, 2); 137 | } 138 | 139 | [numthreads(8, 8, 6)] 140 | void sh_3(CS_INPUT input) 141 | { 142 | if (input.DTid.x < input_size && input.DTid.y < input_size) 143 | { 144 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 145 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 146 | float dw = DifferentialSolidAngle(input_size, uv); 147 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 148 | float sh = Y3(dir); 149 | groupMem[input.GI] = loaded * dw * sh; 150 | } 151 | else 152 | groupMem[input.GI] = float4(0, 0, 0, 0); 153 | 154 | first_reduction(input, 3); 155 | } 156 | 157 | [numthreads(8, 8, 6)] 158 | void sh_4(CS_INPUT input) 159 | { 160 | if (input.DTid.x < input_size && input.DTid.y < input_size) 161 | { 162 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 163 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 164 | float dw = DifferentialSolidAngle(input_size, uv); 165 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 166 | float sh = Y4(dir); 167 | groupMem[input.GI] = loaded * dw * sh; 168 | } 169 | else 170 | groupMem[input.GI] = float4(0, 0, 0, 0); 171 | 172 | first_reduction(input, 4); 173 | } 174 | 175 | [numthreads(8, 8, 6)] 176 | void sh_5(CS_INPUT input) 177 | { 178 | if (input.DTid.x < input_size && input.DTid.y < input_size) 179 | { 180 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 181 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 182 | float dw = DifferentialSolidAngle(input_size, uv); 183 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 184 | float sh = Y5(dir); 185 | groupMem[input.GI] = loaded * dw * sh; 186 | } 187 | else 188 | groupMem[input.GI] = float4(0, 0, 0, 0); 189 | 190 | first_reduction(input, 5); 191 | } 192 | 193 | [numthreads(8, 8, 6)] 194 | void sh_6(CS_INPUT input) 195 | { 196 | if (input.DTid.x < input_size && input.DTid.y < input_size) 197 | { 198 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 199 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 200 | float dw = DifferentialSolidAngle(input_size, uv); 201 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 202 | float sh = Y6(dir); 203 | groupMem[input.GI] = loaded * dw * sh; 204 | } 205 | else 206 | groupMem[input.GI] = float4(0, 0, 0, 0); 207 | 208 | first_reduction(input, 6); 209 | } 210 | 211 | [numthreads(8, 8, 6)] 212 | void sh_7(CS_INPUT input) 213 | { 214 | if (input.DTid.x < input_size && input.DTid.y < input_size) 215 | { 216 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 217 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 218 | float dw = DifferentialSolidAngle(input_size, uv); 219 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 220 | float sh = Y7(dir); 221 | groupMem[input.GI] = loaded * dw * sh; 222 | } 223 | else 224 | groupMem[input.GI] = float4(0, 0, 0, 0); 225 | 226 | first_reduction(input, 7); 227 | } 228 | 229 | [numthreads(8, 8, 6)] 230 | void sh_8(CS_INPUT input) 231 | { 232 | if (input.DTid.x < input_size && input.DTid.y < input_size) 233 | { 234 | float4 loaded = input_data.Load(uint4(input.DTid.x, input.DTid.y, input.DTid.z, 0)); 235 | float2 uv = float2(input.DTid.xy) / (input_size - 1); 236 | float dw = DifferentialSolidAngle(input_size, uv); 237 | float3 dir = normalize(RfromUV(input.DTid.z, uv.x, uv.y)); 238 | float sh = Y8(dir); 239 | groupMem[input.GI] = loaded * dw * sh; 240 | } 241 | else 242 | groupMem[input.GI] = float4(0, 0, 0, 0); 243 | 244 | first_reduction(input, 8); 245 | } 246 | 247 | [numthreads(8, 8, 6)] 248 | void Reduce(CS_INPUT input) 249 | { 250 | if (input.DTid.x < input_size && input.DTid.y < input_size) 251 | { 252 | uint index = input.DTid.x + input.DTid.y * row_size + input.DTid.z * face_size; 253 | float4 v = input_buffer[index]; 254 | groupMem[input.GI] = v; 255 | } 256 | else 257 | groupMem[input.GI] = float4(0, 0, 0, 0); 258 | GroupMemoryBarrierWithGroupSync(); 259 | 260 | uint flatGI = input.GI % 64; 261 | 262 | if (flatGI < 32) 263 | groupMem[input.GI] += groupMem[input.GI + 32]; 264 | 265 | GroupMemoryBarrierWithGroupSync(); 266 | 267 | if (flatGI < 16) 268 | groupMem[input.GI] += groupMem[input.GI + 16]; 269 | 270 | GroupMemoryBarrierWithGroupSync(); 271 | 272 | if (flatGI < 8) 273 | groupMem[input.GI] += groupMem[input.GI + 8]; 274 | 275 | GroupMemoryBarrierWithGroupSync(); 276 | 277 | if (flatGI < 4) 278 | groupMem[input.GI] += groupMem[input.GI + 4]; 279 | 280 | GroupMemoryBarrierWithGroupSync(); 281 | 282 | if (flatGI < 2) 283 | groupMem[input.GI] += groupMem[input.GI + 2]; 284 | 285 | GroupMemoryBarrierWithGroupSync(); 286 | 287 | if (flatGI < 1) 288 | groupMem[input.GI] += groupMem[input.GI + 1]; 289 | 290 | GroupMemoryBarrierWithGroupSync(); 291 | 292 | if (flatGI < 1) 293 | { 294 | float4 output = groupMem[input.GI]; 295 | uint index = input.Gid.x + input.Gid.y * row_size + input.DTid.z * face_size; 296 | output_buffer[index] = output; 297 | 298 | if (input.GI == 0 && input_size <= 8) 299 | { 300 | float4 output = (groupMem[0] + groupMem[64] + groupMem[128] + groupMem[192] + groupMem[256] + groupMem[320]); 301 | coefficients[coeff] = output; 302 | } 303 | } 304 | } 305 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/Reduce_Uniform.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9b8fd18fb5bdfe42888e52023cf62bf 3 | timeCreated: 1525209410 4 | licenseType: Free 5 | ComputeShaderImporter: 6 | externalObjects: {} 7 | currentAPIMask: 4 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/SH_Utils.cginc: -------------------------------------------------------------------------------- 1 | float AreaElement(float x, float y) 2 | { 3 | return atan2(x * y, sqrt(x * x + y * y + 1)); 4 | } 5 | 6 | float DifferentialSolidAngle(float textureSize, float2 uv) 7 | { 8 | float inv = 1.0 / textureSize; 9 | float u = 2.0 * (uv.x + 0.5 * inv) - 1; 10 | float v = 2.0 * (uv.y + 0.5 * inv) - 1; 11 | float x0 = u - inv; 12 | float y0 = v - inv; 13 | float x1 = u + inv; 14 | float y1 = v + inv; 15 | return AreaElement(x0, y0) - AreaElement(x0, y1) - AreaElement(x1, y0) + AreaElement(x1, y1); 16 | } 17 | 18 | float rand(float2 n) 19 | { 20 | return frac(sin(dot(n, float2(12.9898, 4.1414))) * 43758.5453); 21 | } 22 | 23 | float Y0(float3 v) 24 | { 25 | return 0.2820947917f; 26 | } 27 | 28 | float Y1(float3 v) 29 | { 30 | return 0.4886025119f * v.y; 31 | } 32 | 33 | float Y2(float3 v) 34 | { 35 | return 0.4886025119f * v.z; 36 | } 37 | 38 | float Y3(float3 v) 39 | { 40 | return 0.4886025119f * v.x; 41 | } 42 | 43 | float Y4(float3 v) 44 | { 45 | return 1.0925484306f * v.x * v.y; 46 | } 47 | 48 | float Y5(float3 v) 49 | { 50 | return 1.0925484306f * v.y * v.z; 51 | } 52 | 53 | float Y6(float3 v) 54 | { 55 | return 0.3153915652f * (3.0f * v.z * v.z - 1.0f); 56 | } 57 | 58 | float Y7(float3 v) 59 | { 60 | return 1.0925484306f * v.x * v.z; 61 | } 62 | 63 | float Y8(float3 v) 64 | { 65 | return 0.5462742153f * (v.x * v.x - v.y * v.y); 66 | } 67 | 68 | //GET TEXEL DIRECTION VECTOR FROM UV 69 | float3 RfromUV(uint face, float u, float v) 70 | { 71 | float3 dir; 72 | 73 | switch (face) 74 | { 75 | case 0: //+X 76 | dir.x = 1; 77 | dir.y = v * -2.0f + 1.0f; 78 | dir.z = u * -2.0f + 1.0f; 79 | break; 80 | 81 | case 1: //-X 82 | dir.x = -1; 83 | dir.y = v * -2.0f + 1.0f; 84 | dir.z = u * 2.0f - 1.0f; 85 | break; 86 | 87 | case 2: //+Y 88 | dir.x = u * 2.0f - 1.0f; 89 | dir.y = 1.0f; 90 | dir.z = v * 2.0f - 1.0f; 91 | break; 92 | 93 | case 3: //-Y 94 | dir.x = u * 2.0f - 1.0f; 95 | dir.y = -1.0f; 96 | dir.z = v * -2.0f + 1.0f; 97 | break; 98 | 99 | case 4: //+Z 100 | dir.x = u * 2.0f - 1.0f; 101 | dir.y = v * -2.0f + 1.0f; 102 | dir.z = 1; 103 | break; 104 | 105 | case 5: //-Z 106 | dir.x = u * -2.0f + 1.0f; 107 | dir.y = v * -2.0f + 1.0f; 108 | dir.z = -1; 109 | break; 110 | } 111 | 112 | return dir; 113 | } -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/SH_Utils.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b2db836529ee274a96d795e32763c67 3 | timeCreated: 1518903531 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/Thickness.shader: -------------------------------------------------------------------------------- 1 | Shader "Translucency/Thickness" 2 | { 3 | Properties 4 | { 5 | } 6 | SubShader 7 | { 8 | Tags { "RenderType"="Opaque" "LightMode"="ForwardBase"} 9 | LOD 100 10 | 11 | Pass 12 | { 13 | Cull Off 14 | ZTest Always 15 | BlendOp Max 16 | Blend One One 17 | 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | 22 | #include "UnityCG.cginc" 23 | 24 | struct appdata 25 | { 26 | float4 vertex : POSITION; 27 | }; 28 | 29 | struct v2f 30 | { 31 | float4 vertex : SV_POSITION; 32 | float4 world_position : TEXCOORD0; 33 | }; 34 | 35 | v2f vert (appdata v) 36 | { 37 | v2f o; 38 | o.vertex = UnityObjectToClipPos(v.vertex); 39 | o.world_position = mul(unity_ObjectToWorld, v.vertex); 40 | return o; 41 | } 42 | 43 | fixed4 frag (v2f i) : SV_Target 44 | { 45 | float l = length(i.world_position.xyz - _WorldSpaceCameraPos.xyz); 46 | return float4(l, l, l, 1); 47 | } 48 | ENDCG 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/Thickness.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df183f07f4b3bf64d96ce13a99360c06 3 | timeCreated: 1519029660 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/TranslucentShader.shader: -------------------------------------------------------------------------------- 1 | Shader "Translucency/TranslucentShader" 2 | { 3 | Properties 4 | { 5 | //TRANSLUCENCY 6 | _Absorption("Absorption", Color) = (1,1,1,1) 7 | _ThicknessPower("Thickness Power", Float) = 1 8 | 9 | //REFRACTION 10 | _Refraction("Index of Refraction", Range(1, 1.2)) = 1 11 | _RefractionRoughness("Refraction Roughness", Range(0, 10)) = 0 12 | 13 | //POINT LIGHT 14 | _PointLightHardness("Point Light Hardness", Float) = 1 15 | _PointLightIntensity("Point Light Intensity", Float) = 1 16 | 17 | //GGX SPECULAR 18 | _Roughness("Roughness", Range(0, 1)) = 0 19 | _Metalness("Metalness", Range(0, 1)) = 0.04 20 | _Envmap("Envmap", Cube) = "white" {} 21 | _BRDF("BRDF", 2D) = "white" {} 22 | } 23 | SubShader 24 | { 25 | Tags{ "RenderType" = "Opaque" "LightMode" = "ForwardBase" } 26 | LOD 100 27 | 28 | Pass 29 | { 30 | CGPROGRAM 31 | #pragma vertex vert 32 | #pragma fragment frag 33 | 34 | #include "UnityCG.cginc" 35 | #include "SH_Utils.cginc" 36 | 37 | struct appdata 38 | { 39 | float4 vertex : POSITION; 40 | float2 uv : TEXCOORD0; 41 | float2 uv2 : TEXCOORD1; 42 | float2 uv3 : TEXCOORD2; 43 | float2 uv4 : TEXCOORD3; 44 | float4 color : COLOR; 45 | float3 normal : NORMAL; 46 | }; 47 | 48 | struct v2f 49 | { 50 | float4 vertex : SV_POSITION; 51 | float2 uv : TEXCOORD0; 52 | float4 sh_0 : TEXCOORD1; 53 | float4 sh_1 : TEXCOORD2; 54 | float4 world_position : TEXCOORD3; //w is for the last sh coefficient 55 | float3 normal : TEXCOORD4; 56 | }; 57 | 58 | float4 _Absorption; 59 | float _ThicknessPower; 60 | 61 | float _Refraction; 62 | float _RefractionRoughness; 63 | 64 | float _PointLightHardness; 65 | float _PointLightIntensity; 66 | 67 | float _Roughness; 68 | float _Metalness; 69 | samplerCUBE _Envmap; 70 | sampler2D _BRDF; 71 | 72 | v2f vert (appdata v) 73 | { 74 | v2f o; 75 | o.vertex = UnityObjectToClipPos(v.vertex); 76 | o.uv = v.uv; 77 | o.sh_0 = v.color; 78 | o.sh_1 = float4(v.uv2.xy, v.uv3.xy); 79 | o.world_position = mul(unity_ObjectToWorld, v.vertex); 80 | o.world_position.w = v.uv4.x; 81 | o.normal = UnityObjectToWorldNormal(v.normal); 82 | return o; 83 | } 84 | 85 | fixed4 frag (v2f i) : SV_Target 86 | { 87 | //some vectors 88 | float3 V = normalize(i.world_position.xyz - _WorldSpaceCameraPos.xyz); 89 | float3 N = normalize(i.normal); 90 | float3 R = refract(V, N, 1.0 / _Refraction); 91 | float3 r = reflect(V, N); 92 | 93 | //transmitted environment 94 | float4 env = texCUBElod(_Envmap, float4(R, _RefractionRoughness)); 95 | 96 | //indirect specular 97 | float NdotV = saturate(dot(N, -V)); 98 | float2 brdfUV = float2(NdotV, _Roughness); 99 | float2 preBRDF = tex2D(_BRDF, brdfUV).xy; 100 | float4 indirectSpecular = texCUBElod(_Envmap, float4(r, _Roughness * 5)) * (_Metalness * preBRDF.x + preBRDF.y); 101 | 102 | //point lights 103 | float3 light_position = float3(unity_4LightPosX0.x, unity_4LightPosY0.x, unity_4LightPosZ0.x); 104 | float3 L = normalize(light_position - i.world_position.xyz); 105 | float point_light = pow(saturate(dot(V, L)), _PointLightHardness) * _PointLightIntensity; 106 | 107 | //translucency 108 | float4 sh0 = float4(Y0(V), Y1(V), Y2(V), Y3(V)); 109 | float4 sh1 = float4(Y4(V), Y5(V), Y6(V), Y7(V)); 110 | float thickness = max(0, dot(sh0, i.sh_0) + dot(sh1, i.sh_1) + Y8(V) * i.world_position.w); 111 | float4 absorption = exp(-pow(thickness, _ThicknessPower) * _Absorption.a * 20) * _Absorption; 112 | 113 | return absorption * (env/* + point_light*/) + indirectSpecular; 114 | } 115 | ENDCG 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Resources/Shaders/TranslucentShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b2daade16b947441b65552274567509 3 | timeCreated: 1519075721 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b13873dac0e216947ba459febe4ca952 3 | folderAsset: yes 4 | timeCreated: 1518891726 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Scripts/SphericalHarmonics.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public delegate float SH_Base(Vector3 v); 6 | 7 | public class SphericalHarmonicsBasis 8 | { 9 | public static float Y0(Vector3 v) 10 | { 11 | return 0.2820947917f; 12 | } 13 | 14 | public static float Y1(Vector3 v) 15 | { 16 | return 0.4886025119f * v.y; 17 | } 18 | 19 | public static float Y2(Vector3 v) 20 | { 21 | return 0.4886025119f * v.z; 22 | } 23 | 24 | public static float Y3(Vector3 v) 25 | { 26 | return 0.4886025119f * v.x; 27 | } 28 | 29 | public static float Y4(Vector3 v) 30 | { 31 | return 1.0925484306f * v.x * v.y; 32 | } 33 | 34 | public static float Y5(Vector3 v) 35 | { 36 | return 1.0925484306f * v.y * v.z; 37 | } 38 | 39 | public static float Y6(Vector3 v) 40 | { 41 | return 0.3153915652f * (3.0f * v.z * v.z - 1.0f); 42 | } 43 | 44 | public static float Y7(Vector3 v) 45 | { 46 | return 1.0925484306f * v.x * v.z; 47 | } 48 | 49 | public static float Y8(Vector3 v) 50 | { 51 | return 0.5462742153f * (v.x * v.x - v.y * v.y); 52 | } 53 | 54 | public static SH_Base[] Eval = { Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8 }; 55 | } 56 | 57 | public class SphericalHarmonics 58 | { 59 | //Convert a RenderTextureFormat to TextureFormat 60 | public static TextureFormat ConvertFormat(RenderTextureFormat input_format) 61 | { 62 | TextureFormat output_format = TextureFormat.RGBA32; 63 | 64 | switch (input_format) 65 | { 66 | case RenderTextureFormat.ARGB32: 67 | output_format = TextureFormat.RGBA32; 68 | break; 69 | 70 | case RenderTextureFormat.ARGBHalf: 71 | output_format = TextureFormat.RGBAHalf; 72 | break; 73 | 74 | case RenderTextureFormat.ARGBFloat: 75 | output_format = TextureFormat.RGBAFloat; 76 | break; 77 | 78 | default: 79 | string format_string = System.Enum.GetName(typeof(RenderTextureFormat), input_format); 80 | int format_int = (int)System.Enum.Parse(typeof(TextureFormat), format_string); 81 | output_format = (TextureFormat)format_int; 82 | break; 83 | } 84 | 85 | return output_format; 86 | } 87 | 88 | //Convert a TextureFormat to RenderTextureFormat 89 | public static RenderTextureFormat ConvertRenderFormat(TextureFormat input_format) 90 | { 91 | RenderTextureFormat output_format = RenderTextureFormat.ARGB32; 92 | 93 | switch (input_format) 94 | { 95 | case TextureFormat.RGBA32: 96 | output_format = RenderTextureFormat.ARGB32; 97 | break; 98 | 99 | case TextureFormat.RGBAHalf: 100 | output_format = RenderTextureFormat.ARGBHalf; 101 | break; 102 | 103 | case TextureFormat.RGBAFloat: 104 | output_format = RenderTextureFormat.ARGBFloat; 105 | break; 106 | 107 | default: 108 | string format_string = System.Enum.GetName(typeof(TextureFormat), input_format); 109 | int format_int = (int)System.Enum.Parse(typeof(RenderTextureFormat), format_string); 110 | output_format = (RenderTextureFormat)format_int; 111 | break; 112 | } 113 | 114 | return output_format; 115 | } 116 | 117 | //Convert a RenderTexture to a Cubemap 118 | public static Cubemap RenderTextureToCubemap(RenderTexture input) 119 | { 120 | if (input.dimension != UnityEngine.Rendering.TextureDimension.Cube) 121 | { 122 | Debug.LogWarning("Input render texture dimension must be cube"); 123 | return null; 124 | } 125 | 126 | if (input.width != input.height) 127 | { 128 | Debug.LogWarning("Input render texture must be square"); 129 | return null; 130 | } 131 | 132 | Cubemap output = new Cubemap(input.width, ConvertFormat(input.format), false); 133 | Texture2D tmp_face = new Texture2D(input.width, input.height, output.format, false); 134 | 135 | RenderTexture active = RenderTexture.active; 136 | 137 | for (int face = 0; face < 6; ++face) 138 | { 139 | Graphics.SetRenderTarget(input, 0, (CubemapFace)face); 140 | tmp_face.ReadPixels(new Rect(0, 0, input.width, input.height), 0, 0); 141 | output.SetPixels(tmp_face.GetPixels(), (CubemapFace)face); 142 | } 143 | output.Apply(); 144 | 145 | RenderTexture.active = active; 146 | 147 | Object.DestroyImmediate(tmp_face); 148 | 149 | return output; 150 | } 151 | 152 | //differential solid angle 153 | public static float AreaElement(float x, float y) 154 | { 155 | return Mathf.Atan2(x * y, Mathf.Sqrt(x * x + y * y + 1)); 156 | } 157 | 158 | public static float DifferentialSolidAngle(int textureSize, float U, float V) 159 | { 160 | float inv = 1.0f / textureSize; 161 | float u = 2.0f * (U + 0.5f * inv) - 1; 162 | float v = 2.0f * (V + 0.5f * inv) - 1; 163 | float x0 = u - inv; 164 | float y0 = v - inv; 165 | float x1 = u + inv; 166 | float y1 = v + inv; 167 | return AreaElement(x0, y0) - AreaElement(x0, y1) - AreaElement(x1, y0) + AreaElement(x1, y1); 168 | } 169 | 170 | public static Vector3 DirectionFromCubemapTexel(int face, float u, float v) 171 | { 172 | Vector3 dir = Vector3.zero; 173 | 174 | switch (face) 175 | { 176 | case 0: //+X 177 | dir.x = 1; 178 | dir.y = v * -2.0f + 1.0f; 179 | dir.z = u * -2.0f + 1.0f; 180 | break; 181 | 182 | case 1: //-X 183 | dir.x = -1; 184 | dir.y = v * -2.0f + 1.0f; 185 | dir.z = u * 2.0f - 1.0f; 186 | break; 187 | 188 | case 2: //+Y 189 | dir.x = u * 2.0f - 1.0f; 190 | dir.y = 1.0f; 191 | dir.z = v * 2.0f - 1.0f; 192 | break; 193 | 194 | case 3: //-Y 195 | dir.x = u * 2.0f - 1.0f; 196 | dir.y = -1.0f; 197 | dir.z = v * -2.0f + 1.0f; 198 | break; 199 | 200 | case 4: //+Z 201 | dir.x = u * 2.0f - 1.0f; 202 | dir.y = v * -2.0f + 1.0f; 203 | dir.z = 1; 204 | break; 205 | 206 | case 5: //-Z 207 | dir.x = u * -2.0f + 1.0f; 208 | dir.y = v * -2.0f + 1.0f; 209 | dir.z = -1; 210 | break; 211 | } 212 | 213 | return dir.normalized; 214 | } 215 | 216 | public static int FindFace(Vector3 dir) 217 | { 218 | int f = 0; 219 | float max = Mathf.Abs(dir.x); 220 | if (Mathf.Abs(dir.y) > max) 221 | { 222 | max = Mathf.Abs(dir.y); 223 | f = 2; 224 | } 225 | if (Mathf.Abs(dir.z) > max) 226 | { 227 | f = 4; 228 | } 229 | 230 | switch (f) 231 | { 232 | case 0: 233 | if (dir.x < 0) 234 | f = 1; 235 | break; 236 | 237 | case 2: 238 | if (dir.y < 0) 239 | f = 3; 240 | break; 241 | 242 | case 4: 243 | if (dir.z < 0) 244 | f = 5; 245 | break; 246 | } 247 | 248 | return f; 249 | } 250 | 251 | public static int GetTexelIndexFromDirection(Vector3 dir, int cubemap_size) 252 | { 253 | float u = 0, v = 0; 254 | 255 | int f = FindFace(dir); 256 | 257 | switch (f) 258 | { 259 | case 0: 260 | dir.z /= dir.x; 261 | dir.y /= dir.x; 262 | u = (dir.z - 1.0f) * -0.5f; 263 | v = (dir.y - 1.0f) * -0.5f; 264 | break; 265 | 266 | case 1: 267 | dir.z /= -dir.x; 268 | dir.y /= -dir.x; 269 | u = (dir.z + 1.0f) * 0.5f; 270 | v = (dir.y - 1.0f) * -0.5f; 271 | break; 272 | 273 | case 2: 274 | dir.x /= dir.y; 275 | dir.z /= dir.y; 276 | u = (dir.x + 1.0f) * 0.5f; 277 | v = (dir.z + 1.0f) * 0.5f; 278 | break; 279 | 280 | case 3: 281 | dir.x /= -dir.y; 282 | dir.z /= -dir.y; 283 | u = (dir.x + 1.0f) * 0.5f; 284 | v = (dir.z - 1.0f) * -0.5f; 285 | break; 286 | 287 | case 4: 288 | dir.x /= dir.z; 289 | dir.y /= dir.z; 290 | u = (dir.x + 1.0f) * 0.5f; 291 | v = (dir.y - 1.0f) * -0.5f; 292 | break; 293 | 294 | case 5: 295 | dir.x /= -dir.z; 296 | dir.y /= -dir.z; 297 | u = (dir.x - 1.0f) * -0.5f; 298 | v = (dir.y - 1.0f) * -0.5f; 299 | break; 300 | } 301 | 302 | if (v == 1.0f) v = 0.999999f; 303 | if (u == 1.0f) u = 0.999999f; 304 | 305 | int index = (int)(v * cubemap_size) * cubemap_size + (int)(u * cubemap_size); 306 | 307 | return index; 308 | } 309 | 310 | public static bool CPU_Project_Uniform_9Coeff(Cubemap input, Vector4[] output) 311 | { 312 | if (output.Length != 9) 313 | { 314 | Debug.LogWarning("output size must be 9 for 9 coefficients"); 315 | return false; 316 | } 317 | 318 | if (input.width != input.height) 319 | { 320 | Debug.LogWarning("input cubemap must be square"); 321 | return false; 322 | } 323 | 324 | Color[] input_face; 325 | int size = input.width; 326 | 327 | //cycle on all 6 faces of the cubemap 328 | for (int face = 0; face < 6; ++face) 329 | { 330 | input_face = input.GetPixels((CubemapFace)face); 331 | 332 | //cycle all the texels 333 | for (int texel = 0; texel < size * size; ++texel) 334 | { 335 | float u = (texel % size) / (float)size; 336 | float v = ((int)(texel / size)) / (float)size; 337 | 338 | //get the direction vector 339 | Vector3 dir = DirectionFromCubemapTexel(face, u, v); 340 | Color radiance = input_face[texel]; 341 | 342 | //compute the differential solid angle 343 | float d_omega = DifferentialSolidAngle(size, u, v); 344 | 345 | //cycle for 9 coefficients 346 | for (int c = 0; c < 9; ++c) 347 | { 348 | //compute shperical harmonic 349 | float sh = SphericalHarmonicsBasis.Eval[c](dir); 350 | 351 | output[c].x += radiance.r * d_omega * sh; 352 | output[c].y += radiance.g * d_omega * sh; 353 | output[c].z += radiance.b * d_omega * sh; 354 | output[c].w += radiance.a * d_omega * sh; 355 | } 356 | } 357 | } 358 | 359 | return true; 360 | } 361 | 362 | public static bool CPU_Project_MonteCarlo_9Coeff(Cubemap input, Vector4[] output, int sample_count) 363 | { 364 | if (output.Length != 9) 365 | { 366 | Debug.LogWarning("output size must be 9 for 9 coefficients"); 367 | return false; 368 | } 369 | 370 | //cache the cubemap faces 371 | List faces = new List(); 372 | 373 | for (int f = 0; f < 6; ++f) 374 | { 375 | faces.Add(input.GetPixels((CubemapFace)f, 0)); 376 | } 377 | 378 | for (int c = 0; c < 9; ++c) 379 | { 380 | for (int s = 0; s < sample_count; ++s) 381 | { 382 | Vector3 dir = Random.onUnitSphere; 383 | int index = GetTexelIndexFromDirection(dir, input.height); 384 | int face = FindFace(dir); 385 | 386 | //read the radiance texel 387 | Color radiance = faces[face][index]; 388 | 389 | //compute shperical harmonic 390 | float sh = SphericalHarmonicsBasis.Eval[c](dir); 391 | 392 | output[c].x += radiance.r * sh; 393 | output[c].y += radiance.g * sh; 394 | output[c].z += radiance.b * sh; 395 | output[c].w += radiance.a * sh; 396 | } 397 | 398 | output[c].x = output[c].x * 4.0f * Mathf.PI / (float)sample_count; 399 | output[c].y = output[c].y * 4.0f * Mathf.PI / (float)sample_count; 400 | output[c].z = output[c].z * 4.0f * Mathf.PI / (float)sample_count; 401 | output[c].w = output[c].w * 4.0f * Mathf.PI / (float)sample_count; 402 | } 403 | 404 | return true; 405 | } 406 | 407 | public static bool GPU_Project_Uniform_9Coeff(Cubemap input, Vector4[] output) 408 | { 409 | //the starting number of groups 410 | int ceiled_size = Mathf.CeilToInt(input.width / 8.0f); 411 | 412 | ComputeBuffer output_buffer = new ComputeBuffer(9, 16); //the output is a buffer with 9 float4 413 | ComputeBuffer ping_buffer = new ComputeBuffer(ceiled_size * ceiled_size * 6, 16); 414 | ComputeBuffer pong_buffer = new ComputeBuffer(ceiled_size * ceiled_size * 6, 16); 415 | 416 | ComputeShader reduce = Resources.Load("Shaders/Reduce_Uniform"); 417 | 418 | //can't have direct access to the cubemap in the compute shader (I think), so i copy the cubemap faces onto a texture2d array 419 | RenderTextureDescriptor desc = new RenderTextureDescriptor(); 420 | desc.autoGenerateMips = false; 421 | desc.bindMS = false; 422 | desc.colorFormat = ConvertRenderFormat(input.format); 423 | desc.depthBufferBits = 0; 424 | desc.dimension = UnityEngine.Rendering.TextureDimension.Tex2DArray; 425 | desc.enableRandomWrite = false; 426 | desc.height = input.height; 427 | desc.width = input.width; 428 | desc.msaaSamples = 1; 429 | desc.sRGB = true; 430 | desc.useMipMap = false; 431 | desc.volumeDepth = 6; 432 | RenderTexture converted_input = new RenderTexture(desc); 433 | converted_input.Create(); 434 | 435 | for (int face = 0; face < 6; ++face) 436 | Graphics.CopyTexture(input, face, 0, converted_input, face, 0); 437 | 438 | //cycle 9 coefficients 439 | for (int c = 0; c < 9; ++c) 440 | { 441 | ceiled_size = Mathf.CeilToInt(input.width / 8.0f); 442 | 443 | int kernel = reduce.FindKernel("sh_" + c.ToString()); 444 | reduce.SetInt("coeff", c); 445 | 446 | //first pass, I compute the integral and make a first pass of reduction 447 | reduce.SetTexture(kernel, "input_data", converted_input); 448 | reduce.SetBuffer(kernel, "output_buffer", ping_buffer); 449 | reduce.SetBuffer(kernel, "coefficients", output_buffer); 450 | reduce.SetInt("ceiled_size", ceiled_size); 451 | reduce.SetInt("input_size", input.width); 452 | reduce.SetInt("row_size", ceiled_size); 453 | reduce.SetInt("face_size", ceiled_size * ceiled_size); 454 | reduce.Dispatch(kernel, ceiled_size, ceiled_size, 1); 455 | 456 | //second pass, complete reduction 457 | kernel = reduce.FindKernel("Reduce"); 458 | 459 | int index = 0; 460 | ComputeBuffer[] buffers = { ping_buffer, pong_buffer }; 461 | while (ceiled_size > 1) 462 | { 463 | reduce.SetInt("input_size", ceiled_size); 464 | ceiled_size = Mathf.CeilToInt(ceiled_size / 8.0f); 465 | reduce.SetInt("ceiled_size", ceiled_size); 466 | reduce.SetBuffer(kernel, "coefficients", output_buffer); 467 | reduce.SetBuffer(kernel, "input_buffer", buffers[index]); 468 | reduce.SetBuffer(kernel, "output_buffer", buffers[(index + 1) % 2]); 469 | reduce.Dispatch(kernel, ceiled_size, ceiled_size, 1); 470 | index = (index + 1) % 2; 471 | } 472 | } 473 | 474 | Vector4[] data = new Vector4[9]; 475 | output_buffer.GetData(data); 476 | for (int c = 0; c < 9; ++c) 477 | output[c] = data[c]; 478 | 479 | pong_buffer.Release(); 480 | ping_buffer.Release(); 481 | output_buffer.Release(); 482 | return true; 483 | } 484 | 485 | public static bool GPU_Project_MonteCarlo_9Coeff(Cubemap input, Vector4[] output) 486 | { 487 | if (output.Length != 9) 488 | { 489 | Debug.LogWarning("output size must be 9 for 9 coefficients"); 490 | return false; 491 | } 492 | 493 | //there are 9 tiles for 9 coefficients, each tile is 32x32 = 1024 samples 494 | RenderTexture rt = new RenderTexture(96, 96, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear); 495 | 496 | //generating random samples on CPU 497 | //TODO: move the generation to the GPU 498 | Texture2D random_samples = new Texture2D(96, 96, TextureFormat.RGFloat, false, true); 499 | Color[] random_data = new Color[96 * 96]; 500 | for (int i = 0; i < random_data.Length; ++i) 501 | { 502 | random_data[i] = new Color(Random.value, Random.value, 0, 0); 503 | } 504 | random_samples.SetPixels(random_data); 505 | random_samples.Apply(); 506 | 507 | Material mat = new Material(Shader.Find("SH/MonteCarloProject")); 508 | mat.SetTexture("random_samples", random_samples); 509 | mat.SetTexture("input_cubemap", input); 510 | 511 | for (int i = 0; i < 9; ++i) 512 | Graphics.Blit(null, rt, mat, i); 513 | 514 | //use a compute shader to reduce the input, for 1024 samples i need 32x32 threads, grouped with 3x3 groups (9 tiles) 515 | ComputeBuffer coefficients_buffer = new ComputeBuffer(9, 16); 516 | ComputeShader reduce = Resources.Load("Shaders/Reduce_MC_1024"); 517 | int kernel_index = reduce.FindKernel("Reduce_MC_1024"); 518 | reduce.SetTexture(kernel_index, "input_data", rt); 519 | reduce.SetBuffer(kernel_index, "coefficients_buffer", coefficients_buffer); 520 | reduce.Dispatch(kernel_index, 3, 3, 1); 521 | 522 | //read back the data 523 | Vector4[] data = new Vector4[9]; 524 | coefficients_buffer.GetData(data); 525 | for (int i = 0; i < 9; ++i) 526 | { 527 | output[i] = data[i]; 528 | } 529 | 530 | coefficients_buffer.Release(); 531 | 532 | return true; 533 | } 534 | } 535 | -------------------------------------------------------------------------------- /Assets/SHTranslucency/Scripts/SphericalHarmonics.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 075fa191894c4794aab8fa47f4ffd135 3 | timeCreated: 1518903451 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | m_AutoSimulation: 1 20 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 0 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | m_CollabEditorSettings: 16 | inProgressEnabled: 1 17 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_CustomRenderPipeline: {fileID: 0} 43 | m_TransparencySortMode: 0 44 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 45 | m_DefaultRenderingPath: 1 46 | m_DefaultMobileRenderingPath: 1 47 | m_TierSettings: [] 48 | m_LightmapStripping: 0 49 | m_FogStripping: 0 50 | m_InstancingStripping: 0 51 | m_LightmapKeepPlain: 1 52 | m_LightmapKeepDirCombined: 1 53 | m_LightmapKeepDynamicPlain: 1 54 | m_LightmapKeepDynamicDirCombined: 1 55 | m_LightmapKeepShadowMask: 1 56 | m_LightmapKeepSubtractive: 1 57 | m_FogKeepLinear: 1 58 | m_FogKeepExp: 1 59 | m_FogKeepExp2: 1 60 | m_AlbedoSwatchInfos: [] 61 | m_LightsUseLinearIntensity: 0 62 | m_LightsUseColorTemperature: 0 63 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | m_SettingNames: 89 | - Humanoid 90 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AlwaysShowColliders: 0 28 | m_ShowColliderSleep: 1 29 | m_ShowColliderContacts: 0 30 | m_ShowColliderAABB: 0 31 | m_ContactArrowScale: 0.2 32 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 33 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 34 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 35 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 36 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 37 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | productGUID: bf44a1b2e986922438fefdb09125e666 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: DefaultCompany 14 | productName: Unity_SHTranslucency 15 | defaultCursor: {fileID: 0} 16 | cursorHotspot: {x: 0, y: 0} 17 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 18 | m_ShowUnitySplashScreen: 1 19 | m_ShowUnitySplashLogo: 1 20 | m_SplashScreenOverlayOpacity: 1 21 | m_SplashScreenAnimation: 1 22 | m_SplashScreenLogoStyle: 1 23 | m_SplashScreenDrawMode: 0 24 | m_SplashScreenBackgroundAnimationZoom: 1 25 | m_SplashScreenLogoAnimationZoom: 1 26 | m_SplashScreenBackgroundLandscapeAspect: 1 27 | m_SplashScreenBackgroundPortraitAspect: 1 28 | m_SplashScreenBackgroundLandscapeUvs: 29 | serializedVersion: 2 30 | x: 0 31 | y: 0 32 | width: 1 33 | height: 1 34 | m_SplashScreenBackgroundPortraitUvs: 35 | serializedVersion: 2 36 | x: 0 37 | y: 0 38 | width: 1 39 | height: 1 40 | m_SplashScreenLogos: [] 41 | m_SplashScreenBackgroundLandscape: {fileID: 0} 42 | m_SplashScreenBackgroundPortrait: {fileID: 0} 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 600 46 | defaultScreenHeight: 800 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 1 51 | m_MTRendering: 1 52 | m_MobileMTRendering: 0 53 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 54 | iosShowActivityIndicatorOnLoading: -1 55 | androidShowActivityIndicatorOnLoading: -1 56 | tizenShowActivityIndicatorOnLoading: -1 57 | iosAppInBackgroundBehavior: 0 58 | displayResolutionDialog: 1 59 | iosAllowHTTPDownload: 1 60 | allowedAutorotateToPortrait: 1 61 | allowedAutorotateToPortraitUpsideDown: 1 62 | allowedAutorotateToLandscapeRight: 1 63 | allowedAutorotateToLandscapeLeft: 1 64 | useOSAutorotation: 1 65 | use32BitDisplayBuffer: 1 66 | disableDepthAndStencilBuffers: 0 67 | defaultIsFullScreen: 0 68 | defaultIsNativeResolution: 1 69 | runInBackground: 0 70 | captureSingleScreen: 1 71 | muteOtherAudioSources: 0 72 | Prepare IOS For Recording: 0 73 | Force IOS Speakers When Recording: 0 74 | submitAnalytics: 1 75 | usePlayerLog: 1 76 | bakeCollisionMeshes: 0 77 | forceSingleInstance: 0 78 | resizableWindow: 1 79 | useMacAppStoreValidation: 0 80 | macAppStoreCategory: public.app-category.games 81 | gpuSkinning: 0 82 | graphicsJobs: 0 83 | xboxPIXTextureCapture: 0 84 | xboxEnableAvatar: 0 85 | xboxEnableKinect: 0 86 | xboxEnableKinectAutoTracking: 0 87 | xboxEnableFitness: 0 88 | visibleInBackground: 1 89 | allowFullscreenSwitch: 1 90 | graphicsJobMode: 0 91 | macFullscreenMode: 2 92 | d3d9FullscreenMode: 1 93 | d3d11FullscreenMode: 1 94 | xboxSpeechDB: 0 95 | xboxEnableHeadOrientation: 0 96 | xboxEnableGuest: 0 97 | xboxEnablePIXSampling: 0 98 | n3dsDisableStereoscopicView: 0 99 | n3dsEnableSharedListOpt: 1 100 | n3dsEnableVSync: 0 101 | ignoreAlphaClear: 0 102 | xboxOneResolution: 0 103 | xboxOneMonoLoggingLevel: 0 104 | xboxOneLoggingLevel: 1 105 | xboxOneDisableEsram: 0 106 | videoMemoryForVertexBuffers: 0 107 | psp2PowerMode: 0 108 | psp2AcquireBGM: 1 109 | wiiUTVResolution: 0 110 | wiiUGamePadMSAA: 1 111 | wiiUSupportsNunchuk: 0 112 | wiiUSupportsClassicController: 0 113 | wiiUSupportsBalanceBoard: 0 114 | wiiUSupportsMotionPlus: 0 115 | wiiUSupportsProController: 0 116 | wiiUAllowScreenCapture: 1 117 | wiiUControllerCount: 0 118 | m_SupportedAspectRatios: 119 | 4:3: 1 120 | 5:4: 1 121 | 16:10: 1 122 | 16:9: 1 123 | Others: 1 124 | bundleVersion: 1.0 125 | preloadedAssets: [] 126 | metroInputSource: 0 127 | m_HolographicPauseOnTrackingLoss: 1 128 | xboxOneDisableKinectGpuReservation: 0 129 | xboxOneEnable7thCore: 0 130 | vrSettings: 131 | cardboard: 132 | depthFormat: 0 133 | enableTransitionView: 0 134 | daydream: 135 | depthFormat: 0 136 | useSustainedPerformanceMode: 0 137 | hololens: 138 | depthFormat: 1 139 | protectGraphicsMemory: 0 140 | useHDRDisplay: 0 141 | targetPixelDensity: 0 142 | resolutionScalingMode: 0 143 | applicationIdentifier: {} 144 | buildNumber: {} 145 | AndroidBundleVersionCode: 1 146 | AndroidMinSdkVersion: 16 147 | AndroidTargetSdkVersion: 0 148 | AndroidPreferredInstallLocation: 1 149 | aotOptions: 150 | stripEngineCode: 1 151 | iPhoneStrippingLevel: 0 152 | iPhoneScriptCallOptimization: 0 153 | ForceInternetPermission: 0 154 | ForceSDCardPermission: 0 155 | CreateWallpaper: 0 156 | APKExpansionFiles: 0 157 | keepLoadedShadersAlive: 0 158 | StripUnusedMeshComponents: 0 159 | VertexChannelCompressionMask: 160 | serializedVersion: 2 161 | m_Bits: 238 162 | iPhoneSdkVersion: 988 163 | iOSTargetOSVersionString: 164 | tvOSSdkVersion: 0 165 | tvOSRequireExtendedGameController: 0 166 | tvOSTargetOSVersionString: 167 | uIPrerenderedIcon: 0 168 | uIRequiresPersistentWiFi: 0 169 | uIRequiresFullScreen: 1 170 | uIStatusBarHidden: 1 171 | uIExitOnSuspend: 0 172 | uIStatusBarStyle: 0 173 | iPhoneSplashScreen: {fileID: 0} 174 | iPhoneHighResSplashScreen: {fileID: 0} 175 | iPhoneTallHighResSplashScreen: {fileID: 0} 176 | iPhone47inSplashScreen: {fileID: 0} 177 | iPhone55inPortraitSplashScreen: {fileID: 0} 178 | iPhone55inLandscapeSplashScreen: {fileID: 0} 179 | iPadPortraitSplashScreen: {fileID: 0} 180 | iPadHighResPortraitSplashScreen: {fileID: 0} 181 | iPadLandscapeSplashScreen: {fileID: 0} 182 | iPadHighResLandscapeSplashScreen: {fileID: 0} 183 | appleTVSplashScreen: {fileID: 0} 184 | tvOSSmallIconLayers: [] 185 | tvOSLargeIconLayers: [] 186 | tvOSTopShelfImageLayers: [] 187 | tvOSTopShelfImageWideLayers: [] 188 | iOSLaunchScreenType: 0 189 | iOSLaunchScreenPortrait: {fileID: 0} 190 | iOSLaunchScreenLandscape: {fileID: 0} 191 | iOSLaunchScreenBackgroundColor: 192 | serializedVersion: 2 193 | rgba: 0 194 | iOSLaunchScreenFillPct: 100 195 | iOSLaunchScreenSize: 100 196 | iOSLaunchScreenCustomXibPath: 197 | iOSLaunchScreeniPadType: 0 198 | iOSLaunchScreeniPadImage: {fileID: 0} 199 | iOSLaunchScreeniPadBackgroundColor: 200 | serializedVersion: 2 201 | rgba: 0 202 | iOSLaunchScreeniPadFillPct: 100 203 | iOSLaunchScreeniPadSize: 100 204 | iOSLaunchScreeniPadCustomXibPath: 205 | iOSDeviceRequirements: [] 206 | iOSURLSchemes: [] 207 | iOSBackgroundModes: 0 208 | iOSMetalForceHardShadows: 0 209 | metalEditorSupport: 1 210 | metalAPIValidation: 1 211 | iOSRenderExtraFrameOnPause: 0 212 | appleDeveloperTeamID: 213 | iOSManualSigningProvisioningProfileID: 214 | tvOSManualSigningProvisioningProfileID: 215 | appleEnableAutomaticSigning: 0 216 | AndroidTargetDevice: 0 217 | AndroidSplashScreenScale: 0 218 | androidSplashScreen: {fileID: 0} 219 | AndroidKeystoreName: 220 | AndroidKeyaliasName: 221 | AndroidTVCompatibility: 1 222 | AndroidIsGame: 1 223 | androidEnableBanner: 1 224 | m_AndroidBanners: 225 | - width: 320 226 | height: 180 227 | banner: {fileID: 0} 228 | androidGamepadSupportLevel: 0 229 | resolutionDialogBanner: {fileID: 0} 230 | m_BuildTargetIcons: [] 231 | m_BuildTargetBatching: [] 232 | m_BuildTargetGraphicsAPIs: 233 | - m_BuildTarget: WindowsStandaloneSupport 234 | m_APIs: 02000000 235 | m_Automatic: 0 236 | m_BuildTargetVRSettings: [] 237 | openGLRequireES31: 0 238 | openGLRequireES31AEP: 0 239 | webPlayerTemplate: APPLICATION:Default 240 | m_TemplateCustomTags: {} 241 | wiiUTitleID: 0005000011000000 242 | wiiUGroupID: 00010000 243 | wiiUCommonSaveSize: 4096 244 | wiiUAccountSaveSize: 2048 245 | wiiUOlvAccessKey: 0 246 | wiiUTinCode: 0 247 | wiiUJoinGameId: 0 248 | wiiUJoinGameModeMask: 0000000000000000 249 | wiiUCommonBossSize: 0 250 | wiiUAccountBossSize: 0 251 | wiiUAddOnUniqueIDs: [] 252 | wiiUMainThreadStackSize: 3072 253 | wiiULoaderThreadStackSize: 1024 254 | wiiUSystemHeapSize: 128 255 | wiiUTVStartupScreen: {fileID: 0} 256 | wiiUGamePadStartupScreen: {fileID: 0} 257 | wiiUDrcBufferDisabled: 0 258 | wiiUProfilerLibPath: 259 | playModeTestRunnerEnabled: 0 260 | actionOnDotNetUnhandledException: 1 261 | enableInternalProfiler: 0 262 | logObjCUncaughtExceptions: 1 263 | enableCrashReportAPI: 0 264 | cameraUsageDescription: 265 | locationUsageDescription: 266 | microphoneUsageDescription: 267 | switchNetLibKey: 268 | switchSocketMemoryPoolSize: 6144 269 | switchSocketAllocatorPoolSize: 128 270 | switchSocketConcurrencyLimit: 14 271 | switchScreenResolutionBehavior: 2 272 | switchUseCPUProfiler: 0 273 | switchApplicationID: 0x01004b9000490000 274 | switchNSODependencies: 275 | switchTitleNames_0: 276 | switchTitleNames_1: 277 | switchTitleNames_2: 278 | switchTitleNames_3: 279 | switchTitleNames_4: 280 | switchTitleNames_5: 281 | switchTitleNames_6: 282 | switchTitleNames_7: 283 | switchTitleNames_8: 284 | switchTitleNames_9: 285 | switchTitleNames_10: 286 | switchTitleNames_11: 287 | switchPublisherNames_0: 288 | switchPublisherNames_1: 289 | switchPublisherNames_2: 290 | switchPublisherNames_3: 291 | switchPublisherNames_4: 292 | switchPublisherNames_5: 293 | switchPublisherNames_6: 294 | switchPublisherNames_7: 295 | switchPublisherNames_8: 296 | switchPublisherNames_9: 297 | switchPublisherNames_10: 298 | switchPublisherNames_11: 299 | switchIcons_0: {fileID: 0} 300 | switchIcons_1: {fileID: 0} 301 | switchIcons_2: {fileID: 0} 302 | switchIcons_3: {fileID: 0} 303 | switchIcons_4: {fileID: 0} 304 | switchIcons_5: {fileID: 0} 305 | switchIcons_6: {fileID: 0} 306 | switchIcons_7: {fileID: 0} 307 | switchIcons_8: {fileID: 0} 308 | switchIcons_9: {fileID: 0} 309 | switchIcons_10: {fileID: 0} 310 | switchIcons_11: {fileID: 0} 311 | switchSmallIcons_0: {fileID: 0} 312 | switchSmallIcons_1: {fileID: 0} 313 | switchSmallIcons_2: {fileID: 0} 314 | switchSmallIcons_3: {fileID: 0} 315 | switchSmallIcons_4: {fileID: 0} 316 | switchSmallIcons_5: {fileID: 0} 317 | switchSmallIcons_6: {fileID: 0} 318 | switchSmallIcons_7: {fileID: 0} 319 | switchSmallIcons_8: {fileID: 0} 320 | switchSmallIcons_9: {fileID: 0} 321 | switchSmallIcons_10: {fileID: 0} 322 | switchSmallIcons_11: {fileID: 0} 323 | switchManualHTML: 324 | switchAccessibleURLs: 325 | switchLegalInformation: 326 | switchMainThreadStackSize: 1048576 327 | switchPresenceGroupId: 328 | switchLogoHandling: 0 329 | switchReleaseVersion: 0 330 | switchDisplayVersion: 1.0.0 331 | switchStartupUserAccount: 0 332 | switchTouchScreenUsage: 0 333 | switchSupportedLanguagesMask: 0 334 | switchLogoType: 0 335 | switchApplicationErrorCodeCategory: 336 | switchUserAccountSaveDataSize: 0 337 | switchUserAccountSaveDataJournalSize: 0 338 | switchApplicationAttribute: 0 339 | switchCardSpecSize: -1 340 | switchCardSpecClock: -1 341 | switchRatingsMask: 0 342 | switchRatingsInt_0: 0 343 | switchRatingsInt_1: 0 344 | switchRatingsInt_2: 0 345 | switchRatingsInt_3: 0 346 | switchRatingsInt_4: 0 347 | switchRatingsInt_5: 0 348 | switchRatingsInt_6: 0 349 | switchRatingsInt_7: 0 350 | switchRatingsInt_8: 0 351 | switchRatingsInt_9: 0 352 | switchRatingsInt_10: 0 353 | switchRatingsInt_11: 0 354 | switchLocalCommunicationIds_0: 355 | switchLocalCommunicationIds_1: 356 | switchLocalCommunicationIds_2: 357 | switchLocalCommunicationIds_3: 358 | switchLocalCommunicationIds_4: 359 | switchLocalCommunicationIds_5: 360 | switchLocalCommunicationIds_6: 361 | switchLocalCommunicationIds_7: 362 | switchParentalControl: 0 363 | switchAllowsScreenshot: 1 364 | switchDataLossConfirmation: 0 365 | switchSupportedNpadStyles: 3 366 | switchSocketConfigEnabled: 0 367 | switchTcpInitialSendBufferSize: 32 368 | switchTcpInitialReceiveBufferSize: 64 369 | switchTcpAutoSendBufferSizeMax: 256 370 | switchTcpAutoReceiveBufferSizeMax: 256 371 | switchUdpSendBufferSize: 9 372 | switchUdpReceiveBufferSize: 42 373 | switchSocketBufferEfficiency: 4 374 | switchSocketInitializeEnabled: 1 375 | switchNetworkInterfaceManagerInitializeEnabled: 1 376 | switchPlayerConnectionEnabled: 1 377 | ps4NPAgeRating: 12 378 | ps4NPTitleSecret: 379 | ps4NPTrophyPackPath: 380 | ps4ParentalLevel: 11 381 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 382 | ps4Category: 0 383 | ps4MasterVersion: 01.00 384 | ps4AppVersion: 01.00 385 | ps4AppType: 0 386 | ps4ParamSfxPath: 387 | ps4VideoOutPixelFormat: 0 388 | ps4VideoOutInitialWidth: 1920 389 | ps4VideoOutBaseModeInitialWidth: 1920 390 | ps4VideoOutReprojectionRate: 120 391 | ps4PronunciationXMLPath: 392 | ps4PronunciationSIGPath: 393 | ps4BackgroundImagePath: 394 | ps4StartupImagePath: 395 | ps4SaveDataImagePath: 396 | ps4SdkOverride: 397 | ps4BGMPath: 398 | ps4ShareFilePath: 399 | ps4ShareOverlayImagePath: 400 | ps4PrivacyGuardImagePath: 401 | ps4NPtitleDatPath: 402 | ps4RemotePlayKeyAssignment: -1 403 | ps4RemotePlayKeyMappingDir: 404 | ps4PlayTogetherPlayerCount: 0 405 | ps4EnterButtonAssignment: 1 406 | ps4ApplicationParam1: 0 407 | ps4ApplicationParam2: 0 408 | ps4ApplicationParam3: 0 409 | ps4ApplicationParam4: 0 410 | ps4DownloadDataSize: 0 411 | ps4GarlicHeapSize: 2048 412 | ps4ProGarlicHeapSize: 2560 413 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 414 | ps4pnSessions: 1 415 | ps4pnPresence: 1 416 | ps4pnFriends: 1 417 | ps4pnGameCustomData: 1 418 | playerPrefsSupport: 0 419 | restrictedAudioUsageRights: 0 420 | ps4UseResolutionFallback: 0 421 | ps4ReprojectionSupport: 0 422 | ps4UseAudio3dBackend: 0 423 | ps4SocialScreenEnabled: 0 424 | ps4ScriptOptimizationLevel: 0 425 | ps4Audio3dVirtualSpeakerCount: 14 426 | ps4attribCpuUsage: 0 427 | ps4PatchPkgPath: 428 | ps4PatchLatestPkgPath: 429 | ps4PatchChangeinfoPath: 430 | ps4PatchDayOne: 0 431 | ps4attribUserManagement: 0 432 | ps4attribMoveSupport: 0 433 | ps4attrib3DSupport: 0 434 | ps4attribShareSupport: 0 435 | ps4attribExclusiveVR: 0 436 | ps4disableAutoHideSplash: 0 437 | ps4videoRecordingFeaturesUsed: 0 438 | ps4contentSearchFeaturesUsed: 0 439 | ps4attribEyeToEyeDistanceSettingVR: 0 440 | ps4IncludedModules: [] 441 | monoEnv: 442 | psp2Splashimage: {fileID: 0} 443 | psp2NPTrophyPackPath: 444 | psp2NPSupportGBMorGJP: 0 445 | psp2NPAgeRating: 12 446 | psp2NPTitleDatPath: 447 | psp2NPCommsID: 448 | psp2NPCommunicationsID: 449 | psp2NPCommsPassphrase: 450 | psp2NPCommsSig: 451 | psp2ParamSfxPath: 452 | psp2ManualPath: 453 | psp2LiveAreaGatePath: 454 | psp2LiveAreaBackroundPath: 455 | psp2LiveAreaPath: 456 | psp2LiveAreaTrialPath: 457 | psp2PatchChangeInfoPath: 458 | psp2PatchOriginalPackage: 459 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 460 | psp2KeystoneFile: 461 | psp2MemoryExpansionMode: 0 462 | psp2DRMType: 0 463 | psp2StorageType: 0 464 | psp2MediaCapacity: 0 465 | psp2DLCConfigPath: 466 | psp2ThumbnailPath: 467 | psp2BackgroundPath: 468 | psp2SoundPath: 469 | psp2TrophyCommId: 470 | psp2TrophyPackagePath: 471 | psp2PackagedResourcesPath: 472 | psp2SaveDataQuota: 10240 473 | psp2ParentalLevel: 1 474 | psp2ShortTitle: Not Set 475 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 476 | psp2Category: 0 477 | psp2MasterVersion: 01.00 478 | psp2AppVersion: 01.00 479 | psp2TVBootMode: 0 480 | psp2EnterButtonAssignment: 2 481 | psp2TVDisableEmu: 0 482 | psp2AllowTwitterDialog: 1 483 | psp2Upgradable: 0 484 | psp2HealthWarning: 0 485 | psp2UseLibLocation: 0 486 | psp2InfoBarOnStartup: 0 487 | psp2InfoBarColor: 0 488 | psp2ScriptOptimizationLevel: 0 489 | psmSplashimage: {fileID: 0} 490 | splashScreenBackgroundSourceLandscape: {fileID: 0} 491 | splashScreenBackgroundSourcePortrait: {fileID: 0} 492 | spritePackerPolicy: 493 | webGLMemorySize: 256 494 | webGLExceptionSupport: 1 495 | webGLNameFilesAsHashes: 0 496 | webGLDataCaching: 0 497 | webGLDebugSymbols: 0 498 | webGLEmscriptenArgs: 499 | webGLModulesDirectory: 500 | webGLTemplate: APPLICATION:Default 501 | webGLAnalyzeBuildSize: 0 502 | webGLUseEmbeddedResources: 0 503 | webGLUseWasm: 0 504 | webGLCompressionFormat: 1 505 | scriptingDefineSymbols: {} 506 | platformArchitecture: {} 507 | scriptingBackend: {} 508 | incrementalIl2cppBuild: {} 509 | additionalIl2CppArgs: 510 | scriptingRuntimeVersion: 0 511 | apiCompatibilityLevelPerPlatform: {} 512 | m_RenderingPath: 1 513 | m_MobileRenderingPath: 1 514 | metroPackageName: Unity_SHTranslucency 515 | metroPackageVersion: 516 | metroCertificatePath: 517 | metroCertificatePassword: 518 | metroCertificateSubject: 519 | metroCertificateIssuer: 520 | metroCertificateNotAfter: 0000000000000000 521 | metroApplicationDescription: Unity_SHTranslucency 522 | wsaImages: {} 523 | metroTileShortName: 524 | metroCommandLineArgsFile: 525 | metroTileShowName: 0 526 | metroMediumTileShowName: 0 527 | metroLargeTileShowName: 0 528 | metroWideTileShowName: 0 529 | metroDefaultTileSize: 1 530 | metroTileForegroundText: 2 531 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 532 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 533 | a: 1} 534 | metroSplashScreenUseBackgroundColor: 0 535 | platformCapabilities: {} 536 | metroFTAName: 537 | metroFTAFileTypes: [] 538 | metroProtocolName: 539 | metroCompilationOverrides: 1 540 | tizenProductDescription: 541 | tizenProductURL: 542 | tizenSigningProfileName: 543 | tizenGPSPermissions: 0 544 | tizenMicrophonePermissions: 0 545 | tizenDeploymentTarget: 546 | tizenDeploymentTargetType: -1 547 | tizenMinOSVersion: 1 548 | n3dsUseExtSaveData: 0 549 | n3dsCompressStaticMem: 1 550 | n3dsExtSaveDataNumber: 0x12345 551 | n3dsStackSize: 131072 552 | n3dsTargetPlatform: 2 553 | n3dsRegion: 7 554 | n3dsMediaSize: 0 555 | n3dsLogoStyle: 3 556 | n3dsTitle: GameName 557 | n3dsProductCode: 558 | n3dsApplicationId: 0xFF3FF 559 | stvDeviceAddress: 560 | stvProductDescription: 561 | stvProductAuthor: 562 | stvProductAuthorEmail: 563 | stvProductLink: 564 | stvProductCategory: 0 565 | XboxOneProductId: 566 | XboxOneUpdateKey: 567 | XboxOneSandboxId: 568 | XboxOneContentId: 569 | XboxOneTitleId: 570 | XboxOneSCId: 571 | XboxOneGameOsOverridePath: 572 | XboxOnePackagingOverridePath: 573 | XboxOneAppManifestOverridePath: 574 | XboxOnePackageEncryption: 0 575 | XboxOnePackageUpdateGranularity: 2 576 | XboxOneDescription: 577 | XboxOneLanguage: 578 | - enus 579 | XboxOneCapability: [] 580 | XboxOneGameRating: {} 581 | XboxOneIsContentPackage: 0 582 | XboxOneEnableGPUVariability: 0 583 | XboxOneSockets: {} 584 | XboxOneSplashScreen: {fileID: 0} 585 | XboxOneAllowedProductIds: [] 586 | XboxOnePersistentLocalStorageSize: 0 587 | xboxOneScriptCompiler: 0 588 | vrEditorSettings: 589 | daydream: 590 | daydreamIconForeground: {fileID: 0} 591 | daydreamIconBackground: {fileID: 0} 592 | cloudServicesEnabled: {} 593 | facebookSdkVersion: 7.9.4 594 | apiCompatibilityLevel: 2 595 | cloudProjectId: 596 | projectName: 597 | organizationId: 598 | cloudEnabled: 0 599 | enableNativePlatformBackendsForNewInputSystem: 0 600 | disableOldInputManagerSupport: 0 601 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.4.0f1 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Samsung TV: 2 185 | Standalone: 5 186 | Tizen: 2 187 | Web: 5 188 | WebGL: 3 189 | WiiU: 5 190 | Windows Store Apps: 5 191 | XboxOne: 5 192 | iPhone: 2 193 | tvOS: 2 194 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_Enabled: 0 14 | m_CaptureEditorExceptions: 1 15 | UnityPurchasingSettings: 16 | m_Enabled: 0 17 | m_TestMode: 0 18 | UnityAnalyticsSettings: 19 | m_Enabled: 0 20 | m_InitializeOnStartup: 1 21 | m_TestMode: 0 22 | m_TestEventUrl: 23 | m_TestConfigUrl: 24 | UnityAdsSettings: 25 | m_Enabled: 0 26 | m_InitializeOnStartup: 1 27 | m_TestMode: 0 28 | m_EnabledPlatforms: 4294967295 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /UnityPackageManager/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /docs/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Accardi Piero 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Unity Spherical Harmonics Translucency 2 |

3 | 4 |

5 | 6 | # Overview 7 | This is a tool that takes a mesh and foreach vertex saves the thickness in any viewing direction projecting it on the spherical harmonics basis. 8 | > To compute the thickness the object must have a material with the shader `Translucency/Thickness`. Use the Window/ThicknessCompute to process an object 9 | 10 | To create a shader, once you have the 9 coefficients and the fragment view ray, just reconstruct the thickness with the dot between the coefficients and the basis and use it to compute the absorbtion, for example, with a function like `exp(-t)` 11 | 12 | ## License 13 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) 14 | -------------------------------------------------------------------------------- /docs/animated.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Translucency/b04ec0b37b6598e157d4682d21aa05861d745a7e/docs/animated.gif --------------------------------------------------------------------------------