├── .gitattributes ├── .gitignore ├── Assets ├── ComputedMeshes.meta ├── ComputedMeshes │ ├── scene3.asset │ └── scene3.asset.meta ├── Demo.meta ├── Demo │ ├── Cubemaps.meta │ ├── Cubemaps │ │ ├── grace.meta │ │ ├── grace │ │ │ ├── Materials.meta │ │ │ ├── Materials │ │ │ │ ├── grace.mat │ │ │ │ └── grace.mat.meta │ │ │ ├── grace-NX.exr │ │ │ ├── grace-NX.exr.meta │ │ │ ├── grace-NY.exr │ │ │ ├── grace-NY.exr.meta │ │ │ ├── grace-NZ.exr │ │ │ ├── grace-NZ.exr.meta │ │ │ ├── grace-PX.exr │ │ │ ├── grace-PX.exr.meta │ │ │ ├── grace-PY.exr │ │ │ ├── grace-PY.exr.meta │ │ │ ├── grace-PZ.exr │ │ │ ├── grace-PZ.exr.meta │ │ │ ├── grace.cubemap │ │ │ └── grace.cubemap.meta │ │ ├── test.meta │ │ └── test │ │ │ ├── black.png │ │ │ ├── black.png.meta │ │ │ ├── blue.png │ │ │ ├── blue.png.meta │ │ │ ├── green.png │ │ │ ├── green.png.meta │ │ │ ├── purple.png │ │ │ ├── purple.png.meta │ │ │ ├── red.png │ │ │ ├── red.png.meta │ │ │ ├── test 1.cubemap │ │ │ ├── test 1.cubemap.meta │ │ │ ├── test.cubemap │ │ │ ├── test.cubemap.meta │ │ │ ├── white.png │ │ │ ├── white.png.meta │ │ │ ├── yellow.png │ │ │ └── yellow.png.meta │ ├── Materials.meta │ ├── Materials │ │ ├── black.mat │ │ └── black.mat.meta │ ├── Meshes.meta │ ├── Meshes │ │ ├── scene3.fbx │ │ └── scene3.fbx.meta │ ├── Scenes.meta │ └── Scenes │ │ ├── test.unity │ │ └── test.unity.meta ├── SH.meta └── SH │ ├── Editor.meta │ ├── Editor │ ├── CubemapSHProjector.cs │ ├── CubemapSHProjector.cs.meta │ ├── VisibilityComputeEditor.cs │ └── VisibilityComputeEditor.cs.meta │ ├── Resources.meta │ ├── Resources │ ├── Shaders.meta │ └── Shaders │ │ ├── BlackShader.shader │ │ ├── BlackShader.shader.meta │ │ ├── CoeffVisualizer.shader │ │ ├── CoeffVisualizer.shader.meta │ │ ├── CosineSkybox.shader │ │ ├── CosineSkybox.shader.meta │ │ ├── MonteCarloProject.shader │ │ ├── MonteCarloProject.shader.meta │ │ ├── Reduce_MC_1024.compute │ │ ├── Reduce_MC_1024.compute.meta │ │ ├── Reduce_Uniform.compute │ │ ├── Reduce_Uniform.compute.meta │ │ ├── SH_Shader.shader │ │ ├── SH_Shader.shader.meta │ │ ├── SH_Utils.cginc │ │ ├── SH_Utils.cginc.meta │ │ ├── Visibility_Shader.shader │ │ └── Visibility_Shader.shader.meta │ ├── Scripts.meta │ └── Scripts │ ├── SphericalHarmonics.cs │ ├── SphericalHarmonics.cs.meta │ ├── VisibilityCompute.cs │ └── VisibilityCompute.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 ├── banner.png └── project.png /.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/ComputedMeshes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aad6826a661e6c943801964b2cd70fdc 3 | folderAsset: yes 4 | timeCreated: 1518735505 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ComputedMeshes/scene3.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4af16bdca774434392b5c95e1f7a526 3 | timeCreated: 1520199713 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 4300000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edf20978f1d3ffe4d85004ac259dbec5 3 | folderAsset: yes 4 | timeCreated: 1520198124 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa1a8e2687148c1428bc4f23ee1c8a80 3 | folderAsset: yes 4 | timeCreated: 1520198180 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 736a82f41c6e93c48ae3adcab1fb6042 3 | folderAsset: yes 4 | timeCreated: 1520198152 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 293c87a1764f396429ee400a84f95425 3 | folderAsset: yes 4 | timeCreated: 1520199867 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/Materials/grace.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: grace 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: 180aabd27ae6b67418c41d739b204b74, 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/Cubemaps/grace/Materials/grace.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc75c6c432ec8e4eba1ce23df799082 3 | timeCreated: 1520199867 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-NX.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/grace/grace-NX.exr -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-NX.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab99b37dca6df5a448f7680b431a9f41 3 | timeCreated: 1518168887 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-NY.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/grace/grace-NY.exr -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-NY.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ecafcb1e36010474cbdc6a0bab7bc684 3 | timeCreated: 1518168894 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-NZ.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/grace/grace-NZ.exr -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-NZ.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86d80631282211041a0c1b7a3aee63e5 3 | timeCreated: 1518168883 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-PX.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/grace/grace-PX.exr -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-PX.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16fb6917893031c4aa48182f02e9d042 3 | timeCreated: 1518168876 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-PY.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/grace/grace-PY.exr -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-PY.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17e43ea6a4cf0c746bf7da7dab32a3ad 3 | timeCreated: 1518168880 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-PZ.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/grace/grace-PZ.exr -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace-PZ.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba30577f0ac104440a7820a851151694 3 | timeCreated: 1518168890 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/grace/grace.cubemap.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 180aabd27ae6b67418c41d739b204b74 3 | timeCreated: 1518168917 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 8900000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e16ede49ec2892c45a40e21d5d2d1765 3 | folderAsset: yes 4 | timeCreated: 1518209818 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/black.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/black.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9eda69c0f7226443b3ea448d596f7dd 3 | timeCreated: 1518175377 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/blue.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/blue.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e12d0ac8bf36584dac4622fd6d63058 3 | timeCreated: 1518182901 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/green.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/green.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 726bf837c021e7e40be8fa86172f3353 3 | timeCreated: 1518182901 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/purple.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/purple.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48be3e7cfa241e6418c00fbc1d4be2f1 3 | timeCreated: 1518182901 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/red.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/red.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56de3f1f08a0aab49a3e9e005e4de35e 3 | timeCreated: 1518175377 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/test 1.cubemap.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72f9dda586811874ca876416a12ef0a2 3 | timeCreated: 1518175325 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 8900000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/test.cubemap.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bb07185dad63e94e9ec7dfb23498fed 3 | timeCreated: 1518175325 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 8900000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/white.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/white.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c52baf9ed7ad9204196e996d4fa6cb78 3 | timeCreated: 1518182901 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Cubemaps/test/yellow.png -------------------------------------------------------------------------------- /Assets/Demo/Cubemaps/test/yellow.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4980446dcce497147a2440ef733f06ea 3 | timeCreated: 1518182901 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /Assets/Demo/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd9d70cf3007df24d90fe6c36c9c73a9 3 | folderAsset: yes 4 | timeCreated: 1518561816 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/black.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: black 10 | m_Shader: {fileID: 4800000, guid: cd14da542c136ef4faee9672ba687727, 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: 0, g: 0, b: 0, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Assets/Demo/Materials/black.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 132daa5af3a530143bc24575c2d77536 3 | timeCreated: 1518561821 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Meshes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1c23708d74daa94aa0736e415ad78c3 3 | folderAsset: yes 4 | timeCreated: 1518606966 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Demo/Meshes/scene3.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/Assets/Demo/Meshes/scene3.fbx -------------------------------------------------------------------------------- /Assets/Demo/Meshes/scene3.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28aeabcfdaefddb418a0c6c9587f2c91 3 | timeCreated: 1518616227 4 | licenseType: Free 5 | ModelImporter: 6 | serializedVersion: 21 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 400000: //RootNode 10 | 2300000: //RootNode 11 | 3300000: //RootNode 12 | 4300000: Plane 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/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0367ec075c0fb494d871c77103c42cd1 3 | folderAsset: yes 4 | timeCreated: 1517526001 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: 9fc75c6c432ec8e4eba1ce23df799082, 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, g: 0, b: 0, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 1 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_PVRFiltering: 0 81 | m_PVRFilteringMode: 1 82 | m_PVRCulling: 1 83 | m_PVRFilteringGaussRadiusDirect: 1 84 | m_PVRFilteringGaussRadiusIndirect: 5 85 | m_PVRFilteringGaussRadiusAO: 2 86 | m_PVRFilteringAtrousColorSigma: 1 87 | m_PVRFilteringAtrousNormalSigma: 1 88 | m_PVRFilteringAtrousPositionSigma: 1 89 | m_LightingDataAsset: {fileID: 0} 90 | m_UseShadowmask: 1 91 | --- !u!196 &4 92 | NavMeshSettings: 93 | serializedVersion: 2 94 | m_ObjectHideFlags: 0 95 | m_BuildSettings: 96 | serializedVersion: 2 97 | agentTypeID: 0 98 | agentRadius: 0.5 99 | agentHeight: 2 100 | agentSlope: 45 101 | agentClimb: 0.4 102 | ledgeDropHeight: 0 103 | maxJumpAcrossDistance: 0 104 | minRegionArea: 2 105 | manualCellSize: 0 106 | cellSize: 0.16666667 107 | manualTileSize: 0 108 | tileSize: 256 109 | accuratePlacement: 0 110 | m_NavMeshData: {fileID: 0} 111 | --- !u!21 &9767107 112 | Material: 113 | serializedVersion: 6 114 | m_ObjectHideFlags: 0 115 | m_PrefabParentObject: {fileID: 0} 116 | m_PrefabInternal: {fileID: 0} 117 | m_Name: SH/SH_Shader 118 | m_Shader: {fileID: 4800000, guid: 268a0bcb0352c534ea6d9eb0939d7e59, type: 3} 119 | m_ShaderKeywords: 120 | m_LightmapFlags: 4 121 | m_EnableInstancingVariants: 0 122 | m_DoubleSidedGI: 0 123 | m_CustomRenderQueue: -1 124 | stringTagMap: {} 125 | disabledShaderPasses: [] 126 | m_SavedProperties: 127 | serializedVersion: 3 128 | m_TexEnvs: 129 | - _MainTex: 130 | m_Texture: {fileID: 0} 131 | m_Scale: {x: 1, y: 1} 132 | m_Offset: {x: 0, y: 0} 133 | m_Floats: [] 134 | m_Colors: [] 135 | --- !u!1 &1624089204 136 | GameObject: 137 | m_ObjectHideFlags: 0 138 | m_PrefabParentObject: {fileID: 0} 139 | m_PrefabInternal: {fileID: 0} 140 | serializedVersion: 5 141 | m_Component: 142 | - component: {fileID: 1624089205} 143 | - component: {fileID: 1624089207} 144 | - component: {fileID: 1624089206} 145 | m_Layer: 0 146 | m_Name: scene3 147 | m_TagString: Untagged 148 | m_Icon: {fileID: 0} 149 | m_NavMeshLayer: 0 150 | m_StaticEditorFlags: 4294967295 151 | m_IsActive: 1 152 | --- !u!4 &1624089205 153 | Transform: 154 | m_ObjectHideFlags: 0 155 | m_PrefabParentObject: {fileID: 0} 156 | m_PrefabInternal: {fileID: 0} 157 | m_GameObject: {fileID: 1624089204} 158 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 159 | m_LocalPosition: {x: 0, y: 0, z: 0} 160 | m_LocalScale: {x: 1, y: 1, z: 1} 161 | m_Children: [] 162 | m_Father: {fileID: 1987065385} 163 | m_RootOrder: 0 164 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 165 | --- !u!23 &1624089206 166 | MeshRenderer: 167 | m_ObjectHideFlags: 0 168 | m_PrefabParentObject: {fileID: 0} 169 | m_PrefabInternal: {fileID: 0} 170 | m_GameObject: {fileID: 1624089204} 171 | m_Enabled: 1 172 | m_CastShadows: 1 173 | m_ReceiveShadows: 1 174 | m_MotionVectors: 1 175 | m_LightProbeUsage: 1 176 | m_ReflectionProbeUsage: 1 177 | m_Materials: 178 | - {fileID: 9767107} 179 | m_StaticBatchInfo: 180 | firstSubMesh: 0 181 | subMeshCount: 0 182 | m_StaticBatchRoot: {fileID: 0} 183 | m_ProbeAnchor: {fileID: 0} 184 | m_LightProbeVolumeOverride: {fileID: 0} 185 | m_ScaleInLightmap: 1 186 | m_PreserveUVs: 0 187 | m_IgnoreNormalsForChartDetection: 0 188 | m_ImportantGI: 0 189 | m_SelectedEditorRenderState: 3 190 | m_MinimumChartSize: 4 191 | m_AutoUVMaxDistance: 0.5 192 | m_AutoUVMaxAngle: 89 193 | m_LightmapParameters: {fileID: 0} 194 | m_SortingLayerID: 0 195 | m_SortingLayer: 0 196 | m_SortingOrder: 0 197 | --- !u!33 &1624089207 198 | MeshFilter: 199 | m_ObjectHideFlags: 0 200 | m_PrefabParentObject: {fileID: 0} 201 | m_PrefabInternal: {fileID: 0} 202 | m_GameObject: {fileID: 1624089204} 203 | m_Mesh: {fileID: 4300000, guid: b4af16bdca774434392b5c95e1f7a526, type: 2} 204 | --- !u!1 &1987065384 205 | GameObject: 206 | m_ObjectHideFlags: 0 207 | m_PrefabParentObject: {fileID: 0} 208 | m_PrefabInternal: {fileID: 0} 209 | serializedVersion: 5 210 | m_Component: 211 | - component: {fileID: 1987065385} 212 | m_Layer: 0 213 | m_Name: computed 214 | m_TagString: Untagged 215 | m_Icon: {fileID: 0} 216 | m_NavMeshLayer: 0 217 | m_StaticEditorFlags: 0 218 | m_IsActive: 1 219 | --- !u!4 &1987065385 220 | Transform: 221 | m_ObjectHideFlags: 0 222 | m_PrefabParentObject: {fileID: 0} 223 | m_PrefabInternal: {fileID: 0} 224 | m_GameObject: {fileID: 1987065384} 225 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 226 | m_LocalPosition: {x: 0, y: 0, z: 0} 227 | m_LocalScale: {x: 1, y: 1, z: 1} 228 | m_Children: 229 | - {fileID: 1624089205} 230 | m_Father: {fileID: 0} 231 | m_RootOrder: 0 232 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 233 | -------------------------------------------------------------------------------- /Assets/Demo/Scenes/test.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cefa5af6fb456f245a4f90eec339fb48 3 | timeCreated: 1517526013 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/SH.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d6c21ab8d8a782479641a22ae433e58 3 | folderAsset: yes 4 | timeCreated: 1517784468 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2fc03ffd8cb1574eb613bfed5f2310c 3 | folderAsset: yes 4 | timeCreated: 1518166877 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Editor/CubemapSHProjector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public class CubemapSHProjector : EditorWindow 7 | { 8 | //PUBLIC FIELDS 9 | public Cubemap input_cubemap; 10 | 11 | //PRIVATE FIELDS 12 | private Material view_mat; 13 | private float view_mode; 14 | private Vector4[] coefficients; 15 | 16 | private SerializedObject so; 17 | private SerializedProperty sp_input_cubemap; 18 | 19 | private Texture2D tmp = null; 20 | 21 | [MenuItem("Window/CubemapSHProjector")] 22 | static void Init() 23 | { 24 | CubemapSHProjector window = (CubemapSHProjector)EditorWindow.GetWindow(typeof(CubemapSHProjector)); 25 | window.Show(); 26 | } 27 | 28 | private void OnFocus() 29 | { 30 | Initialize(); 31 | } 32 | 33 | private void OnEnable() 34 | { 35 | Initialize(); 36 | } 37 | 38 | private void Initialize() 39 | { 40 | so = new SerializedObject(this); 41 | sp_input_cubemap = so.FindProperty("input_cubemap"); 42 | 43 | if (view_mat == null) 44 | view_mat = new Material(Shader.Find("SH/CoeffVisualizer")); 45 | } 46 | 47 | private void OnGUI() 48 | { 49 | EditorGUILayout.PropertyField(sp_input_cubemap, new GUIContent("Input Cubemap")); 50 | 51 | so.ApplyModifiedProperties(); 52 | 53 | if (input_cubemap != null) 54 | { 55 | EditorGUILayout.Space(); 56 | 57 | if (GUILayout.Button("CPU Uniform 9 Coefficients")) 58 | { 59 | coefficients = new Vector4[9]; 60 | if (SphericalHarmonics.CPU_Project_Uniform_9Coeff(input_cubemap, coefficients)) 61 | { 62 | for (int i = 0; i < 9; ++i) 63 | { 64 | view_mat.SetVector("c" + i.ToString(), coefficients[i]); 65 | view_mat.SetTexture("input", input_cubemap); 66 | } 67 | 68 | SceneView.RepaintAll(); 69 | } 70 | } 71 | 72 | EditorGUILayout.Space(); 73 | 74 | if (GUILayout.Button("CPU Monte Carlo 9 Coefficients")) 75 | { 76 | coefficients = new Vector4[9]; 77 | if (SphericalHarmonics.CPU_Project_MonteCarlo_9Coeff(input_cubemap, coefficients, 4096)) 78 | { 79 | for (int i = 0; i < 9; ++i) 80 | { 81 | view_mat.SetVector("c" + i.ToString(), coefficients[i]); 82 | view_mat.SetTexture("input", input_cubemap); 83 | } 84 | 85 | SceneView.RepaintAll(); 86 | } 87 | } 88 | 89 | EditorGUILayout.Space(); 90 | 91 | if (GUILayout.Button("GPU Uniform 9 Coefficients")) 92 | { 93 | coefficients = new Vector4[9]; 94 | if (SphericalHarmonics.GPU_Project_Uniform_9Coeff(input_cubemap, coefficients)) 95 | { 96 | for (int i = 0; i < 9; ++i) 97 | { 98 | view_mat.SetVector("c" + i.ToString(), coefficients[i]); 99 | view_mat.SetTexture("input", input_cubemap); 100 | } 101 | 102 | SceneView.RepaintAll(); 103 | } 104 | } 105 | 106 | EditorGUILayout.Space(); 107 | 108 | if (GUILayout.Button("GPU Monte Carlo 9 Coefficients")) 109 | { 110 | coefficients = new Vector4[9]; 111 | 112 | if (SphericalHarmonics.GPU_Project_MonteCarlo_9Coeff(input_cubemap, coefficients)) 113 | { 114 | for (int i = 0; i < 9; ++i) 115 | { 116 | view_mat.SetVector("c" + i.ToString(), coefficients[i]); 117 | view_mat.SetTexture("input", input_cubemap); 118 | } 119 | } 120 | } 121 | 122 | EditorGUILayout.Space(); 123 | 124 | if (GUILayout.Button("Show")) 125 | { 126 | RenderSettings.skybox = view_mat; 127 | } 128 | 129 | view_mode = EditorGUILayout.Slider(view_mode, 0, 1); 130 | view_mat.SetFloat("_Mode", view_mode); 131 | 132 | EditorGUILayout.Space(); 133 | 134 | //print the 9 coefficients 135 | if (coefficients != null) 136 | { 137 | for (int i = 0; i < 9; ++i) 138 | { 139 | EditorGUILayout.LabelField("c_" + i.ToString() + ": " + coefficients[i].ToString("f4")); 140 | } 141 | } 142 | } 143 | 144 | EditorGUILayout.Space(); 145 | if (tmp != null) 146 | GUILayout.Label(tmp); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /Assets/SH/Editor/CubemapSHProjector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e589fb2c7b9ff864e9be37c6dd6dee21 3 | timeCreated: 1518166886 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/SH/Editor/VisibilityComputeEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(VisibilityCompute))] 7 | public class VisibilityComputeEditor : Editor 8 | { 9 | public override void OnInspectorGUI() 10 | { 11 | base.OnInspectorGUI(); 12 | 13 | if (GUILayout.Button("Compute static children")) 14 | { 15 | (target as VisibilityCompute).Compute(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assets/SH/Editor/VisibilityComputeEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03aeecda5bebc0b46b842a9fad05dcca 3 | timeCreated: 1518557467 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/SH/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a53664dbeafb234c9d7885689bab16c 3 | folderAsset: yes 4 | timeCreated: 1518171645 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f32efbcbaffd03e45b0e6700081c9122 3 | folderAsset: yes 4 | timeCreated: 1518170382 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/BlackShader.shader: -------------------------------------------------------------------------------- 1 | Shader "SH/BlackShader" 2 | { 3 | Properties 4 | { 5 | } 6 | SubShader 7 | { 8 | Tags { "RenderType"="Opaque" } 9 | LOD 100 10 | 11 | Pass 12 | { 13 | CGPROGRAM 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | 17 | #include "UnityCG.cginc" 18 | 19 | struct appdata 20 | { 21 | float4 vertex : POSITION; 22 | }; 23 | 24 | struct v2f 25 | { 26 | float4 vertex : SV_POSITION; 27 | }; 28 | 29 | v2f vert (appdata v) 30 | { 31 | v2f o; 32 | o.vertex = UnityObjectToClipPos(v.vertex); 33 | return o; 34 | } 35 | 36 | fixed4 frag (v2f i) : SV_Target 37 | { 38 | return float4(0, 0, 0, 0); 39 | } 40 | ENDCG 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/BlackShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 671ad36a6fb53934ba929b1d40742d9b 3 | timeCreated: 1525203065 4 | licenseType: Free 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/CoeffVisualizer.shader: -------------------------------------------------------------------------------- 1 | Shader "SH/CoeffVisualizer" 2 | { 3 | Properties 4 | { 5 | _Mode("Mode", Range(0, 1)) = 0 6 | } 7 | 8 | SubShader 9 | { 10 | Tags{ "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" } 11 | Cull Off ZWrite Off 12 | 13 | Pass 14 | { 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | #pragma target 2.0 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata_t 23 | { 24 | float4 vertex : POSITION; 25 | UNITY_VERTEX_INPUT_INSTANCE_ID 26 | }; 27 | 28 | struct v2f 29 | { 30 | float4 vertex : SV_POSITION; 31 | float3 texcoord : TEXCOORD0; 32 | UNITY_VERTEX_OUTPUT_STEREO 33 | }; 34 | 35 | float4 c0; 36 | float4 c1; 37 | float4 c2; 38 | float4 c3; 39 | float4 c4; 40 | float4 c5; 41 | float4 c6; 42 | float4 c7; 43 | float4 c8; 44 | 45 | samplerCUBE input; 46 | float _Mode; 47 | 48 | float Y0(float3 v) 49 | { 50 | return 0.2820947917f; 51 | } 52 | 53 | float Y1(float3 v) 54 | { 55 | return 0.4886025119f * v.y; 56 | } 57 | 58 | float Y2(float3 v) 59 | { 60 | return 0.4886025119f * v.z; 61 | } 62 | 63 | float Y3(float3 v) 64 | { 65 | return 0.4886025119f * v.x; 66 | } 67 | 68 | float Y4(float3 v) 69 | { 70 | return 1.0925484306f * v.x * v.y; 71 | } 72 | 73 | float Y5(float3 v) 74 | { 75 | return 1.0925484306f * v.y * v.z; 76 | } 77 | 78 | float Y6(float3 v) 79 | { 80 | return 0.3153915652f * (3.0f * v.z * v.z - 1.0f); 81 | } 82 | 83 | float Y7(float3 v) 84 | { 85 | return 1.0925484306f * v.x * v.z; 86 | } 87 | 88 | float Y8(float3 v) 89 | { 90 | return 0.5462742153f * (v.x * v.x - v.y * v.y); 91 | } 92 | 93 | v2f vert(appdata_t v) 94 | { 95 | v2f o; 96 | UNITY_SETUP_INSTANCE_ID(v); 97 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 98 | o.vertex = UnityObjectToClipPos(v.vertex); 99 | o.texcoord = v.vertex.xyz; 100 | return o; 101 | } 102 | 103 | fixed4 frag(v2f i) : SV_Target 104 | { 105 | float3 v = i.texcoord.xyz; 106 | float4 original = texCUBE(input, i.texcoord); 107 | float4 approx = c0 * Y0(v) + c1 * Y1(v) + c2 * Y2(v) + c3 * Y3(v) + c4 * Y4(v) + c5 * Y5(v) + c6 * Y6(v) + c7 * Y7(v) + c8 * Y8(v); 108 | return lerp(original, approx, _Mode); 109 | } 110 | ENDCG 111 | } 112 | } 113 | 114 | Fallback Off 115 | } 116 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/CoeffVisualizer.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: effa7410b33b1d5498a486afbcc6af2c 3 | timeCreated: 1518170417 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/CosineSkybox.shader: -------------------------------------------------------------------------------- 1 | Shader "SH/CosineSkybox" 2 | { 3 | SubShader 4 | { 5 | Tags{ "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" } 6 | Cull Off ZWrite Off 7 | 8 | Pass 9 | { 10 | CGPROGRAM 11 | #pragma vertex vert 12 | #pragma fragment frag 13 | 14 | #include "UnityCG.cginc" 15 | 16 | struct appdata_t 17 | { 18 | float4 vertex : POSITION; 19 | UNITY_VERTEX_INPUT_INSTANCE_ID 20 | }; 21 | 22 | struct v2f 23 | { 24 | float4 vertex : SV_POSITION; 25 | float3 texcoord : TEXCOORD0; 26 | UNITY_VERTEX_OUTPUT_STEREO 27 | }; 28 | 29 | float3 N; 30 | 31 | v2f vert(appdata_t v) 32 | { 33 | v2f o; 34 | UNITY_SETUP_INSTANCE_ID(v); 35 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 36 | o.vertex = UnityObjectToClipPos(v.vertex); 37 | o.texcoord = v.vertex.xyz; 38 | return o; 39 | } 40 | 41 | fixed4 frag(v2f i) : SV_Target 42 | { 43 | return saturate(dot(N, i.texcoord)); 44 | } 45 | 46 | ENDCG 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/CosineSkybox.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d439d242be5752e4ca5d52b0e03f3447 3 | timeCreated: 1518730088 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/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/SH/Resources/Shaders/MonteCarloProject.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8461fe2903609944ad881e10fe5a481 3 | timeCreated: 1518302973 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/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/SH/Resources/Shaders/Reduce_MC_1024.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14b4d8bcece52bb4baa2eedb48fc75b2 3 | timeCreated: 1518445243 4 | licenseType: Free 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/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 | RWStructuredBuffer output_buffer; 16 | RWStructuredBuffer coefficients; 17 | StructuredBuffer 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/SH/Resources/Shaders/Reduce_Uniform.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02b04601367488847afe4381e11a6547 3 | timeCreated: 1524514159 4 | licenseType: Free 5 | ComputeShaderImporter: 6 | externalObjects: {} 7 | currentAPIMask: 4 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/SH_Shader.shader: -------------------------------------------------------------------------------- 1 | Shader "SH/SH_Shader" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType"="Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | // make fog work 18 | #pragma multi_compile_fog 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata 23 | { 24 | float4 vertex : POSITION; 25 | float2 uv : TEXCOORD0; 26 | float2 uv2 : TEXCOORD1; 27 | float2 uv3 : TEXCOORD2; 28 | float2 uv4 : TEXCOORD3; 29 | float4 color : COLOR0; 30 | }; 31 | 32 | struct v2f 33 | { 34 | float2 uv : TEXCOORD0; 35 | UNITY_FOG_COORDS(1) 36 | float4 vertex : SV_POSITION; 37 | float4 radiance : TEXCOORD2; 38 | }; 39 | 40 | sampler2D _MainTex; 41 | float4 _MainTex_ST; 42 | 43 | v2f vert (appdata v) 44 | { 45 | v2f o; 46 | o.vertex = UnityObjectToClipPos(v.vertex); 47 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 48 | UNITY_TRANSFER_FOG(o,o.vertex); 49 | 50 | float4 sh_0 = v.color; 51 | float4 sh_1 = float4(v.uv2, v.uv3); 52 | float sh_2 = v.uv4.x; 53 | 54 | //i'm using the coefficients from the grace cubemap 55 | float r = (dot(sh_0, float4(0.9082, -0.1342, 0.0227, -0.0247)) + dot(sh_1, float4(-0.0384, -0.0158, -0.0641, -0.0485)) - sh_2 * 0.2564); 56 | float g = (dot(sh_0, float4(0.6772, -0.07, 0.0255, -0.0245)) + dot(sh_1, float4(-0.0391, 0.0143, -0.074, -0.0434)) - sh_2 * 0.02328); 57 | float b = (dot(sh_0, float4(0.5759, -0.0224, 0.0385, -0.0363)) + dot(sh_1, float4(-0.039, 0.0004, -0.0751, -0.0476)) - sh_2 * 0.2214); 58 | 59 | o.radiance = float4(r, b, g, 1) * 0.4; 60 | 61 | return o; 62 | } 63 | 64 | fixed4 frag (v2f i) : SV_Target 65 | { 66 | return i.radiance; 67 | } 68 | ENDCG 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/SH_Shader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 268a0bcb0352c534ea6d9eb0939d7e59 3 | timeCreated: 1518600620 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/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/SH/Resources/Shaders/SH_Utils.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5dba9c8f94e4251419f7f8a369d58d78 3 | timeCreated: 1518388360 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/Visibility_Shader.shader: -------------------------------------------------------------------------------- 1 | Shader "SH/Visibility_Shader" 2 | { 3 | SubShader 4 | { 5 | Tags { "RenderType"="Opaque" } 6 | LOD 100 7 | 8 | Pass 9 | { 10 | Cull Off 11 | 12 | CGPROGRAM 13 | #pragma vertex vert 14 | #pragma fragment frag 15 | 16 | #include "UnityCG.cginc" 17 | 18 | struct appdata 19 | { 20 | float4 vertex : POSITION; 21 | }; 22 | 23 | struct v2f 24 | { 25 | float4 vertex : SV_POSITION; 26 | }; 27 | 28 | v2f vert (appdata v) 29 | { 30 | v2f o; 31 | o.vertex = UnityObjectToClipPos(v.vertex); 32 | return o; 33 | } 34 | 35 | fixed4 frag (v2f i) : SV_Target 36 | { 37 | return float4(0, 0, 0, 1); 38 | } 39 | ENDCG 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/SH/Resources/Shaders/Visibility_Shader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd14da542c136ef4faee9672ba687727 3 | timeCreated: 1518603622 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16f325e0e26cd544abbd1abe4f2fa2ea 3 | folderAsset: yes 4 | timeCreated: 1518166862 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SH/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/SH/Scripts/SphericalHarmonics.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b47c8defac1243d43953fa7d47fae0b0 3 | timeCreated: 1518163719 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/SH/Scripts/VisibilityCompute.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public class VisibilityCompute : MonoBehaviour 7 | { 8 | public void Compute() 9 | { 10 | Material old_skybox = RenderSettings.skybox; 11 | Material cosine_skybox = new Material(Shader.Find("SH/CosineSkybox")); 12 | RenderSettings.skybox = cosine_skybox; 13 | 14 | //create the folder with saved mesh assets 15 | if (!AssetDatabase.IsValidFolder("Assets/ComputedMeshes")) 16 | { 17 | AssetDatabase.CreateFolder("Assets", "ComputedMeshes"); 18 | } 19 | 20 | //don't modify the original objects but make a copy 21 | GameObject parent = new GameObject("computed"); 22 | parent.SetActive(false); 23 | 24 | GameObject tmp_camera_object = new GameObject("tmp_camera"); 25 | Camera tmp_camera = tmp_camera_object.AddComponent(); 26 | tmp_camera.clearFlags = CameraClearFlags.Skybox; 27 | tmp_camera.nearClipPlane = 0.01f; 28 | tmp_camera.farClipPlane = 300; 29 | 30 | //temporary storage for the sh coefficients 31 | Vector4[] coefficients = new Vector4[9]; 32 | 33 | //64x64 cubemap should be enough 34 | Cubemap visibility_cubemap = new Cubemap(64, TextureFormat.RGBA32, false); 35 | 36 | //cycle the children renderers 37 | MeshRenderer[] to_compute = gameObject.GetComponentsInChildren(); 38 | 39 | //get the total number of vertex to compute 40 | int total_vertex = 0; 41 | int completed_vertex = 0; 42 | foreach (MeshRenderer mr in to_compute) 43 | { 44 | if (mr.gameObject.isStatic) 45 | total_vertex = mr.gameObject.GetComponent().sharedMesh.vertexCount; 46 | } 47 | 48 | //shader for rendering the visibility (black = occluded) 49 | Shader black_shader = Shader.Find("SH/BlackShader"); 50 | 51 | foreach (MeshRenderer mr in to_compute) 52 | { 53 | if (mr.gameObject.isStatic) //compute only static objects 54 | { 55 | //clone the original 56 | GameObject clone = Instantiate(mr.gameObject); 57 | clone.name = mr.gameObject.name; 58 | clone.transform.SetParent(parent.transform); 59 | 60 | Mesh mesh = Instantiate(mr.gameObject.GetComponent().sharedMesh); 61 | Vector3[] vertices = mesh.vertices; 62 | Vector3[] normals = mesh.normals; 63 | Vector2[] uv2 = new Vector2[mesh.vertexCount]; 64 | Vector2[] uv3 = new Vector2[mesh.vertexCount]; 65 | Vector2[] uv4 = new Vector2[mesh.vertexCount]; 66 | Color[] colors = new Color[mesh.vertexCount]; 67 | 68 | for (int v = 0; v < mesh.vertexCount; ++v) 69 | { 70 | //vertices in the mesh are in local space, transform to world coordinate 71 | Vector3 vertex_world_position = clone.transform.localToWorldMatrix.MultiplyPoint(vertices[v]); 72 | Vector3 world_normal = clone.transform.localToWorldMatrix.MultiplyVector(normals[v]); 73 | tmp_camera.transform.position = vertex_world_position + world_normal * 0.011f; //offset the camera a little in the normal direction 74 | cosine_skybox.SetVector("N", world_normal); 75 | 76 | tmp_camera.SetReplacementShader(black_shader, ""); 77 | tmp_camera.RenderToCubemap(visibility_cubemap); 78 | tmp_camera.ResetReplacementShader(); 79 | 80 | //project the cubemap to the spherical harmonic basis 81 | SphericalHarmonics.GPU_Project_Uniform_9Coeff(visibility_cubemap, coefficients); 82 | 83 | //put 4 coefficients in the vertex color, 2 in the uv2 and 2 in the uv3 and 1 in uv4 84 | colors[v] = new Color(coefficients[0].x, coefficients[1].x, coefficients[2].x, coefficients[3].x); 85 | uv2[v] = new Vector2(coefficients[4].x, coefficients[5].x); 86 | uv3[v] = new Vector2(coefficients[6].x, coefficients[7].x); 87 | uv4[v] = new Vector2(coefficients[8].x, 0); 88 | 89 | for (int i = 0; i < 9; ++i) 90 | coefficients[i] = Vector4.zero; 91 | 92 | completed_vertex++; 93 | } 94 | 95 | mesh.colors = colors; 96 | mesh.uv2 = uv2; 97 | mesh.uv3 = uv3; 98 | mesh.uv4 = uv4; 99 | mesh.UploadMeshData(true); 100 | 101 | //save the mesh 102 | AssetDatabase.CreateAsset(mesh, "Assets/ComputedMeshes/" + mr.name + ".asset"); 103 | 104 | clone.GetComponent().sharedMesh = mesh; 105 | 106 | Material mat = new Material(Shader.Find("SH/SH_Shader")); 107 | clone.GetComponent().material = mat; 108 | } 109 | } 110 | 111 | Object.DestroyImmediate(tmp_camera_object); 112 | 113 | gameObject.SetActive(false); 114 | parent.SetActive(true); 115 | 116 | RenderSettings.skybox = old_skybox; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Assets/SH/Scripts/VisibilityCompute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c6dcf98623780c45b1d7a3f0ce1d2bb 3 | timeCreated: 1518553986 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 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /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: db55b524f49afc54ebaab2607e5eb87c 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: DefaultCompany 14 | productName: Unity_VisibilityFactor 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: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 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: 1 68 | defaultIsNativeResolution: 1 69 | runInBackground: 0 70 | captureSingleScreen: 0 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: 0 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_BuildTargetVRSettings: [] 234 | openGLRequireES31: 0 235 | openGLRequireES31AEP: 0 236 | webPlayerTemplate: APPLICATION:Default 237 | m_TemplateCustomTags: {} 238 | wiiUTitleID: 0005000011000000 239 | wiiUGroupID: 00010000 240 | wiiUCommonSaveSize: 4096 241 | wiiUAccountSaveSize: 2048 242 | wiiUOlvAccessKey: 0 243 | wiiUTinCode: 0 244 | wiiUJoinGameId: 0 245 | wiiUJoinGameModeMask: 0000000000000000 246 | wiiUCommonBossSize: 0 247 | wiiUAccountBossSize: 0 248 | wiiUAddOnUniqueIDs: [] 249 | wiiUMainThreadStackSize: 3072 250 | wiiULoaderThreadStackSize: 1024 251 | wiiUSystemHeapSize: 128 252 | wiiUTVStartupScreen: {fileID: 0} 253 | wiiUGamePadStartupScreen: {fileID: 0} 254 | wiiUDrcBufferDisabled: 0 255 | wiiUProfilerLibPath: 256 | playModeTestRunnerEnabled: 0 257 | actionOnDotNetUnhandledException: 1 258 | enableInternalProfiler: 0 259 | logObjCUncaughtExceptions: 1 260 | enableCrashReportAPI: 0 261 | cameraUsageDescription: 262 | locationUsageDescription: 263 | microphoneUsageDescription: 264 | switchNetLibKey: 265 | switchSocketMemoryPoolSize: 6144 266 | switchSocketAllocatorPoolSize: 128 267 | switchSocketConcurrencyLimit: 14 268 | switchScreenResolutionBehavior: 2 269 | switchUseCPUProfiler: 0 270 | switchApplicationID: 0x01004b9000490000 271 | switchNSODependencies: 272 | switchTitleNames_0: 273 | switchTitleNames_1: 274 | switchTitleNames_2: 275 | switchTitleNames_3: 276 | switchTitleNames_4: 277 | switchTitleNames_5: 278 | switchTitleNames_6: 279 | switchTitleNames_7: 280 | switchTitleNames_8: 281 | switchTitleNames_9: 282 | switchTitleNames_10: 283 | switchTitleNames_11: 284 | switchPublisherNames_0: 285 | switchPublisherNames_1: 286 | switchPublisherNames_2: 287 | switchPublisherNames_3: 288 | switchPublisherNames_4: 289 | switchPublisherNames_5: 290 | switchPublisherNames_6: 291 | switchPublisherNames_7: 292 | switchPublisherNames_8: 293 | switchPublisherNames_9: 294 | switchPublisherNames_10: 295 | switchPublisherNames_11: 296 | switchIcons_0: {fileID: 0} 297 | switchIcons_1: {fileID: 0} 298 | switchIcons_2: {fileID: 0} 299 | switchIcons_3: {fileID: 0} 300 | switchIcons_4: {fileID: 0} 301 | switchIcons_5: {fileID: 0} 302 | switchIcons_6: {fileID: 0} 303 | switchIcons_7: {fileID: 0} 304 | switchIcons_8: {fileID: 0} 305 | switchIcons_9: {fileID: 0} 306 | switchIcons_10: {fileID: 0} 307 | switchIcons_11: {fileID: 0} 308 | switchSmallIcons_0: {fileID: 0} 309 | switchSmallIcons_1: {fileID: 0} 310 | switchSmallIcons_2: {fileID: 0} 311 | switchSmallIcons_3: {fileID: 0} 312 | switchSmallIcons_4: {fileID: 0} 313 | switchSmallIcons_5: {fileID: 0} 314 | switchSmallIcons_6: {fileID: 0} 315 | switchSmallIcons_7: {fileID: 0} 316 | switchSmallIcons_8: {fileID: 0} 317 | switchSmallIcons_9: {fileID: 0} 318 | switchSmallIcons_10: {fileID: 0} 319 | switchSmallIcons_11: {fileID: 0} 320 | switchManualHTML: 321 | switchAccessibleURLs: 322 | switchLegalInformation: 323 | switchMainThreadStackSize: 1048576 324 | switchPresenceGroupId: 325 | switchLogoHandling: 0 326 | switchReleaseVersion: 0 327 | switchDisplayVersion: 1.0.0 328 | switchStartupUserAccount: 0 329 | switchTouchScreenUsage: 0 330 | switchSupportedLanguagesMask: 0 331 | switchLogoType: 0 332 | switchApplicationErrorCodeCategory: 333 | switchUserAccountSaveDataSize: 0 334 | switchUserAccountSaveDataJournalSize: 0 335 | switchApplicationAttribute: 0 336 | switchCardSpecSize: -1 337 | switchCardSpecClock: -1 338 | switchRatingsMask: 0 339 | switchRatingsInt_0: 0 340 | switchRatingsInt_1: 0 341 | switchRatingsInt_2: 0 342 | switchRatingsInt_3: 0 343 | switchRatingsInt_4: 0 344 | switchRatingsInt_5: 0 345 | switchRatingsInt_6: 0 346 | switchRatingsInt_7: 0 347 | switchRatingsInt_8: 0 348 | switchRatingsInt_9: 0 349 | switchRatingsInt_10: 0 350 | switchRatingsInt_11: 0 351 | switchLocalCommunicationIds_0: 352 | switchLocalCommunicationIds_1: 353 | switchLocalCommunicationIds_2: 354 | switchLocalCommunicationIds_3: 355 | switchLocalCommunicationIds_4: 356 | switchLocalCommunicationIds_5: 357 | switchLocalCommunicationIds_6: 358 | switchLocalCommunicationIds_7: 359 | switchParentalControl: 0 360 | switchAllowsScreenshot: 1 361 | switchDataLossConfirmation: 0 362 | switchSupportedNpadStyles: 3 363 | switchSocketConfigEnabled: 0 364 | switchTcpInitialSendBufferSize: 32 365 | switchTcpInitialReceiveBufferSize: 64 366 | switchTcpAutoSendBufferSizeMax: 256 367 | switchTcpAutoReceiveBufferSizeMax: 256 368 | switchUdpSendBufferSize: 9 369 | switchUdpReceiveBufferSize: 42 370 | switchSocketBufferEfficiency: 4 371 | switchSocketInitializeEnabled: 1 372 | switchNetworkInterfaceManagerInitializeEnabled: 1 373 | switchPlayerConnectionEnabled: 1 374 | ps4NPAgeRating: 12 375 | ps4NPTitleSecret: 376 | ps4NPTrophyPackPath: 377 | ps4ParentalLevel: 11 378 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 379 | ps4Category: 0 380 | ps4MasterVersion: 01.00 381 | ps4AppVersion: 01.00 382 | ps4AppType: 0 383 | ps4ParamSfxPath: 384 | ps4VideoOutPixelFormat: 0 385 | ps4VideoOutInitialWidth: 1920 386 | ps4VideoOutBaseModeInitialWidth: 1920 387 | ps4VideoOutReprojectionRate: 120 388 | ps4PronunciationXMLPath: 389 | ps4PronunciationSIGPath: 390 | ps4BackgroundImagePath: 391 | ps4StartupImagePath: 392 | ps4SaveDataImagePath: 393 | ps4SdkOverride: 394 | ps4BGMPath: 395 | ps4ShareFilePath: 396 | ps4ShareOverlayImagePath: 397 | ps4PrivacyGuardImagePath: 398 | ps4NPtitleDatPath: 399 | ps4RemotePlayKeyAssignment: -1 400 | ps4RemotePlayKeyMappingDir: 401 | ps4PlayTogetherPlayerCount: 0 402 | ps4EnterButtonAssignment: 1 403 | ps4ApplicationParam1: 0 404 | ps4ApplicationParam2: 0 405 | ps4ApplicationParam3: 0 406 | ps4ApplicationParam4: 0 407 | ps4DownloadDataSize: 0 408 | ps4GarlicHeapSize: 2048 409 | ps4ProGarlicHeapSize: 2560 410 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 411 | ps4pnSessions: 1 412 | ps4pnPresence: 1 413 | ps4pnFriends: 1 414 | ps4pnGameCustomData: 1 415 | playerPrefsSupport: 0 416 | restrictedAudioUsageRights: 0 417 | ps4UseResolutionFallback: 0 418 | ps4ReprojectionSupport: 0 419 | ps4UseAudio3dBackend: 0 420 | ps4SocialScreenEnabled: 0 421 | ps4ScriptOptimizationLevel: 0 422 | ps4Audio3dVirtualSpeakerCount: 14 423 | ps4attribCpuUsage: 0 424 | ps4PatchPkgPath: 425 | ps4PatchLatestPkgPath: 426 | ps4PatchChangeinfoPath: 427 | ps4PatchDayOne: 0 428 | ps4attribUserManagement: 0 429 | ps4attribMoveSupport: 0 430 | ps4attrib3DSupport: 0 431 | ps4attribShareSupport: 0 432 | ps4attribExclusiveVR: 0 433 | ps4disableAutoHideSplash: 0 434 | ps4videoRecordingFeaturesUsed: 0 435 | ps4contentSearchFeaturesUsed: 0 436 | ps4attribEyeToEyeDistanceSettingVR: 0 437 | ps4IncludedModules: [] 438 | monoEnv: 439 | psp2Splashimage: {fileID: 0} 440 | psp2NPTrophyPackPath: 441 | psp2NPSupportGBMorGJP: 0 442 | psp2NPAgeRating: 12 443 | psp2NPTitleDatPath: 444 | psp2NPCommsID: 445 | psp2NPCommunicationsID: 446 | psp2NPCommsPassphrase: 447 | psp2NPCommsSig: 448 | psp2ParamSfxPath: 449 | psp2ManualPath: 450 | psp2LiveAreaGatePath: 451 | psp2LiveAreaBackroundPath: 452 | psp2LiveAreaPath: 453 | psp2LiveAreaTrialPath: 454 | psp2PatchChangeInfoPath: 455 | psp2PatchOriginalPackage: 456 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 457 | psp2KeystoneFile: 458 | psp2MemoryExpansionMode: 0 459 | psp2DRMType: 0 460 | psp2StorageType: 0 461 | psp2MediaCapacity: 0 462 | psp2DLCConfigPath: 463 | psp2ThumbnailPath: 464 | psp2BackgroundPath: 465 | psp2SoundPath: 466 | psp2TrophyCommId: 467 | psp2TrophyPackagePath: 468 | psp2PackagedResourcesPath: 469 | psp2SaveDataQuota: 10240 470 | psp2ParentalLevel: 1 471 | psp2ShortTitle: Not Set 472 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 473 | psp2Category: 0 474 | psp2MasterVersion: 01.00 475 | psp2AppVersion: 01.00 476 | psp2TVBootMode: 0 477 | psp2EnterButtonAssignment: 2 478 | psp2TVDisableEmu: 0 479 | psp2AllowTwitterDialog: 1 480 | psp2Upgradable: 0 481 | psp2HealthWarning: 0 482 | psp2UseLibLocation: 0 483 | psp2InfoBarOnStartup: 0 484 | psp2InfoBarColor: 0 485 | psp2ScriptOptimizationLevel: 0 486 | psmSplashimage: {fileID: 0} 487 | splashScreenBackgroundSourceLandscape: {fileID: 0} 488 | splashScreenBackgroundSourcePortrait: {fileID: 0} 489 | spritePackerPolicy: 490 | webGLMemorySize: 256 491 | webGLExceptionSupport: 1 492 | webGLNameFilesAsHashes: 0 493 | webGLDataCaching: 0 494 | webGLDebugSymbols: 0 495 | webGLEmscriptenArgs: 496 | webGLModulesDirectory: 497 | webGLTemplate: APPLICATION:Default 498 | webGLAnalyzeBuildSize: 0 499 | webGLUseEmbeddedResources: 0 500 | webGLUseWasm: 0 501 | webGLCompressionFormat: 1 502 | scriptingDefineSymbols: {} 503 | platformArchitecture: {} 504 | scriptingBackend: {} 505 | incrementalIl2cppBuild: {} 506 | additionalIl2CppArgs: 507 | scriptingRuntimeVersion: 0 508 | apiCompatibilityLevelPerPlatform: {} 509 | m_RenderingPath: 1 510 | m_MobileRenderingPath: 1 511 | metroPackageName: Unity_VisibilityFactor 512 | metroPackageVersion: 513 | metroCertificatePath: 514 | metroCertificatePassword: 515 | metroCertificateSubject: 516 | metroCertificateIssuer: 517 | metroCertificateNotAfter: 0000000000000000 518 | metroApplicationDescription: Unity_VisibilityFactor 519 | wsaImages: {} 520 | metroTileShortName: 521 | metroCommandLineArgsFile: 522 | metroTileShowName: 0 523 | metroMediumTileShowName: 0 524 | metroLargeTileShowName: 0 525 | metroWideTileShowName: 0 526 | metroDefaultTileSize: 1 527 | metroTileForegroundText: 2 528 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 529 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 530 | a: 1} 531 | metroSplashScreenUseBackgroundColor: 0 532 | platformCapabilities: {} 533 | metroFTAName: 534 | metroFTAFileTypes: [] 535 | metroProtocolName: 536 | metroCompilationOverrides: 1 537 | tizenProductDescription: 538 | tizenProductURL: 539 | tizenSigningProfileName: 540 | tizenGPSPermissions: 0 541 | tizenMicrophonePermissions: 0 542 | tizenDeploymentTarget: 543 | tizenDeploymentTargetType: -1 544 | tizenMinOSVersion: 1 545 | n3dsUseExtSaveData: 0 546 | n3dsCompressStaticMem: 1 547 | n3dsExtSaveDataNumber: 0x12345 548 | n3dsStackSize: 131072 549 | n3dsTargetPlatform: 2 550 | n3dsRegion: 7 551 | n3dsMediaSize: 0 552 | n3dsLogoStyle: 3 553 | n3dsTitle: GameName 554 | n3dsProductCode: 555 | n3dsApplicationId: 0xFF3FF 556 | stvDeviceAddress: 557 | stvProductDescription: 558 | stvProductAuthor: 559 | stvProductAuthorEmail: 560 | stvProductLink: 561 | stvProductCategory: 0 562 | XboxOneProductId: 563 | XboxOneUpdateKey: 564 | XboxOneSandboxId: 565 | XboxOneContentId: 566 | XboxOneTitleId: 567 | XboxOneSCId: 568 | XboxOneGameOsOverridePath: 569 | XboxOnePackagingOverridePath: 570 | XboxOneAppManifestOverridePath: 571 | XboxOnePackageEncryption: 0 572 | XboxOnePackageUpdateGranularity: 2 573 | XboxOneDescription: 574 | XboxOneLanguage: 575 | - enus 576 | XboxOneCapability: [] 577 | XboxOneGameRating: {} 578 | XboxOneIsContentPackage: 0 579 | XboxOneEnableGPUVariability: 0 580 | XboxOneSockets: {} 581 | XboxOneSplashScreen: {fileID: 0} 582 | XboxOneAllowedProductIds: [] 583 | XboxOnePersistentLocalStorageSize: 0 584 | xboxOneScriptCompiler: 0 585 | vrEditorSettings: 586 | daydream: 587 | daydreamIconForeground: {fileID: 0} 588 | daydreamIconBackground: {fileID: 0} 589 | cloudServicesEnabled: {} 590 | facebookSdkVersion: 7.9.4 591 | apiCompatibilityLevel: 2 592 | cloudProjectId: 593 | projectName: 594 | organizationId: 595 | cloudEnabled: 0 596 | enableNativePlatformBackendsForNewInputSystem: 0 597 | disableOldInputManagerSupport: 0 598 | -------------------------------------------------------------------------------- /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: 2 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 Tools 2 |

3 | 4 |

5 | 6 | ## Overview 7 | In this project the are two tools: the first one takes an input cubemap and project into the spherical harmonic basis and print the first three bands (**9 coefficients**). It's possible to compute this projection with 3 different techniques: 8 | - On the **CPU** with **uniform sampling**, which means reading all the texels of the cubemap. 9 | - On the **CPU** with **Monte Carlo sampling**, which means less texture readings, more rapid but with an approximated result. 10 | - On the **GPU** with **Monte Carlo sampling**, with a result similar to the CPU one but faster. 11 | - On the **GPU** with **uniform sampling**, using a *Compute Shader*, this gives the accuracy of CPU uniform sampling with maximum speed. **I Recommend using this.** 12 | 13 | Once the result is computed you can see it and toggle the original version and the projected one. 14 |

15 | 16 |

17 | The second tool is a component to add on a game object; its purpose is to get all the game object's children and foreach of their vertices compute and project onto the SH basis the **Geometry Factor**. It won't change directly the objects meshes but will create a clone object to modify. 18 | 19 | The **Geometry Factor** describes the visibility from the vertex (so 0 if the vertex is occluded or 1 if the vertex can see direclty the environment from direction **v**) multiplied with che **cosine** of the **vertex normal** with the direction **v**. 20 | > At the momenty Unity doesn't support custom vertex attributes so i had to put the 9 coefficients in the existing ones, organizing them in this way: first 4 coefficients in the vertex color rgba, the next 2 in the uv2, the next 2 in the uv3 and the last one in the x component of uv4. It's a temporary solution and i hope to find a better workaround. 21 | -------------------------------------------------------------------------------- /docs/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/docs/banner.png -------------------------------------------------------------------------------- /docs/project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pieroaccardi/Unity_SphericalHarmonics_Tools/10a2b7dca0294ab471e52954d7a9c6a375fd70c8/docs/project.png --------------------------------------------------------------------------------