├── Project ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── EditorBuildSettings.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── AudioManager.asset │ ├── TagManager.asset │ ├── EditorSettings.asset │ ├── UnityConnectSettings.asset │ ├── DynamicsManager.asset │ ├── Physics2DSettings.asset │ ├── NavMeshAreas.asset │ ├── GraphicsSettings.asset │ ├── QualitySettings.asset │ ├── InputManager.asset │ └── ProjectSettings.asset ├── UnityPackageManager │ └── manifest.json └── Assets │ ├── Demo │ ├── Texture │ │ ├── grass_tex1.png │ │ ├── grass_tex2.png │ │ ├── grass_tex1.png.meta │ │ └── grass_tex2.png.meta │ ├── Scene │ │ ├── Demo.unity.meta │ │ ├── DemoEdit.unity.meta │ │ └── Demo.unity │ ├── GrassData.meta │ ├── Scene.meta │ ├── Script.meta │ ├── Texture.meta │ ├── GrassData │ │ └── GrassData.asset.meta │ └── Script │ │ ├── GpuGrassTest.cs.meta │ │ └── GpuGrassTest.cs │ ├── Demo.meta │ ├── GrassInstance.meta │ └── GrassInstance │ ├── EditRes.meta │ ├── Instance.meta │ ├── Script.meta │ ├── Shader.meta │ ├── EditRes │ ├── Model.meta │ ├── Shader.meta │ ├── Material.meta │ ├── Shader │ │ ├── Grass-Editor.shader.meta │ │ └── Grass-Editor.shader │ ├── Model │ │ ├── GrassMesh.asset.meta │ │ ├── grass.prefab.meta │ │ ├── grass.prefab │ │ └── GrassMesh.asset │ └── Material │ │ ├── GrassEditor.mat.meta │ │ └── GrassEditor.mat │ ├── Script │ ├── Editor.meta │ ├── GrassBrush.cs.meta │ ├── GrassData.cs.meta │ ├── GrassInstance.cs.meta │ ├── GrassEditorDataCache.cs.meta │ ├── Editor │ │ ├── GrassBrushEditor.cs.meta │ │ └── GrassBrushEditor.cs │ ├── GrassData.cs │ ├── GrassEditorDataCache.cs │ ├── GrassBrush.cs │ └── GrassInstance.cs │ ├── Shader │ ├── Grass-0.shader.meta │ ├── Grass-1.shader.meta │ ├── Grass-2.shader.meta │ ├── Grass-0.shader │ ├── Grass-1.shader │ └── Grass-2.shader │ └── Instance │ ├── GrassMesh.asset.meta │ ├── GrassMat0.mat.meta │ ├── GrassMat1.mat.meta │ ├── GrassMat2.mat.meta │ ├── GrassInstance.prefab.meta │ ├── GrassInstance.prefab │ ├── GrassMat0.mat │ ├── GrassMat1.mat │ ├── GrassMat2.mat │ └── GrassMesh.asset ├── image ├── 1.png ├── 2.png ├── 3.png └── 4.png ├── README.md ├── .gitignore └── LICENSE /Project/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.4.26f1 2 | -------------------------------------------------------------------------------- /Project/UnityPackageManager/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tongguang/GpuInstanceGrass/HEAD/image/1.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tongguang/GpuInstanceGrass/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tongguang/GpuInstanceGrass/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tongguang/GpuInstanceGrass/HEAD/image/4.png -------------------------------------------------------------------------------- /Project/Assets/Demo/Texture/grass_tex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tongguang/GpuInstanceGrass/HEAD/Project/Assets/Demo/Texture/grass_tex1.png -------------------------------------------------------------------------------- /Project/Assets/Demo/Texture/grass_tex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tongguang/GpuInstanceGrass/HEAD/Project/Assets/Demo/Texture/grass_tex2.png -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /Project/Assets/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e51eb691e3e2004d8d413a500328996 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Scene/Demo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08d50af04e0a5db46a6b2d8aba02cb80 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Scene/DemoEdit.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96556373aadc3d34fa6c199394c34248 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /Project/Assets/Demo/GrassData.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f17f52c96628ed54bb35ebac1143a056 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Scene.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3bce0b5e416ecb4c8ab3a838d392a29 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Script.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ec265dcceaa29c45b81b1ff3f23b012 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Texture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77ef54b60b9c1f542b500336bfd172da 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da86edd5c1366944fa2fdc6e5df830f5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b486c8627464484eb6b075bf827cd62 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54a0f0f9f5c6b844fa7355a432c36407 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6c93e6cd1fcbff489b36e1b0aa09667 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81edbff5fcb3f934097ae262a94a787b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8533f11d46e99114b8d28d67c6f9acde 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d690018bd13cf3f44bf19a1f212da863 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26088514eab19a544a96a6444ab31952 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a57205a29f8ab08459ce5a36625d9810 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader/Grass-0.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f45d7f0561486a41a1df039e3236c21 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader/Grass-1.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d5a639e173a2854b820c09ec51d0a38 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader/Grass-2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3a2183ed68046341ab1ce717ffc1623 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/Demo/GrassData/GrassData.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca1860baebf404545af8e71106c5d248 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMesh.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ade3f1ef004008c42b4e1e24ebf139a9 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Shader/Grass-Editor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3716effc9ee99048b6ec1537dcd24a5 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMat0.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f09b90a7fdb50af40b84aef33c088f24 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMat1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e897923d1641b204c831b02f1df73cab 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMat2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78615cdbdd3eb6a4eb050ebaaae7c294 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Model/GrassMesh.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 680ae62697e47dd49b066d8937df3c3d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 4300000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Model/grass.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3496f234bd8b074090a022177e15941 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 100100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Material/GrassEditor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 463b494a5119cb7418982aeb14dd1de5 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassInstance.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8108a1b203ca45418a84710e5d795b1 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 100100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Script/GpuGrassTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56c4e94d5f8a6794181d1628d13371b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassBrush.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eab59850d05187f44822e8f3b0f91f47 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec8c9fc995a34194a84fff3884fe4afa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassInstance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88f42fbffbed9724295275a962e419cf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassEditorDataCache.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0f0df4197b29ce4b83d099b1abcaf43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/Editor/GrassBrushEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 106cb8c429e54a14cbacb176e4eff4c4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GpuInstanceGrass 2 | ## 介绍 3 | 4 | unity GpuInstance合批的可摆动的草,支持设置草颜色 5 | 6 | 已支持: 7 | 8 | - GpuInstance合批 9 | - 可以对每颗草设置颜色 位置 缩放 10 | - 草分块(运行时只渲染附近格子的草) 11 | - 支持草可交互(人物过去草会往旁边压) 12 | - 编辑模式批量刷草 13 | 14 | ![1](image/1.png) 15 | 16 | ![2](image/2.png) 17 | 18 | ## demo使用 19 | 20 | Demo\Scene\DemoEdit.unity 编辑草 选中此节点在场景中点击种草 21 | 22 | ![](image/3.png) 23 | 24 | Demo\Scene\Demo.unity 运行实例 25 | 26 | 可以拖动DemoGameObject来看看分块加载![](image/4.png) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | *.pdb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | 34 | # Builds 35 | *.apk 36 | *.unitypackage 37 | -------------------------------------------------------------------------------- /Project/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 | - Terrain 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 | -------------------------------------------------------------------------------- /Project/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: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Script/GpuGrassTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace GupInstanceGrass.Demo 6 | { 7 | public class GpuGrassTest : MonoBehaviour 8 | { 9 | public GrassData GrassDataInfo; 10 | public GrassInstance GrassInstanceObj; 11 | 12 | private Transform _Transform; 13 | 14 | void Start() 15 | { 16 | _Transform = transform; 17 | 18 | GrassInstanceObj.SetGrassLevel(2); 19 | GrassInstanceObj.SetMapGrassData(GrassDataInfo); 20 | } 21 | 22 | // Update is called once per frame 23 | void Update() 24 | { 25 | GrassInstanceObj.SetRolePosition(_Transform.position.x, _Transform.position.y, _Transform.position.z); 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace GupInstanceGrass 7 | { 8 | public class GrassData : ScriptableObject 9 | { 10 | 11 | [Serializable] 12 | public class GrassItem 13 | { 14 | public Matrix4x4 TransformMatrix; 15 | public Color ColorInfo; 16 | public Vector4 UV0Offset; 17 | public string TextureName; 18 | } 19 | 20 | [Serializable] 21 | public class GrassBlock 22 | { 23 | public List GrassItems = new List(); 24 | } 25 | 26 | public int BlockXMax; 27 | public int BlockYMax; 28 | public List GrassTextures = new List(); 29 | public List BlockList = new List(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Material/GrassEditor.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: GrassEditor 10 | m_Shader: {fileID: 4800000, guid: c3716effc9ee99048b6ec1537dcd24a5, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 1 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _MainTex: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | m_Floats: 26 | - _Rigidness: 25 27 | - _Speed: 25 28 | - _SwayMax: 0.005 29 | - _YOffset: 0.5 30 | m_Colors: 31 | - _Color: {r: 1, g: 1, b: 1, a: 1} 32 | -------------------------------------------------------------------------------- /Project/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_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 1 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 1 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 tongguang 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. 22 | -------------------------------------------------------------------------------- /Project/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: 7 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_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassEditorDataCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace GupInstanceGrass 7 | { 8 | [ExecuteInEditMode] 9 | public class GrassEditorDataCache : MonoBehaviour 10 | { 11 | public Renderer RendererObj; 12 | 13 | public Color GrassColor = Color.white; 14 | public Texture GrassTexture = null; 15 | 16 | private void Start() 17 | { 18 | if (RendererObj) 19 | { 20 | var props = new MaterialPropertyBlock(); 21 | props.SetColor("_Color", GrassColor); 22 | props.SetTexture("_MainTex", GrassTexture); 23 | RendererObj.SetPropertyBlock(props); 24 | } 25 | } 26 | 27 | private void OnEnable() 28 | { 29 | if (RendererObj) 30 | { 31 | var props = new MaterialPropertyBlock(); 32 | props.SetColor("_Color", GrassColor); 33 | props.SetTexture("_MainTex", GrassTexture); 34 | RendererObj.SetPropertyBlock(props); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Project/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_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /Project/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 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassInstance.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1696781180489284} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1696781180489284 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4981637379775036} 22 | - component: {fileID: 114256154784952712} 23 | m_Layer: 0 24 | m_Name: GrassInstance 25 | m_TagString: Untagged 26 | m_Icon: {fileID: 0} 27 | m_NavMeshLayer: 0 28 | m_StaticEditorFlags: 0 29 | m_IsActive: 1 30 | --- !u!4 &4981637379775036 31 | Transform: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 1696781180489284} 36 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 37 | m_LocalPosition: {x: 0, y: 0, z: 0} 38 | m_LocalScale: {x: 1, y: 1, z: 1} 39 | m_Children: [] 40 | m_Father: {fileID: 0} 41 | m_RootOrder: 0 42 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 43 | --- !u!114 &114256154784952712 44 | MonoBehaviour: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 1696781180489284} 49 | m_Enabled: 1 50 | m_EditorHideFlags: 0 51 | m_Script: {fileID: 11500000, guid: 88f42fbffbed9724295275a962e419cf, type: 3} 52 | m_Name: 53 | m_EditorClassIdentifier: 54 | IsDebug: 0 55 | RenderCamera: {fileID: 0} 56 | _GrassMaterialList: 57 | - {fileID: 2100000, guid: f09b90a7fdb50af40b84aef33c088f24, type: 2} 58 | - {fileID: 2100000, guid: e897923d1641b204c831b02f1df73cab, type: 2} 59 | - {fileID: 2100000, guid: 78615cdbdd3eb6a4eb050ebaaae7c294, type: 2} 60 | _CurMesh: {fileID: 4300000, guid: ade3f1ef004008c42b4e1e24ebf139a9, type: 2} 61 | _CombineTexture: {fileID: 0} 62 | -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMat0.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: GrassMat0 10 | m_Shader: {fileID: 4800000, guid: 6f45d7f0561486a41a1df039e3236c21, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 1 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 | - _Rigidness: 25 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _Speed: 50 73 | - _SrcBlend: 1 74 | - _SwayMax: 0.05 75 | - _UVSec: 0 76 | - _YOffset: 0.1 77 | - _ZWrite: 1 78 | m_Colors: 79 | - _Color: {r: 1, g: 1, b: 1, a: 1} 80 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 81 | - _UV0Offset: {r: 0, g: 0, b: 1, a: 1} 82 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMat1.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: GrassMat1 10 | m_Shader: {fileID: 4800000, guid: 9d5a639e173a2854b820c09ec51d0a38, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 1 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 | - _Rigidness: 25 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _Speed: 50 73 | - _SrcBlend: 1 74 | - _SwayMax: 0.05 75 | - _UVSec: 0 76 | - _YOffset: 0.1 77 | - _ZWrite: 1 78 | m_Colors: 79 | - _Color: {r: 1, g: 1, b: 1, a: 1} 80 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 81 | - _UV0Offset: {r: 0, g: 0, b: 1, a: 1} 82 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMat2.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: GrassMat2 10 | m_Shader: {fileID: 4800000, guid: d3a2183ed68046341ab1ce717ffc1623, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 1 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 | - _MaxWidth: 0.1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _Radius: 1 71 | - _Rigidness: 25 72 | - _SmoothnessTextureChannel: 0 73 | - _SpecularHighlights: 1 74 | - _Speed: 50 75 | - _SrcBlend: 1 76 | - _SwayMax: 0.05 77 | - _UVSec: 0 78 | - _YOffset: 0.1 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | - _UV0Offset: {r: 0, g: 0, b: 1, a: 1} 84 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Texture/grass_tex1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a53e44957ae00a9409a92a00469c456a 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 1 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: 1 33 | aniso: 0 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 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 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | - buildTarget: Standalone 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | androidETC2FallbackOverride: 0 78 | - buildTarget: Android 79 | maxTextureSize: 2048 80 | resizeAlgorithm: 0 81 | textureFormat: -1 82 | textureCompression: 1 83 | compressionQuality: 50 84 | crunchedCompression: 0 85 | allowsAlphaSplitting: 0 86 | overridden: 0 87 | androidETC2FallbackOverride: 0 88 | spriteSheet: 89 | serializedVersion: 2 90 | sprites: [] 91 | outline: [] 92 | physicsShape: [] 93 | spritePackingTag: 94 | userData: 95 | assetBundleName: 96 | assetBundleVariant: 97 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Texture/grass_tex2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9907b5d188f7bb8489ac8bf51abe60b2 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 1 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: 1 33 | aniso: 0 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 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 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | - buildTarget: Standalone 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | androidETC2FallbackOverride: 0 78 | - buildTarget: Android 79 | maxTextureSize: 2048 80 | resizeAlgorithm: 0 81 | textureFormat: -1 82 | textureCompression: 1 83 | compressionQuality: 50 84 | crunchedCompression: 0 85 | allowsAlphaSplitting: 0 86 | overridden: 0 87 | androidETC2FallbackOverride: 0 88 | spriteSheet: 89 | serializedVersion: 2 90 | sprites: [] 91 | outline: [] 92 | physicsShape: [] 93 | spritePackingTag: 94 | userData: 95 | assetBundleName: 96 | assetBundleVariant: 97 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Model/grass.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1543891951469150} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1543891951469150 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4404342582926288} 22 | - component: {fileID: 33200064621264928} 23 | - component: {fileID: 23124843640553316} 24 | m_Layer: 0 25 | m_Name: Grass 26 | m_TagString: Untagged 27 | m_Icon: {fileID: 0} 28 | m_NavMeshLayer: 0 29 | m_StaticEditorFlags: 0 30 | m_IsActive: 1 31 | --- !u!4 &4404342582926288 32 | Transform: 33 | m_ObjectHideFlags: 1 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | m_GameObject: {fileID: 1543891951469150} 37 | m_LocalRotation: {x: 0.000000021855694, y: 0, z: -0, w: 1} 38 | m_LocalPosition: {x: -0, y: 0, z: 0.000000010970283} 39 | m_LocalScale: {x: 1, y: 1, z: 1} 40 | m_Children: [] 41 | m_Father: {fileID: 0} 42 | m_RootOrder: 0 43 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 44 | --- !u!23 &23124843640553316 45 | MeshRenderer: 46 | m_ObjectHideFlags: 1 47 | m_PrefabParentObject: {fileID: 0} 48 | m_PrefabInternal: {fileID: 100100000} 49 | m_GameObject: {fileID: 1543891951469150} 50 | m_Enabled: 1 51 | m_CastShadows: 1 52 | m_ReceiveShadows: 1 53 | m_DynamicOccludee: 1 54 | m_MotionVectors: 1 55 | m_LightProbeUsage: 1 56 | m_ReflectionProbeUsage: 1 57 | m_Materials: 58 | - {fileID: 2100000, guid: 463b494a5119cb7418982aeb14dd1de5, type: 2} 59 | m_StaticBatchInfo: 60 | firstSubMesh: 0 61 | subMeshCount: 0 62 | m_StaticBatchRoot: {fileID: 0} 63 | m_ProbeAnchor: {fileID: 0} 64 | m_LightProbeVolumeOverride: {fileID: 0} 65 | m_ScaleInLightmap: 1 66 | m_PreserveUVs: 0 67 | m_IgnoreNormalsForChartDetection: 0 68 | m_ImportantGI: 0 69 | m_StitchLightmapSeams: 0 70 | m_SelectedEditorRenderState: 3 71 | m_MinimumChartSize: 4 72 | m_AutoUVMaxDistance: 0.5 73 | m_AutoUVMaxAngle: 89 74 | m_LightmapParameters: {fileID: 0} 75 | m_SortingLayerID: 0 76 | m_SortingLayer: 0 77 | m_SortingOrder: 0 78 | --- !u!33 &33200064621264928 79 | MeshFilter: 80 | m_ObjectHideFlags: 1 81 | m_PrefabParentObject: {fileID: 0} 82 | m_PrefabInternal: {fileID: 100100000} 83 | m_GameObject: {fileID: 1543891951469150} 84 | m_Mesh: {fileID: 4300000, guid: 680ae62697e47dd49b066d8937df3c3d, type: 2} 85 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader/Grass-0.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "LearnShader/Grass-0" { 4 | Properties{ 5 | _Color("Color", Color) = (1,1,1,1) 6 | _MainTex("MainTex", 2D) = "white" {} 7 | _UV0Offset ("UV0Offset", Vector) = (0,0,1,1) 8 | } 9 | 10 | SubShader 11 | { 12 | Tags 13 | { 14 | "Queue"="Transparent" 15 | "RenderType"="Transparent" 16 | "IgnoreProject"="True" 17 | "DisableBatching" = "True" 18 | } 19 | LOD 100 20 | Cull Off 21 | ZWrite Off 22 | Blend SrcAlpha OneMinusSrcAlpha 23 | 24 | Pass 25 | { 26 | CGPROGRAM 27 | #pragma vertex vert 28 | #pragma fragment frag 29 | #pragma multi_compile_instancing 30 | #include "UnityCG.cginc" 31 | 32 | struct appdata_t 33 | { 34 | float4 vertex : POSITION; 35 | float2 texcoord : TEXCOORD0; 36 | UNITY_VERTEX_INPUT_INSTANCE_ID 37 | }; 38 | 39 | struct v2f 40 | { 41 | float4 vertex : SV_POSITION; 42 | float2 texcoord : TEXCOORD0; 43 | UNITY_VERTEX_INPUT_INSTANCE_ID 44 | }; 45 | 46 | sampler2D _MainTex; 47 | UNITY_INSTANCING_BUFFER_START(Props) 48 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color) 49 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _UV0Offset) 50 | UNITY_INSTANCING_BUFFER_END(Props) 51 | 52 | v2f vert(appdata_t IN) 53 | { 54 | v2f o; 55 | UNITY_SETUP_INSTANCE_ID(IN); 56 | UNITY_TRANSFER_INSTANCE_ID(IN, o); 57 | 58 | //o.vertex = UnityObjectToClipPos(IN.vertex); 59 | 60 | // float3 vpos = mul((float3x3)unity_ObjectToWorld, IN.vertex.xyz); 61 | // float4 worldCoord = float4(unity_ObjectToWorld._m03, unity_ObjectToWorld._m13, unity_ObjectToWorld._m23, 1); 62 | // float4 viewPos = mul(UNITY_MATRIX_V, worldCoord) + float4(vpos, 0); 63 | // float4 outPos = mul(UNITY_MATRIX_P, viewPos); 64 | // o.vertex = outPos; 65 | 66 | // billboard 67 | float3 viewerLocal = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1)); 68 | float3 localDir = viewerLocal - float3(0,0,0); 69 | localDir.y = lerp(0, localDir.y, 0.1); 70 | localDir = normalize(localDir); 71 | // float3 upLocal = abs(localDir.y) > 0.999f ? float3(0, 0, 1) : float3(0, 1, 0); 72 | float3 upLocal = float3(0, 1, 0); 73 | float3 rightLocal = normalize(cross(localDir, upLocal)); 74 | upLocal = cross(rightLocal, localDir); 75 | float3 BBLocalPos = rightLocal * IN.vertex.x + upLocal * IN.vertex.y; 76 | o.vertex = UnityObjectToClipPos(float4(BBLocalPos, 1)); 77 | 78 | fixed4 uV0Offset = UNITY_ACCESS_INSTANCED_PROP(Props, _UV0Offset); 79 | o.texcoord.x = uV0Offset.x + IN.texcoord.x * (uV0Offset.z - uV0Offset.x); 80 | o.texcoord.y = uV0Offset.y + IN.texcoord.y * (uV0Offset.w - uV0Offset.y); 81 | return o; 82 | } 83 | 84 | fixed4 frag(v2f IN) : SV_Target 85 | { 86 | UNITY_SETUP_INSTANCE_ID(IN); 87 | half4 color = tex2D(_MainTex, IN.texcoord) * UNITY_ACCESS_INSTANCED_PROP(Props, _Color); 88 | return color; 89 | } 90 | ENDCG 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Instance/GrassMesh.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!43 &4300000 4 | Mesh: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: GrassMesh 9 | serializedVersion: 8 10 | m_SubMeshes: 11 | - serializedVersion: 2 12 | firstByte: 0 13 | indexCount: 12 14 | topology: 0 15 | baseVertex: 0 16 | firstVertex: 0 17 | vertexCount: 6 18 | localAABB: 19 | m_Center: {x: 0, y: 0.25048542, z: -0.000000011028152} 20 | m_Extent: {x: 0.25, y: 0.25048542, z: 0.000000040788038} 21 | m_Shapes: 22 | vertices: [] 23 | shapes: [] 24 | channels: [] 25 | fullWeights: [] 26 | m_BindPose: [] 27 | m_BoneNameHashes: 28 | m_RootBoneNameHash: 0 29 | m_MeshCompression: 0 30 | m_IsReadable: 1 31 | m_KeepVertices: 1 32 | m_KeepIndices: 1 33 | m_IndexFormat: 0 34 | m_IndexBuffer: 000001000200000002000300030002000400030004000500 35 | m_Skin: [] 36 | m_VertexData: 37 | m_CurrentChannels: 11 38 | m_VertexCount: 6 39 | m_Channels: 40 | - stream: 0 41 | offset: 0 42 | format: 0 43 | dimension: 3 44 | - stream: 0 45 | offset: 12 46 | format: 0 47 | dimension: 3 48 | - stream: 0 49 | offset: 0 50 | format: 0 51 | dimension: 0 52 | - stream: 0 53 | offset: 24 54 | format: 0 55 | dimension: 2 56 | - stream: 0 57 | offset: 0 58 | format: 0 59 | dimension: 0 60 | - stream: 0 61 | offset: 0 62 | format: 0 63 | dimension: 0 64 | - stream: 0 65 | offset: 0 66 | format: 0 67 | dimension: 0 68 | - stream: 0 69 | offset: 0 70 | format: 0 71 | dimension: 0 72 | m_DataSize: 192 73 | _typelessdata: 0000803ea03f003fafa2ff3200000000000000000000803ff2b0bf3a90bb7f3f000080bea03f003fafa2ff3200000000000000000000803fef177f3f90bb7f3f000080bedc97363edfbbc3b200000000000000000000803fef177f3fb4b7b63e0000803edc97363edfbbc3b200000000000000000000803ff2b0bf3ab4b7b63e000080be00000000818c5eb300000000000000000000803fef177f3fdddd043b0000803e00000000818c5eb300000000000000000000803ff2b0bf3adddd043b 74 | m_CompressedMesh: 75 | m_Vertices: 76 | m_NumItems: 0 77 | m_Range: 0 78 | m_Start: 0 79 | m_Data: 80 | m_BitSize: 0 81 | m_UV: 82 | m_NumItems: 0 83 | m_Range: 0 84 | m_Start: 0 85 | m_Data: 86 | m_BitSize: 0 87 | m_Normals: 88 | m_NumItems: 0 89 | m_Range: 0 90 | m_Start: 0 91 | m_Data: 92 | m_BitSize: 0 93 | m_Tangents: 94 | m_NumItems: 0 95 | m_Range: 0 96 | m_Start: 0 97 | m_Data: 98 | m_BitSize: 0 99 | m_Weights: 100 | m_NumItems: 0 101 | m_Data: 102 | m_BitSize: 0 103 | m_NormalSigns: 104 | m_NumItems: 0 105 | m_Data: 106 | m_BitSize: 0 107 | m_TangentSigns: 108 | m_NumItems: 0 109 | m_Data: 110 | m_BitSize: 0 111 | m_FloatColors: 112 | m_NumItems: 0 113 | m_Range: 0 114 | m_Start: 0 115 | m_Data: 116 | m_BitSize: 0 117 | m_BoneIndices: 118 | m_NumItems: 0 119 | m_Data: 120 | m_BitSize: 0 121 | m_Triangles: 122 | m_NumItems: 0 123 | m_Data: 124 | m_BitSize: 0 125 | m_UVInfo: 0 126 | m_LocalAABB: 127 | m_Center: {x: 0, y: 0.25048542, z: -0.000000011028152} 128 | m_Extent: {x: 0.25, y: 0.25048542, z: 0.000000040788038} 129 | m_MeshUsageFlags: 0 130 | m_BakedConvexCollisionMesh: 131 | m_BakedTriangleCollisionMesh: 132 | m_MeshOptimized: 1 133 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Model/GrassMesh.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!43 &4300000 4 | Mesh: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: GrassMesh 9 | serializedVersion: 8 10 | m_SubMeshes: 11 | - serializedVersion: 2 12 | firstByte: 0 13 | indexCount: 12 14 | topology: 0 15 | baseVertex: 0 16 | firstVertex: 0 17 | vertexCount: 6 18 | localAABB: 19 | m_Center: {x: 0, y: 0.25048542, z: -0.000000011028152} 20 | m_Extent: {x: 0.25, y: 0.25048542, z: 0.000000040788038} 21 | m_Shapes: 22 | vertices: [] 23 | shapes: [] 24 | channels: [] 25 | fullWeights: [] 26 | m_BindPose: [] 27 | m_BoneNameHashes: 28 | m_RootBoneNameHash: 0 29 | m_MeshCompression: 0 30 | m_IsReadable: 1 31 | m_KeepVertices: 1 32 | m_KeepIndices: 1 33 | m_IndexFormat: 0 34 | m_IndexBuffer: 000001000200000002000300030002000400030004000500 35 | m_Skin: [] 36 | m_VertexData: 37 | m_CurrentChannels: 11 38 | m_VertexCount: 6 39 | m_Channels: 40 | - stream: 0 41 | offset: 0 42 | format: 0 43 | dimension: 3 44 | - stream: 0 45 | offset: 12 46 | format: 0 47 | dimension: 3 48 | - stream: 0 49 | offset: 0 50 | format: 0 51 | dimension: 0 52 | - stream: 0 53 | offset: 24 54 | format: 0 55 | dimension: 2 56 | - stream: 0 57 | offset: 0 58 | format: 0 59 | dimension: 0 60 | - stream: 0 61 | offset: 0 62 | format: 0 63 | dimension: 0 64 | - stream: 0 65 | offset: 0 66 | format: 0 67 | dimension: 0 68 | - stream: 0 69 | offset: 0 70 | format: 0 71 | dimension: 0 72 | m_DataSize: 192 73 | _typelessdata: 0000803ea03f003fafa2ff3200000000000000000000803ff2b0bf3a90bb7f3f000080bea03f003fafa2ff3200000000000000000000803fef177f3f90bb7f3f000080bedc97363edfbbc3b200000000000000000000803fef177f3fb4b7b63e0000803edc97363edfbbc3b200000000000000000000803ff2b0bf3ab4b7b63e000080be00000000818c5eb300000000000000000000803fef177f3fdddd043b0000803e00000000818c5eb300000000000000000000803ff2b0bf3adddd043b 74 | m_CompressedMesh: 75 | m_Vertices: 76 | m_NumItems: 0 77 | m_Range: 0 78 | m_Start: 0 79 | m_Data: 80 | m_BitSize: 0 81 | m_UV: 82 | m_NumItems: 0 83 | m_Range: 0 84 | m_Start: 0 85 | m_Data: 86 | m_BitSize: 0 87 | m_Normals: 88 | m_NumItems: 0 89 | m_Range: 0 90 | m_Start: 0 91 | m_Data: 92 | m_BitSize: 0 93 | m_Tangents: 94 | m_NumItems: 0 95 | m_Range: 0 96 | m_Start: 0 97 | m_Data: 98 | m_BitSize: 0 99 | m_Weights: 100 | m_NumItems: 0 101 | m_Data: 102 | m_BitSize: 0 103 | m_NormalSigns: 104 | m_NumItems: 0 105 | m_Data: 106 | m_BitSize: 0 107 | m_TangentSigns: 108 | m_NumItems: 0 109 | m_Data: 110 | m_BitSize: 0 111 | m_FloatColors: 112 | m_NumItems: 0 113 | m_Range: 0 114 | m_Start: 0 115 | m_Data: 116 | m_BitSize: 0 117 | m_BoneIndices: 118 | m_NumItems: 0 119 | m_Data: 120 | m_BitSize: 0 121 | m_Triangles: 122 | m_NumItems: 0 123 | m_Data: 124 | m_BitSize: 0 125 | m_UVInfo: 0 126 | m_LocalAABB: 127 | m_Center: {x: 0, y: 0.25048542, z: -0.000000011028152} 128 | m_Extent: {x: 0.25, y: 0.25048542, z: 0.000000040788038} 129 | m_MeshUsageFlags: 0 130 | m_BakedConvexCollisionMesh: 131 | m_BakedTriangleCollisionMesh: 132 | m_MeshOptimized: 1 133 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassBrush.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Linq; 4 | using UnityEditor; 5 | using UnityEngine; 6 | using UnityEngine.Rendering; 7 | 8 | namespace GupInstanceGrass 9 | { 10 | [ExecuteInEditMode] 11 | public class GrassBrush : MonoBehaviour 12 | { 13 | public GameObject GrassPrefab; 14 | 15 | public Texture GrassTexture = null; 16 | 17 | public Color GrassColor = Color.white; 18 | 19 | public float GrassMinScale = 1.0f; 20 | 21 | public float GrassMaxScale = 1.0f; 22 | 23 | public float BrushRadius = 1.0f; 24 | 25 | public int CreateGrassNum = 1; 26 | 27 | public string TerrainLayerName = "Terrain"; 28 | 29 | public Vector2Int MapSize = new Vector2Int(100, 100); 30 | 31 | // public Vector2Int BlockSize = new Vector2Int(30, 30); 32 | 33 | public string GrassDataDir = "Assets/3-GpuInstanceGrass/GrassData"; 34 | 35 | public string GrassDataFileName = "GrassData"; 36 | 37 | 38 | private void Awake() 39 | { 40 | // GrassPrefab = 41 | // AssetDatabase.LoadAssetAtPath("Assets/_RawData/map_editor/map_models/grass/grass.prefab"); 42 | } 43 | 44 | public void Save() 45 | { 46 | int xMax = Mathf.CeilToInt((1.0f * MapSize.x / GrassInstance.BlockSize.x)); 47 | int yMax = Mathf.CeilToInt((1.0f * MapSize.y / GrassInstance.BlockSize.y)); 48 | GrassData grassData = ScriptableObject.CreateInstance(); 49 | for (int i = 0; i < xMax * yMax; i++) 50 | { 51 | grassData.BlockList.Add(new GrassData.GrassBlock()); 52 | } 53 | 54 | grassData.BlockXMax = xMax; 55 | grassData.BlockYMax = yMax; 56 | var grassRoot = transform; 57 | var msehFilters = grassRoot.GetComponentsInChildren(); 58 | HashSet textures = new HashSet(); 59 | foreach (var msehFilter in msehFilters) 60 | { 61 | var blockX = Mathf.FloorToInt(1.0f * msehFilter.transform.position.x / GrassInstance.BlockSize.x); 62 | var blockY = Mathf.FloorToInt(1.0f * msehFilter.transform.position.z / GrassInstance.BlockSize.y); 63 | var index = blockY * xMax + blockX; 64 | var grassItem = new GrassData.GrassItem(); 65 | grassData.BlockList[index].GrassItems.Add(grassItem); 66 | grassItem.TransformMatrix = msehFilter.transform.localToWorldMatrix; 67 | grassItem.UV0Offset = new Vector4(1f, 1f, 0f, 0f); 68 | foreach (var uvInfo in msehFilter.sharedMesh.uv) 69 | { 70 | grassItem.UV0Offset.x = Mathf.Min(grassItem.UV0Offset.x, uvInfo.x); 71 | grassItem.UV0Offset.y = Mathf.Min(grassItem.UV0Offset.y, uvInfo.y); 72 | grassItem.UV0Offset.z = Mathf.Max(grassItem.UV0Offset.z, uvInfo.x); 73 | grassItem.UV0Offset.w = Mathf.Max(grassItem.UV0Offset.w, uvInfo.y); 74 | } 75 | var grassEditorDataCache = msehFilter.GetComponent(); 76 | grassItem.ColorInfo = grassEditorDataCache.GrassColor; 77 | var texture = grassEditorDataCache.GrassTexture; 78 | var assetName = texture.name; 79 | grassItem.TextureName = assetName; 80 | textures.Add(texture as Texture2D); 81 | } 82 | grassData.GrassTextures = textures.ToList(); 83 | if (!Directory.Exists(GrassDataDir)) 84 | { 85 | Directory.CreateDirectory(GrassDataDir); 86 | AssetDatabase.Refresh(); 87 | } 88 | AssetDatabase.CreateAsset(grassData, GrassDataDir + "/" + GrassDataFileName + ".asset"); 89 | } 90 | } 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/EditRes/Shader/Grass-Editor.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "LearnShader/Grass-Editor" { 4 | Properties{ 5 | _Color("Color", Color) = (1,1,1,1) 6 | _MainTex("MainTex", 2D) = "white" {} 7 | _Speed ("MoveSpeed", Range(20,50)) = 25 8 | _Rigidness("Rigidness", Range(1,50)) = 25 9 | _SwayMax("Sway Max", Range(0, 0.1)) = .005 10 | _YOffset("Y offset", float) = 0.5 11 | } 12 | 13 | SubShader 14 | { 15 | Tags 16 | { 17 | "Queue"="Transparent" 18 | "RenderType"="Opaque" 19 | "IgnoreProject"="True" 20 | "DisableBatching" = "True" 21 | } 22 | LOD 100 23 | Cull Off 24 | ZWrite Off 25 | Blend SrcAlpha OneMinusSrcAlpha 26 | 27 | Pass 28 | { 29 | CGPROGRAM 30 | #pragma vertex vert 31 | #pragma fragment frag 32 | #pragma multi_compile_instancing 33 | #include "UnityCG.cginc" 34 | 35 | struct appdata_t 36 | { 37 | float4 vertex : POSITION; 38 | float2 texcoord : TEXCOORD0; 39 | UNITY_VERTEX_INPUT_INSTANCE_ID 40 | }; 41 | 42 | struct v2f 43 | { 44 | float4 vertex : SV_POSITION; 45 | float2 texcoord : TEXCOORD0; 46 | UNITY_VERTEX_INPUT_INSTANCE_ID 47 | }; 48 | 49 | sampler2D _MainTex; 50 | UNITY_INSTANCING_BUFFER_START(Props) 51 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color) 52 | UNITY_DEFINE_INSTANCED_PROP(float, _Speed) 53 | UNITY_DEFINE_INSTANCED_PROP(float, _Rigidness) 54 | UNITY_DEFINE_INSTANCED_PROP(float, _SwayMax) 55 | UNITY_DEFINE_INSTANCED_PROP(float, _YOffset) 56 | UNITY_INSTANCING_BUFFER_END(Props) 57 | 58 | v2f vert(appdata_t IN) 59 | { 60 | v2f o; 61 | UNITY_SETUP_INSTANCE_ID(IN); 62 | UNITY_TRANSFER_INSTANCE_ID(IN, o); 63 | 64 | //o.vertex = UnityObjectToClipPos(IN.vertex); 65 | 66 | // float3 vpos = mul((float3x3)unity_ObjectToWorld, IN.vertex.xyz); 67 | // float4 worldCoord = float4(unity_ObjectToWorld._m03, unity_ObjectToWorld._m13, unity_ObjectToWorld._m23, 1); 68 | // float4 viewPos = mul(UNITY_MATRIX_V, worldCoord) + float4(vpos, 0); 69 | // float4 outPos = mul(UNITY_MATRIX_P, viewPos); 70 | // o.vertex = outPos; 71 | 72 | float speed = UNITY_ACCESS_INSTANCED_PROP(Props, _Speed); 73 | float rigidness = UNITY_ACCESS_INSTANCED_PROP(Props, _Rigidness); 74 | float swayMax = UNITY_ACCESS_INSTANCED_PROP(Props, _SwayMax); 75 | float yOffset = UNITY_ACCESS_INSTANCED_PROP(Props, _YOffset); 76 | float3 wpos = mul(unity_ObjectToWorld, IN.vertex).xyz;// world position 77 | float x = sin(wpos.x / rigidness + (_Time.x * speed)) *(IN.vertex.y - yOffset) * 5;// x axis movements 78 | float z = sin(wpos.z / rigidness + (_Time.x * speed)) *(IN.vertex.y - yOffset) * 5;// z axis movements 79 | IN.vertex.x += step(0,IN.vertex.y - yOffset) * x * swayMax;// apply the movement if the vertex's y above the YOffset 80 | IN.vertex.z += step(0,IN.vertex.y - yOffset) * z * swayMax; 81 | 82 | // billboard 83 | float3 viewerLocal = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1)); 84 | float3 localDir = viewerLocal - float3(0,0,0); 85 | localDir.y = lerp(0, localDir.y, 0.1); 86 | localDir = normalize(localDir); 87 | // float3 upLocal = abs(localDir.y) > 0.999f ? float3(0, 0, 1) : float3(0, 1, 0); 88 | float3 upLocal = float3(0, 1, 0); 89 | float3 rightLocal = normalize(cross(localDir, upLocal)); 90 | upLocal = cross(rightLocal, localDir); 91 | float3 BBLocalPos = rightLocal * IN.vertex.x + upLocal * IN.vertex.y; 92 | o.vertex = UnityObjectToClipPos(float4(BBLocalPos, 1)); 93 | 94 | o.texcoord = IN.texcoord; 95 | return o; 96 | } 97 | 98 | fixed4 frag(v2f IN) : SV_Target 99 | { 100 | UNITY_SETUP_INSTANCE_ID(IN); 101 | half4 color = tex2D(_MainTex, IN.texcoord) * UNITY_ACCESS_INSTANCED_PROP(Props, _Color); 102 | return color; 103 | } 104 | ENDCG 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader/Grass-1.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "LearnShader/Grass-1" { 4 | Properties{ 5 | _Color("Color", Color) = (1,1,1,1) 6 | _MainTex("MainTex", 2D) = "white" {} 7 | _UV0Offset ("UV0Offset", Vector) = (0,0,1,1) 8 | _Speed ("MoveSpeed", Range(20,50)) = 25 9 | _Rigidness("Rigidness", Range(1,50)) = 25 10 | _SwayMax("Sway Max", Range(0, 0.1)) = .005 11 | _YOffset("Y offset", float) = 0.5 12 | } 13 | 14 | SubShader 15 | { 16 | Tags 17 | { 18 | "Queue"="Transparent" 19 | "RenderType"="Transparent" 20 | "IgnoreProject"="True" 21 | "DisableBatching" = "True" 22 | } 23 | LOD 100 24 | Cull Off 25 | ZWrite Off 26 | Blend SrcAlpha OneMinusSrcAlpha 27 | 28 | Pass 29 | { 30 | CGPROGRAM 31 | #pragma vertex vert 32 | #pragma fragment frag 33 | #pragma multi_compile_instancing 34 | #include "UnityCG.cginc" 35 | 36 | struct appdata_t 37 | { 38 | float4 vertex : POSITION; 39 | float2 texcoord : TEXCOORD0; 40 | UNITY_VERTEX_INPUT_INSTANCE_ID 41 | }; 42 | 43 | struct v2f 44 | { 45 | float4 vertex : SV_POSITION; 46 | float2 texcoord : TEXCOORD0; 47 | UNITY_VERTEX_INPUT_INSTANCE_ID 48 | }; 49 | 50 | sampler2D _MainTex; 51 | UNITY_INSTANCING_BUFFER_START(Props) 52 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color) 53 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _UV0Offset) 54 | UNITY_DEFINE_INSTANCED_PROP(float, _Speed) 55 | UNITY_DEFINE_INSTANCED_PROP(float, _Rigidness) 56 | UNITY_DEFINE_INSTANCED_PROP(float, _SwayMax) 57 | UNITY_DEFINE_INSTANCED_PROP(float, _YOffset) 58 | UNITY_INSTANCING_BUFFER_END(Props) 59 | 60 | v2f vert(appdata_t IN) 61 | { 62 | v2f o; 63 | UNITY_SETUP_INSTANCE_ID(IN); 64 | UNITY_TRANSFER_INSTANCE_ID(IN, o); 65 | 66 | //o.vertex = UnityObjectToClipPos(IN.vertex); 67 | 68 | // float3 vpos = mul((float3x3)unity_ObjectToWorld, IN.vertex.xyz); 69 | // float4 worldCoord = float4(unity_ObjectToWorld._m03, unity_ObjectToWorld._m13, unity_ObjectToWorld._m23, 1); 70 | // float4 viewPos = mul(UNITY_MATRIX_V, worldCoord) + float4(vpos, 0); 71 | // float4 outPos = mul(UNITY_MATRIX_P, viewPos); 72 | // o.vertex = outPos; 73 | 74 | float speed = UNITY_ACCESS_INSTANCED_PROP(Props, _Speed); 75 | float rigidness = UNITY_ACCESS_INSTANCED_PROP(Props, _Rigidness); 76 | float swayMax = UNITY_ACCESS_INSTANCED_PROP(Props, _SwayMax); 77 | float yOffset = UNITY_ACCESS_INSTANCED_PROP(Props, _YOffset); 78 | float3 wpos = mul(unity_ObjectToWorld, IN.vertex).xyz;// world position 79 | float x = sin(wpos.x / rigidness + (_Time.x * speed)) *(IN.vertex.y - yOffset) * 5;// x axis movements 80 | float z = sin(wpos.z / rigidness + (_Time.x * speed)) *(IN.vertex.y - yOffset) * 5;// z axis movements 81 | IN.vertex.x += step(0,IN.vertex.y - yOffset) * x * swayMax;// apply the movement if the vertex's y above the YOffset 82 | IN.vertex.z += step(0,IN.vertex.y - yOffset) * z * swayMax; 83 | 84 | // billboard 85 | float3 viewerLocal = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1)); 86 | float3 localDir = viewerLocal - float3(0,0,0); 87 | localDir.y = lerp(0, localDir.y, 0.1); 88 | localDir = normalize(localDir); 89 | // float3 upLocal = abs(localDir.y) > 0.999f ? float3(0, 0, 1) : float3(0, 1, 0); 90 | float3 upLocal = float3(0, 1, 0); 91 | float3 rightLocal = normalize(cross(localDir, upLocal)); 92 | upLocal = cross(rightLocal, localDir); 93 | float3 BBLocalPos = rightLocal * IN.vertex.x + upLocal * IN.vertex.y; 94 | o.vertex = UnityObjectToClipPos(float4(BBLocalPos, 1)); 95 | 96 | // o.texcoord = IN.texcoord; 97 | fixed4 uV0Offset = UNITY_ACCESS_INSTANCED_PROP(Props, _UV0Offset); 98 | o.texcoord.x = uV0Offset.x + IN.texcoord.x * (uV0Offset.z - uV0Offset.x); 99 | o.texcoord.y = uV0Offset.y + IN.texcoord.y * (uV0Offset.w - uV0Offset.y); 100 | return o; 101 | } 102 | 103 | fixed4 frag(v2f IN) : SV_Target 104 | { 105 | UNITY_SETUP_INSTANCE_ID(IN); 106 | half4 color = tex2D(_MainTex, IN.texcoord) * UNITY_ACCESS_INSTANCED_PROP(Props, _Color); 107 | return color; 108 | } 109 | ENDCG 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Shader/Grass-2.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "LearnShader/Grass-2" { 4 | Properties{ 5 | _Color("Color", Color) = (1,1,1,1) 6 | _MainTex("MainTex", 2D) = "white" {} 7 | _UV0Offset ("UV0Offset", Vector) = (0,0,1,1) 8 | _Speed ("MoveSpeed", Range(20,50)) = 25 9 | _Rigidness("Rigidness", Range(1,50)) = 25 10 | _SwayMax("Sway Max", Range(0, 0.1)) = .005 11 | _YOffset("Y offset", float) = 0.5 12 | _MaxWidth("Max Displacement Width", Range(0, 2)) = 0.1 13 | _Radius("Radius", Range(0,5)) = 1 14 | } 15 | 16 | SubShader 17 | { 18 | Tags 19 | { 20 | "Queue"="Transparent" 21 | "RenderType"="Transparent" 22 | "IgnoreProject"="True" 23 | "DisableBatching" = "True" 24 | } 25 | LOD 100 26 | Cull Off 27 | ZWrite Off 28 | Blend SrcAlpha OneMinusSrcAlpha 29 | 30 | Pass 31 | { 32 | CGPROGRAM 33 | #pragma vertex vert 34 | #pragma fragment frag 35 | #pragma multi_compile_instancing 36 | #include "UnityCG.cginc" 37 | 38 | struct appdata_t 39 | { 40 | float4 vertex : POSITION; 41 | float2 texcoord : TEXCOORD0; 42 | UNITY_VERTEX_INPUT_INSTANCE_ID 43 | }; 44 | 45 | struct v2f 46 | { 47 | float4 vertex : SV_POSITION; 48 | float2 texcoord : TEXCOORD0; 49 | UNITY_VERTEX_INPUT_INSTANCE_ID 50 | }; 51 | 52 | 53 | sampler2D _MainTex; 54 | UNITY_INSTANCING_BUFFER_START(Props) 55 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color) 56 | UNITY_DEFINE_INSTANCED_PROP(fixed4, _UV0Offset) 57 | UNITY_DEFINE_INSTANCED_PROP(float, _Speed) 58 | UNITY_DEFINE_INSTANCED_PROP(float, _Rigidness) 59 | UNITY_DEFINE_INSTANCED_PROP(float, _SwayMax) 60 | UNITY_DEFINE_INSTANCED_PROP(float, _YOffset) 61 | UNITY_DEFINE_INSTANCED_PROP(float, _MaxWidth) 62 | UNITY_DEFINE_INSTANCED_PROP(float, _Radius) 63 | UNITY_INSTANCING_BUFFER_END(Props) 64 | 65 | uniform float3 _RolePosition; 66 | 67 | v2f vert(appdata_t IN) 68 | { 69 | v2f o; 70 | UNITY_SETUP_INSTANCE_ID(IN); 71 | UNITY_TRANSFER_INSTANCE_ID(IN, o); 72 | 73 | //o.vertex = UnityObjectToClipPos(IN.vertex); 74 | 75 | // float3 vpos = mul((float3x3)unity_ObjectToWorld, IN.vertex.xyz); 76 | // float4 worldCoord = float4(unity_ObjectToWorld._m03, unity_ObjectToWorld._m13, unity_ObjectToWorld._m23, 1); 77 | // float4 viewPos = mul(UNITY_MATRIX_V, worldCoord) + float4(vpos, 0); 78 | // float4 outPos = mul(UNITY_MATRIX_P, viewPos); 79 | // o.vertex = outPos; 80 | 81 | float speed = UNITY_ACCESS_INSTANCED_PROP(Props, _Speed); 82 | float rigidness = UNITY_ACCESS_INSTANCED_PROP(Props, _Rigidness); 83 | float swayMax = UNITY_ACCESS_INSTANCED_PROP(Props, _SwayMax); 84 | float yOffset = UNITY_ACCESS_INSTANCED_PROP(Props, _YOffset); 85 | float MaxWidth = UNITY_ACCESS_INSTANCED_PROP(Props, _MaxWidth); 86 | float Radius = UNITY_ACCESS_INSTANCED_PROP(Props, _Radius); 87 | 88 | float3 wpos = mul(unity_ObjectToWorld, IN.vertex).xyz;// world position 89 | float x = sin(wpos.x / rigidness + (_Time.x * speed)) *(IN.vertex.y - yOffset) * 5;// x axis movements 90 | float z = sin(wpos.z / rigidness + (_Time.x * speed)) *(IN.vertex.y - yOffset) * 5;// z axis movements 91 | IN.vertex.x += step(0,IN.vertex.y - yOffset) * x * swayMax;// apply the movement if the vertex's y above the YOffset 92 | IN.vertex.z += step(0,IN.vertex.y - yOffset) * z * swayMax; 93 | 94 | float3 dis = distance(_RolePosition, wpos); 95 | float3 radius = 1 - saturate(dis /Radius); 96 | float3 sphereDisp = wpos - _RolePosition; 97 | sphereDisp *= radius; 98 | IN.vertex.xz += clamp(sphereDisp.xz * step(yOffset, IN.vertex.y), -MaxWidth, MaxWidth); 99 | 100 | // billboard 101 | float3 viewerLocal = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1)); 102 | float3 localDir = viewerLocal - float3(0,0,0); 103 | localDir.y = lerp(0, localDir.y, 0.1); 104 | localDir = normalize(localDir); 105 | // float3 upLocal = abs(localDir.y) > 0.999f ? float3(0, 0, 1) : float3(0, 1, 0); 106 | float3 upLocal = float3(0, 1, 0); 107 | float3 rightLocal = normalize(cross(localDir, upLocal)); 108 | upLocal = cross(rightLocal, localDir); 109 | float3 BBLocalPos = rightLocal * IN.vertex.x + upLocal * IN.vertex.y; 110 | o.vertex = UnityObjectToClipPos(float4(BBLocalPos, 1)); 111 | 112 | // o.texcoord = IN.texcoord; 113 | fixed4 uV0Offset = UNITY_ACCESS_INSTANCED_PROP(Props, _UV0Offset); 114 | o.texcoord.x = uV0Offset.x + IN.texcoord.x * (uV0Offset.z - uV0Offset.x); 115 | o.texcoord.y = uV0Offset.y + IN.texcoord.y * (uV0Offset.w - uV0Offset.y); 116 | return o; 117 | } 118 | 119 | fixed4 frag(v2f IN) : SV_Target 120 | { 121 | UNITY_SETUP_INSTANCE_ID(IN); 122 | half4 color = tex2D(_MainTex, IN.texcoord) * UNITY_ACCESS_INSTANCED_PROP(Props, _Color); 123 | return color; 124 | } 125 | ENDCG 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /Project/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 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /Project/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 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/Editor/GrassBrushEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace GupInstanceGrass.Editor 5 | { 6 | [CustomEditor(typeof(GrassBrush))] 7 | public class GrassBrushEditor : UnityEditor.Editor 8 | { 9 | SerializedProperty _GrassPrefab; 10 | SerializedProperty _GrassTexture; 11 | SerializedProperty _GrassColor; 12 | SerializedProperty _GrassMinScale; 13 | SerializedProperty _GrassMaxScale; 14 | SerializedProperty _BrushRadius; 15 | SerializedProperty _CreateGrassNum; 16 | SerializedProperty _TerrainLayerName; 17 | 18 | RaycastHit _RaycastHit; 19 | private bool _IsRayHit = false; 20 | 21 | void OnEnable() 22 | { 23 | _GrassPrefab = serializedObject.FindProperty("GrassPrefab"); 24 | _GrassTexture = serializedObject.FindProperty("GrassTexture"); 25 | _GrassColor = serializedObject.FindProperty("GrassColor"); 26 | _GrassMinScale = serializedObject.FindProperty("GrassMinScale"); 27 | _GrassMaxScale = serializedObject.FindProperty("GrassMaxScale"); 28 | _BrushRadius = serializedObject.FindProperty("BrushRadius"); 29 | _CreateGrassNum = serializedObject.FindProperty("CreateGrassNum"); 30 | _TerrainLayerName = serializedObject.FindProperty("TerrainLayerName"); 31 | } 32 | 33 | void OnSceneGUI() 34 | { 35 | Event e = Event.current; 36 | if (e == null) 37 | { 38 | return; 39 | } 40 | HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); 41 | 42 | var mono = target as GrassBrush; 43 | if (e.type == EventType.MouseDown && !e.alt && e.button == 0) 44 | { 45 | if (_GrassTexture.objectReferenceValue == null) 46 | { 47 | Debug.LogError("请选择贴图"); 48 | return; 49 | } 50 | if (_GrassPrefab.objectReferenceValue != null && _IsRayHit) 51 | { 52 | var go = new GameObject("GrassGroup"); 53 | go.transform.SetParent(mono.transform); 54 | var props = new MaterialPropertyBlock(); 55 | props.SetColor("_Color", _GrassColor.colorValue); 56 | props.SetTexture("_MainTex", _GrassTexture.objectReferenceValue as Texture); 57 | if (_CreateGrassNum.intValue == 1) 58 | { 59 | var grass = PrefabUtility.InstantiatePrefab(_GrassPrefab.objectReferenceValue) as GameObject; 60 | if (grass != null) 61 | { 62 | grass.transform.SetParent(go.transform); 63 | grass.transform.localPosition = _RaycastHit.point; 64 | grass.transform.localScale = 65 | (_GrassMinScale.floatValue + (_GrassMaxScale.floatValue - _GrassMinScale.floatValue) * GetRandom()) * Vector3.one; 66 | var render = grass.GetComponent(); 67 | var grassCache = grass.AddComponent(); 68 | grassCache.RendererObj = render; 69 | grassCache.GrassColor = _GrassColor.colorValue; 70 | grassCache.GrassTexture = _GrassTexture.objectReferenceValue as Texture; 71 | render.SetPropertyBlock(props); 72 | } 73 | } 74 | else 75 | { 76 | if (_GrassPrefab.objectReferenceValue != null) 77 | { 78 | int createNum = 0; 79 | for (int i = 0; i < _CreateGrassNum.intValue * 10; i++) 80 | { 81 | float x, z; 82 | GetRandomPos(_RaycastHit.point.x, _RaycastHit.point.z, _BrushRadius.floatValue, out x, 83 | out z); 84 | var startPos = new Vector3(x, _RaycastHit.point.y + 500, z); 85 | RaycastHit tempRaycastHit; 86 | if (Physics.Raycast(startPos, Vector3.down, out tempRaycastHit, 1000f, 87 | 1 << LayerMask.NameToLayer(_TerrainLayerName.stringValue))) 88 | { 89 | if (Vector3.Distance(_RaycastHit.point, tempRaycastHit.point) > _BrushRadius.floatValue) 90 | { 91 | continue; 92 | } 93 | var pos = tempRaycastHit.point; 94 | var grass = PrefabUtility.InstantiatePrefab(_GrassPrefab.objectReferenceValue) as GameObject; 95 | if (grass != null) 96 | { 97 | grass.transform.SetParent(go.transform); 98 | grass.transform.localPosition = pos; 99 | grass.transform.localScale = 100 | (_GrassMinScale.floatValue + (_GrassMaxScale.floatValue - _GrassMinScale.floatValue) * GetRandom()) * Vector3.one; 101 | var render = grass.GetComponent(); 102 | var grassCache = grass.AddComponent(); 103 | grassCache.RendererObj = render; 104 | grassCache.GrassColor = _GrassColor.colorValue; 105 | grassCache.GrassTexture = _GrassTexture.objectReferenceValue as Texture; 106 | render.SetPropertyBlock(props); 107 | createNum += 1; 108 | } 109 | 110 | if (createNum >= _CreateGrassNum.intValue) 111 | { 112 | break; 113 | } 114 | } 115 | 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | if (e.type == EventType.MouseDrag && !e.alt && e.button == 0) 123 | { 124 | } 125 | 126 | _IsRayHit = false; 127 | Ray worldRay = HandleUtility.GUIPointToWorldRay(e.mousePosition); 128 | if (Physics.Raycast(worldRay, out _RaycastHit, 500f, 1 << LayerMask.NameToLayer(_TerrainLayerName.stringValue))) 129 | { 130 | _IsRayHit = true; 131 | Handles.color = new Color(1f, 1f, 1f, 0.5f); 132 | Handles.DrawSolidDisc(_RaycastHit.point, _RaycastHit.normal, _BrushRadius.floatValue); 133 | Handles.color = Color.red; 134 | Handles.DrawWireDisc(_RaycastHit.point, _RaycastHit.normal, _BrushRadius.floatValue); 135 | SceneView.RepaintAll(); 136 | } 137 | } 138 | 139 | void GetRandomPos(float centerX, float centerY, float radius, out float x, out float y) 140 | { 141 | float u = Mathf.Sqrt(GetRandom()) * radius; 142 | float v = GetRandom() * 2 * Mathf.PI; 143 | 144 | x = centerX + u * Mathf.Cos(v); 145 | y = centerY + u * Mathf.Sin(v); 146 | } 147 | 148 | float GetRandom() 149 | { 150 | var x = UnityEngine.Random.value; 151 | return x; 152 | } 153 | 154 | public override void OnInspectorGUI() 155 | { 156 | DrawDefaultInspector(); 157 | if (GUILayout.Button("Save")) 158 | { 159 | var mono = target as GrassBrush; 160 | mono.Save(); 161 | } 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /Project/Assets/GrassInstance/Script/GrassInstance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.Rendering; 6 | 7 | namespace GupInstanceGrass 8 | { 9 | public class GrassInstance : MonoBehaviour 10 | { 11 | public static Vector2Int BlockSize = new Vector2Int(30, 30); 12 | 13 | public class SubmitInstance 14 | { 15 | public Matrix4x4[] Matrixs; 16 | public MaterialPropertyBlock PropertyBlock = new MaterialPropertyBlock(); 17 | } 18 | 19 | public bool IsDebug = false; 20 | 21 | // public Vector2Int BlockSize = new Vector2Int(30, 30); 22 | 23 | public Camera RenderCamera; 24 | 25 | [SerializeField] 26 | List _GrassMaterialList = new List(); 27 | 28 | [SerializeField] 29 | Mesh _CurMesh; 30 | 31 | [SerializeField] 32 | Texture2D _CombineTexture; 33 | 34 | int GrassLevel = 0; 35 | 36 | Vector3 RolePosition = Vector3.zero; 37 | 38 | GrassData GrassDataInfo; 39 | 40 | List _RealUseGrassMaterialList = new List(); 41 | 42 | Material _CurMaterial; 43 | 44 | List _CurSubmitInstances = new List(); 45 | 46 | Vector2Int[] _CurShowBlocks = new Vector2Int[9]; 47 | 48 | int[] _ShowBlockIndexCalcInts = new[] { -1, 0, 1 }; 49 | List _TempMatrix4x4s = new List(); 50 | List _TempVector4s1 = new List(); 51 | List _TempVector4s2 = new List(); 52 | Dictionary _TextureNameToUV0Offset = new Dictionary(); 53 | 54 | private bool _ShowBlockDirty = false; 55 | private bool _SubmitInstanceDirty = false; 56 | 57 | private int _ColorPropID = Shader.PropertyToID("_Color"); 58 | private int _UV0OffsetPropID = Shader.PropertyToID("_UV0Offset"); 59 | private int _MainTexPropID = Shader.PropertyToID("_MainTex"); 60 | private int _RolePositionPropID = Shader.PropertyToID("_RolePosition"); 61 | 62 | 63 | // public Vector2 testPos; 64 | // public List testTexture2Ds; 65 | // 66 | // public void Test1() 67 | // { 68 | // } 69 | // 70 | // public void Test2() 71 | // { 72 | // SetRolePosition(testPos.x, testPos.y); 73 | // } 74 | // 75 | // public void Test3() 76 | // { 77 | // SetTextures(testTexture2Ds); 78 | // } 79 | 80 | public void SetGrassLevel(int level) 81 | { 82 | GrassLevel = level; 83 | _CurMaterial = null; 84 | if (_RealUseGrassMaterialList.Count >= GrassLevel) 85 | { 86 | _CurMaterial = _RealUseGrassMaterialList[GrassLevel]; 87 | } 88 | } 89 | 90 | public void SetMapGrassData(GrassData grassData) 91 | { 92 | GrassDataInfo = grassData; 93 | SetTextures(grassData.GrassTextures); 94 | _ShowBlockDirty = true; 95 | _SubmitInstanceDirty = true; 96 | } 97 | 98 | public void SetTextures(List textures) 99 | { 100 | var rects = _CombineTexture.PackTextures(textures.ToArray(), 0, 1024, true); 101 | _TextureNameToUV0Offset.Clear(); 102 | for (int i = 0; i < textures.Count; i++) 103 | { 104 | _TextureNameToUV0Offset.Add(textures[i].name, new Vector4(rects[i].min.x, rects[i].min.y, rects[i].max.x, rects[i].max.y)); 105 | } 106 | 107 | foreach (var material in _RealUseGrassMaterialList) 108 | { 109 | material.SetTexture(_MainTexPropID, _CombineTexture); 110 | } 111 | } 112 | 113 | public void SetRolePosition(float x, float y, float z) 114 | { 115 | if (Math.Abs(RolePosition.x - x) > 0.001f || Math.Abs(RolePosition.y - y) > 0.001f || Math.Abs(RolePosition.z - z) > 0.001f) 116 | { 117 | RolePosition.x = x; 118 | RolePosition.y = y; 119 | RolePosition.z = z; 120 | Shader.SetGlobalVector(_RolePositionPropID, RolePosition); 121 | _ShowBlockDirty = true; 122 | } 123 | } 124 | 125 | public void Clear() 126 | { 127 | SetMapGrassData(null); 128 | } 129 | 130 | void Awake() 131 | { 132 | foreach (var material in _GrassMaterialList) 133 | { 134 | _RealUseGrassMaterialList.Add(Instantiate(material)); 135 | } 136 | for (int i = 0; i < _CurShowBlocks.Length; i++) 137 | { 138 | _CurShowBlocks[i] = new Vector2Int(-1, -1); 139 | } 140 | _CombineTexture = new Texture2D(0, 0, TextureFormat.RGBA32, false, false); 141 | SetGrassLevel(0); 142 | } 143 | 144 | // Update is called once per frame 145 | void Update() 146 | { 147 | UpdateShowBlock(); 148 | UpdateSubmitInstance(); 149 | UpdateGrassDraw(); 150 | } 151 | 152 | void UpdateShowBlock() 153 | { 154 | if (!_ShowBlockDirty) 155 | { 156 | return; 157 | } 158 | _ShowBlockDirty = false; 159 | 160 | int blockX4, blockY4; 161 | PosToBlock(RolePosition.x, RolePosition.z, out blockX4, out blockY4); 162 | if (_CurShowBlocks[4].x == blockX4 && _CurShowBlocks[4].y == blockY4) 163 | { 164 | return; 165 | } 166 | for (int j = 0; j < 3; j++) 167 | { 168 | for (int i = 0; i < 3; i++) 169 | { 170 | int index = j * 3 + i; 171 | var oldX = _CurShowBlocks[index].x; 172 | var oldY = _CurShowBlocks[index].y; 173 | var newX = blockX4 + _ShowBlockIndexCalcInts[i]; 174 | var newY = blockY4 + _ShowBlockIndexCalcInts[j]; 175 | if (oldX != newX || oldY != newY) 176 | { 177 | _CurShowBlocks[index].x = newX; 178 | _CurShowBlocks[index].y = newY; 179 | _SubmitInstanceDirty = true; 180 | } 181 | } 182 | } 183 | } 184 | 185 | void UpdateSubmitInstance() 186 | { 187 | if (!_SubmitInstanceDirty) 188 | { 189 | return; 190 | } 191 | _SubmitInstanceDirty = false; 192 | 193 | SubmitInstance curSubmitInstance = null; 194 | _TempMatrix4x4s.Clear(); 195 | _TempVector4s1.Clear(); 196 | _TempVector4s2.Clear(); 197 | _CurSubmitInstances.Clear(); 198 | if (GrassDataInfo != null) 199 | { 200 | foreach (var curShowBlock in _CurShowBlocks) 201 | { 202 | if (curShowBlock.x < 0 || curShowBlock.y < 0) 203 | { 204 | continue; 205 | } 206 | 207 | var index = BlockToIndex(curShowBlock.x, curShowBlock.y); 208 | if (index >= GrassDataInfo.BlockList.Count) 209 | { 210 | continue; 211 | } 212 | 213 | var grassBlock = GrassDataInfo.BlockList[index]; 214 | foreach (var grassItem in grassBlock.GrassItems) 215 | { 216 | if (curSubmitInstance == null) 217 | { 218 | curSubmitInstance = new SubmitInstance(); 219 | _CurSubmitInstances.Add(curSubmitInstance); 220 | } 221 | _TempMatrix4x4s.Add(grassItem.TransformMatrix); 222 | _TempVector4s1.Add(grassItem.ColorInfo); 223 | _TempVector4s2.Add(_TextureNameToUV0Offset[grassItem.TextureName]); 224 | if (_TempMatrix4x4s.Count >= 1023) 225 | { 226 | curSubmitInstance.Matrixs = _TempMatrix4x4s.ToArray(); 227 | curSubmitInstance.PropertyBlock.SetVectorArray(_ColorPropID, _TempVector4s1); 228 | curSubmitInstance.PropertyBlock.SetVectorArray(_UV0OffsetPropID, _TempVector4s2); 229 | _TempMatrix4x4s.Clear(); 230 | _TempVector4s1.Clear(); 231 | _TempVector4s2.Clear(); 232 | curSubmitInstance = null; 233 | } 234 | } 235 | } 236 | if (curSubmitInstance != null) 237 | { 238 | curSubmitInstance.Matrixs = _TempMatrix4x4s.ToArray(); 239 | curSubmitInstance.PropertyBlock.SetVectorArray(_ColorPropID, _TempVector4s1); 240 | curSubmitInstance.PropertyBlock.SetVectorArray(_UV0OffsetPropID, _TempVector4s2); 241 | _TempMatrix4x4s.Clear(); 242 | _TempVector4s1.Clear(); 243 | _TempVector4s2.Clear(); 244 | curSubmitInstance = null; 245 | } 246 | } 247 | } 248 | 249 | void UpdateGrassDraw() 250 | { 251 | if (!_CurMaterial) 252 | { 253 | return; 254 | } 255 | if (!_CurMesh) 256 | { 257 | return; 258 | } 259 | if (!RenderCamera) 260 | { 261 | return; 262 | } 263 | foreach (var curSubmitInstance in _CurSubmitInstances) 264 | { 265 | // Graphics.DrawMeshInstanced(_CurMesh, 0, _CurMaterial, curSubmitInstance.Matrixs, curSubmitInstance.Matrixs.Length); 266 | // MaterialPropertyBlock properties = new MaterialPropertyBlock(); 267 | // properties.SetVectorArray("_Color", new List() { Color.red, Color.red }); 268 | if (IsDebug) 269 | { 270 | Graphics.DrawMeshInstanced( 271 | _CurMesh, 272 | 0, 273 | _CurMaterial, 274 | curSubmitInstance.Matrixs, 275 | curSubmitInstance.Matrixs.Length, 276 | curSubmitInstance.PropertyBlock, 277 | ShadowCastingMode.Off, 278 | false, 279 | 0, 280 | null); 281 | } 282 | else 283 | { 284 | Graphics.DrawMeshInstanced( 285 | _CurMesh, 286 | 0, 287 | _CurMaterial, 288 | curSubmitInstance.Matrixs, 289 | curSubmitInstance.Matrixs.Length, 290 | curSubmitInstance.PropertyBlock, 291 | ShadowCastingMode.Off, 292 | false, 293 | 0, 294 | RenderCamera); 295 | } 296 | } 297 | } 298 | 299 | private void PosToBlock(float x, float z, out int blockX, out int blockY) 300 | { 301 | blockX = Mathf.FloorToInt(1.0f * x / BlockSize.x); 302 | blockY = Mathf.FloorToInt(1.0f * z / BlockSize.y); 303 | } 304 | 305 | private int BlockToIndex(int blockX, int blockY) 306 | { 307 | int index = 0; 308 | if (GrassDataInfo != null) 309 | { 310 | index = blockY * GrassDataInfo.BlockXMax + blockX; 311 | } 312 | 313 | return index; 314 | } 315 | 316 | private int PosToBlockIndex(float x, float z) 317 | { 318 | int blockX, blockY; 319 | PosToBlock(x, z, out blockX, out blockY); 320 | return BlockToIndex(blockX, blockY); 321 | } 322 | } 323 | 324 | } 325 | -------------------------------------------------------------------------------- /Project/Assets/Demo/Scene/Demo.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: 10304, guid: 0000000000000000f000000000000000, type: 0} 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.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1001 &40168405 117 | Prefab: 118 | m_ObjectHideFlags: 0 119 | serializedVersion: 2 120 | m_Modification: 121 | m_TransformParent: {fileID: 0} 122 | m_Modifications: 123 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 124 | propertyPath: m_LocalPosition.x 125 | value: 0 126 | objectReference: {fileID: 0} 127 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 128 | propertyPath: m_LocalPosition.y 129 | value: 0 130 | objectReference: {fileID: 0} 131 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 132 | propertyPath: m_LocalPosition.z 133 | value: 0 134 | objectReference: {fileID: 0} 135 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 136 | propertyPath: m_LocalRotation.x 137 | value: 0 138 | objectReference: {fileID: 0} 139 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 140 | propertyPath: m_LocalRotation.y 141 | value: 0 142 | objectReference: {fileID: 0} 143 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 144 | propertyPath: m_LocalRotation.z 145 | value: 0 146 | objectReference: {fileID: 0} 147 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 148 | propertyPath: m_LocalRotation.w 149 | value: 1 150 | objectReference: {fileID: 0} 151 | - target: {fileID: 4981637379775036, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 152 | propertyPath: m_RootOrder 153 | value: 2 154 | objectReference: {fileID: 0} 155 | - target: {fileID: 114256154784952712, guid: d8108a1b203ca45418a84710e5d795b1, 156 | type: 2} 157 | propertyPath: RenderCamera 158 | value: 159 | objectReference: {fileID: 903460136} 160 | - target: {fileID: 114256154784952712, guid: d8108a1b203ca45418a84710e5d795b1, 161 | type: 2} 162 | propertyPath: IsDebug 163 | value: 1 164 | objectReference: {fileID: 0} 165 | m_RemovedComponents: [] 166 | m_ParentPrefab: {fileID: 100100000, guid: d8108a1b203ca45418a84710e5d795b1, type: 2} 167 | m_IsPrefabParent: 0 168 | --- !u!1 &583586625 169 | GameObject: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | serializedVersion: 5 174 | m_Component: 175 | - component: {fileID: 583586627} 176 | - component: {fileID: 583586626} 177 | - component: {fileID: 583586629} 178 | - component: {fileID: 583586628} 179 | m_Layer: 0 180 | m_Name: DemoGameObject 181 | m_TagString: Untagged 182 | m_Icon: {fileID: 0} 183 | m_NavMeshLayer: 0 184 | m_StaticEditorFlags: 0 185 | m_IsActive: 1 186 | --- !u!114 &583586626 187 | MonoBehaviour: 188 | m_ObjectHideFlags: 0 189 | m_PrefabParentObject: {fileID: 0} 190 | m_PrefabInternal: {fileID: 0} 191 | m_GameObject: {fileID: 583586625} 192 | m_Enabled: 1 193 | m_EditorHideFlags: 0 194 | m_Script: {fileID: 11500000, guid: 56c4e94d5f8a6794181d1628d13371b2, type: 3} 195 | m_Name: 196 | m_EditorClassIdentifier: 197 | GrassDataInfo: {fileID: 11400000, guid: ca1860baebf404545af8e71106c5d248, type: 2} 198 | GrassInstanceObj: {fileID: 1530078215} 199 | --- !u!4 &583586627 200 | Transform: 201 | m_ObjectHideFlags: 0 202 | m_PrefabParentObject: {fileID: 0} 203 | m_PrefabInternal: {fileID: 0} 204 | m_GameObject: {fileID: 583586625} 205 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 206 | m_LocalPosition: {x: 0, y: 0, z: 0} 207 | m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} 208 | m_Children: [] 209 | m_Father: {fileID: 0} 210 | m_RootOrder: 3 211 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 212 | --- !u!23 &583586628 213 | MeshRenderer: 214 | m_ObjectHideFlags: 0 215 | m_PrefabParentObject: {fileID: 0} 216 | m_PrefabInternal: {fileID: 0} 217 | m_GameObject: {fileID: 583586625} 218 | m_Enabled: 1 219 | m_CastShadows: 1 220 | m_ReceiveShadows: 1 221 | m_DynamicOccludee: 1 222 | m_MotionVectors: 1 223 | m_LightProbeUsage: 1 224 | m_ReflectionProbeUsage: 1 225 | m_Materials: 226 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 227 | m_StaticBatchInfo: 228 | firstSubMesh: 0 229 | subMeshCount: 0 230 | m_StaticBatchRoot: {fileID: 0} 231 | m_ProbeAnchor: {fileID: 0} 232 | m_LightProbeVolumeOverride: {fileID: 0} 233 | m_ScaleInLightmap: 1 234 | m_PreserveUVs: 1 235 | m_IgnoreNormalsForChartDetection: 0 236 | m_ImportantGI: 0 237 | m_StitchLightmapSeams: 0 238 | m_SelectedEditorRenderState: 3 239 | m_MinimumChartSize: 4 240 | m_AutoUVMaxDistance: 0.5 241 | m_AutoUVMaxAngle: 89 242 | m_LightmapParameters: {fileID: 0} 243 | m_SortingLayerID: 0 244 | m_SortingLayer: 0 245 | m_SortingOrder: 0 246 | --- !u!33 &583586629 247 | MeshFilter: 248 | m_ObjectHideFlags: 0 249 | m_PrefabParentObject: {fileID: 0} 250 | m_PrefabInternal: {fileID: 0} 251 | m_GameObject: {fileID: 583586625} 252 | m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} 253 | --- !u!1 &903460133 254 | GameObject: 255 | m_ObjectHideFlags: 0 256 | m_PrefabParentObject: {fileID: 0} 257 | m_PrefabInternal: {fileID: 0} 258 | serializedVersion: 5 259 | m_Component: 260 | - component: {fileID: 903460137} 261 | - component: {fileID: 903460136} 262 | - component: {fileID: 903460135} 263 | - component: {fileID: 903460134} 264 | m_Layer: 0 265 | m_Name: Main Camera 266 | m_TagString: MainCamera 267 | m_Icon: {fileID: 0} 268 | m_NavMeshLayer: 0 269 | m_StaticEditorFlags: 0 270 | m_IsActive: 1 271 | --- !u!81 &903460134 272 | AudioListener: 273 | m_ObjectHideFlags: 0 274 | m_PrefabParentObject: {fileID: 0} 275 | m_PrefabInternal: {fileID: 0} 276 | m_GameObject: {fileID: 903460133} 277 | m_Enabled: 1 278 | --- !u!124 &903460135 279 | Behaviour: 280 | m_ObjectHideFlags: 0 281 | m_PrefabParentObject: {fileID: 0} 282 | m_PrefabInternal: {fileID: 0} 283 | m_GameObject: {fileID: 903460133} 284 | m_Enabled: 1 285 | --- !u!20 &903460136 286 | Camera: 287 | m_ObjectHideFlags: 0 288 | m_PrefabParentObject: {fileID: 0} 289 | m_PrefabInternal: {fileID: 0} 290 | m_GameObject: {fileID: 903460133} 291 | m_Enabled: 1 292 | serializedVersion: 2 293 | m_ClearFlags: 1 294 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 295 | m_NormalizedViewPortRect: 296 | serializedVersion: 2 297 | x: 0 298 | y: 0 299 | width: 1 300 | height: 1 301 | near clip plane: 0.3 302 | far clip plane: 1000 303 | field of view: 60 304 | orthographic: 0 305 | orthographic size: 5 306 | m_Depth: -1 307 | m_CullingMask: 308 | serializedVersion: 2 309 | m_Bits: 4294967295 310 | m_RenderingPath: -1 311 | m_TargetTexture: {fileID: 0} 312 | m_TargetDisplay: 0 313 | m_TargetEye: 3 314 | m_HDR: 1 315 | m_AllowMSAA: 1 316 | m_AllowDynamicResolution: 0 317 | m_ForceIntoRT: 0 318 | m_OcclusionCulling: 1 319 | m_StereoConvergence: 10 320 | m_StereoSeparation: 0.022 321 | --- !u!4 &903460137 322 | Transform: 323 | m_ObjectHideFlags: 0 324 | m_PrefabParentObject: {fileID: 0} 325 | m_PrefabInternal: {fileID: 0} 326 | m_GameObject: {fileID: 903460133} 327 | m_LocalRotation: {x: 0.1264911, y: -0, z: -0, w: 0.9919678} 328 | m_LocalPosition: {x: 1.2, y: 2.29, z: -2.92} 329 | m_LocalScale: {x: 1, y: 1, z: 1} 330 | m_Children: [] 331 | m_Father: {fileID: 0} 332 | m_RootOrder: 0 333 | m_LocalEulerAnglesHint: {x: 14.534, y: 0, z: 0} 334 | --- !u!114 &1530078215 stripped 335 | MonoBehaviour: 336 | m_PrefabParentObject: {fileID: 114256154784952712, guid: d8108a1b203ca45418a84710e5d795b1, 337 | type: 2} 338 | m_PrefabInternal: {fileID: 40168405} 339 | m_Script: {fileID: 11500000, guid: 88f42fbffbed9724295275a962e419cf, type: 3} 340 | --- !u!1 &1586470512 341 | GameObject: 342 | m_ObjectHideFlags: 0 343 | m_PrefabParentObject: {fileID: 0} 344 | m_PrefabInternal: {fileID: 0} 345 | serializedVersion: 5 346 | m_Component: 347 | - component: {fileID: 1586470514} 348 | - component: {fileID: 1586470513} 349 | m_Layer: 0 350 | m_Name: Directional Light 351 | m_TagString: Untagged 352 | m_Icon: {fileID: 0} 353 | m_NavMeshLayer: 0 354 | m_StaticEditorFlags: 0 355 | m_IsActive: 1 356 | --- !u!108 &1586470513 357 | Light: 358 | m_ObjectHideFlags: 0 359 | m_PrefabParentObject: {fileID: 0} 360 | m_PrefabInternal: {fileID: 0} 361 | m_GameObject: {fileID: 1586470512} 362 | m_Enabled: 1 363 | serializedVersion: 8 364 | m_Type: 1 365 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 366 | m_Intensity: 1 367 | m_Range: 10 368 | m_SpotAngle: 30 369 | m_CookieSize: 10 370 | m_Shadows: 371 | m_Type: 2 372 | m_Resolution: -1 373 | m_CustomResolution: -1 374 | m_Strength: 1 375 | m_Bias: 0.05 376 | m_NormalBias: 0.4 377 | m_NearPlane: 0.2 378 | m_Cookie: {fileID: 0} 379 | m_DrawHalo: 0 380 | m_Flare: {fileID: 0} 381 | m_RenderMode: 0 382 | m_CullingMask: 383 | serializedVersion: 2 384 | m_Bits: 4294967295 385 | m_Lightmapping: 4 386 | m_AreaSize: {x: 1, y: 1} 387 | m_BounceIntensity: 1 388 | m_ColorTemperature: 6570 389 | m_UseColorTemperature: 0 390 | m_ShadowRadius: 0 391 | m_ShadowAngle: 0 392 | --- !u!4 &1586470514 393 | Transform: 394 | m_ObjectHideFlags: 0 395 | m_PrefabParentObject: {fileID: 0} 396 | m_PrefabInternal: {fileID: 0} 397 | m_GameObject: {fileID: 1586470512} 398 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 399 | m_LocalPosition: {x: 0, y: 3, z: 0} 400 | m_LocalScale: {x: 1, y: 1, z: 1} 401 | m_Children: [] 402 | m_Father: {fileID: 0} 403 | m_RootOrder: 1 404 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 405 | -------------------------------------------------------------------------------- /Project/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: 15 7 | productGUID: 6ad6807ec45ebce429d7a84f795d8870 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | defaultScreenOrientation: 4 11 | targetDevice: 2 12 | useOnDemandResources: 0 13 | accelerometerFrequency: 60 14 | companyName: DefaultCompany 15 | productName: GpuInstanceGrass1 16 | defaultCursor: {fileID: 0} 17 | cursorHotspot: {x: 0, y: 0} 18 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 19 | m_ShowUnitySplashScreen: 1 20 | m_ShowUnitySplashLogo: 1 21 | m_SplashScreenOverlayOpacity: 1 22 | m_SplashScreenAnimation: 1 23 | m_SplashScreenLogoStyle: 1 24 | m_SplashScreenDrawMode: 0 25 | m_SplashScreenBackgroundAnimationZoom: 1 26 | m_SplashScreenLogoAnimationZoom: 1 27 | m_SplashScreenBackgroundLandscapeAspect: 1 28 | m_SplashScreenBackgroundPortraitAspect: 1 29 | m_SplashScreenBackgroundLandscapeUvs: 30 | serializedVersion: 2 31 | x: 0 32 | y: 0 33 | width: 1 34 | height: 1 35 | m_SplashScreenBackgroundPortraitUvs: 36 | serializedVersion: 2 37 | x: 0 38 | y: 0 39 | width: 1 40 | height: 1 41 | m_SplashScreenLogos: [] 42 | m_VirtualRealitySplashScreen: {fileID: 0} 43 | m_HolographicTrackingLossScreen: {fileID: 0} 44 | defaultScreenWidth: 1024 45 | defaultScreenHeight: 768 46 | defaultScreenWidthWeb: 960 47 | defaultScreenHeightWeb: 600 48 | m_StereoRenderingPath: 0 49 | m_ActiveColorSpace: 0 50 | m_MTRendering: 1 51 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 52 | iosShowActivityIndicatorOnLoading: -1 53 | androidShowActivityIndicatorOnLoading: -1 54 | tizenShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidBlitType: 0 67 | defaultIsFullScreen: 1 68 | defaultIsNativeResolution: 1 69 | macRetinaSupport: 1 70 | runInBackground: 0 71 | captureSingleScreen: 0 72 | muteOtherAudioSources: 0 73 | Prepare IOS For Recording: 0 74 | Force IOS Speakers When Recording: 0 75 | deferSystemGesturesMode: 0 76 | hideHomeButton: 0 77 | submitAnalytics: 1 78 | usePlayerLog: 1 79 | bakeCollisionMeshes: 0 80 | forceSingleInstance: 0 81 | resizableWindow: 0 82 | useMacAppStoreValidation: 0 83 | macAppStoreCategory: public.app-category.games 84 | gpuSkinning: 0 85 | graphicsJobs: 0 86 | xboxPIXTextureCapture: 0 87 | xboxEnableAvatar: 0 88 | xboxEnableKinect: 0 89 | xboxEnableKinectAutoTracking: 0 90 | xboxEnableFitness: 0 91 | visibleInBackground: 1 92 | allowFullscreenSwitch: 1 93 | graphicsJobMode: 0 94 | macFullscreenMode: 2 95 | d3d11FullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | n3dsDisableStereoscopicView: 0 102 | n3dsEnableSharedListOpt: 1 103 | n3dsEnableVSync: 0 104 | xboxOneResolution: 0 105 | xboxOneSResolution: 0 106 | xboxOneXResolution: 3 107 | xboxOneMonoLoggingLevel: 0 108 | xboxOneLoggingLevel: 1 109 | xboxOneDisableEsram: 0 110 | xboxOnePresentImmediateThreshold: 0 111 | videoMemoryForVertexBuffers: 0 112 | psp2PowerMode: 0 113 | psp2AcquireBGM: 1 114 | wiiUTVResolution: 0 115 | wiiUGamePadMSAA: 1 116 | wiiUSupportsNunchuk: 0 117 | wiiUSupportsClassicController: 0 118 | wiiUSupportsBalanceBoard: 0 119 | wiiUSupportsMotionPlus: 0 120 | wiiUSupportsProController: 0 121 | wiiUAllowScreenCapture: 1 122 | wiiUControllerCount: 0 123 | m_SupportedAspectRatios: 124 | 4:3: 1 125 | 5:4: 1 126 | 16:10: 1 127 | 16:9: 1 128 | Others: 1 129 | bundleVersion: 1.0 130 | preloadedAssets: [] 131 | metroInputSource: 0 132 | wsaTransparentSwapchain: 0 133 | m_HolographicPauseOnTrackingLoss: 1 134 | xboxOneDisableKinectGpuReservation: 0 135 | xboxOneEnable7thCore: 0 136 | vrSettings: 137 | cardboard: 138 | depthFormat: 0 139 | enableTransitionView: 0 140 | daydream: 141 | depthFormat: 0 142 | useSustainedPerformanceMode: 0 143 | enableVideoLayer: 0 144 | useProtectedVideoMemory: 0 145 | minimumSupportedHeadTracking: 0 146 | maximumSupportedHeadTracking: 1 147 | hololens: 148 | depthFormat: 1 149 | depthBufferSharingEnabled: 0 150 | oculus: 151 | sharedDepthBuffer: 0 152 | dashSupport: 0 153 | protectGraphicsMemory: 0 154 | useHDRDisplay: 0 155 | m_ColorGamuts: 00000000 156 | targetPixelDensity: 30 157 | resolutionScalingMode: 0 158 | androidSupportedAspectRatio: 1 159 | androidMaxAspectRatio: 2.1 160 | applicationIdentifier: {} 161 | buildNumber: {} 162 | AndroidBundleVersionCode: 1 163 | AndroidMinSdkVersion: 16 164 | AndroidTargetSdkVersion: 0 165 | AndroidPreferredInstallLocation: 1 166 | aotOptions: 167 | stripEngineCode: 1 168 | iPhoneStrippingLevel: 0 169 | iPhoneScriptCallOptimization: 0 170 | ForceInternetPermission: 0 171 | ForceSDCardPermission: 0 172 | CreateWallpaper: 0 173 | APKExpansionFiles: 0 174 | keepLoadedShadersAlive: 0 175 | StripUnusedMeshComponents: 0 176 | VertexChannelCompressionMask: 177 | serializedVersion: 2 178 | m_Bits: 238 179 | iPhoneSdkVersion: 988 180 | iOSTargetOSVersionString: 7.0 181 | tvOSSdkVersion: 0 182 | tvOSRequireExtendedGameController: 0 183 | tvOSTargetOSVersionString: 9.0 184 | uIPrerenderedIcon: 0 185 | uIRequiresPersistentWiFi: 0 186 | uIRequiresFullScreen: 1 187 | uIStatusBarHidden: 1 188 | uIExitOnSuspend: 0 189 | uIStatusBarStyle: 0 190 | iPhoneSplashScreen: {fileID: 0} 191 | iPhoneHighResSplashScreen: {fileID: 0} 192 | iPhoneTallHighResSplashScreen: {fileID: 0} 193 | iPhone47inSplashScreen: {fileID: 0} 194 | iPhone55inPortraitSplashScreen: {fileID: 0} 195 | iPhone55inLandscapeSplashScreen: {fileID: 0} 196 | iPhone58inPortraitSplashScreen: {fileID: 0} 197 | iPhone58inLandscapeSplashScreen: {fileID: 0} 198 | iPadPortraitSplashScreen: {fileID: 0} 199 | iPadHighResPortraitSplashScreen: {fileID: 0} 200 | iPadLandscapeSplashScreen: {fileID: 0} 201 | iPadHighResLandscapeSplashScreen: {fileID: 0} 202 | appleTVSplashScreen: {fileID: 0} 203 | appleTVSplashScreen2x: {fileID: 0} 204 | tvOSSmallIconLayers: [] 205 | tvOSSmallIconLayers2x: [] 206 | tvOSLargeIconLayers: [] 207 | tvOSTopShelfImageLayers: [] 208 | tvOSTopShelfImageLayers2x: [] 209 | tvOSTopShelfImageWideLayers: [] 210 | tvOSTopShelfImageWideLayers2x: [] 211 | iOSLaunchScreenType: 0 212 | iOSLaunchScreenPortrait: {fileID: 0} 213 | iOSLaunchScreenLandscape: {fileID: 0} 214 | iOSLaunchScreenBackgroundColor: 215 | serializedVersion: 2 216 | rgba: 0 217 | iOSLaunchScreenFillPct: 100 218 | iOSLaunchScreenSize: 100 219 | iOSLaunchScreenCustomXibPath: 220 | iOSLaunchScreeniPadType: 0 221 | iOSLaunchScreeniPadImage: {fileID: 0} 222 | iOSLaunchScreeniPadBackgroundColor: 223 | serializedVersion: 2 224 | rgba: 0 225 | iOSLaunchScreeniPadFillPct: 100 226 | iOSLaunchScreeniPadSize: 100 227 | iOSLaunchScreeniPadCustomXibPath: 228 | iOSUseLaunchScreenStoryboard: 0 229 | iOSLaunchScreenCustomStoryboardPath: 230 | iOSDeviceRequirements: [] 231 | iOSURLSchemes: [] 232 | iOSBackgroundModes: 0 233 | iOSMetalForceHardShadows: 0 234 | metalEditorSupport: 1 235 | metalAPIValidation: 1 236 | iOSRenderExtraFrameOnPause: 0 237 | appleDeveloperTeamID: 238 | iOSManualSigningProvisioningProfileID: 239 | tvOSManualSigningProvisioningProfileID: 240 | appleEnableAutomaticSigning: 0 241 | clonedFromGUID: 00000000000000000000000000000000 242 | AndroidTargetArchitectures: 5 243 | AndroidSplashScreenScale: 0 244 | androidSplashScreen: {fileID: 0} 245 | AndroidKeystoreName: 246 | AndroidKeyaliasName: 247 | AndroidTVCompatibility: 1 248 | AndroidIsGame: 1 249 | AndroidEnableTango: 0 250 | androidEnableBanner: 1 251 | androidUseLowAccuracyLocation: 0 252 | m_AndroidBanners: 253 | - width: 320 254 | height: 180 255 | banner: {fileID: 0} 256 | androidGamepadSupportLevel: 0 257 | resolutionDialogBanner: {fileID: 0} 258 | m_BuildTargetIcons: [] 259 | m_BuildTargetBatching: [] 260 | m_BuildTargetGraphicsAPIs: [] 261 | m_BuildTargetVRSettings: [] 262 | m_BuildTargetEnableVuforiaSettings: [] 263 | openGLRequireES31: 0 264 | openGLRequireES31AEP: 0 265 | m_TemplateCustomTags: {} 266 | mobileMTRendering: 267 | Android: 1 268 | iPhone: 1 269 | tvOS: 1 270 | m_BuildTargetGroupLightmapEncodingQuality: [] 271 | wiiUTitleID: 0005000011000000 272 | wiiUGroupID: 00010000 273 | wiiUCommonSaveSize: 4096 274 | wiiUAccountSaveSize: 2048 275 | wiiUOlvAccessKey: 0 276 | wiiUTinCode: 0 277 | wiiUJoinGameId: 0 278 | wiiUJoinGameModeMask: 0000000000000000 279 | wiiUCommonBossSize: 0 280 | wiiUAccountBossSize: 0 281 | wiiUAddOnUniqueIDs: [] 282 | wiiUMainThreadStackSize: 3072 283 | wiiULoaderThreadStackSize: 1024 284 | wiiUSystemHeapSize: 128 285 | wiiUTVStartupScreen: {fileID: 0} 286 | wiiUGamePadStartupScreen: {fileID: 0} 287 | wiiUDrcBufferDisabled: 0 288 | wiiUProfilerLibPath: 289 | playModeTestRunnerEnabled: 0 290 | actionOnDotNetUnhandledException: 1 291 | enableInternalProfiler: 0 292 | logObjCUncaughtExceptions: 1 293 | enableCrashReportAPI: 0 294 | cameraUsageDescription: 295 | locationUsageDescription: 296 | microphoneUsageDescription: 297 | switchNetLibKey: 298 | switchSocketMemoryPoolSize: 6144 299 | switchSocketAllocatorPoolSize: 128 300 | switchSocketConcurrencyLimit: 14 301 | switchScreenResolutionBehavior: 2 302 | switchUseCPUProfiler: 0 303 | switchApplicationID: 0x01004b9000490000 304 | switchNSODependencies: 305 | switchTitleNames_0: 306 | switchTitleNames_1: 307 | switchTitleNames_2: 308 | switchTitleNames_3: 309 | switchTitleNames_4: 310 | switchTitleNames_5: 311 | switchTitleNames_6: 312 | switchTitleNames_7: 313 | switchTitleNames_8: 314 | switchTitleNames_9: 315 | switchTitleNames_10: 316 | switchTitleNames_11: 317 | switchTitleNames_12: 318 | switchTitleNames_13: 319 | switchTitleNames_14: 320 | switchPublisherNames_0: 321 | switchPublisherNames_1: 322 | switchPublisherNames_2: 323 | switchPublisherNames_3: 324 | switchPublisherNames_4: 325 | switchPublisherNames_5: 326 | switchPublisherNames_6: 327 | switchPublisherNames_7: 328 | switchPublisherNames_8: 329 | switchPublisherNames_9: 330 | switchPublisherNames_10: 331 | switchPublisherNames_11: 332 | switchPublisherNames_12: 333 | switchPublisherNames_13: 334 | switchPublisherNames_14: 335 | switchIcons_0: {fileID: 0} 336 | switchIcons_1: {fileID: 0} 337 | switchIcons_2: {fileID: 0} 338 | switchIcons_3: {fileID: 0} 339 | switchIcons_4: {fileID: 0} 340 | switchIcons_5: {fileID: 0} 341 | switchIcons_6: {fileID: 0} 342 | switchIcons_7: {fileID: 0} 343 | switchIcons_8: {fileID: 0} 344 | switchIcons_9: {fileID: 0} 345 | switchIcons_10: {fileID: 0} 346 | switchIcons_11: {fileID: 0} 347 | switchIcons_12: {fileID: 0} 348 | switchIcons_13: {fileID: 0} 349 | switchIcons_14: {fileID: 0} 350 | switchSmallIcons_0: {fileID: 0} 351 | switchSmallIcons_1: {fileID: 0} 352 | switchSmallIcons_2: {fileID: 0} 353 | switchSmallIcons_3: {fileID: 0} 354 | switchSmallIcons_4: {fileID: 0} 355 | switchSmallIcons_5: {fileID: 0} 356 | switchSmallIcons_6: {fileID: 0} 357 | switchSmallIcons_7: {fileID: 0} 358 | switchSmallIcons_8: {fileID: 0} 359 | switchSmallIcons_9: {fileID: 0} 360 | switchSmallIcons_10: {fileID: 0} 361 | switchSmallIcons_11: {fileID: 0} 362 | switchSmallIcons_12: {fileID: 0} 363 | switchSmallIcons_13: {fileID: 0} 364 | switchSmallIcons_14: {fileID: 0} 365 | switchManualHTML: 366 | switchAccessibleURLs: 367 | switchLegalInformation: 368 | switchMainThreadStackSize: 1048576 369 | switchPresenceGroupId: 370 | switchLogoHandling: 0 371 | switchReleaseVersion: 0 372 | switchDisplayVersion: 1.0.0 373 | switchStartupUserAccount: 0 374 | switchTouchScreenUsage: 0 375 | switchSupportedLanguagesMask: 0 376 | switchLogoType: 0 377 | switchApplicationErrorCodeCategory: 378 | switchUserAccountSaveDataSize: 0 379 | switchUserAccountSaveDataJournalSize: 0 380 | switchApplicationAttribute: 0 381 | switchCardSpecSize: -1 382 | switchCardSpecClock: -1 383 | switchRatingsMask: 0 384 | switchRatingsInt_0: 0 385 | switchRatingsInt_1: 0 386 | switchRatingsInt_2: 0 387 | switchRatingsInt_3: 0 388 | switchRatingsInt_4: 0 389 | switchRatingsInt_5: 0 390 | switchRatingsInt_6: 0 391 | switchRatingsInt_7: 0 392 | switchRatingsInt_8: 0 393 | switchRatingsInt_9: 0 394 | switchRatingsInt_10: 0 395 | switchRatingsInt_11: 0 396 | switchLocalCommunicationIds_0: 397 | switchLocalCommunicationIds_1: 398 | switchLocalCommunicationIds_2: 399 | switchLocalCommunicationIds_3: 400 | switchLocalCommunicationIds_4: 401 | switchLocalCommunicationIds_5: 402 | switchLocalCommunicationIds_6: 403 | switchLocalCommunicationIds_7: 404 | switchParentalControl: 0 405 | switchAllowsScreenshot: 1 406 | switchAllowsVideoCapturing: 1 407 | switchAllowsRuntimeAddOnContentInstall: 0 408 | switchDataLossConfirmation: 0 409 | switchUserAccountLockEnabled: 0 410 | switchSupportedNpadStyles: 3 411 | switchSocketConfigEnabled: 0 412 | switchTcpInitialSendBufferSize: 32 413 | switchTcpInitialReceiveBufferSize: 64 414 | switchTcpAutoSendBufferSizeMax: 256 415 | switchTcpAutoReceiveBufferSizeMax: 256 416 | switchUdpSendBufferSize: 9 417 | switchUdpReceiveBufferSize: 42 418 | switchSocketBufferEfficiency: 4 419 | switchSocketInitializeEnabled: 1 420 | switchNetworkInterfaceManagerInitializeEnabled: 1 421 | switchPlayerConnectionEnabled: 1 422 | ps4NPAgeRating: 12 423 | ps4NPTitleSecret: 424 | ps4NPTrophyPackPath: 425 | ps4ParentalLevel: 11 426 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 427 | ps4Category: 0 428 | ps4MasterVersion: 01.00 429 | ps4AppVersion: 01.00 430 | ps4AppType: 0 431 | ps4ParamSfxPath: 432 | ps4VideoOutPixelFormat: 0 433 | ps4VideoOutInitialWidth: 1920 434 | ps4VideoOutBaseModeInitialWidth: 1920 435 | ps4VideoOutReprojectionRate: 60 436 | ps4PronunciationXMLPath: 437 | ps4PronunciationSIGPath: 438 | ps4BackgroundImagePath: 439 | ps4StartupImagePath: 440 | ps4StartupImagesFolder: 441 | ps4IconImagesFolder: 442 | ps4SaveDataImagePath: 443 | ps4SdkOverride: 444 | ps4BGMPath: 445 | ps4ShareFilePath: 446 | ps4ShareOverlayImagePath: 447 | ps4PrivacyGuardImagePath: 448 | ps4NPtitleDatPath: 449 | ps4RemotePlayKeyAssignment: -1 450 | ps4RemotePlayKeyMappingDir: 451 | ps4PlayTogetherPlayerCount: 0 452 | ps4EnterButtonAssignment: 1 453 | ps4ApplicationParam1: 0 454 | ps4ApplicationParam2: 0 455 | ps4ApplicationParam3: 0 456 | ps4ApplicationParam4: 0 457 | ps4DownloadDataSize: 0 458 | ps4GarlicHeapSize: 2048 459 | ps4ProGarlicHeapSize: 2560 460 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 461 | ps4pnSessions: 1 462 | ps4pnPresence: 1 463 | ps4pnFriends: 1 464 | ps4pnGameCustomData: 1 465 | playerPrefsSupport: 0 466 | restrictedAudioUsageRights: 0 467 | ps4UseResolutionFallback: 0 468 | ps4ReprojectionSupport: 0 469 | ps4UseAudio3dBackend: 0 470 | ps4SocialScreenEnabled: 0 471 | ps4ScriptOptimizationLevel: 0 472 | ps4Audio3dVirtualSpeakerCount: 14 473 | ps4attribCpuUsage: 0 474 | ps4PatchPkgPath: 475 | ps4PatchLatestPkgPath: 476 | ps4PatchChangeinfoPath: 477 | ps4PatchDayOne: 0 478 | ps4attribUserManagement: 0 479 | ps4attribMoveSupport: 0 480 | ps4attrib3DSupport: 0 481 | ps4attribShareSupport: 0 482 | ps4attribExclusiveVR: 0 483 | ps4disableAutoHideSplash: 0 484 | ps4videoRecordingFeaturesUsed: 0 485 | ps4contentSearchFeaturesUsed: 0 486 | ps4attribEyeToEyeDistanceSettingVR: 0 487 | ps4IncludedModules: [] 488 | monoEnv: 489 | psp2Splashimage: {fileID: 0} 490 | psp2NPTrophyPackPath: 491 | psp2NPSupportGBMorGJP: 0 492 | psp2NPAgeRating: 12 493 | psp2NPTitleDatPath: 494 | psp2NPCommsID: 495 | psp2NPCommunicationsID: 496 | psp2NPCommsPassphrase: 497 | psp2NPCommsSig: 498 | psp2ParamSfxPath: 499 | psp2ManualPath: 500 | psp2LiveAreaGatePath: 501 | psp2LiveAreaBackroundPath: 502 | psp2LiveAreaPath: 503 | psp2LiveAreaTrialPath: 504 | psp2PatchChangeInfoPath: 505 | psp2PatchOriginalPackage: 506 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 507 | psp2KeystoneFile: 508 | psp2MemoryExpansionMode: 0 509 | psp2DRMType: 0 510 | psp2StorageType: 0 511 | psp2MediaCapacity: 0 512 | psp2DLCConfigPath: 513 | psp2ThumbnailPath: 514 | psp2BackgroundPath: 515 | psp2SoundPath: 516 | psp2TrophyCommId: 517 | psp2TrophyPackagePath: 518 | psp2PackagedResourcesPath: 519 | psp2SaveDataQuota: 10240 520 | psp2ParentalLevel: 1 521 | psp2ShortTitle: Not Set 522 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 523 | psp2Category: 0 524 | psp2MasterVersion: 01.00 525 | psp2AppVersion: 01.00 526 | psp2TVBootMode: 0 527 | psp2EnterButtonAssignment: 2 528 | psp2TVDisableEmu: 0 529 | psp2AllowTwitterDialog: 1 530 | psp2Upgradable: 0 531 | psp2HealthWarning: 0 532 | psp2UseLibLocation: 0 533 | psp2InfoBarOnStartup: 0 534 | psp2InfoBarColor: 0 535 | psp2ScriptOptimizationLevel: 0 536 | psmSplashimage: {fileID: 0} 537 | splashScreenBackgroundSourceLandscape: {fileID: 0} 538 | splashScreenBackgroundSourcePortrait: {fileID: 0} 539 | spritePackerPolicy: 540 | webGLMemorySize: 256 541 | webGLExceptionSupport: 1 542 | webGLNameFilesAsHashes: 0 543 | webGLDataCaching: 0 544 | webGLDebugSymbols: 0 545 | webGLEmscriptenArgs: 546 | webGLModulesDirectory: 547 | webGLTemplate: APPLICATION:Default 548 | webGLAnalyzeBuildSize: 0 549 | webGLUseEmbeddedResources: 0 550 | webGLUseWasm: 0 551 | webGLCompressionFormat: 1 552 | scriptingDefineSymbols: {} 553 | platformArchitecture: {} 554 | scriptingBackend: {} 555 | incrementalIl2cppBuild: {} 556 | additionalIl2CppArgs: 557 | scriptingRuntimeVersion: 0 558 | apiCompatibilityLevelPerPlatform: {} 559 | m_RenderingPath: 1 560 | m_MobileRenderingPath: 1 561 | metroPackageName: GpuInstanceGrass1 562 | metroPackageVersion: 563 | metroCertificatePath: 564 | metroCertificatePassword: 565 | metroCertificateSubject: 566 | metroCertificateIssuer: 567 | metroCertificateNotAfter: 0000000000000000 568 | metroApplicationDescription: GpuInstanceGrass1 569 | wsaImages: {} 570 | metroTileShortName: 571 | metroCommandLineArgsFile: 572 | metroTileShowName: 0 573 | metroMediumTileShowName: 0 574 | metroLargeTileShowName: 0 575 | metroWideTileShowName: 0 576 | metroDefaultTileSize: 1 577 | metroTileForegroundText: 2 578 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 579 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 580 | a: 1} 581 | metroSplashScreenUseBackgroundColor: 0 582 | platformCapabilities: {} 583 | metroFTAName: 584 | metroFTAFileTypes: [] 585 | metroProtocolName: 586 | metroCompilationOverrides: 1 587 | tizenProductDescription: 588 | tizenProductURL: 589 | tizenSigningProfileName: 590 | tizenGPSPermissions: 0 591 | tizenMicrophonePermissions: 0 592 | tizenDeploymentTarget: 593 | tizenDeploymentTargetType: -1 594 | tizenMinOSVersion: 1 595 | n3dsUseExtSaveData: 0 596 | n3dsCompressStaticMem: 1 597 | n3dsExtSaveDataNumber: 0x12345 598 | n3dsStackSize: 131072 599 | n3dsTargetPlatform: 2 600 | n3dsRegion: 7 601 | n3dsMediaSize: 0 602 | n3dsLogoStyle: 3 603 | n3dsTitle: GameName 604 | n3dsProductCode: 605 | n3dsApplicationId: 0xFF3FF 606 | XboxOneProductId: 607 | XboxOneUpdateKey: 608 | XboxOneSandboxId: 609 | XboxOneContentId: 610 | XboxOneTitleId: 611 | XboxOneSCId: 612 | XboxOneGameOsOverridePath: 613 | XboxOnePackagingOverridePath: 614 | XboxOneAppManifestOverridePath: 615 | XboxOnePackageEncryption: 0 616 | XboxOnePackageUpdateGranularity: 2 617 | XboxOneDescription: 618 | XboxOneLanguage: 619 | - enus 620 | XboxOneCapability: [] 621 | XboxOneGameRating: {} 622 | XboxOneIsContentPackage: 0 623 | XboxOneEnableGPUVariability: 0 624 | XboxOneSockets: {} 625 | XboxOneSplashScreen: {fileID: 0} 626 | XboxOneAllowedProductIds: [] 627 | XboxOnePersistentLocalStorageSize: 0 628 | XboxOneXTitleMemory: 8 629 | xboxOneScriptCompiler: 0 630 | vrEditorSettings: 631 | daydream: 632 | daydreamIconForeground: {fileID: 0} 633 | daydreamIconBackground: {fileID: 0} 634 | cloudServicesEnabled: 635 | UNet: 1 636 | facebookSdkVersion: 7.9.4 637 | apiCompatibilityLevel: 2 638 | cloudProjectId: 7a2ee03e-de9c-4ffd-b9df-4a625df569f7 639 | projectName: GpuInstanceGrass1 640 | organizationId: tongguang 641 | cloudEnabled: 0 642 | enableNativePlatformBackendsForNewInputSystem: 0 643 | disableOldInputManagerSupport: 0 644 | --------------------------------------------------------------------------------