├── ProjectSettings ├── ProjectVersion.txt ├── TagManager.asset ├── AudioManager.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── TimeManager.asset ├── DynamicsManager.asset ├── EditorSettings.asset ├── NetworkManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── GraphicsSettings.asset ├── Physics2DSettings.asset ├── UnityAdsSettings.asset ├── ClusterInputManager.asset ├── EditorBuildSettings.asset └── UnityConnectSettings.asset ├── Assets ├── FishManShaderTutorial │ ├── MyShader.mat │ ├── Models │ │ ├── Long.mat │ │ ├── long@FBX.fbx │ │ ├── zuoqi_2NRM.png │ │ ├── zuoqi_2_3.png │ │ ├── Long.controller │ │ ├── Long.mat.meta │ │ ├── Long.controller.meta │ │ ├── zuoqi_2_3.png.meta │ │ └── zuoqi_2NRM.png.meta │ ├── Scene │ │ ├── 10 SDF.unity │ │ ├── 14 Sky.unity │ │ ├── 17 Sea.unity │ │ ├── 19 Fog.unity │ │ ├── Desert.unity │ │ ├── 05 2DSnow.unity │ │ ├── 07 2DLava.unity │ │ ├── 13 Stars.unity │ │ ├── 16 Lake.unity │ │ ├── 17 Sea2.unity │ │ ├── 20 Cloud.unity │ │ ├── 24 Rain.unity │ │ ├── 27 2DRain.unity │ │ ├── 01 BaseMath.unity │ │ ├── 15 Mountain.unity │ │ ├── 221 Ripple.unity │ │ ├── 23 Voronoi.unity │ │ ├── 26 Caustic.unity │ │ ├── 28 GameHPUI.unity │ │ ├── 04 2DCloudSea.unity │ │ ├── WaterCauster.unity │ │ ├── 16 HighlandLake.unity │ │ ├── 06 2DFireParticle.unity │ │ ├── 12 SDFBouncedBall.unity │ │ ├── 09 RaymarchFramework.unity │ │ ├── 09 RaymarchMergeRaster.unity │ │ ├── 09 RaymarchSimpleScene.unity │ │ ├── 05 2DSnow.unity.meta │ │ ├── 07 2DLava.unity.meta │ │ ├── 10 SDF.unity.meta │ │ ├── 13 Stars.unity.meta │ │ ├── 14 Sky.unity.meta │ │ ├── 16 Lake.unity.meta │ │ ├── 17 Sea.unity.meta │ │ ├── 17 Sea2.unity.meta │ │ ├── 19 Fog.unity.meta │ │ ├── 20 Cloud.unity.meta │ │ ├── 221 Ripple.unity.meta │ │ ├── 23 Voronoi.unity.meta │ │ ├── 24 Rain.unity.meta │ │ ├── 26 Caustic.unity.meta │ │ ├── 27 2DRain.unity.meta │ │ ├── Desert.unity.meta │ │ ├── 01 BaseMath.unity.meta │ │ ├── 04 2DCloudSea.unity.meta │ │ ├── 15 Mountain.unity.meta │ │ ├── 16 HighlandLake.unity.meta │ │ ├── 28 GameHPUI.unity.meta │ │ ├── WaterCauster.unity.meta │ │ ├── 06 2DFireParticle.unity.meta │ │ ├── 09 RaymarchFramework.unity.meta │ │ ├── 12 SDFBouncedBall.unity.meta │ │ ├── 09 RaymarchMergeRaster.unity.meta │ │ └── 09 RaymarchSimpleScene.unity.meta │ ├── Prefabs │ │ ├── Long.prefab │ │ └── Long.prefab.meta │ ├── Shaders │ │ ├── 2DLava.shader │ │ ├── 2DSnow.shader │ │ ├── BaseMath.shader │ │ ├── ShaderLibs │ │ │ ├── Hash.cginc │ │ │ ├── Noise.cginc │ │ │ ├── Common.cginc.meta │ │ │ ├── FBM.cginc.meta │ │ │ ├── Feature.cginc.meta │ │ │ ├── Hash.cginc.meta │ │ │ ├── Math.cginc.meta │ │ │ ├── Noise.cginc.meta │ │ │ ├── SDF.cginc.meta │ │ │ ├── Framework2D.cginc.meta │ │ │ ├── Framework3D.cginc.meta │ │ │ ├── Framework3D_Terrain.cginc.meta │ │ │ ├── Framework3D_DefaultRender.cginc.meta │ │ │ ├── Common.cginc │ │ │ ├── Framework2D.cginc │ │ │ ├── Framework3D_Terrain.cginc │ │ │ ├── Math.cginc │ │ │ ├── FBM.cginc │ │ │ ├── Framework3D.cginc │ │ │ ├── Framework3D_DefaultRender.cginc │ │ │ └── SDF.cginc │ │ ├── ShaderLibs.meta │ │ ├── 2DLava.shader.meta │ │ ├── 2DRain.shader.meta │ │ ├── 2DSnow.shader.meta │ │ ├── Cloud.shader.meta │ │ ├── Desert.shader.meta │ │ ├── Fog.shader.meta │ │ ├── Lake.shader.meta │ │ ├── Rain.shader.meta │ │ ├── Ripple.shader.meta │ │ ├── SDF.shader.meta │ │ ├── Sea.shader.meta │ │ ├── Sea2.shader.meta │ │ ├── Sky.shader.meta │ │ ├── Stars.shader.meta │ │ ├── Voronoi.shader.meta │ │ ├── 2DCloudSea.shader.meta │ │ ├── BaseMath.shader.meta │ │ ├── GameHPUI.shader.meta │ │ ├── HighlandLake.shader.meta │ │ ├── Mountain.shader.meta │ │ ├── SoapBubble.shader.meta │ │ ├── TerrianMap.shader.meta │ │ ├── 2DFireParticle.shader.meta │ │ ├── Caustic_RotateMin.shader.meta │ │ ├── Caustic_TriTwist.shader.meta │ │ ├── Caustic_Voronoi.shader.meta │ │ ├── RayMarchFramework.shader.meta │ │ ├── RaymarchExample.shader.meta │ │ ├── SDFBouncedBall.shader.meta │ │ ├── RayMarchSimpleScene.shader.meta │ │ ├── RaymarchMergeRaster.shader.meta │ │ ├── LightScanWithDepthTexture.shader.meta │ │ ├── Stars.shader │ │ ├── Caustic_Voronoi.shader │ │ ├── Caustic_TriTwist.shader │ │ ├── Caustic_RotateMin.shader │ │ ├── SoapBubble.shader │ │ ├── RaymarchExample.shader │ │ ├── SDFBouncedBall.shader │ │ ├── Sky.shader │ │ ├── Voronoi.shader │ │ ├── TerrianMap.shader │ │ ├── 2DFireParticle.shader │ │ ├── Fog.shader │ │ ├── 2DRain.shader │ │ ├── Lake.shader │ │ ├── Sea.shader │ │ ├── Cloud.shader │ │ ├── 2DCloudSea.shader │ │ ├── Mountain.shader │ │ ├── Rain.shader │ │ ├── Desert.shader │ │ ├── Sea2.shader │ │ ├── RayMarchFramework.shader │ │ ├── RaymarchMergeRaster.shader │ │ ├── Ripple.shader │ │ ├── LightScanWithDepthTexture.shader │ │ └── RayMarchSimpleScene.shader │ ├── Textures │ │ ├── TerrialMap.png │ │ ├── MainTex │ │ │ ├── Tile.tga │ │ │ ├── GrayNoise.png │ │ │ ├── NoiseTex.png │ │ │ ├── WhiteNoise.png │ │ │ ├── PerlinNoise.png │ │ │ ├── Tile.tga.meta │ │ │ ├── PerlinNoise.png.meta │ │ │ ├── NoiseTex.png.meta │ │ │ ├── GrayNoise.png.meta │ │ │ └── WhiteNoise.png.meta │ │ ├── MainTex.meta │ │ └── TerrialMap.png.meta │ ├── Materials │ │ ├── FishManShaderTutorial_Cloud.mat │ │ ├── FishManShaderTutorial_Fog.mat │ │ ├── FishManShaderTutorial_Lake.mat │ │ ├── FishManShaderTutorial_Rain.mat │ │ ├── FishManShaderTutorial_SDF.mat │ │ ├── FishManShaderTutorial_Sea.mat │ │ ├── FishManShaderTutorial_Sea2.mat │ │ ├── FishManShaderTutorial_Sky.mat │ │ ├── FishManShaderTutorial_Stars.mat │ │ ├── FishManShaderTutorial_2DLava.mat │ │ ├── FishManShaderTutorial_2DRain.mat │ │ ├── FishManShaderTutorial_2DSnow.mat │ │ ├── FishManShaderTutorial_Desert.mat │ │ ├── FishManShaderTutorial_Ripple.mat │ │ ├── FishManShaderTutorial_Voronoi.mat │ │ ├── FishManShaderTutorial_2DCloudSea.mat │ │ ├── FishManShaderTutorial_BaseMath.mat │ │ ├── FishManShaderTutorial_GameHPUI.mat │ │ ├── FishManShaderTutorial_Mountain.mat │ │ ├── FishManShaderTutorial_FireParticle.mat │ │ ├── FishManShaderTutorial_HighlandLake.mat │ │ ├── FishManShaderTutorial_2DFireParticle.mat │ │ ├── FishManShaderTutorial_Caustic_Voronoi.mat │ │ ├── FishManShaderTutorial_SDFBouncedBall.mat │ │ ├── FishManShaderTutorial_Caustic_RotateMin.mat │ │ ├── FishManShaderTutorial_Caustic_TriTwist.mat │ │ ├── FishManShaderTutorial_RayMarchFramework.mat │ │ ├── FishManShaderTutorial_RayMarchSimpleScene.mat │ │ ├── FishManShaderTutorial_RaymarchMergeRaster.mat │ │ ├── FishManShaderTutorial_Shadertoy_Elevated.mat │ │ ├── FishManShaderTutorial_Fog.mat.meta │ │ ├── FishManShaderTutorial_Lake.mat.meta │ │ ├── FishManShaderTutorial_Rain.mat.meta │ │ ├── FishManShaderTutorial_SDF.mat.meta │ │ ├── FishManShaderTutorial_Sea.mat.meta │ │ ├── FishManShaderTutorial_Sea2.mat.meta │ │ ├── FishManShaderTutorial_Sky.mat.meta │ │ ├── FishManShaderTutorial_2DLava.mat.meta │ │ ├── FishManShaderTutorial_2DRain.mat.meta │ │ ├── FishManShaderTutorial_2DSnow.mat.meta │ │ ├── FishManShaderTutorial_BaseMath.mat.meta │ │ ├── FishManShaderTutorial_Cloud.mat.meta │ │ ├── FishManShaderTutorial_Desert.mat.meta │ │ ├── FishManShaderTutorial_GameHPUI.mat.meta │ │ ├── FishManShaderTutorial_Mountain.mat.meta │ │ ├── FishManShaderTutorial_Ripple.mat.meta │ │ ├── FishManShaderTutorial_Stars.mat.meta │ │ ├── FishManShaderTutorial_Voronoi.mat.meta │ │ ├── FishManShaderTutorial_2DCloudSea.mat.meta │ │ ├── FishManShaderTutorial_2DFireParticle.mat.meta │ │ ├── FishManShaderTutorial_FireParticle.mat.meta │ │ ├── FishManShaderTutorial_HighlandLake.mat.meta │ │ ├── FishManShaderTutorial_SDFBouncedBall.mat.meta │ │ ├── FishManShaderTutorial_Caustic_RotateMin.mat.meta │ │ ├── FishManShaderTutorial_Caustic_TriTwist.mat.meta │ │ ├── FishManShaderTutorial_Caustic_Voronoi.mat.meta │ │ ├── FishManShaderTutorial_RayMarchFramework.mat.meta │ │ ├── FishManShaderTutorial_RayMarchSimpleScene.mat.meta │ │ ├── FishManShaderTutorial_RaymarchMergeRaster.mat.meta │ │ └── FishManShaderTutorial_Shadertoy_Elevated.mat.meta │ ├── Models.meta │ ├── Scene.meta │ ├── Materials.meta │ ├── Prefabs.meta │ ├── Scripts.meta │ ├── Shaders.meta │ ├── Textures.meta │ ├── Scripts │ │ ├── ConstVar.cs │ │ ├── Tools.meta │ │ ├── Tools │ │ │ ├── Editor.meta │ │ │ ├── NoiseTools.cs.meta │ │ │ ├── GLSL2CGGenerator.cs.meta │ │ │ └── Editor │ │ │ │ ├── EditorGLSL2CG.cs.meta │ │ │ │ ├── EditorCreateNoiseTex.cs.meta │ │ │ │ ├── EditorCreateTerrialMap.cs.meta │ │ │ │ ├── EditorCreateTerrialMap.cs │ │ │ │ ├── EditorGLSL2CG.cs │ │ │ │ └── EditorCreateNoiseTex.cs │ │ ├── ThirdPersonUserControl.cs.meta │ │ ├── ConstVar.cs.meta │ │ ├── ShowFPS.cs.meta │ │ ├── CameraControler.cs.meta │ │ ├── PostEffectsBase.cs.meta │ │ ├── LightScanWithDepthTexture.cs.meta │ │ ├── MergeRayMarch.cs.meta │ │ ├── ShowFPS.cs │ │ ├── PostEffectsBase.cs │ │ ├── ThirdPersonUserControl.cs │ │ ├── CameraControler.cs │ │ ├── MergeRayMarch.cs │ │ └── LightScanWithDepthTexture.cs │ └── MyShader.mat.meta └── FishManShaderTutorial.meta ├── .gitignore └── LICENSE /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.6.3f1 2 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/MyShader.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/MyShader.mat -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/Long.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Models/Long.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/10 SDF.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/10 SDF.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/14 Sky.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/14 Sky.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/17 Sea.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/17 Sea.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/19 Fog.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/19 Fog.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/Desert.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/Desert.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/long@FBX.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Models/long@FBX.fbx -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/zuoqi_2NRM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Models/zuoqi_2NRM.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/zuoqi_2_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Models/zuoqi_2_3.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Prefabs/Long.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Prefabs/Long.prefab -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/05 2DSnow.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/05 2DSnow.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/07 2DLava.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/07 2DLava.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/13 Stars.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/13 Stars.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/16 Lake.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/16 Lake.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/17 Sea2.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/17 Sea2.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/20 Cloud.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/20 Cloud.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/24 Rain.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/24 Rain.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/27 2DRain.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/27 2DRain.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DLava.shader: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Shaders/2DLava.shader -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DSnow.shader: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Shaders/2DSnow.shader -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/Long.controller: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Models/Long.controller -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/01 BaseMath.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/01 BaseMath.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/15 Mountain.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/15 Mountain.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/221 Ripple.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/221 Ripple.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/23 Voronoi.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/23 Voronoi.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/26 Caustic.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/26 Caustic.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/28 GameHPUI.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/28 GameHPUI.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/BaseMath.shader: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Shaders/BaseMath.shader -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/TerrialMap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Textures/TerrialMap.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/04 2DCloudSea.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/04 2DCloudSea.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/WaterCauster.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/WaterCauster.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/Tile.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Textures/MainTex/Tile.tga -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/16 HighlandLake.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/16 HighlandLake.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/06 2DFireParticle.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/06 2DFireParticle.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/12 SDFBouncedBall.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/12 SDFBouncedBall.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Hash.cginc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Shaders/ShaderLibs/Hash.cginc -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Noise.cginc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Shaders/ShaderLibs/Noise.cginc -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/GrayNoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Textures/MainTex/GrayNoise.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/NoiseTex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Textures/MainTex/NoiseTex.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/WhiteNoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Textures/MainTex/WhiteNoise.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/09 RaymarchFramework.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/09 RaymarchFramework.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/PerlinNoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Textures/MainTex/PerlinNoise.png -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/09 RaymarchMergeRaster.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/09 RaymarchMergeRaster.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/09 RaymarchSimpleScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Scene/09 RaymarchSimpleScene.unity -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Cloud.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Cloud.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Fog.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Fog.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Lake.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Lake.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Rain.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Rain.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_SDF.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_SDF.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sea.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sea.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sea2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sea2.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sky.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sky.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Stars.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Stars.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DLava.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DLava.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DRain.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DRain.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DSnow.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DSnow.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Desert.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Desert.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Ripple.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Ripple.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Voronoi.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Voronoi.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DCloudSea.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DCloudSea.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_BaseMath.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_BaseMath.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_GameHPUI.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_GameHPUI.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Mountain.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Mountain.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_FireParticle.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_FireParticle.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_HighlandLake.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_HighlandLake.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DFireParticle.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DFireParticle.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_Voronoi.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_Voronoi.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_SDFBouncedBall.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_SDFBouncedBall.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_RotateMin.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_RotateMin.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_TriTwist.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_TriTwist.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RayMarchFramework.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RayMarchFramework.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RayMarchSimpleScene.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RayMarchSimpleScene.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RaymarchMergeRaster.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RaymarchMergeRaster.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Shadertoy_Elevated.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiepengTan/FishManShaderTutorial/HEAD/Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Shadertoy_Elevated.mat -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/05 2DSnow.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a713a4629c925c499f5259e60c479a1 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/07 2DLava.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c867481d63cb574eadf3bfd80a73bbd 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/10 SDF.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5d6ce165f0d9e24fab8ba17ea3e0888 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/13 Stars.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0508449572129a142b8e5a17b0a8f882 3 | timeCreated: 1520648796 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/14 Sky.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad19a61865b0e1245a6d2b0454f7d52d 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/16 Lake.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4fd57b5ec6338ad4ab050920ebb70f34 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/17 Sea.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1a60fec90915e149a069a3b805911ef 3 | timeCreated: 1520648796 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/17 Sea2.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a52ddcb7d6ab6b41b69202042d33817 3 | timeCreated: 1520648796 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/19 Fog.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbbc460b77da09f42acdcb7f012ad47f 3 | timeCreated: 1520648796 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/20 Cloud.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90b52c78b523d3b40bc0d1a3c0002674 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/221 Ripple.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 774e72f82680f1744afd94c8917b155d 3 | timeCreated: 1523525268 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/23 Voronoi.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ce65899d1ad3b44d8c639274ca72a76 3 | timeCreated: 1523532075 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/24 Rain.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ba943e5383c5764db57c4d0429f2fcd 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/26 Caustic.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 987304d62cae7a74fa4ac6b4fdcdaf02 3 | timeCreated: 1523532075 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/27 2DRain.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8090a786711b394469d0f628b87ca972 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/Desert.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f0f6d462c4bfec4bad8d183aeae2634 3 | timeCreated: 1520648796 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/01 BaseMath.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b0ebcd2f2c404548bf12baef43d9e83 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/04 2DCloudSea.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc026a34274d1024abf5e0343bfb72a8 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/15 Mountain.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f92ee07a1073ccb43a690bc20d33bf10 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/16 HighlandLake.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97961746ea16a6c43bad8f2a669a4835 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/28 GameHPUI.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1d504b6c90b99e45a784562a73d0521 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/WaterCauster.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d0ba0567bdc5684e83c00a26359593c 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1ad08095cd15ba4dbebd3d4ad348b84 3 | folderAsset: yes 4 | timeCreated: 1520328502 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/06 2DFireParticle.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d48d47377efb69a41afb1bf20e909e1f 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/09 RaymarchFramework.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dba87633ca7a3b843b37a6e97dd947f3 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/12 SDFBouncedBall.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ee91f6862653cd43a498b65b44caded 3 | timeCreated: 1523957177 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d60ff863bd94f1143beaf5450ae9edf5 3 | folderAsset: yes 4 | timeCreated: 1523760628 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7e026b109728ed46a70c048abe74c57 3 | folderAsset: yes 4 | timeCreated: 1520647240 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/09 RaymarchMergeRaster.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dbfefe4a4aecc44dab1b59ef694741d 3 | timeCreated: 1520648796 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scene/09 RaymarchSimpleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43600a3f40e6a364c931ad227f217c6e 3 | timeCreated: 1521287146 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acafbb7fb1623294dacad49b4deaa817 3 | folderAsset: yes 4 | timeCreated: 1523757495 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5145468e56ce1af4d9deb9c8a59f59a0 3 | folderAsset: yes 4 | timeCreated: 1523761502 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5f792ad1e4de6a47b7c841c17350944 3 | folderAsset: yes 4 | timeCreated: 1520669940 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa71dfdf06e848d47b08ebdec1e357b6 3 | folderAsset: yes 4 | timeCreated: 1520648389 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14cbc473f42f5e34983cf0db9736ea4c 3 | folderAsset: yes 4 | timeCreated: 1520669950 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/ConstVar.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class ConstVar { 5 | public static string ProjectName = "FishManShaderTutorial"; 6 | public static string ProjectDir = Application.dataPath + "/"+ ProjectName; 7 | 8 | } -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16c65fbc19cbe584a8531c5eb761d188 3 | folderAsset: yes 4 | timeCreated: 1522660333 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2c44e785ce7c554f9a2090696aadcb0 3 | folderAsset: yes 4 | timeCreated: 1507459857 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 314e2a3a8c1fecd49b7f0b068ddac114 3 | folderAsset: yes 4 | timeCreated: 1520669940 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 561f011ff4edd5d4e9cd30617d51ef69 3 | folderAsset: yes 4 | timeCreated: 1523452121 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DLava.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf3ab995f5257914fbcaa3dc8bf19907 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DRain.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dece4609f4a8db14c8504169485dd9aa 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DSnow.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eba74e8098fa7ed418b848f7b6c2f76c 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Cloud.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e5817005efa6b64290160aa46bf0711 3 | timeCreated: 1523596991 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Desert.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7859314b0c3c1b142b4ca6cbd87a85ea 3 | timeCreated: 1523596991 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Fog.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39b3f08c8eb2ec448a3570d17b8b75e2 3 | timeCreated: 1523596991 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Lake.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b1b0fd1aba53974b9c7e39bebf71352 3 | timeCreated: 1523970636 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Rain.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5226f25a7dceb64b92bf97e8c9bc3b9 3 | timeCreated: 1523970636 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Ripple.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c18b4f6dca068a4a8a19bb1cfaed392 3 | timeCreated: 1523523623 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/SDF.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c53607bf75de70b4cab6ce3875aa9447 3 | timeCreated: 1523956884 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Sea.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a73fc538747f07c499afb9886e07138c 3 | timeCreated: 1523596991 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Sea2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e84b768e14625c4abdb67407fb6a596 3 | timeCreated: 1523596991 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Sky.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba25e7ac3e69dbe4c934d2f74ca0d6ef 3 | timeCreated: 1523956884 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Stars.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7970a2fc8db5fb34493d5f9094534820 3 | timeCreated: 1523523623 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Voronoi.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b9e3a12aee2b10459eb6a8543d2b4e8 3 | timeCreated: 1523871132 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/Long.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b4cfd31454ab284f936ee652a104e5a 3 | timeCreated: 1523761054 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/MyShader.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cedc9b401fef5a54481f3031005a7c71 3 | timeCreated: 1524742286 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DCloudSea.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06087962bb9cd6d4c880680963886e27 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/BaseMath.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f3ec4d0b17d64641952277f954380ba 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/GameHPUI.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9565ff0d78c4eb4eabd76532c002c20 3 | timeCreated: 1521530815 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/HighlandLake.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3556c3d25c426ac47b04c270fd5e7ae2 3 | timeCreated: 1523956884 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Mountain.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d55e678d4854ed648b774e69d4da955d 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/SoapBubble.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2082928d82bcca8408c8c2ec7d49f592 3 | timeCreated: 1520847506 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/TerrianMap.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 561d282f642578d4a8336424acf0f552 3 | timeCreated: 1524191675 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DFireParticle.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8badc31047a24ea4b8c87f858d1cb33b 3 | timeCreated: 1520670040 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Caustic_RotateMin.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71823e718735f6946bb76fc8d255708a 3 | timeCreated: 1523523623 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Caustic_TriTwist.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e6afde52b0891f4ca2267b4a85a69ae 3 | timeCreated: 1523523623 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Caustic_Voronoi.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 773895d61e0654f43aa4782d420c4b33 3 | timeCreated: 1523523623 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RayMarchFramework.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27a732797b8aea2458d7e86d5ead9645 3 | timeCreated: 1524191675 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RaymarchExample.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3b1a6052ddb75d45971c0c2c4f249d0 3 | timeCreated: 1524486482 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/SDFBouncedBall.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb1cad58954e6514a936019ee0eda7fa 3 | timeCreated: 1523956884 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Common.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9baf943d7a9d6948a16f5052992deb1 3 | timeCreated: 1523972025 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/FBM.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d100e9ce51ab92439f648886673301b 3 | timeCreated: 1524191674 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Feature.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef2a6d133ed480b409e6d8a28afdda64 3 | timeCreated: 1523452181 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Hash.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e550209de8150e45ad46c48bdc27609 3 | timeCreated: 1524191674 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Math.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 063a35099c8283a4cb298cf72f84e1ef 3 | timeCreated: 1523452181 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Noise.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a8079c3616c9c84a875b8abce5e5791 3 | timeCreated: 1523452181 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/SDF.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a37b4b75e1decea4b9df15cb69062ae1 3 | timeCreated: 1523452181 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/Long.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91f231428b36cc24496cf453e6d35214 3 | timeCreated: 1523762313 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 9100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Prefabs/Long.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8f8d5f97c7fa68469aa61036d1b1b5d 3 | timeCreated: 1523761421 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/ThirdPersonUserControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 521b611700410be45810047f0a74e899 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RayMarchSimpleScene.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7bad6c21247ccc4b8c8c864e539a488 3 | timeCreated: 1524191675 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RaymarchMergeRaster.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52fd39b013bf2f74eab37570ca8b26e8 3 | timeCreated: 1520651574 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework2D.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 383bced5c8874784c8776fb6bc146a80 3 | timeCreated: 1524366965 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework3D.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8bf7b3c12de434b48aa33ecab7b01207 3 | timeCreated: 1523452181 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/LightScanWithDepthTexture.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f47fb17ef63628479decf673cbef472 3 | timeCreated: 1520648303 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework3D_Terrain.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82bc06230c2908f47930b1c51ccde526 3 | timeCreated: 1524713687 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Fog.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65760a24b94107d4fa89220d620cae36 3 | timeCreated: 1523757769 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Lake.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c9a09c78a08d7a4e92ff92b6f83d6d8 3 | timeCreated: 1523970683 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Rain.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cfecce32a7064f848a023ac74680e66b 3 | timeCreated: 1524879278 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_SDF.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be48bb0c794bc07428e120104b4d18e8 3 | timeCreated: 1524530313 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sea.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95b7d0f6de1cdcf409b2725375857a63 3 | timeCreated: 1523610467 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sea2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be403bda6247aae4e92e29b61bf86fca 3 | timeCreated: 1523614899 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Sky.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aac117acda553574cb5e49fef634b2fd 3 | timeCreated: 1523956992 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework3D_DefaultRender.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bee4d723ad280d1479c1caa5abc5ac49 3 | timeCreated: 1524663725 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DLava.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84e3920843a42a146b956843906bb011 3 | timeCreated: 1524446995 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DRain.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0961bf5949e08b047b6323950651f742 3 | timeCreated: 1523791584 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DSnow.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64dd0bffa1e69e94e9f3b403f53776f9 3 | timeCreated: 1523792042 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_BaseMath.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e5fb7bcc1e369b4bb86bd91cbfc7b42 3 | timeCreated: 1524382577 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Cloud.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27eeb7c448215be49a42f9066fbb6de0 3 | timeCreated: 1524829668 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Desert.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6de076072658814a88be613db9c6e63 3 | timeCreated: 1523791757 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_GameHPUI.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51eae5f9cbb25554bb80a19dca72c4fd 3 | timeCreated: 1523880574 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Mountain.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40e9e90cacdcd874eac343de3218f43f 3 | timeCreated: 1524734166 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Ripple.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d2cce16a1955d846b62212390163340 3 | timeCreated: 1523525305 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Stars.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a94f7c973bc9e6f4989414181ccbd52d 3 | timeCreated: 1523969107 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Voronoi.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a454f6d4a299c94d886d851ef91c8ee 3 | timeCreated: 1523871182 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DCloudSea.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e124c2711cb7974ab67689e81528285 3 | timeCreated: 1523791726 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_2DFireParticle.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8da1a8ba998aeb245b8060b129949091 3 | timeCreated: 1523792200 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_FireParticle.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 222a49ca2b0877b4e94d49fb02ba76c7 3 | timeCreated: 1523792006 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_HighlandLake.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c5f5f84547aa7f4e8b5833d18e0ed5d 3 | timeCreated: 1524041574 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_SDFBouncedBall.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27681f5f0995e6c4db252b86407314eb 3 | timeCreated: 1524664754 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_RotateMin.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f0509246496e244b80619a76f553eb3 3 | timeCreated: 1523540926 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_TriTwist.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91764dc426a2f6841ba14308139d829e 3 | timeCreated: 1523540916 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Caustic_Voronoi.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eee7c4355fb857e4ea1e995b7055c167 3 | timeCreated: 1523540922 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RayMarchFramework.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68c2d76e5adb97c499afbfc4a30ff393 3 | timeCreated: 1524362555 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RayMarchSimpleScene.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85140e0b36033eb48b5c5506f02f8c82 3 | timeCreated: 1524319465 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_RaymarchMergeRaster.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 333eac15f8cf3e748bdff12621887455 3 | timeCreated: 1524363990 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Materials/FishManShaderTutorial_Shadertoy_Elevated.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3040984e2023674ea47caf161317a9f 3 | timeCreated: 1523952658 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/ConstVar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae7382e3e93d74a41825ba6ed65377d6 3 | timeCreated: 1523794755 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/ShowFPS.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6de2ef9dd179a84f9ddd055d78d697b 3 | timeCreated: 1520649679 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/CameraControler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5c33bd84c1d0fc4983c913e31842279 3 | timeCreated: 1520658904 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/PostEffectsBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e63c0f94d20cd3f4cab1d6e3782f310e 3 | timeCreated: 1522660187 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/NoiseTools.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a923aaa9aa75a546a7737b96135c74b 3 | timeCreated: 1524022058 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/GLSL2CGGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d5da69312354284d9577c6b861796fc 3 | timeCreated: 1511546989 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/LightScanWithDepthTexture.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3ee4158dbdfdda40ab53a0aa8e275e1 3 | timeCreated: 1520648254 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor/EditorGLSL2CG.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: daa4304f941eeb746b6619ec71cfbd93 3 | timeCreated: 1511581011 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Common.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-03-27 4 | #ifndef FMST_COMMOM 5 | #define FMST_COMMOM 6 | 7 | #include "UnityCG.cginc" 8 | 9 | #define ftime (_Time.y) 10 | 11 | #define _LightDir (normalize(_WorldSpaceLightPos0.xyz)) 12 | 13 | #endif // FMST_COMMOM -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor/EditorCreateNoiseTex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61d534bfeaf974246bc23d877ce26f47 3 | timeCreated: 1523794755 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor/EditorCreateTerrialMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3786bfd1e04cd342914ae8ff2c4d980 3 | timeCreated: 1523794755 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/MergeRayMarch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1b153d5efa56c345846b260e3817c5d 3 | timeCreated: 1444465351 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - fogShader: {fileID: 4800000, guid: 6ca587aa357114cf6ab123394e4de910, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 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 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework2D.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-03-27 4 | #include "FBM.cginc" 5 | #include "Feature.cginc" 6 | sampler2D _MainTex; 7 | float4 _MainTex_ST; 8 | struct appdata 9 | { 10 | float4 vertex : POSITION; 11 | float2 uv : TEXCOORD0; 12 | }; 13 | 14 | struct v2f 15 | { 16 | float2 uv : TEXCOORD0; 17 | float4 vertex : SV_POSITION; 18 | }; 19 | 20 | v2f vert (appdata v) 21 | { 22 | v2f o; 23 | o.vertex = UnityObjectToClipPos(v.vertex); 24 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 25 | return o; 26 | } 27 | float3 ProcessFrag(float2 uv); 28 | float4 frag(v2f i) : SV_Target{ 29 | return float4(ProcessFrag(i.uv),1.0); 30 | } -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/zuoqi_2_3.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18c781ed13cb3b14c9843f85d527ce2d 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 1 7 | enableMipMap: 1 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 1 13 | mipMapFadeDistanceEnd: 3 14 | bumpmap: 15 | convertToNormalMap: 0 16 | externalNormalMap: 0 17 | heightScale: .25 18 | normalMapFilter: 0 19 | isReadable: 0 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | textureFormat: 32 23 | maxTextureSize: 256 24 | textureSettings: 25 | filterMode: -1 26 | aniso: -1 27 | mipBias: -1 28 | wrapMode: -1 29 | nPOTScale: 1 30 | lightmap: 0 31 | compressionQuality: 50 32 | textureType: 5 33 | buildTargetSettings: [] 34 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework3D_Terrain.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-24 4 | #ifndef FRAMEWORK_3D_DEFAULT_SCENE 5 | #define FRAMEWORK_3D_DEFAULT_SCENE 6 | 7 | #include "SDF.cginc" 8 | #include "Framework3D.cginc" 9 | 10 | //DEFAULT_RENDER_SKY default sky box 11 | 12 | 13 | 14 | float2 TerrainL(float3 pos); 15 | float2 TerrainM(float3 pos); 16 | float2 TerrainH(float3 pos); 17 | 18 | float RaycastTerrain(float3 ro, float3 rd) { 19 | _MRCRO_RAY_CAST(ro,rd,10000.,TerrainL); 20 | } 21 | float3 NormalTerrian( in float3 pos, float rz ){ 22 | _MACRO_CALC_NORMAL(pos,rz,TerrainH); 23 | } 24 | 25 | float SoftShadow(in float3 ro, in float3 rd,float tmax){ 26 | _MACRO_SOFT_SHADOW(ro,rd,tmax,TerrainM); 27 | } 28 | 29 | 30 | #endif // FRAMEWORK_3D_DEFAULT_SCENE -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Stars.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-13 email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/Stars" { 5 | Properties{ 6 | _MainTex("Base (RGB)", 2D) = "white" {} 7 | } 8 | SubShader{ 9 | Pass { 10 | ZTest Always Cull Off ZWrite Off 11 | CGPROGRAM 12 | 13 | #pragma vertex vert 14 | #pragma fragment frag 15 | #include "ShaderLibs/Feature.cginc" 16 | #include "ShaderLibs/Framework3D.cginc" 17 | 18 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 19 | sceneCol.xyz = Stars(rd,3.,50.); 20 | return sceneCol; 21 | } 22 | ENDCG 23 | }//end pass 24 | }//end SubShader 25 | FallBack Off 26 | } 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Caustic_Voronoi.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-04-11 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/Caustic_Voronoi"{ 6 | Properties{ 7 | _MainTex ("Texture", 2D) = "white" {} 8 | _TileNum ("TileNum", float) = 1 9 | } 10 | SubShader 11 | { 12 | Tags { "RenderType"="Opaque" } 13 | Pass 14 | { 15 | ZWrite Off 16 | Blend SrcAlpha OneMinusSrcAlpha 17 | 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | #include "ShaderLibs/Framework2D.cginc" 22 | float _TileNum ; 23 | 24 | float3 ProcessFrag(float2 _uv){ 25 | float2 uv = _TileNum * _uv; 26 | float time = _Time.y; 27 | float val = CausticVoronoi(uv,time); 28 | return float3(val,val,val); 29 | } 30 | ENDCG 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Caustic_TriTwist.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-04-11 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/Caustic_TriTwist"{ 6 | Properties{ 7 | _MainTex ("Texture", 2D) = "white" {} 8 | _TileNum ("TileNum", float) = 1 9 | } 10 | SubShader 11 | { 12 | Tags { "RenderType"="Opaque" } 13 | Pass 14 | { 15 | ZWrite Off 16 | Blend SrcAlpha OneMinusSrcAlpha 17 | 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | #include "ShaderLibs/Framework2D.cginc" 22 | float _TileNum ; 23 | 24 | float3 ProcessFrag(float2 _uv){ 25 | float2 uv = _TileNum * _uv; 26 | float time = _Time.y; 27 | float val = CausticTriTwist(uv,time); 28 | return float3(val,val,val); 29 | } 30 | ENDCG 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Caustic_RotateMin.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-03-27 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/Caustic_RotateMin"{ 6 | Properties{ 7 | _MainTex ("Texture", 2D) = "white" {} 8 | _TileNum ("TileNum", float) = 1 9 | } 10 | SubShader 11 | { 12 | Tags { "RenderType"="Opaque" } 13 | Pass 14 | { 15 | ZWrite Off 16 | Blend SrcAlpha OneMinusSrcAlpha 17 | 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | #include "ShaderLibs/Framework2D.cginc" 22 | float _TileNum ; 23 | 24 | float3 ProcessFrag(float2 _uv){ 25 | float2 uv = _TileNum * _uv; 26 | float time = _Time.y; 27 | float val = CausticRotateMin(uv,time); 28 | return float3(val,val,val); 29 | } 30 | ENDCG 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 david 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 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Models/zuoqi_2NRM.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 134a8b2dc886ec0439abba29466e991f 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 1 7 | enableMipMap: 1 8 | linearTexture: 1 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 1 13 | mipMapFadeDistanceEnd: 3 14 | bumpmap: 15 | convertToNormalMap: 0 16 | externalNormalMap: 1 17 | heightScale: .25 18 | normalMapFilter: 0 19 | isReadable: 0 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: 30 24 | maxTextureSize: 256 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: -1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | spriteMode: 0 34 | spriteExtrude: 1 35 | spriteMeshType: 1 36 | alignment: 0 37 | spritePivot: {x: .5, y: .5} 38 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 39 | spritePixelsToUnits: 100 40 | alphaIsTransparency: 0 41 | textureType: 5 42 | buildTargetSettings: [] 43 | spriteSheet: 44 | sprites: [] 45 | spritePackingTag: 46 | userData: 47 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/SoapBubble.shader: -------------------------------------------------------------------------------- 1 | Shader "Unlit/NewUnlitShader" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType"="Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | // make fog work 18 | #pragma multi_compile_fog 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata 23 | { 24 | float4 vertex : POSITION; 25 | float2 uv : TEXCOORD0; 26 | }; 27 | 28 | struct v2f 29 | { 30 | float2 uv : TEXCOORD0; 31 | UNITY_FOG_COORDS(1) 32 | float4 vertex : SV_POSITION; 33 | }; 34 | 35 | sampler2D _MainTex; 36 | float4 _MainTex_ST; 37 | 38 | v2f vert (appdata v) 39 | { 40 | v2f o; 41 | o.vertex = UnityObjectToClipPos(v.vertex); 42 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 43 | UNITY_TRANSFER_FOG(o,o.vertex); 44 | return o; 45 | } 46 | 47 | fixed4 frag (v2f i) : SV_Target 48 | { 49 | // sample the texture 50 | fixed4 col = tex2D(_MainTex, i.uv); 51 | // apply fog 52 | UNITY_APPLY_FOG(i.fogCoord, col); 53 | return col; 54 | } 55 | ENDCG 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/ShowFPS.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ShowFPS : MonoBehaviour { 6 | 7 | private float m_LastUpdateShowTime = 0f; //上一次更新帧率的时间; 8 | 9 | private float m_UpdateShowDeltaTime = 0.01f;//更新帧率的时间间隔; 10 | 11 | private int m_FrameUpdate = 0;//帧数; 12 | 13 | public float m_FPS = 0; 14 | 15 | void Awake() { 16 | Application.targetFrameRate = 100; 17 | } 18 | 19 | // Use this for initialization 20 | GUIStyle style; 21 | void Start() { 22 | style = new GUIStyle(); 23 | m_LastUpdateShowTime = Time.realtimeSinceStartup; 24 | } 25 | 26 | // Update is called once per frame 27 | void Update() { 28 | m_FrameUpdate++; 29 | if (Time.realtimeSinceStartup - m_LastUpdateShowTime >= m_UpdateShowDeltaTime) { 30 | m_FPS = m_FrameUpdate / (Time.realtimeSinceStartup - m_LastUpdateShowTime); 31 | m_FrameUpdate = 0; 32 | m_LastUpdateShowTime = Time.realtimeSinceStartup; 33 | } 34 | } 35 | public int fontSizeRel = 15; 36 | void OnGUI() { 37 | style.fontSize = fontSizeRel; 38 | GUI.Label(new Rect(0, 0, 300, 300), "FPS: " + m_FPS, style); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RaymarchExample.shader: -------------------------------------------------------------------------------- 1 | //// create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | //// date:2018-04-12 4 | //// email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/RaymarchMergeExample" { 6 | Properties{ 7 | _MainTex("Base (RGB)", 2D) = "white" {} 8 | } 9 | SubShader{ 10 | Pass { 11 | ZTest Always Cull Off ZWrite Off 12 | CGPROGRAM 13 | 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | #include "ShaderLibs/Framework3D.cginc" 17 | 18 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 19 | float3 col = float3(0.,0.,0.); 20 | float3 n = float3(0.,1.0,0.); 21 | float t = sceneDep + 10; 22 | float occ = 0.; 23 | float3 sc = float3(0.,1.0+0.5*sin(ftime*PI2),0.); 24 | float3 sr = 0.5; 25 | float3 ce = sc - ro; 26 | float b = dot( rd, ce ); 27 | float tt = sr*sr - (dot( ce, ce )- b*b ); 28 | if( tt > 0.0 ){ 29 | t = b - sqrt(tt); 30 | float3 p = ro+t*rd; 31 | col = 0.5+0.5*cos(2.*PI*(float3(1.,1.,1.)*p.y*0.2+float3(0.,0.33,0.67))); 32 | } 33 | MergeRayMarchingIntoUnity(t,col, sceneDep,sceneCol); 34 | return float4(col,1.0); 35 | } 36 | ENDCG 37 | }//end pass 38 | }//end SubShader 39 | FallBack Off 40 | } 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/SDFBouncedBall.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/SDFBouncedBall" { 5 | Properties{ 6 | _MainTex("Base (RGB)", 2D) = "white" {} 7 | } 8 | SubShader{ 9 | Pass { 10 | ZTest Always Cull Off ZWrite Off 11 | CGPROGRAM 12 | 13 | #pragma vertex vert 14 | #pragma fragment frag 15 | 16 | #define DEFAULT_MAT_COL 17 | #define DEFAULT_PROCESS_FRAG 18 | #define DEFAULT_RENDER 19 | #include "ShaderLibs/Framework3D_DefaultRender.cginc" 20 | 21 | float SdBounceBalls(float3 pos){ 22 | float SIZE = 2.; 23 | float2 gridSize = float2(SIZE,SIZE); 24 | float rv = Hash12( floor((pos.xz) / gridSize)); 25 | pos.xz = OpRep(pos.xz,gridSize); 26 | float bollSize = 0.1; 27 | float bounceH = .5; 28 | return SdSphere(pos- float3(0.,(bollSize+bounceH+sin(_Time.y*3.14 + rv*6.24)*bounceH),0.),bollSize); 29 | } 30 | 31 | float2 Map( in float3 pos ) 32 | { 33 | float2 res = float2( SdPlane( pos), 1.0 ) ; 34 | res = OpU( res, float2( SdBounceBalls( pos),1.) ); 35 | return res; 36 | } 37 | 38 | ENDCG 39 | }//end pass 40 | }//end SubShader 41 | FallBack Off 42 | } 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/PostEffectsBase.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | [ExecuteInEditMode] 5 | [RequireComponent (typeof(Camera))] 6 | public class PostEffectsBase : MonoBehaviour { 7 | 8 | // Called when start 9 | protected void CheckResources() { 10 | bool isSupported = CheckSupport(); 11 | 12 | if (isSupported == false) { 13 | NotSupported(); 14 | } 15 | } 16 | 17 | // Called in CheckResources to check support on this platform 18 | protected bool CheckSupport() { 19 | if (SystemInfo.supportsImageEffects == false) { 20 | Debug.LogWarning("This platform does not support image effects."); 21 | return false; 22 | } 23 | 24 | return true; 25 | } 26 | 27 | // Called when the platform doesn't support this effect 28 | protected void NotSupported() { 29 | enabled = false; 30 | } 31 | 32 | protected void Start() { 33 | CheckResources(); 34 | } 35 | 36 | // Called when need to create the material used by this effect 37 | protected Material CheckShaderAndCreateMaterial(Shader shader, Material material) { 38 | if (shader == null) { 39 | return null; 40 | } 41 | 42 | if (shader.isSupported && material && material.shader == shader) 43 | return material; 44 | 45 | if (!shader.isSupported) { 46 | return null; 47 | } 48 | else { 49 | material = new Material(shader); 50 | material.hideFlags = HideFlags.DontSave; 51 | if (material) 52 | return material; 53 | else 54 | return null; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor/EditorCreateTerrialMap.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | 7 | 8 | public class EditorCreateTerrialMap { 9 | static Texture2D texMatrix; 10 | public static int wid = 512; 11 | public static int hei = 512; 12 | public static int scale = 10; 13 | public static int bordPixelNum = 16; 14 | 15 | public static string TerrialMapTexPath = "/Textures/TerrialMap.png"; 16 | 17 | 18 | [MenuItem("Tool/CreateTerrialMap")] 19 | public static void CreateWhiteNoiseTex() { 20 | //FastNoise fn = new FastNoise(); 21 | // 22 | //Color[] colors = new Color[wid * hei]; 23 | //for (int i = 0; i < hei; i++) { 24 | // for (int j = 0; j < wid; j++) { 25 | // var val = fn.GetPerlinFractal(i, j); ; 26 | // colors[i * wid + j].r = val; 27 | // colors[i * wid + j].a = 1.0f; 28 | // } 29 | //} 30 | //SaveToPic(colors, TerrialMapTexPath); 31 | } 32 | 33 | static void SaveToPic(Color[] colors, string relPath) { 34 | texMatrix = new Texture2D(wid, hei); 35 | texMatrix.SetPixels(colors); 36 | texMatrix.Apply(); 37 | byte[] bytes = texMatrix.EncodeToPNG(); 38 | // 将字节保存成图片,这个路径只能在PC端对图片进行读写操作 39 | var path = ConstVar.ProjectDir + relPath; 40 | System.IO.File.WriteAllBytes(path, bytes); 41 | UnityEditor.AssetDatabase.ImportAsset(path); 42 | UnityEditor.AssetDatabase.Refresh(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/ThirdPersonUserControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | public class ThirdPersonUserControl : MonoBehaviour { 5 | public float moveSpd = 5; 6 | public float turnSpeed = 180; 7 | public float lerpSpd = 2f; 8 | public Camera cam; 9 | public Vector3 relSrcPos = new Vector3(0,7,-7); 10 | public Vector3 relTargetPos = new Vector3(0, 0, 7); 11 | float up; 12 | private void Update() { 13 | float h = Input.GetAxis("Horizontal"); 14 | float v = Input.GetAxis("Vertical"); 15 | bool crouch = Input.GetKey(KeyCode.C); 16 | up = 0; 17 | if (Input.GetKey(KeyCode.F)) { 18 | up = -1; 19 | } 20 | if (Input.GetKey(KeyCode.G)) { 21 | up = 1; 22 | } 23 | 24 | transform.Rotate(0, h * turnSpeed * Time.deltaTime, 0); 25 | transform.position += (v * transform.forward + up * transform.up) * moveSpd * Time.deltaTime; 26 | if (cam != null) { 27 | var camTran = cam.transform; 28 | var srcRot = camTran.rotation; 29 | var srcPos = camTran.position; 30 | var dstPos = transform.TransformPoint(relSrcPos); 31 | var targetPos = transform.TransformPoint(relTargetPos); 32 | camTran.position = dstPos; 33 | camTran.LookAt(targetPos); 34 | var dstRot = camTran.rotation; 35 | 36 | camTran.position = Vector3.Slerp(srcPos, dstPos, Time.deltaTime* lerpSpd); 37 | camTran.rotation = Quaternion.Slerp(srcRot, dstRot, Time.deltaTime* lerpSpd); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Sky.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-13 email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/Mountain" { 5 | Properties{ 6 | _MainTex("Base (RGB)", 2D) = "white" {} 7 | } 8 | SubShader{ 9 | Pass { 10 | ZTest Always Cull Off ZWrite Off 11 | CGPROGRAM 12 | 13 | #pragma vertex vert 14 | #pragma fragment frag 15 | #include "ShaderLibs/Framework3D.cginc" 16 | 17 | 18 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 19 | fixed3 col = fixed3(0.0,0.0,0.0); 20 | float3 light1 = normalize( float3(-0.8,0.4,-0.3) ); 21 | float sundot = clamp(dot(rd,light1),0.0,1.0); 22 | 23 | // sky 24 | col = float3(0.2,0.5,0.85)*1.1 - rd.y*rd.y*0.5; 25 | col = lerp( col, 0.85*float3(0.7,0.75,0.85), pow( 1.0-max(rd.y,0.0), 4.0 ) ); 26 | // sun 27 | col += 0.25*float3(1.0,0.7,0.4)*pow( sundot,5.0 ); 28 | col += 0.25*float3(1.0,0.8,0.6)*pow( sundot,64.0 ); 29 | col += 0.2*float3(1.0,0.8,0.6)*pow( sundot,512.0 ); 30 | // clouds 31 | col = Cloud(col,ro,rd,float3(1.0,0.95,1.0),1,1); 32 | // . 33 | col = lerp( col, 0.68*float3(0.4,0.65,1.0), pow( 1.0-max(rd.y,0.0), 16.0 ) ); 34 | sceneCol.xyz = col; 35 | return sceneCol; 36 | } 37 | ENDCG 38 | }//end pass 39 | }//end SubShader 40 | FallBack Off 41 | } 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Voronoi.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-12 email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/Voronoi" 5 | { 6 | Properties 7 | { 8 | _MainTex ("Texture", 2D) = "white" {} 9 | _TileNum ("TileNum", float) = 5 10 | } 11 | 12 | SubShader 13 | { 14 | Tags { "RenderType"="Opaque" } 15 | LOD 100 16 | 17 | Pass 18 | { 19 | CGPROGRAM 20 | #pragma vertex vert 21 | #pragma fragment frag 22 | #include "UnityCG.cginc" 23 | #include "ShaderLibs/Noise.cginc" 24 | struct appdata 25 | { 26 | float4 vertex : POSITION; 27 | float2 uv : TEXCOORD0; 28 | }; 29 | 30 | struct v2f 31 | { 32 | float2 uv : TEXCOORD0; 33 | float4 vertex : SV_POSITION; 34 | }; 35 | 36 | sampler2D _MainTex; 37 | float4 _MainTex_ST; 38 | float _TileNum ; 39 | 40 | #define HASHSCALE3 float3(.1031, .1030, .0973) 41 | 42 | v2f vert (appdata v) 43 | { 44 | v2f o; 45 | o.vertex = UnityObjectToClipPos(v.vertex); 46 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 47 | return o; 48 | } 49 | 50 | fixed4 frag (v2f i) : SV_Target 51 | { 52 | float2 uv = _TileNum * i.uv; 53 | float time = _Time.y; 54 | float val = WNoise(uv,time); 55 | 56 | return float4(val,val,val,1.0); 57 | } 58 | ENDCG 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/TerrialMap.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab1e112e2751b8e489ccd5c11d6ee604 3 | timeCreated: 1524034873 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/Tile.tga.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f714f2f5038ac3b469734ab1cc8f9647 3 | timeCreated: 1520648314 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/PerlinNoise.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2728a4d324dbeb448a79646bb06d7b2 3 | timeCreated: 1523795424 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/TerrianMap.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-12 email: jiepengtan@gmail.com 4 | // all right reserve 5 | Shader "FishManShaderTutorial/Ripple" 6 | { 7 | Properties 8 | { 9 | _MainTex ("Texture", 2D) = "white" {} 10 | _Color ("color", Color) = (.34, .85, .92, 1) // color 11 | crossGridNum ("crossGridNum", float) = 1.//Maximum number of cells a ripple can cross. 12 | _Precision ("_Precision", float) = 1.//peroid 13 | _High ("_High", float) = 2.//wave move speed 14 | 15 | } 16 | 17 | SubShader 18 | { 19 | Tags { "RenderType"="Opaque" } 20 | LOD 100 21 | 22 | Pass 23 | { 24 | CGPROGRAM 25 | #pragma vertex vert 26 | #pragma fragment frag 27 | #include "UnityCG.cginc" 28 | //#include "ShaderLibs/Noise.cginc" 29 | struct appdata 30 | { 31 | float4 vertex : POSITION; 32 | float2 uv : TEXCOORD0; 33 | }; 34 | 35 | struct v2f 36 | { 37 | float2 uv : TEXCOORD0; 38 | float4 vertex : SV_POSITION; 39 | }; 40 | 41 | sampler2D _MainTex; 42 | float4 _MainTex_ST; 43 | float _Precision; 44 | float _High; 45 | 46 | v2f vert (appdata v) 47 | { 48 | v2f o; 49 | o.vertex = UnityObjectToClipPos(v.vertex); 50 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 51 | return o; 52 | } 53 | fixed4 frag (v2f i) : SV_Target 54 | { 55 | float2 uv = i.uv * float2(_ScreenParams.x/_ScreenParams.y,1.0); 56 | // sample the texture 57 | float3 col = float3(0.,0.,0.); 58 | return float4(col,1.0); 59 | /**/ 60 | } 61 | ENDCG 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/CameraControler.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | 5 | public class CameraControler : MonoBehaviour { 6 | 7 | public float moveSpd = 10f; 8 | public float rotateSpd = 1f; 9 | //旋转变量; 10 | private float m_deltX = 0f; 11 | private float m_deltY = 0f; 12 | //缩放变量; 13 | private float m_distance = 10f; 14 | private float m_mSpeed = 5f; 15 | //移动变量; 16 | private Vector3 m_mouseMovePos = Vector3.zero; 17 | Camera camera; 18 | void Start() { 19 | camera = GetComponent(); 20 | if (camera == null) { 21 | enabled = false; 22 | return; 23 | } 24 | } 25 | 26 | void Update() { 27 | //鼠标右键点下控制相机旋转; 28 | if (Input.GetMouseButton(1)) { 29 | m_deltX += Input.GetAxis("Mouse X") * m_mSpeed * rotateSpd; 30 | m_deltY -= Input.GetAxis("Mouse Y") * m_mSpeed * rotateSpd; 31 | m_deltX = ClampAngle(m_deltX, -360, 360); 32 | m_deltY = ClampAngle(m_deltY, -70, 70); 33 | camera.transform.rotation = Quaternion.Euler(m_deltY, m_deltX, 0); 34 | } 35 | if (Input.GetMouseButton(2)) { 36 | transform.Translate(Vector3.left * Input.GetAxis("Mouse X")); 37 | transform.Translate(Vector3.down * Input.GetAxis("Mouse Y")); 38 | } 39 | //鼠标中键点下场景缩放; 40 | if (Input.GetAxis("Mouse ScrollWheel") != 0) { 41 | //自由缩放方式; 42 | m_distance = Input.GetAxis("Mouse ScrollWheel") * 10f; 43 | camera.transform.localPosition = camera.transform.position + camera.transform.forward * m_distance * moveSpd; 44 | } 45 | 46 | //相机复位远点; 47 | if (Input.GetKey(KeyCode.Space)) { 48 | m_distance = 10.0f; 49 | camera.transform.localPosition = new Vector3(0, m_distance, 0); 50 | } 51 | } 52 | 53 | //规划角度; 54 | float ClampAngle(float angle, float minAngle, float maxAgnle) { 55 | if (angle <= -360) 56 | angle += 360; 57 | if (angle >= 360) 58 | angle -= 360; 59 | 60 | return Mathf.Clamp(angle, minAngle, maxAgnle); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Math.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-03-27 4 | #ifndef FMST_MATH 5 | #define FMST_MATH 6 | 7 | #define PI 3.14159265359 8 | #define PI2 6.28318530718 9 | #define Deg2Radius PI/180. 10 | #define Radius2Deg 180./PI 11 | 12 | #define clamp01(a) clamp(a,0.0,1.0) 13 | 14 | float length2( float2 p ) 15 | { 16 | return sqrt( p.x*p.x + p.y*p.y ); 17 | } 18 | 19 | float length6( float2 p ) 20 | { 21 | p = p*p*p; p = p*p; 22 | return pow( p.x + p.y, 1.0/6.0 ); 23 | } 24 | 25 | float length8( float2 p ) 26 | { 27 | p = p*p; p = p*p; p = p*p; 28 | return pow( p.x + p.y, 1.0/8.0 ); 29 | } 30 | 31 | 32 | float smin( float a, float b, float k ) 33 | { 34 | float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 ); 35 | return lerp( b, a, h ) - k*h*(1.0-h); 36 | } 37 | #define _m2 (float2x2(0.8,-0.6,0.6,0.8)) 38 | #define _m3 (float3x3( 0.00, 0.80, 0.60, -0.80, 0.36, -0.48, -0.60, -0.48, 0.64 )) 39 | 40 | float2x2 Rot2D(float a){a*= Radius2Deg; float sa = sin(a); float ca = cos(a); return float2x2(ca,-sa,sa,ca);} 41 | float2x2 Rot2DRad(float a){float sa = sin(a); float ca = cos(a); return float2x2(ca,-sa,sa,ca);} 42 | 43 | 44 | float3x3 Rotx(float a){a*= Radius2Deg; float sa = sin(a); float ca = cos(a); return float3x3(1.,.0,.0, .0,ca,sa, .0,-sa,ca);} 45 | float3x3 Roty(float a){a*= Radius2Deg; float sa = sin(a); float ca = cos(a); return float3x3(ca,.0,sa, .0,1.,.0, -sa,.0,ca);} 46 | float3x3 Rotz(float a){a*= Radius2Deg; float sa = sin(a); float ca = cos(a); return float3x3(ca,sa,.0, -sa,ca,.0, .0,.0,1.); } 47 | 48 | float3x3 RotEuler(float3 ang) { 49 | ang = ang*Radius2Deg; 50 | float2 a1 = float2(sin(ang.x),cos(ang.x)); 51 | float2 a2 = float2(sin(ang.y),cos(ang.y)); 52 | float2 a3 = float2(sin(ang.z),cos(ang.z)); 53 | float3x3 m; 54 | m[0] = float3(a1.y*a3.y+a1.x*a2.x*a3.x,a1.y*a2.x*a3.x+a3.y*a1.x,-a2.y*a3.x); 55 | m[1] = float3(-a2.y*a1.x,a1.y*a2.y,a2.x); 56 | m[2] = float3(a3.y*a1.x*a2.x+a1.y*a3.x,a1.x*a3.x-a1.y*a3.y*a2.x,a2.y*a3.y); 57 | return m; 58 | } 59 | 60 | float Remap(float oa,float ob,float na,float nb,float val){ 61 | return (val-oa)/(ob-oa) * (nb-na) + na; 62 | } 63 | #endif // FMST_MATH -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/NoiseTex.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab95a43a8c8a5394fa9247158b3ffb37 3 | timeCreated: 1523846670 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | sRGBTexture: 0 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 1 31 | aniso: 0 32 | mipBias: -1 33 | wrapMode: 0 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 0 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 512 55 | textureFormat: -1 56 | textureCompression: 0 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 512 63 | textureFormat: -1 64 | textureCompression: 0 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: Android 70 | maxTextureSize: 512 71 | textureFormat: -1 72 | textureCompression: 0 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | spriteSheet: 78 | serializedVersion: 2 79 | sprites: [] 80 | outline: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/GrayNoise.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b45493ab65ef3f843ac99a1b1d73b7f4 3 | timeCreated: 1523952852 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 1 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: Android 70 | maxTextureSize: 2048 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | spriteSheet: 78 | serializedVersion: 2 79 | sprites: [] 80 | outline: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Textures/MainTex/WhiteNoise.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4ac261bc347f8a4d9f56b98757d646e 3 | timeCreated: 1523795505 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: 0 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: Android 70 | maxTextureSize: 2048 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | spriteSheet: 78 | serializedVersion: 2 79 | sprites: [] 80 | outline: [] 81 | spritePackingTag: 82 | userData: 83 | assetBundleName: 84 | assetBundleVariant: 85 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DFireParticle.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-03-27 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/2DFireParticle"{ 6 | Properties{ 7 | _MainTex ("MainTex", 2D) = "white" {} 8 | _Color ("_Color", Color) = (1.0,0.3,0.0,1.) 9 | _GridSize ("SparkGridSize", float) = 30 10 | _RotSpd ("_RotSpd", float) = 0.5 11 | _YSpd ("_YSpd", float) = 0.7 12 | 13 | } 14 | 15 | SubShader 16 | { 17 | Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } 18 | 19 | Pass 20 | { 21 | ZWrite Off 22 | Blend SrcAlpha OneMinusSrcAlpha 23 | 24 | CGPROGRAM 25 | #pragma vertex vert 26 | #pragma fragment frag 27 | #include "ShaderLibs/Framework2D.cginc" 28 | 29 | float3 _Color; 30 | float _GridSize; 31 | float _RotSpd; 32 | float _YSpd; 33 | float3 ProcessFrag(float2 uv){ 34 | float3 acc = float3(0.0,0.0,0.0); 35 | 36 | float rotDeg = 3.*_RotSpd * ftime; 37 | float yOffset = 4.*_YSpd* ftime; 38 | 39 | float2 coord = uv*_GridSize - float2(0.,yOffset);//整体沿y轴上升 40 | if (abs(fmod(coord.y,2.0))<1.0) //让格子交错 41 | coord.x += 0.5; 42 | float2 gridIndex = float2(floor(coord)); 43 | float rnd = Hash12(gridIndex);//根据ID 获取hash值 44 | // 弥补y轴上升的逆差 获取原来的y值 45 | // 同时因为gridIndex = floor(coord) 的原因 会让tempY值在锁定固定的grid的同时越来越大; 46 | float tempY = gridIndex.y + yOffset ; 47 | float life = min( 10.0*(1.0-min((tempY)/(24.0-20.0*rnd)//生命值随机 48 | ,1.0)),1.0); 49 | if (life>0.0 ) { 50 | float size = 0.08*rnd;//让大小随机化 51 | float deg = 999.0*rnd*2.0*PI + rotDeg*(0.5+0.5*rnd);//添加旋转随机化 52 | float radius = 0.5-size*0.2; 53 | float2 cirOffset = radius*float2(sin(deg),cos(deg));//单位圆旋转偏移 54 | float2 part = frac(coord-cirOffset) - 0.5 ;//让格子自己旋转起来 位置变 方向不变 55 | float len = length(part); 56 | float sparksGray = max(0.0,1.0 -len/size);//画圆 57 | float sinval = sin(PI*1.*(0.3+0.7*rnd)*ftime+rnd*10.);//加点亮度的变化实现闪烁 58 | float period = clamp(pow(pow(sinval,5.),5.),0.,1.); 59 | float blink =(0.8+0.8*abs(period)); 60 | acc = life*sparksGray*_Color*blink; 61 | } 62 | return acc; 63 | } 64 | ENDCG 65 | }//end pass 66 | }//end SubShader 67 | }//end Shader 68 | 69 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/FBM.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-03-27 4 | #ifndef FMST_FBM 5 | #define FMST_FBM 6 | 7 | #include "Noise.cginc" 8 | 9 | 10 | float FBM( float2 p ) 11 | { 12 | float f = 0.0; 13 | f += 0.50000*Noise( p*1.0 ); 14 | f += 0.25000*Noise( p*2.03 ); 15 | f += 0.12500*Noise( p*4.01 ); 16 | f += 0.06250*Noise( p*8.05 ); 17 | f += 0.03125*Noise( p*16.02 ); 18 | return f/0.984375; 19 | } 20 | float FBM( float2 p,float iterNum) 21 | { 22 | float f = 0.0; 23 | float s = 0.5; 24 | float s2 = 2.00; 25 | float sum = 0.0; 26 | for(int i = 0;i< iterNum;i++){ 27 | f += s*Noise( p ); 28 | p *=s2; 29 | sum+=s; 30 | s*= 0.5;s2+=0.01; 31 | } 32 | return f/sum; 33 | } 34 | 35 | float FBMR( float2 p ) 36 | { 37 | float f = 0.0; 38 | 39 | f += 0.50000*Noise( p ); p = mul(_m2,p)*2.02; 40 | f += 0.25000*Noise( p ); p = mul(_m2,p)*2.03; 41 | f += 0.12500*Noise( p ); p = mul(_m2,p)*2.01; 42 | f += 0.06250*Noise( p ); p = mul(_m2,p)*2.04; 43 | f += 0.03125*Noise( p ); 44 | return f/0.984375; 45 | } 46 | float FBMR( float3 p ) 47 | { 48 | float f = 0.0; 49 | 50 | f += 0.50000*Noise( p ); p = mul(_m3,p)*2.02; 51 | f += 0.25000*Noise( p ); p = mul(_m3,p)*2.03; 52 | f += 0.12500*Noise( p ); p = mul(_m3,p)*2.01; 53 | f += 0.06250*Noise( p ); p = mul(_m3,p)*2.04; 54 | f += 0.03125*Noise( p ); 55 | return f/0.984375; 56 | } 57 | float FBMR( float2 p,float iterNum) 58 | { 59 | float f = 0.0; 60 | float s = 0.5; 61 | float s2 = 2.00; 62 | float sum = 0.0; 63 | for(int i = 0;i< iterNum;i++){ 64 | f += s*Noise( p ); 65 | p = mul(_m2,p)*s2; 66 | sum+=s; 67 | s*= 0.5;s2+=0.01; 68 | } 69 | return f/sum; 70 | } 71 | 72 | float FBM( in float3 p ) 73 | { 74 | float n = 0.0; 75 | n += 0.50000*Noise( p*1.0 ); 76 | n += 0.25000*Noise( p*2.0 ); 77 | n += 0.12500*Noise( p*4.0 ); 78 | n += 0.06250*Noise( p*8.0 ); 79 | n += 0.03125*Noise( p*16.0 ); 80 | return n/0.984375; 81 | } 82 | 83 | float FBM( float3 p,float iterNum) 84 | { 85 | float f = 0.0; 86 | float s = 0.5; 87 | float s2 = 2.00; 88 | float sum = 0.0; 89 | for(int i = 0;i< iterNum;i++){ 90 | f += s*Noise( p ); 91 | p *=s2; 92 | sum+=s; 93 | s*= 0.5;s2+=0.01; 94 | } 95 | return f/sum; 96 | } 97 | 98 | #endif // FMST_FBM 99 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Fog.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-13 email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/Fog" { 5 | Properties{ 6 | _MainTex("Base (RGB)", 2D) = "white" {} 7 | _LoopNum ("_LoopNum", Vector) = (40.,128., 1, 1) 8 | _FogSpd ("_FogSpd", Vector) = (1.,0.,0.,0.5) 9 | _FogHighRange ("_FogHighRange", Vector) = (-5,10,0.,0.5) 10 | _FogCol ("_FogCol", COLOR) = (.025, .2, .125,0.) 11 | 12 | } 13 | SubShader{ 14 | Pass { 15 | ZTest Always Cull Off ZWrite Off 16 | CGPROGRAM 17 | float4 _LoopNum = float4(40.,128.,0.,0.); 18 | float3 _FogSpd ; 19 | float2 _FogHighRange; 20 | fixed3 _FogCol; 21 | 22 | #pragma vertex vert 23 | #pragma fragment frag 24 | #include "ShaderLibs/Framework3D.cginc" 25 | #define ITR 100 26 | #define FAR 50. 27 | 28 | 29 | fixed3 Normal(in fixed3 p) 30 | { 31 | return float3(0.,1.0,0.); 32 | } 33 | 34 | fixed RayCast(in fixed3 ro, in fixed3 rd) 35 | { 36 | if (rd.y>=0.0) { 37 | return 100000; 38 | } 39 | float d = -(ro.y - 0.)/rd.y; 40 | d = min(100000.0, d); 41 | return d; 42 | } 43 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol){ 44 | fixed3 ligt = normalize( fixed3(.5, .05, -.2) ); 45 | fixed3 ligt2 = normalize( fixed3(.5, -.1, -.2) ); 46 | 47 | fixed rz = RayCast(ro,rd); 48 | 49 | fixed3 fogb = lerp(fixed3(.7,.8,.8 )*0.3, fixed3(1.,1.,.77)*.95, pow(dot(rd,ligt2)+1.2, 2.5)*.25); 50 | fogb *= clamp(rd.y*.5+.6, 0., 1.); 51 | fixed3 col = fogb; 52 | 53 | if ( rz < FAR ) 54 | { 55 | fixed3 pos = ro+rz*rd; 56 | fixed3 nor= Normal( pos ); 57 | fixed dif = clamp( dot( nor, ligt ), 0.0, 1.0 ); 58 | fixed spe = pow(clamp( dot( reflect(rd,nor), ligt ), 0.0, 1.0 ),50.); 59 | col = lerp(fixed3(0.1,0.2,1),fixed3(.3,.5,1),pos.y*.5)*0.2+.1; 60 | col = col*dif + col*spe*.5 ; 61 | } 62 | 63 | MergeRayMarchingIntoUnity(rz,col,sceneDep,sceneCol); 64 | 65 | col = lerp(col, fogb, smoothstep(FAR-7.,FAR,rz)); 66 | //then volumetric fog 67 | col = Fog(col, ro, rd, rz,_FogCol,_FogSpd,_FogHighRange); 68 | //post 69 | col = pow(col,float3(0.8,0.8,0.8)); 70 | sceneCol.xyz = col; 71 | return sceneCol; 72 | } 73 | ENDCG 74 | }//end pass 75 | }//end SubShader 76 | FallBack Off 77 | } 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DRain.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-03-27 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/2DRain"{ 6 | Properties{ 7 | _MainTex ("MainTex", 2D) = "white" {} 8 | _NoiseTex ("_NoiseTex", 2D) = "white" {} 9 | _LoopNum ("_LoopNum", Vector) = (1, 1, 1, 1) 10 | } 11 | 12 | SubShader 13 | { 14 | Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } 15 | 16 | Pass 17 | { 18 | ZWrite Off 19 | Blend SrcAlpha OneMinusSrcAlpha 20 | 21 | CGPROGRAM 22 | #pragma vertex vert 23 | #pragma fragment frag 24 | #include "ShaderLibs/Framework2D.cginc" 25 | 26 | fixed2 Rains(fixed2 uv, fixed seed, fixed m) { 27 | float period = 5;//雨滴在格子中循环的周期 28 | float2 retVal = float2(0.0,0.0); 29 | float aspectRatio = 4.0;//雨滴的宽高比 30 | float tileNum = 5;//平铺数量 31 | float ySpd = 0.1; 32 | uv.y += ftime * 0.0618;//加点y轴移动 =PI2 /period *0.45*0.55 / tileNum 33 | uv *= fixed2(tileNum * aspectRatio,tileNum);//栅格化uv 34 | //加点基于格子的随机值 35 | fixed idRand = Hash12(floor(uv)); 36 | uv = frac(uv); 37 | float2 gridUV = uv; 38 | uv -=0.5;//(-0.5,0.5) 39 | //此处uv值范围为(-0.5,0.5) 40 | //*0.45的原因 是让水滴在格子内游走刚好让上下两个格子之间游走, 41 | //从而在视觉上格子之间的水滴是可以碰撞的,从而克服格子的空间的分割感 42 | float t = ftime * PI2 /period; 43 | t += idRand * PI2;//添加Y随机值 44 | 45 | uv.y += sin(t+sin(t+sin(t)*0.55))*0.45; 46 | uv.y *= aspectRatio; 47 | //添加x轴随机偏移 48 | uv.x += (idRand-.5)*.6; 49 | 50 | float r = length(uv); 51 | r = smoothstep(0.2,0.1,r); 52 | 53 | //添加尾迹 54 | float tailTileNum = 3.0; 55 | float2 tailUV =uv * float2(1.0,tailTileNum); 56 | tailUV.y = frac(tailUV.y) - 0.5; 57 | tailUV.x *= tailTileNum; 58 | //在雨滴上面总共有 59 | float rtail = length(tailUV); 60 | //尾迹塑形 61 | rtail *= uv.y * 1.5; 62 | rtail = smoothstep(0.2,0.1,rtail); 63 | //切除掉大雨滴下面的部分 64 | rtail *= smoothstep(0.3,0.5,uv.y); 65 | retVal = float2(rtail*tailUV+r*uv); 66 | return retVal; 67 | } 68 | 69 | float3 ProcessFrag(float2 _uv){ 70 | float baseOffset = 0.1; 71 | float2 uv = _uv; 72 | uv *= float2(_ScreenParams.x/_ScreenParams.y,1.0); 73 | float x = (sin(_Time.y*.1)*.5+.5)*.3; 74 | x =x*x; 75 | x+= baseOffset; 76 | float s = sin(x); 77 | float c = cos(x); 78 | float2x2 rot = float2x2(c, -s, s, c); 79 | uv = mul(rot,uv); 80 | float moveSpd = 0.1; 81 | float2 rainUV = float2(0.,0.); 82 | rainUV += Rains(uv,152.12,moveSpd); 83 | rainUV += Rains(uv*2.32, 25.23, moveSpd); 84 | fixed4 finalColor = tex2D(_MainTex, _uv + rainUV*2.); 85 | return finalColor.xyz; 86 | } 87 | ENDCG 88 | }//end pass 89 | }//end SubShader 90 | }//end Shader 91 | 92 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/MergeRayMarch.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | [ExecuteInEditMode] 5 | [RequireComponent(typeof(Camera))] 6 | public class MergeRayMarch : MonoBehaviour { 7 | public Material material; 8 | public Texture2D _NoiseTex; 9 | public Vector4 _LoopNum; 10 | 11 | private Camera myCamera; 12 | public new Camera camera { 13 | get { 14 | if (myCamera == null) { 15 | myCamera = GetComponent(); 16 | } 17 | return myCamera; 18 | } 19 | } 20 | 21 | private Transform myCameraTransform; 22 | public Transform cameraTransform { 23 | get { 24 | if (myCameraTransform == null) { 25 | myCameraTransform = camera.transform; 26 | } 27 | 28 | return myCameraTransform; 29 | } 30 | } 31 | 32 | 33 | private void Start() { 34 | if (material == null || material.shader == null || !material.shader.isSupported) { 35 | this.enabled = false; 36 | return; 37 | } 38 | } 39 | void OnEnable() { 40 | camera.depthTextureMode |= DepthTextureMode.Depth; 41 | } 42 | 43 | [ImageEffectOpaque] 44 | void OnRenderImage (RenderTexture src, RenderTexture dest) { 45 | if (material != null) { 46 | SetRay(); 47 | material.SetTexture("_NoiseTex", _NoiseTex); 48 | material.SetVector("_LoopNum", _LoopNum); 49 | Graphics.Blit(src, dest, material); 50 | } else { 51 | Graphics.Blit(src, dest); 52 | } 53 | } 54 | 55 | private void SetRay() { 56 | Matrix4x4 frustumCorners = Matrix4x4.identity; 57 | 58 | float fov = camera.fieldOfView; 59 | float near = camera.nearClipPlane; 60 | float aspect = camera.aspect; 61 | 62 | float halfHeight = near * Mathf.Tan(fov * 0.5f * Mathf.Deg2Rad); 63 | Vector3 toRight = cameraTransform.right * halfHeight * aspect; 64 | Vector3 toTop = cameraTransform.up * halfHeight; 65 | 66 | Vector3 topLeft = cameraTransform.forward * near + toTop - toRight; 67 | float scale = topLeft.magnitude / near; 68 | 69 | topLeft.Normalize(); 70 | topLeft *= scale; 71 | 72 | Vector3 topRight = cameraTransform.forward * near + toRight + toTop; 73 | topRight.Normalize(); 74 | topRight *= scale; 75 | 76 | Vector3 bottomLeft = cameraTransform.forward * near - toTop - toRight; 77 | bottomLeft.Normalize(); 78 | bottomLeft *= scale; 79 | 80 | Vector3 bottomRight = cameraTransform.forward * near + toRight - toTop; 81 | bottomRight.Normalize(); 82 | bottomRight *= scale; 83 | 84 | frustumCorners.SetRow(0, bottomLeft); 85 | frustumCorners.SetRow(1, bottomRight); 86 | frustumCorners.SetRow(2, topRight); 87 | frustumCorners.SetRow(3, topLeft); 88 | 89 | material.SetMatrix("_FrustumCornersRay", frustumCorners); 90 | material.SetMatrix("_UnityMatVP", frustumCorners); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Lake.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-04-16 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/Lake" { 6 | Properties{ 7 | _MainTex("Base (RGB)", 2D) = "white" {} 8 | _LoopNum ("_LoopNum", Vector) = (40.,128., 1, 1) 9 | _BaseWaterColor ("_BaseWaterColor", COLOR) = (.025, .2, .125,0.) 10 | _LightWaterColor ("_LightWaterColor", COLOR) = (.025, .2, .125,0.) 11 | waterHeight ("waterHeight", float) =1.0 12 | lightDir ("lightDir", Vector) =(-0.8,0.4,-0.3,0.) 13 | } 14 | SubShader{ 15 | Pass { 16 | ZTest Always Cull Off ZWrite Off 17 | CGPROGRAM 18 | float4 _LoopNum = float4(40.,128.,0.,0.); 19 | //#define USING_PERLIN_NOISE 20 | #pragma vertex vert 21 | #pragma fragment frag 22 | #include "ShaderLibs/Framework3D.cginc" 23 | 24 | float3 _BaseWaterColor; 25 | float3 _LightWaterColor; 26 | 27 | float waterHeight = 4.; 28 | 29 | float3 lightDir ; 30 | float _FBM( in float3 p ) { 31 | float f = 0.0; 32 | f += 0.5000*Noise( p ); p = mul(_m3,p)*2.02; 33 | f += 0.2500*Noise( p ); p = mul(_m3,p)*2.03; 34 | f += 0.1250*Noise( p ); p = mul(_m3,p)*2.01; 35 | f += 0.0625*Noise( p ); 36 | return f/0.9375; 37 | } 38 | float WaterMap( fixed3 pos ) { 39 | return _FBM( fixed3( pos.xz, ftime )) * 1; 40 | } 41 | 42 | float3 WaterNormal(float3 pos,float rz){ 43 | float EPSILON = 0.001 * rz; 44 | float3 dx = float3( EPSILON, 0.,0. ); 45 | float3 dz = float3( 0.,0., EPSILON ); 46 | 47 | float3 normal = float3( 0., 1., 0. ); 48 | float bumpfactor = 0.2 * (1. - smoothstep( 0., 1000, rz) );//根据距离所见Bump幅度 49 | 50 | normal.x = -bumpfactor * (WaterMap(pos + dx) - WaterMap(pos-dx) ) / (2. * EPSILON); 51 | normal.z = -bumpfactor * (WaterMap(pos + dz) - WaterMap(pos-dz) ) / (2. * EPSILON); 52 | return normalize( normal ); 53 | } 54 | 55 | 56 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol){ 57 | fixed3 col = Sky(ro,rd,lightDir); 58 | if(rd.y < -0.01 ) { 59 | float rz = (-ro.y)/rd.y; 60 | float3 pos = ro + rd * rz; 61 | float3 normal = WaterNormal(pos,rz); 62 | float ndotr = dot(normal,-rd); 63 | float fresnel = pow(1.0-abs(ndotr),6.);//计算 64 | float3 reflectRd = reflect( rd, normal); 65 | float3 reflectCol = Sky( ro, reflectRd,lightDir); 66 | 67 | float3 diff = pow(dot(normal,lightDir) * 0.4 + 0.6,3.); 68 | float3 refractCol = _BaseWaterColor + diff * _LightWaterColor * 0.12; 69 | 70 | col = lerp(refractCol,reflectCol,fresnel); 71 | 72 | float nrm = (60. + 8.0) / (PI * 8.0); 73 | float spec= pow(max(dot(reflectRd,lightDir),0.0),128.) * nrm; 74 | col += float3(spec,spec,spec); 75 | } 76 | col = pow(col,float3(0.8,0.8,0.8)); 77 | 78 | sceneCol.xyz = col; 79 | return sceneCol; 80 | } 81 | ENDCG 82 | }//end pass 83 | }//end SubShader 84 | FallBack Off 85 | } 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor/EditorGLSL2CG.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.IO; 4 | using System; 5 | 6 | [IODescriptionAttribute("FileSystemWatcherDesc")] 7 | // Simple script that creates a new non-dockable window 8 | public class ShaderConverterEditor : EditorWindow 9 | { 10 | bool convert; 11 | public string shaderName = "MyShader"; 12 | string text = "Give Me ShaderToy :D"; 13 | public string path; 14 | bool Replace; 15 | TextAsset txtAsset,newTxtAsset; 16 | 17 | //public enum GameEngine {ShaderToy, GameMaker, Construct}; 18 | //public GameEngine gameEngine; 19 | Vector2 scroll; 20 | [MenuItem("Tool/ShadertoyToUnity")] 21 | static void Initialize() 22 | { 23 | ShaderConverterEditor window = (ShaderConverterEditor)EditorWindow.GetWindow (typeof(ShaderConverterEditor), true, "ShaderMan v.2.0"); 24 | window.maxSize = new Vector2 (718, 520); 25 | window.minSize = new Vector2 (718, 520); 26 | 27 | window.wantsMouseMove = true; 28 | } 29 | 30 | void OnGUI () { 31 | GUILayout.BeginArea (new Rect (10,10,700,500)); // you only need to do this once unless you want to show the same window twice 32 | shaderName = EditorGUILayout.TextField(shaderName); 33 | 34 | 35 | scroll = EditorGUILayout.BeginScrollView(scroll); 36 | 37 | text = EditorGUILayout.TextArea(text, GUILayout.Height(position.height - 80)); 38 | EditorGUILayout.EndScrollView(); 39 | 40 | 41 | 42 | 43 | if(GUILayout.Button("Convert")) 44 | { 45 | Debug.Log("Build"); 46 | CreateShader (); 47 | 48 | } 49 | GUI.skin.label.fontSize = 100; 50 | 51 | GUILayout.EndArea (); 52 | 53 | GUILayout.BeginArea (new Rect (800,10,800,600)); // you only need to do this once unless you want to show the same window twice 54 | //myString = EditorGUILayout.TextField ("Text Field", myString); 55 | //EditorGUILayout.EnumPopup (gameEngine); 56 | 57 | //EditorGUILayout.EndToggleGroup (); 58 | GUILayout.EndArea (); 59 | } 60 | 61 | 62 | void CreateShader(){ 63 | string path = "Assets/FishManShaderTutorial/"; 64 | var fileName = shaderName + ".shader"; 65 | if(!Directory.Exists(path)) 66 | Directory.CreateDirectory(path); 67 | 68 | 69 | 70 | if (File.Exists (path + fileName)) { 71 | Debug.Log (fileName + " Already exists."); 72 | Replace = EditorUtility.DisplayDialog ("What am I doing?", 73 | "There is already a file the same name in this location.Do you want to replace?" 74 | , "Replace", "Do Not Replace"); 75 | 76 | if (!Replace) { 77 | 78 | return; 79 | } 80 | } 81 | 82 | var sr = File.CreateText (path + fileName); 83 | 84 | sr.WriteLine (""); 85 | var create = new CodeGenerator(); 86 | create.ShaderName = shaderName; 87 | create.Init(); 88 | sr.WriteLine(create.Convert(text)); 89 | sr.Close(); 90 | AssetDatabase.Refresh(); 91 | 92 | // Create a simple material asset 93 | //string shaderfullpath = path + fileName + shaderName; 94 | var material = new Material(Shader.Find("FishManShaderTutorial/" + shaderName)); 95 | AssetDatabase.CreateAsset(material, path + shaderName + ".mat"); 96 | } 97 | } -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Sea.shader: -------------------------------------------------------------------------------- 1 | Shader "FishManShaderTutorial/Sea" { 2 | Properties{ 3 | _MainTex("Base (RGB)", 2D) = "white" {} 4 | _LoopNum ("_LoopNum", Vector) = (314.,1., 1, 1) 5 | _SeaBaseColor ("_SeaBaseColor", Color) = (0.1,0.19,0.22, 1) // color 6 | _SeaWaterColor ("_SeaWaterColor", Color) = (0.8,0.9,0.6) // color 7 | _SeaWaveHeight ("_SeaWaveHeight", float) = 5. // color 8 | 9 | } 10 | SubShader{ 11 | Pass { 12 | ZTest Always Cull Off ZWrite Off 13 | CGPROGRAM 14 | 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | #include "ShaderLibs/Framework3D_Terrain.cginc" 18 | 19 | float3 _SeaBaseColor; 20 | float3 _SeaWaterColor; 21 | float4 _LoopNum; 22 | float _SeaWaveHeight; 23 | 24 | #define Waves(pos,NUM)\ 25 | float2 uv = pos.xz;\ 26 | float w = 0.0,sw = 0.0;\ 27 | float iter = 0.0, ww = 1.0;\ 28 | uv += ftime * 0.5;\ 29 | for(int i=0;i 0.99 || t > tmax ) break; 33 | float3 pos = ro + t*rd; 34 | float4 col = MapCloud( pos ); 35 | col.xyz *= float3(0.4,0.52,0.6); 36 | col.xyz += float3(1.0,0.7,0.4)*0.3*pow( dif, 6.0 )*(1.0-col.w); 37 | col.xyz = lerp( col.xyz, bgCol, 1.0-exp(-0.0018*t*t) ); 38 | col.a *= 0.5; 39 | col.rgb *= col.a; 40 | sum = sum + col*(1.0 - sum.a); 41 | t += max(0.1,0.05*t); 42 | } 43 | sum = clamp( sum, 0.0, 1.0 ); 44 | return bgCol*(1.0-sum.w) + sum.xyz; 45 | } 46 | 47 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 48 | fixed3 col = fixed3(0.0,0.0,0.0); 49 | float3 light1 = normalize( float3(-0.8,0.4,-0.3) ); 50 | float sundot = clamp(dot(rd,light1),0.0,1.0); 51 | 52 | // sky 53 | col = float3(0.2,0.5,0.85)*1.1 - rd.y*rd.y*0.5; 54 | col = lerp( col, 0.85*float3(0.7,0.75,0.85), pow( 1.0-max(rd.y,0.0), 4.0 ) ); 55 | // sun 56 | col += 0.25*float3(1.0,0.7,0.4)*pow( sundot,5.0 ); 57 | col += 0.25*float3(1.0,0.8,0.6)*pow( sundot,64.0 ); 58 | col += 0.2*float3(1.0,0.8,0.6)*pow( sundot,512.0 ); 59 | // . 60 | col = RenderCloud(col,ro,rd,200.); 61 | //col = lerp( col, 0.68*float3(0.4,0.65,1.0), pow( 1.0-max(rd.y,0.0), 16.0 ) ); 62 | // clouds 63 | //float val = VNoise(float3(uv*10.,0.)); 64 | //col.xyz = float3(val,val,val); 65 | sceneCol.xyz = col; 66 | return sceneCol; 67 | } 68 | ENDCG 69 | }//end pass 70 | }//end SubShader 71 | FallBack Off 72 | } 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/2DCloudSea.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-03-27 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/2DCloudSea"{ 6 | Properties{ 7 | _MainTex ("MainTex", 2D) = "white" {} 8 | } 9 | 10 | SubShader 11 | { 12 | Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } 13 | 14 | Pass 15 | { 16 | ZWrite Off 17 | Blend SrcAlpha OneMinusSrcAlpha 18 | 19 | CGPROGRAM 20 | #pragma vertex vert 21 | #pragma fragment frag 22 | #include "ShaderLibs/Framework2D.cginc" 23 | 24 | #define LAYER 22.0 25 | fixed Wave(float layer,fixed2 uv,fixed val){ 26 | float amplitude = layer*layer*0.00004; 27 | float frequency = val*200*uv.x/layer; 28 | float phase = 9.*layer+ _Time.z/val; 29 | return amplitude*sin(frequency+phase); 30 | } 31 | float Circle(fixed2 uv,fixed2 center,float size,float blur){ 32 | uv = uv - center; 33 | uv /= size; 34 | float len = length(uv); 35 | return smoothstep(1.,1.-blur,len); 36 | } 37 | float AngleCircle(fixed2 uv,fixed2 center,float size,float blur){ 38 | uv = uv - center; 39 | uv /= size; 40 | float deg = atan2(uv.y,uv.x) + _Time.y * -0.1; 41 | float len = length(uv); 42 | float offs =( sin(deg*9)*3.+sin(deg*11+sin(_Time.y*6)*.5))*0.05; 43 | return smoothstep(1.+offs,1.-blur+offs,len); 44 | } 45 | 46 | float DrawCloud(fixed2 uv,fixed2 center,float size){ 47 | uv = uv - center; 48 | uv /= size; 49 | float col = Circle(uv,fixed2(0.,0.),0.2,0.05); 50 | col =col * smoothstep(-0.1,-0.1+0.01,uv.y); 51 | col += Circle(uv,fixed2(0.15,-0.05),0.1,0.05); 52 | col += Circle(uv,fixed2(0.,-0.1),0.11,0.05); 53 | col += Circle(uv,fixed2(-0.15,-0.1),0.1,0.05); 54 | col += Circle(uv,fixed2(-0.3,-0.08),0.1,0.05); 55 | col += Circle(uv,fixed2(-0.2,0.),0.15,0.05); 56 | return col; 57 | } 58 | float DrawClouds(fixed2 uv){ 59 | uv.x += 0.03*_Time.y; 60 | uv.x = frac(uv.x+0.5) - 0.5; 61 | float col = DrawCloud( uv,fixed2(-0.4,0.3),0.2); 62 | col += DrawCloud( uv,fixed2(-0.2,0.42),0.2); 63 | col += DrawCloud( uv,fixed2(0.0,0.4),0.2); 64 | col += DrawCloud( uv,fixed2(0.15,0.3),0.2); 65 | col += DrawCloud( uv,fixed2(0.45,0.45),0.2); 66 | return col; 67 | } 68 | float3 ProcessFrag(float2 uv) { 69 | float3 col = float3(0.0,0.0,0.0); 70 | float num = 0.; 71 | for (float i=1.; i < LAYER; i++) { 72 | float wave = 2.*Wave(i,uv,1.)+Wave(i,uv,1.8)+.5*Wave(i,uv,3.); 73 | float layerVal = 0.7-0.03*i + wave; 74 | if(uv.y >layerVal){ 75 | break; 76 | } 77 | num = i;//计算所在层的ID 78 | } 79 | col = num*fixed3(0,.03,1);//计算每一层的基本颜色 80 | col += (LAYER - num) * fixed3(.04,.04,.04);//颜色叠亮 81 | if(num ==0){ 82 | //添加海平面泛光 83 | float ry = Remap(0.7,1.0,1.0,0.0,uv.y); 84 | col = lerp(fixed3(0.1,0.6,0.9),fixed3(0.1,0.7,0.9),ry); 85 | col += pow(ry,10.)*fixed3(0.9,0.2,0.1)*0.2; 86 | } 87 | //调整UV为(-0.5,-0.5,0.5,0.5)方便绘图 88 | uv = uv - fixed2(0.5,0.5); 89 | //添加太阳 90 | fixed2 sunPos = fixed2(0.3,0.35); 91 | fixed sun = Circle(uv,sunPos,0.06,0.05); 92 | fixed sunCircle = AngleCircle(uv,sunPos,0.08,0.05); 93 | col = lerp( col ,fixed3(0.9,0.6,0.15),sunCircle); 94 | col = lerp( col ,fixed3(0.98,0.9,0.1),sun); 95 | //云 96 | col += DrawClouds(uv); 97 | return col; 98 | } 99 | ENDCG 100 | }//end pass 101 | }//end SubShader 102 | }//end Shader 103 | 104 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Mountain.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-13 email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/Mountain" { 5 | Properties{ 6 | _MainTex("Base (RGB)", 2D) = "white" {} 7 | _LoopNum ("_LoopNum", Vector) = (314.,1., 1, 1) 8 | _MaxTerrianH ("_MaxTerrianH", float) = 500. // color 9 | } 10 | SubShader{ 11 | Pass { 12 | ZTest Always Cull Off ZWrite Off 13 | CGPROGRAM 14 | 15 | #define USING_VALUE_NOISE 1 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | #include "ShaderLibs/Framework3D_Terrain.cginc" 19 | float _MaxTerrianH; 20 | 21 | #define Terrain(pos,NUM)\ 22 | float2 p = pos.xz*.9/_MaxTerrianH;\ 23 | float a = 0.0;\ 24 | float b = 0.491;\ 25 | float2 d = float2(0.0,0.);\ 26 | for( int i=0; itmax ){ 80 | col= Sky(pos,rd,_LightDir); 81 | }else{ 82 | col = RenderMountain(pos,rd,rz,nor,_LightDir); 83 | } 84 | //gamma 85 | col = pow( col, float3(0.4545,0.4545,0.4545) ); 86 | sceneCol.xyz = col; 87 | return sceneCol; 88 | } 89 | ENDCG 90 | }//end pass 91 | }//end SubShader 92 | FallBack Off 93 | } 94 | 95 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework3D.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-03-27 4 | #ifndef FRAMEWORK_3D 5 | #define FRAMEWORK_3D 6 | 7 | #include "FBM.cginc" 8 | #include "Feature.cginc" 9 | sampler2D _MainTex; 10 | float2 _MainTex_TexelSize; 11 | float4x4 _FrustumCornersRay; 12 | sampler2D _CameraDepthTexture; 13 | 14 | struct v2f { 15 | float4 pos : SV_POSITION; 16 | half2 uv : TEXCOORD0; 17 | half2 uv_depth : TEXCOORD1; 18 | float4 interpolatedRay : TEXCOORD2; 19 | }; 20 | 21 | v2f vert(appdata_img v) { 22 | v2f o; 23 | o.pos = UnityObjectToClipPos(v.vertex); 24 | 25 | o.uv = v.texcoord; 26 | o.uv_depth = v.texcoord; 27 | 28 | #if UNITY_UV_STARTS_AT_TOP 29 | if (_MainTex_TexelSize.y < 0) 30 | o.uv_depth.y = 1 - o.uv_depth.y; 31 | #endif 32 | 33 | int index = 0; 34 | if (v.texcoord.x < 0.5 && v.texcoord.y < 0.5) { 35 | index = 0; 36 | } 37 | else if (v.texcoord.x > 0.5 && v.texcoord.y < 0.5) { 38 | index = 1; 39 | } 40 | else if (v.texcoord.x > 0.5 && v.texcoord.y > 0.5) { 41 | index = 2; 42 | } 43 | else { 44 | index = 3; 45 | } 46 | 47 | #if UNITY_UV_STARTS_AT_TOP 48 | if (_MainTex_TexelSize.y < 0) 49 | index = 3 - index; 50 | #endif 51 | o.interpolatedRay = _FrustumCornersRay[index]; 52 | return o; 53 | } 54 | 55 | //RayMarching is the main world, ignore unity sky box 56 | void MergeUnityIntoRayMarching(inout float rz,inout float3 rCol, float unityDep,float4 unityCol){ 57 | if(rz>unityDep && unityDep<_ProjectionParams.z-1.){// unity camera far plane 58 | rCol = unityCol.xyz; 59 | rz = unityDep; 60 | } 61 | } 62 | //Unity scene is the main world, ignore RayMarching sky box 63 | void MergeRayMarchingIntoUnity(inout float rz,inout float3 rCol, float unityDep,float4 unityCol){ 64 | if(rz>unityDep ){ 65 | rCol = unityCol.xyz; 66 | rz = unityDep; 67 | } 68 | } 69 | 70 | 71 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol); 72 | 73 | float4 frag(v2f i) : SV_Target{ 74 | float depth = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv_depth)); 75 | depth *= length(i.interpolatedRay.xyz); 76 | fixed4 sceneCol = tex2D(_MainTex, i.uv); 77 | float2 uv = i.uv * float2(_ScreenParams.x/_ScreenParams.y,1.0); 78 | fixed3 ro = _WorldSpaceCameraPos; 79 | fixed3 rd = normalize(i.interpolatedRay.xyz); 80 | return ProcessRayMarch(uv,ro,rd,depth,sceneCol); 81 | } 82 | 83 | 84 | #define _MACRO_CALC_NORMAL(pos,rz, MAP_FUNC)\ 85 | float2 e = float2(1.0,-1.0)*0.5773*0.002*rz;\ 86 | return normalize( e.xyy*MAP_FUNC( pos + e.xyy ).x + \ 87 | e.yyx*MAP_FUNC( pos + e.yyx ).x + \ 88 | e.yxy*MAP_FUNC( pos + e.yxy ).x + \ 89 | e.xxx*MAP_FUNC( pos + e.xxx ).x ); 90 | 91 | 92 | #define _MACRO_SOFT_SHADOW(ro, rd, maxH,MAP_FUNC) \ 93 | float res = 1.0;\ 94 | float t = 0.001;\ 95 | for( int i=0; i<80; i++ ){\ 96 | float3 p = ro + t*rd;\ 97 | float h = MAP_FUNC( p).x;\ 98 | res = min( res, 16.0*h/t );\ 99 | t += h;\ 100 | if( res<0.001 ||p.y> maxH ) break;\ 101 | }\ 102 | return clamp( res, 0.0, 1.0 ); 103 | 104 | 105 | #define _MRCRO_RAY_CAST( ro, rd ,tmax,MAP_FUNC)\ 106 | float t = .1;\ 107 | float m = -1.0;\ 108 | for( int i=0; i<256; i++ ) {\ 109 | float precis = 0.0005*t;\ 110 | float2 res = MAP_FUNC( ro+rd*t );\ 111 | if( res.xtmax ) break;\ 112 | t += 0.5*res.x;\ 113 | m = res.y;\ 114 | } \ 115 | if( t>tmax ) m=-1.0;\ 116 | return float2( t, m ); 117 | 118 | 119 | 120 | 121 | #endif -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/LightScanWithDepthTexture.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class ScanWithDepthTexture : PostEffectsBase { 5 | 6 | public Shader fogShader; 7 | 8 | public Transform centerTargetTrans; 9 | public float _RingIntensity; 10 | public float _RingWidth;//环半径 11 | public float spreadSpeed;//扩散速度 12 | public float maxRange = 100; 13 | private float _InnerRange; 14 | 15 | public Texture _TileTex; 16 | public float _TileSize; 17 | public float _TileIntensity; 18 | public Color _TileColor; 19 | 20 | public Texture _NoiseTex; 21 | public float _NoiseCellSize; 22 | public Color _NoiseCellColor; 23 | 24 | public Color _EdgeColor = Color.white; 25 | 26 | private Material fogMaterial = null; 27 | 28 | public Material material { 29 | get { 30 | fogMaterial = CheckShaderAndCreateMaterial(fogShader, fogMaterial); 31 | return fogMaterial; 32 | } 33 | } 34 | 35 | private Camera myCamera; 36 | public new Camera camera { 37 | get { 38 | if (myCamera == null) { 39 | myCamera = GetComponent(); 40 | } 41 | return myCamera; 42 | } 43 | } 44 | 45 | private Transform myCameraTransform; 46 | public Transform cameraTransform { 47 | get { 48 | if (myCameraTransform == null) { 49 | myCameraTransform = camera.transform; 50 | } 51 | 52 | return myCameraTransform; 53 | } 54 | } 55 | 56 | private void Update() 57 | { 58 | _InnerRange = spreadSpeed * Time.realtimeSinceStartup % maxRange; 59 | } 60 | 61 | void OnEnable() { 62 | camera.depthTextureMode |= DepthTextureMode.Depth; 63 | } 64 | 65 | void OnRenderImage (RenderTexture src, RenderTexture dest) { 66 | if (material != null) { 67 | Matrix4x4 frustumCorners = Matrix4x4.identity; 68 | 69 | float fov = camera.fieldOfView; 70 | float near = camera.nearClipPlane; 71 | float aspect = camera.aspect; 72 | 73 | float halfHeight = near * Mathf.Tan(fov * 0.5f * Mathf.Deg2Rad); 74 | Vector3 toRight = cameraTransform.right * halfHeight * aspect; 75 | Vector3 toTop = cameraTransform.up * halfHeight; 76 | 77 | Vector3 topLeft = cameraTransform.forward * near + toTop - toRight; 78 | float scale = topLeft.magnitude / near; 79 | 80 | topLeft.Normalize(); 81 | topLeft *= scale; 82 | 83 | Vector3 topRight = cameraTransform.forward * near + toRight + toTop; 84 | topRight.Normalize(); 85 | topRight *= scale; 86 | 87 | Vector3 bottomLeft = cameraTransform.forward * near - toTop - toRight; 88 | bottomLeft.Normalize(); 89 | bottomLeft *= scale; 90 | 91 | Vector3 bottomRight = cameraTransform.forward * near + toRight - toTop; 92 | bottomRight.Normalize(); 93 | bottomRight *= scale; 94 | 95 | frustumCorners.SetRow(0, bottomLeft); 96 | frustumCorners.SetRow(1, bottomRight); 97 | frustumCorners.SetRow(2, topRight); 98 | frustumCorners.SetRow(3, topLeft); 99 | 100 | material.SetMatrix("_FrustumCornersRay", frustumCorners); 101 | material.SetVector("_SrcCenterPos", centerTargetTrans.position); 102 | material.SetFloat("_InnerRange", _InnerRange); 103 | material.SetFloat("_RingWidth", _RingWidth); 104 | material.SetFloat("_RingIntensity", _RingIntensity); 105 | 106 | material.SetTexture("_TileTex", _TileTex); 107 | material.SetFloat("_TileSize", _TileSize); 108 | material.SetFloat("_TileIntensity", _TileIntensity); 109 | material.SetColor("_TileColor", _TileColor); 110 | 111 | 112 | material.SetTexture("_NoiseTex", _NoiseTex); 113 | material.SetFloat("_NoiseCellSize", _NoiseCellSize); 114 | material.SetColor("_NoiseCellColor", _NoiseCellColor); 115 | 116 | material.SetColor("_EdgeColor", _EdgeColor); 117 | 118 | Graphics.Blit (src, dest, material); 119 | } else { 120 | Graphics.Blit(src, dest); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/Framework3D_DefaultRender.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-24 4 | #ifndef FRAMEWORK_3D_DEFAULT_SCENE 5 | #define FRAMEWORK_3D_DEFAULT_SCENE 6 | 7 | #include "SDF.cginc" 8 | #include "Framework3D.cginc" 9 | 10 | //DEFAULT_RENDER default render function 11 | //DEFAULT_MAT_COL defualt material color function 12 | //DEFAULT_PROCESS_FRAG default process frag function 13 | 14 | float3 MatCol(float matID,float3 pos,float3 nor); 15 | float2 Map( in float3 pos ); 16 | float3 Render( in float3 ro, in float3 rd ); 17 | 18 | float RayCast(float3 ro, float3 rd) { 19 | _MRCRO_RAY_CAST(ro,rd,1000.,Map); 20 | } 21 | float3 CalcNormal( in float3 pos, float rz ){ 22 | _MACRO_CALC_NORMAL(pos,rz,Map); 23 | } 24 | 25 | float SoftShadow(in float3 ro, in float3 rd,float tmax){ 26 | _MACRO_SOFT_SHADOW(ro,rd,tmax,Map); 27 | } 28 | 29 | float CalcAO( in float3 pos, in float3 nor ) 30 | { 31 | float occ = 0.0; 32 | float sca = 1.0; 33 | for( int i=0; i<5; i++ ) 34 | { 35 | float hr = 0.01 + 0.12*float(i)/4.0; 36 | float3 aopos = nor * hr + pos; 37 | float dd = Map( aopos ).x; 38 | occ += -(dd-hr)*sca; 39 | sca *= 0.95; 40 | } 41 | return clamp( 1.0 - 3.0*occ, 0.0, 1.0 ); 42 | } 43 | 44 | #ifdef DEFAULT_RENDER 45 | float3 Render( in float3 ro, in float3 rd ) 46 | { 47 | float3 col = float3(0.7, 0.9, 1.0) +rd.y*0.8; 48 | float2 res = RayCast(ro,rd); 49 | float t = res.x; 50 | float m = res.y; 51 | if( m>-0.5 ) 52 | { 53 | float3 pos = ro + t*rd; 54 | float3 nor = CalcNormal( pos,0.01); 55 | float3 ref = reflect( rd, nor ); 56 | col = MatCol(m,pos,nor); 57 | 58 | // lighitng 59 | float occ = CalcAO( pos, nor ); 60 | float3 lig = normalize( float3(-0.4, 0.7, -0.6) ); 61 | float3 hal = normalize( lig-rd ); 62 | float amb = clamp( 0.5+0.5*nor.y, 0.0, 1.0 ); 63 | float dif = clamp( dot( nor, lig ), 0.0, 1.0 ); 64 | float bac = clamp( dot( nor, normalize(float3(-lig.x,0.0,-lig.z))), 0.0, 1.0 )*clamp( 1.0-pos.y,0.0,1.0); 65 | float dom = smoothstep( -0.1, 0.1, ref.y ); 66 | float fre = pow( clamp(1.0+dot(nor,rd),0.0,1.0), 2.0 ); 67 | 68 | dif *= SoftShadow( pos, lig, 2.5 ); 69 | dom *= SoftShadow( pos, ref, 2.5 ); 70 | 71 | float spe = pow( clamp( dot( nor, hal ), 0.0, 1.0 ),16.0)* 72 | dif * 73 | (0.04 + 0.96*pow( clamp(1.0+dot(hal,rd),0.0,1.0), 5.0 )); 74 | 75 | float3 lin = float3(0.0,0.0,0.0); 76 | lin += 1.30*dif*float3(1.00,0.80,0.55); 77 | lin += 0.40*amb*float3(0.40,0.60,1.00)*occ; 78 | lin += 0.50*dom*float3(0.40,0.60,1.00)*occ; 79 | lin += 0.50*bac*float3(0.25,0.25,0.25)*occ; 80 | lin += 0.25*fre*float3(1.00,1.00,1.00)*occ; 81 | col = col*lin; 82 | col += 10.00*spe*float3(1.00,0.90,0.70); 83 | 84 | col = lerp( col, float3(0.8,0.9,1.0), 1.0-exp( -0.0002*t*t*t ) ); 85 | } 86 | 87 | return float3( clamp(col,0.0,1.0) ); 88 | } 89 | #endif 90 | 91 | #ifdef DEFAULT_MAT_COL 92 | float3 MatCol(float matID,float3 pos,float3 nor) 93 | { 94 | // material 95 | float3 col = 0.45 + 0.35*sin( float3(0.05,0.08,0.10)*(matID-1.0) ); 96 | if( matID<1.5 ) 97 | { 98 | float f = CheckersGradBox( 5.0*pos.xz ); 99 | col = 0.3 + f*float3(0.1,0.1,0.1); 100 | } 101 | return col; 102 | } 103 | #endif 104 | 105 | #ifdef DEFAULT_PROCESS_FRAG 106 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 107 | // render 108 | float3 col = Render( ro, rd ); 109 | // gamma 110 | col = pow( col, float3(0.4545,0.4545,0.4545) ); 111 | sceneCol.xyz = col; 112 | return sceneCol; 113 | } 114 | #endif 115 | 116 | 117 | #endif // FRAMEWORK_3D_DEFAULT_SCENE -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Rain.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date: 2018-04-16 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/Rain" { 6 | Properties{ 7 | _MainTex("Base (RGB)", 2D) = "white" {} 8 | _LoopNum ("_LoopNum", Vector) = (40.,128., 1, 1) 9 | _BaseWaterColor ("_BaseWaterColor", COLOR) = (.025, .2, .125,0.) 10 | _LightWaterColor ("_LightWaterColor", COLOR) = (.025, .2, .125,0.) 11 | waterHeight ("waterHeight", float) =1.0 12 | 13 | 14 | period ("period", float) = 1.//peroid 15 | spreadSpd ("spreadSpd", float) = 1.//wave move speed 16 | waveGap ("waveGap", float) = 0.2//single wave 's width 17 | waveHei ("waveHei", float) = 0.3// wave height 18 | Rain_Slop ("Rain_Slop", float) = 0.03// wave height 19 | } 20 | SubShader{ 21 | Pass { 22 | ZTest Always Cull Off ZWrite Off 23 | CGPROGRAM 24 | float4 _LoopNum = float4(40.,128.,0.,0.); 25 | //#define USING_PERLIN_NOISE 26 | #pragma vertex vert 27 | #pragma fragment frag 28 | #include "ShaderLibs/Framework3D.cginc" 29 | 30 | float3 _BaseWaterColor; 31 | float3 _LightWaterColor; 32 | 33 | float waterHeight = 4.; 34 | 35 | 36 | float period ;//peroid 37 | float spreadSpd;//wave move speed 38 | float waveGap;//single wave 's width 39 | float waveHei;// wave height 40 | float Rain_Slop; 41 | 42 | float WaterMap( fixed3 pos ) { 43 | float h = FBMR( fixed3( pos.xz, ftime*0.6 )) * 0.5 + Ripples(pos.xz,7.,2.,period,spreadSpd,waveGap)* waveHei; 44 | return h; 45 | } 46 | 47 | float3 WaterNormal(float3 pos,float rz){ 48 | float EPSILON = 0.001 *rz; 49 | float3 dx = float3( EPSILON, 0.,0. ); 50 | float3 dz = float3( 0.,0., EPSILON ); 51 | 52 | float3 normal = float3( 0., 1., 0. ); 53 | float bumpfactor = 0.2 * (1. - smoothstep( 0., 1000, rz) );//根据距离所见Bump幅度 54 | 55 | normal.x = -bumpfactor * (WaterMap(pos + dx) - WaterMap(pos-dx) ) / (2. * EPSILON); 56 | normal.z = -bumpfactor * (WaterMap(pos + dz) - WaterMap(pos-dz) ) / (2. * EPSILON); 57 | return normalize( normal ); 58 | } 59 | 60 | 61 | 62 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol){ 63 | fixed3 col = Sky(ro,rd,_LightDir); 64 | if(rd.y < -0.01 ) { 65 | float rz = (-ro.y)/rd.y; 66 | float3 pos = ro + rd * rz; 67 | float3 normal = WaterNormal(pos,rz); 68 | //add ripples 69 | 70 | 71 | float ndotr = dot(normal,-rd); 72 | float fresnel = pow(1.0-abs(ndotr),6.);//计算 73 | float3 reflectRd = reflect( rd, normal); 74 | float3 reflectCol = Sky( ro, reflectRd,_LightDir); 75 | 76 | float3 diff = pow(dot(normal,_LightDir) * 0.4 + 0.6,3.); 77 | float3 refractCol = _BaseWaterColor + diff * _LightWaterColor * 0.12; 78 | 79 | col = lerp(refractCol,reflectCol,fresnel); 80 | 81 | float spec= pow(max(dot(reflectRd,_LightDir),0.0),128.) * 1.; 82 | col += float3(spec,spec,spec); 83 | } 84 | //vec2 st = uv * vec2(.5+(xy.y+1.0)*.3, .02)+vec2(gTime*.5+xy.y*.2, gTime*.2); 85 | // Rain & Lightning together... 86 | float2 ruv = uv / float2(_ScreenParams.x/_ScreenParams.y,1.0); 87 | uv = (ruv * 2.0 - 1.0) * float2(_ScreenParams.x/_ScreenParams.y,1.0); 88 | float2 st = uv * float2(.5+(ruv.y+1.0)*0.5, .03)+float2(ftime*.2-ruv.y*.1, ftime*.2); 89 | // I'm adding two parts of the texture to stop repetition... 90 | float f = tex2D(_NoiseTex, st).y * tex2D(_NoiseTex, st*.773).x * 1.55; 91 | f = clamp(pow(abs(f), 23.0) * 13.0, 0.0, (ruv.y-.2)*.14); 92 | col += float3(f,f,f); 93 | 94 | col = pow(col,float3(0.8,0.8,0.8)); 95 | 96 | sceneCol.xyz = col; 97 | return sceneCol; 98 | } 99 | ENDCG 100 | }//end pass 101 | }//end SubShader 102 | FallBack Off 103 | } 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Desert.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-13 email: jiepengtan@gmail.com 4 | Shader "FishManShaderTutorial/Desert" { 5 | Properties{ 6 | _MainTex("Base (RGB)", 2D) = "white" {} 7 | _LoopNum ("_LoopNum", Vector) = (40.,128., 1, 1) 8 | } 9 | SubShader{ 10 | Pass { 11 | ZTest Always Cull Off ZWrite Off 12 | CGPROGRAM 13 | float4 _LoopNum = float4(40.,128.,0.,0.); 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | #include "ShaderLibs/Framework3D.cginc" 17 | float terrainH( in float2 p) 18 | { 19 | //middle 20 | float valM = PNoise(p * 0.26) + 0.5;//0~1 21 | valM = 1.0 - abs(valM - 0.5) * 2.0; 22 | valM = pow(valM,2.0); 23 | 24 | //big 25 | float valB = smoothstep(0.0,1.0,PNoise(p * 0.2) + 0.5);//0~1 26 | float val = valB * 0.8 +valM * 0.19*pow(valB,2.0) ; 27 | return val * _LoopNum.z; 28 | } 29 | 30 | float softShadow(in float3 ro, in float3 rd ) 31 | { 32 | // real shadows 33 | float res = 1.0; 34 | float t = 0.001; 35 | for( int i=0; i<_LoopNum.x; i++ ) 36 | { 37 | float3 p = ro + t*rd; 38 | float h = p.y - terrainH( p.xz ); 39 | res = min( res, 16.0*h/t ); 40 | t += h; 41 | if( res<0.01 ||p.y>(200.0) ) break; 42 | } 43 | return clamp( res, 0.0, 1.0 ); 44 | } 45 | 46 | 47 | float interesct( in float3 ro, in float3 rd, in float tmin, in float tmax ) 48 | { 49 | float t = tmin; 50 | for( int i=0; i<_LoopNum.y; i++ ) 51 | { 52 | float3 pos = ro + t*rd; 53 | float h = pos.y - terrainH( pos.xz ); 54 | if( h<(0.002*t) || t>tmax ) break; 55 | t += 0.5*h; 56 | } 57 | return t; 58 | } 59 | 60 | 61 | float3 calcNormal( in float3 pos, float t ) 62 | { 63 | float2 eps = float2( 0.002*t, 0.0 ); 64 | return normalize( float3( terrainH(pos.xz-eps.xy) - terrainH(pos.xz+eps.xy), 65 | 2.0*eps.x, 66 | terrainH(pos.xz-eps.yx) - terrainH(pos.xz+eps.yx) ) ); 67 | } 68 | 69 | float3 render( in float3 ro, in float3 rd ) 70 | { 71 | float3 lightDir = normalize( float3(-0.8,0.3,-0.3) ); 72 | float3 lightColor = float3(1.0,1.0,1.0); 73 | float3 sandColor = float3(0.9,0.70,0.4); 74 | float3 ambientColor = float3(0.5,0.5,0.5); 75 | 76 | float tmin = 0.1; 77 | float tmax = 30.0; 78 | float t = interesct(ro,rd,tmin,tmax); 79 | 80 | float3 col; 81 | if(t>tmax){ 82 | float3 sky0 = float3(0.8,0.7,0.5) * 1.2; 83 | float3 sky1 = float3(0.4,0.6,0.8) * 1.2; 84 | col = lerp(sky0,sky1,pow(max(rd.y + 0.15,0.0),0.5)); 85 | float val = pow(max(dot(rd,lightDir),0.0),200.0); 86 | col += float3(val,val,val); 87 | } 88 | else{ 89 | float3 pos = ro + t*rd; 90 | 91 | float shadow = softShadow(pos + lightDir *0.01,lightDir); 92 | 93 | float3 normal = calcNormal( pos, t ); 94 | normal = normalize(normal + float3(sin(pos.x * 100.0 + sin(pos.z * 31.0) + sin(pos.y) * 200.0) * 0.02,0,0)); 95 | float3 viewDir = -rd; 96 | 97 | float lambertian = max(dot(lightDir,normal), 0.0); 98 | 99 | float shininess = 20.0; 100 | float3 fixedDir = normalize(lightDir + viewDir); 101 | float specAngle = max(dot(fixedDir, normal), 0.0); 102 | float specular1 = pow(specAngle, shininess); 103 | float specular2 = pow(specAngle, shininess / 2.0) * pow(tex2D(_MainTex,pos.xz * 10.0).x,3.0); 104 | 105 | float3 diff = sandColor * lambertian * lightColor; 106 | float3 spec = (specular1 *0.3 + specular2 * 0.2) * lightColor; 107 | float3 ambient = ambientColor * sandColor; 108 | col = shadow * (diff + spec) + ambient; 109 | } 110 | return col; 111 | } 112 | 113 | 114 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol){ 115 | sceneCol.xyz = render(ro,rd); 116 | return sceneCol; 117 | } 118 | ENDCG 119 | }//end pass 120 | }//end SubShader 121 | FallBack Off 122 | } 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Sea2.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // email: jiepengtan@gmail.com 4 | // 2018-04-13 5 | 6 | 7 | 8 | Shader "FishManShaderTutorial/Sea2" { 9 | Properties{ 10 | _MainTex("Base (RGB)", 2D) = "white" {} 11 | _NoiseTex("_NoiseTex", 2D) = "white" {} 12 | //_LooPNUMS ("_LooPNUMS", Vector) = (3.,5.,8., 1) 13 | _SeaWaveHeight ("_SeaWaveHeight", float) = 0.6// color 14 | _SeaChoppy ("_SeaChoppy", float) = 4.0 // color 15 | _SeaSpeed ("_SeaSpeed", float) = 0.8 // color 16 | _SeaFreq ("_SeaFreq", float) = 0.16 // color 17 | _SeaBaseColor ("_SeaBaseColor", Color) = (0.1,0.19,0.22, 1) // color 18 | _SeaWaterColor ("_SeaWaterColor", Color) = (0.8,0.9,0.6) // color 19 | 20 | MAP_LOOP_NUM ("MAP_LOOP_NUM", float) = 3 // color 21 | MAPH_LOOP_NUM ("MAPH_LOOP_NUM", float) = 5 // color 22 | 23 | } 24 | SubShader{ 25 | Pass { 26 | ZTest Always Cull Off ZWrite Off 27 | CGPROGRAM 28 | float4 _LooPNUMS = float4(3.,5.,25., 1); 29 | // 是否使用Noise 贴图来加速 30 | #define USING_VALUE_NOISE 31 | 32 | #pragma vertex vert 33 | #pragma fragment frag 34 | #include "ShaderLibs/Framework3D_Terrain.cginc" 35 | 36 | 37 | float _SeaWaveHeight = 0.6; 38 | float _SeaChoppy = 4.0; 39 | float _SeaSpeed = 0.8; 40 | float _SeaFreq = 0.16; 41 | float3 _SeaBaseColor = float3(0.1,0.19,0.22); 42 | float3 _SeaWaterColor = float3(0.8,0.9,0.6); 43 | float MAP_LOOP_NUM = 3; 44 | float MAPH_LOOP_NUM = 5; 45 | #define SEA_TIME (1.0 + _Time.y * _SeaSpeed) 46 | 47 | 48 | 49 | #define Waves(pos,_LOOP_NUM)\ 50 | float2 uv = pos.xz;\ 51 | float2x2 octave_m = float2x2(1.6,1.2,-1.2,1.6);\ 52 | float freq = _SeaFreq;\ 53 | float amp = _SeaWaveHeight;\ 54 | float choppy = _SeaChoppy;\ 55 | uv.x *= 0.75;\ 56 | float d, h = 0.0; \ 57 | for(int i = 0; i < _LOOP_NUM; i++) { \ 58 | d = Wave((uv+SEA_TIME)*freq,choppy);\ 59 | d += Wave((uv-SEA_TIME)*freq,choppy);\ 60 | h += d * amp; \ 61 | uv = mul(octave_m,uv); freq *= 1.9; amp *= 0.22;\ 62 | choppy = lerp(choppy,1.0,0.2);\ 63 | }\ 64 | return float2(pos.y - h,1.0); 65 | 66 | 67 | // sea 68 | float Wave(float2 uv, float choppy) { 69 | uv += Noise(uv); //与sea1 不同的主要地方加了一个noise 70 | float2 wv = 1.0-abs(sin(uv)); 71 | float2 swv = abs(cos(uv)); 72 | wv = lerp(wv,swv,wv); 73 | return pow(1.0-pow(wv.x * wv.y,0.65),choppy); 74 | } 75 | 76 | 77 | float2 TerrainL(float3 pos){ 78 | Waves(pos,MAP_LOOP_NUM); 79 | } 80 | float2 TerrainM(float3 pos){ 81 | Waves(pos,MAP_LOOP_NUM); 82 | } 83 | float2 TerrainH(float3 pos){ 84 | Waves(pos,MAPH_LOOP_NUM); 85 | } 86 | 87 | 88 | float3 RenderSea(float3 pos, float3 rd,float rz, float3 nor, float3 lightDir) { 89 | float fresnel = clamp(1.0 - dot(nor,-rd), 0.0, 1.0); 90 | fresnel = pow(fresnel,3.0) * 0.65; 91 | 92 | float3 reflected = Sky(pos,reflect(rd,nor),lightDir); 93 | float3 diff = pow(dot(nor,lightDir) * 0.4 + 0.6,3.); 94 | float3 refracted = _SeaBaseColor + diff * _SeaWaterColor * 0.12; 95 | float3 col = lerp(refracted,reflected,fresnel); 96 | 97 | float atten = max(1.0 - dot(rz,rz) * 0.001, 0.0); 98 | //col += _SeaWaterColor * (p.y - _SeaHeight) * 0.18 * atten; 99 | float spec= pow(max(dot(reflect(rd,nor),lightDir),0.0),60.) * 3.; 100 | col += float3(spec,spec,spec); 101 | 102 | return col; 103 | } 104 | 105 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol){ 106 | float rz = RaycastTerrain(ro,rd).x; 107 | float3 pos = ro + rd *rz; 108 | float3 nor = NormalTerrian(pos,rz); 109 | 110 | // color 111 | float3 skyCol = Sky(ro,rd,_LightDir ); 112 | float3 seaCol = RenderSea(pos,rd,rz,nor,_LightDir); 113 | float3 col = lerp(skyCol,seaCol,pow(smoothstep(0.0,-0.05,rd.y),0.3)); 114 | col = pow( col, float3(0.4545,0.4545,0.4545) ); 115 | sceneCol.xyz = col; 116 | return sceneCol; 117 | } 118 | ENDCG 119 | }//end pass 120 | }//end SubShader 121 | FallBack Off 122 | } 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RayMarchFramework.shader: -------------------------------------------------------------------------------- 1 | //// create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | //// date:2018-04-12 4 | //// email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/RayMarchFramework" { 6 | Properties{ 7 | _MainTex("Base (RGB)", 2D) = "white" {} 8 | } 9 | SubShader{ 10 | Pass { 11 | ZTest Always Cull Off ZWrite Off 12 | CGPROGRAM 13 | 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | #include "ShaderLibs/Feature.cginc" 17 | #include "ShaderLibs/Framework3D.cginc" 18 | 19 | #define SPHERE_ID (1.0) 20 | #define FLOOR_ID (2.0) 21 | #define lightDir (normalize(float3(5.,3.0,-1.0))) 22 | 23 | 24 | float MapSphere(float3 pos){ 25 | // center at float3(0.,0.,0.); 26 | float radius = 0.5; 27 | float3 centerPos = float3(0.,1.0+ sin(_Time.y*1.*PI)*0.5,0.); 28 | return length(pos-centerPos) - radius; 29 | } 30 | float MapFloor(float3 pos ){ 31 | float3 n= float3(0.,1.,0.); 32 | float3 d = 0; 33 | return dot(n,pos)-d; 34 | } 35 | float2 Map(float3 pos){ 36 | float dist2Sphere = MapSphere(pos);// ID 1 37 | float dist2Plane = MapFloor(pos); // ID 2 38 | if(dist2Plane < dist2Sphere) { 39 | return float2(dist2Plane,FLOOR_ID); 40 | }else{ 41 | return float2(dist2Sphere,SPHERE_ID); 42 | } 43 | } 44 | 45 | 46 | #define MARCH_NUM 256 //最多光线检测次数 47 | float2 RayCast(float3 ro,float3 rd){ 48 | float tmin = 0.1; 49 | float tmax = 20.0; 50 | 51 | float t = tmin; 52 | float2 res = float2(0.,-1.0); 53 | for( int i=0; i tmax ) break; 59 | t += 0.5*res.x;// 加速检测速度 这里可以有不同的策略 60 | } 61 | if( t>tmax ) return float2(t,-1.0); 62 | return float2( t, res.y ); 63 | } 64 | float SoftShadow(float3 ro, float3 rd ) 65 | { 66 | float res = 1.0; 67 | float t = 0.001; 68 | for( int i=0; i<80; i++ ) 69 | { 70 | float3 p = ro + t*rd; 71 | float h = Map(p); 72 | res = min( res, 16.0*h/t ); 73 | t += h; 74 | if( res<0.001 ||p.y>(200.0) ) break; 75 | } 76 | return clamp( res, 0.0, 1.0 ); 77 | } 78 | 79 | float3 ShadingShpere(float3 rd,float3 pos, float3 n,float3 sd){ 80 | float3 col = float3(1.,0.,0.); 81 | float diff = clamp(dot(n,lightDir),0.,1.); 82 | float bklig = clamp(dot(n,-lightDir),0.,1.)*0.05;//加点背光 83 | return col *(diff+bklig); 84 | } 85 | float3 ShadingFloor(float3 rd,float3 pos, float3 n,float3 sd ){ 86 | float3 col = float3(0.,1.,0.); 87 | float diff = clamp(dot(n,lightDir),0.,1.); 88 | return col *diff*sd; 89 | } 90 | float3 ShadingBG(float3 rd,float3 pos, float3 n ){ 91 | float val = pow(rd.y,2.0); 92 | float3 bCol =float3(0.,0.,0.); 93 | float3 uCol =float3(0.1,0.2,0.9); 94 | return lerp(bCol,uCol,val); 95 | } 96 | float3 Shading(float3 rd,float3 pos, float3 n ,float matID){ 97 | float sd = SoftShadow(pos,lightDir); 98 | if(matID >= (FLOOR_ID-0.5)){ 99 | return ShadingFloor(rd,pos,n,sd); 100 | }else{ 101 | return ShadingShpere(rd,pos,n,sd); 102 | } 103 | } 104 | float3 Normal(float3 pos, float t){ 105 | float val = 0.0001 * t*t; 106 | float3 eps = float3(val,0.,0.); 107 | float3 nor = float3( 108 | Map(pos+eps.xyy).x - Map(pos-eps.xyy).x, 109 | Map(pos+eps.yxy).x - Map(pos-eps.yxy).x, 110 | Map(pos+eps.yyx).x - Map(pos-eps.yyx).x ); 111 | return normalize(nor); 112 | } 113 | // 省掉了camera 设置相关 114 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 115 | float2 ret = RayCast(ro,rd); 116 | float3 pos = ro+ret.x*rd; 117 | 118 | //4.计算碰撞点的法线信息 119 | float3 nor= Normal( pos, ret.x ); 120 | 121 | //5.使用步骤4获得的信息计算当前像素的的颜色值 122 | float3 col = Shading(rd, pos,nor,ret.y); 123 | if(ret.y < -0.5){ 124 | col = ShadingBG(rd,pos,nor); 125 | } 126 | return float4(col,1.0); 127 | } 128 | ENDCG 129 | }//end pass 130 | }//end SubShader 131 | FallBack Off 132 | } 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RaymarchMergeRaster.shader: -------------------------------------------------------------------------------- 1 | //// create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | //// date:2018-04-12 4 | //// email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/RaymarchMergeRaster" { 6 | Properties{ 7 | _MainTex("Base (RGB)", 2D) = "white" {} 8 | } 9 | SubShader{ 10 | Pass { 11 | ZTest Always Cull Off ZWrite Off 12 | CGPROGRAM 13 | 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | #include "ShaderLibs/Feature.cginc" 17 | #include "ShaderLibs/Framework3D.cginc" 18 | 19 | #define SPHERE_ID (1.0) 20 | #define FLOOR_ID (2.0) 21 | #define lightDir (normalize(float3(5.,3.0,-1.0))) 22 | 23 | 24 | float MapSphere(float3 pos){ 25 | // center at float3(0.,0.,0.); 26 | float radius = 0.5; 27 | float3 centerPos = float3(0.,1.0+ sin(_Time.y*1.)*0.5,0.); 28 | return length(pos-centerPos) - radius; 29 | } 30 | float MapFloor(float3 pos ){ 31 | float3 n= float3(0.,1.,0.); 32 | float3 d = 0; 33 | return dot(n,pos)-d; 34 | } 35 | float2 Map(float3 pos){ 36 | float dist2Sphere = MapSphere(pos);// ID 1 37 | float dist2Plane = MapFloor(pos); // ID 2 38 | if(dist2Plane < dist2Sphere) { 39 | return float2(dist2Plane,FLOOR_ID); 40 | }else{ 41 | return float2(dist2Sphere,SPHERE_ID); 42 | } 43 | } 44 | 45 | 46 | #define MARCH_NUM 256 //最多光线检测次数 47 | float2 RayCast(float3 ro,float3 rd){ 48 | float tmin = 0.1; 49 | float tmax = 20.0; 50 | 51 | float t = tmin; 52 | float2 res = float2(0.,-1.0); 53 | for( int i=0; i tmax ) break; 59 | t += 0.5*res.x;// 加速检测速度 这里可以有不同的策略 60 | } 61 | if( t>tmax ) return float2(t,-1.0); 62 | return float2( t, res.y ); 63 | } 64 | float SoftShadow(float3 ro, float3 rd ) 65 | { 66 | float res = 1.0; 67 | float t = 0.001; 68 | for( int i=0; i<80; i++ ) 69 | { 70 | float3 p = ro + t*rd; 71 | float h = Map(p); 72 | res = min( res, 16.0*h/t ); 73 | t += h; 74 | if( res<0.001 ||p.y>(200.0) ) break; 75 | } 76 | return clamp( res, 0.0, 1.0 ); 77 | } 78 | 79 | float3 ShadingShpere(float3 rd,float3 pos, float3 n,float3 sd){ 80 | float3 col = float3(1.,0.,0.); 81 | float diff = clamp(dot(n,lightDir),0.,1.); 82 | float bklig = clamp(dot(n,-lightDir),0.,1.)*0.05;//加点背光 83 | return col *(diff+bklig); 84 | } 85 | float3 ShadingFloor(float3 rd,float3 pos, float3 n,float3 sd ){ 86 | float3 col = float3(0.,1.,0.); 87 | float diff = clamp(dot(n,lightDir),0.,1.); 88 | return col *diff*sd; 89 | } 90 | float3 ShadingBG(float3 rd,float3 pos, float3 n ){ 91 | float val = pow(rd.y,2.0); 92 | float3 bCol =float3(0.,0.,0.); 93 | float3 uCol =float3(0.1,0.2,0.9); 94 | return lerp(bCol,uCol,val); 95 | } 96 | float3 Shading(float3 rd,float3 pos, float3 n ,float matID){ 97 | float sd = SoftShadow(pos,lightDir); 98 | if(matID >= (FLOOR_ID-0.5)){ 99 | return ShadingFloor(rd,pos,n,sd); 100 | }else{ 101 | return ShadingShpere(rd,pos,n,sd); 102 | } 103 | } 104 | float3 Normal(float3 pos, float t){ 105 | float val = 0.0001 * t*t; 106 | float3 eps = float3(val,0.,0.); 107 | float3 nor = float3( 108 | Map(pos+eps.xyy).x - Map(pos-eps.xyy).x, 109 | Map(pos+eps.yxy).x - Map(pos-eps.yxy).x, 110 | Map(pos+eps.yyx).x - Map(pos-eps.yyx).x ); 111 | return normalize(nor); 112 | } 113 | 114 | float4 ProcessRayMarch(float2 uv,float3 ro,float3 rd,inout float sceneDep,float4 sceneCol) { 115 | float2 ret = RayCast(ro,rd); 116 | float3 pos = ro+ret.x*rd; 117 | float matID = ret.y; 118 | float rz = ret.x; 119 | //4.计算碰撞点的法线信息 120 | float3 nor= Normal( pos, ret.x ); 121 | 122 | //5.使用步骤4获得的信息计算当前像素的的颜色值 123 | float3 col = Shading(rd, pos,nor,matID); 124 | if(ret.y < -0.5){ 125 | col = ShadingBG(rd,pos,nor); 126 | } 127 | //检测Unity中场景的z值时候小于raymarch场景中的t值,类似于ztest 128 | if(rz>sceneDep){ 129 | col = sceneCol; 130 | rz = sceneDep; 131 | } 132 | return float4(col,1.0); 133 | } 134 | ENDCG 135 | }//end pass 136 | }//end SubShader 137 | FallBack Off 138 | } 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Scripts/Tools/Editor/EditorCreateNoiseTex.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public class EditorCreateNoiseTex { 7 | static Texture2D texMatrix; 8 | public static int wid = 512; 9 | public static int hei = 512; 10 | public static int scale = 10; 11 | public static int bordPixelNum = 16; 12 | 13 | public static string perlinNoiseTexPath = "/Textures/PerlinNoise.png"; 14 | public static string whiteNoiseTexPath = "/Textures/WhiteNoise.png"; 15 | 16 | [MenuItem("Tool/CreatePerlinNoiseTex")] 17 | public static void CreatePerlinNoiseTex() { 18 | Color[] colors = new Color[wid * hei]; 19 | for (int i = 0; i < hei; i++) { 20 | for (int j = 0; j < wid; j++) { 21 | colors[i * wid + j].r = Mathf.PerlinNoise(1.0f * i / hei * scale+ 0, 1.0f * j / wid * scale+0); 22 | colors[i * wid + j].g = Mathf.PerlinNoise(1.0f * i / hei * scale+ 101, 1.0f * j / wid * scale+101); 23 | colors[i * wid + j].b = Mathf.PerlinNoise(1.0f * i / hei * scale+ 217, 1.0f * j / wid * scale+217); 24 | colors[i * wid + j].a = Mathf.PerlinNoise(1.0f * i / hei * scale+ 331, 1.0f * j / wid * scale+331); 25 | } 26 | } 27 | // 让边界变得连续 28 | SmoothBorder(colors); 29 | SaveToPic(colors, perlinNoiseTexPath); 30 | } 31 | [MenuItem("Tool/CreateWhiteNoiseTex")] 32 | public static void CreateWhiteNoiseTex() { 33 | Color[] colors = new Color[wid * hei]; 34 | for (int i = 0; i < hei; i++) { 35 | for (int j = 0; j < wid; j++) { 36 | colors[i * wid + j].r = WhiteNoise(); 37 | colors[i * wid + j].g = WhiteNoise(); 38 | colors[i * wid + j].b = WhiteNoise(); 39 | colors[i * wid + j].a = WhiteNoise(); 40 | } 41 | } 42 | // 让边界变得连续 43 | SmoothBorder(colors); 44 | SaveToPic(colors, whiteNoiseTexPath); 45 | } 46 | 47 | 48 | static private void SmoothBorder(Color[] colors) { 49 | int num = bordPixelNum; 50 | for (int j = 0; j < hei; j++) { 51 | float tr = colors[j * wid + num].r; 52 | float tl = colors[j * wid + wid - num - 2].r; 53 | for (int i = 0; i < num; i++) { 54 | float rper = 1.0f * (i + 1) / (num * 2 + 1); 55 | colors[j * wid + num - i - 1].r = Mathf.Lerp(tl, tr, 1.0f - rper); 56 | colors[j * wid + wid - num + i].r = Mathf.Lerp(tl, tr, rper); 57 | } 58 | } 59 | for (int j = 0; j < wid; j++) { 60 | float tc = colors[(hei - 1 - num) * wid + j].r; 61 | float bc = colors[(num) * wid + j].r; 62 | for (int i = 0; i < num; i++) { 63 | float rper = 1.0f * (i + 1) / (num * 2 + 1); 64 | colors[(num - i - 1) * wid + j].r = Mathf.Lerp(bc, tc, rper); 65 | colors[(hei - 1 - num + 1 + i) * wid + j].r = Mathf.Lerp(bc, tc, 1.0f - rper); 66 | } 67 | } 68 | } 69 | 70 | static float Hash12(Vector2 p) { 71 | float h = p.x * 127.1f + p.y * 311.7f;// dot(p, Vector2(127.1, 311.7)); 72 | float val = Mathf.Sin(h) * 43758.5453123f; 73 | return val - Mathf.Floor(val); 74 | } 75 | static float Noise(float x, float y) { 76 | return ValueNoise(new Vector2(x, y)); 77 | } 78 | static float ValueNoise(Vector2 p) { 79 | float ix = Mathf.Floor(p.x); 80 | float iy = Mathf.Floor(p.y); 81 | Vector2 i = new Vector2(ix, iy); 82 | float fx = p.x - ix; 83 | float fy = p.y - iy; 84 | Vector2 u = new Vector2(fx * fx * (3.0f - 2.0f * fx), fy * fy * (3.0f - 2.0f * fy)); 85 | return -1.0f + 2.0f * Mathf.Lerp(Mathf.Lerp(Hash12(i + new Vector2(0.0f, 0.0f)), 86 | Hash12(i + new Vector2(1.0f, 0.0f)), u.x), 87 | Mathf.Lerp(Hash12(i + new Vector2(0.0f, 1.0f)), 88 | Hash12(i + new Vector2(1.0f, 1.0f)), u.x), u.y); 89 | } 90 | static float WhiteNoise() { 91 | return Random.value; 92 | } 93 | static void SaveToPic(Color[] colors, string relPath) { 94 | texMatrix = new Texture2D(wid, hei); 95 | texMatrix.SetPixels(colors); 96 | texMatrix.Apply(); 97 | byte[] bytes = texMatrix.EncodeToPNG(); 98 | // 将字节保存成图片,这个路径只能在PC端对图片进行读写操作 99 | var path = ConstVar.ProjectDir + relPath; 100 | System.IO.File.WriteAllBytes(path, bytes); 101 | UnityEditor.AssetDatabase.ImportAsset(path); 102 | UnityEditor.AssetDatabase.Refresh(); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/ShaderLibs/SDF.cginc: -------------------------------------------------------------------------------- 1 | // Create by JiepengTan@gmail.com 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-03-27 4 | #ifndef FMST_SDF 5 | #define FMST_SDF 6 | #include "Math.cginc" 7 | 8 | //------------------------------------------------------------------ 9 | 10 | float OpS( float d1, float d2 ) 11 | { 12 | return max(-d2,d1); 13 | } 14 | 15 | float OpU( float d1, float d2 ) 16 | { 17 | return min(d1,d2); 18 | } 19 | float2 OpU( float2 d1, float2 d2 ) 20 | { 21 | return (d1.x 0.0 ) p = float2( p.x - k*p.y, -k*p.x - p.y )/2.0; 101 | p.x += 2.0 - 2.0*clamp( (p.x+2.0)/2.0, 0.0, 1.0 ); 102 | return -length(p)*sign(p.y); 103 | } 104 | 105 | float SdTriPrism( float3 p, float2 h ) 106 | { 107 | float3 q = abs(p); 108 | float d1 = q.z-h.y; 109 | #if 1 110 | // distance bound 111 | float d2 = max(q.x*0.866025+p.y*0.5,-p.y)-h.x*0.5; 112 | #else 113 | // correct distance 114 | h.x *= 0.866025; 115 | float d2 = SdEquilateralTriangle(p.xy/h.x)*h.x; 116 | #endif 117 | return length(max(float2(d1,d2),0.0)) + min(max(d1,d2), 0.); 118 | } 119 | 120 | 121 | 122 | float SdCylinder( float3 p, float2 h ) 123 | { 124 | float2 d = abs(float2(length(p.xz),p.y)) - h; 125 | return min(max(d.x,d.y),0.0) + length(max(d,0.0)); 126 | } 127 | 128 | float SdCone( in float3 p, in float3 c ) 129 | { 130 | float2 q = float2( length(p.xz), p.y ); 131 | float d1 = -q.y-c.z; 132 | float d2 = max( dot(q,c.xy), q.y); 133 | return length(max(float2(d1,d2),0.0)) + min(max(d1,d2), 0.); 134 | } 135 | 136 | float SdConeSection( in float3 p, in float h, in float r1, in float r2 ) 137 | { 138 | float d1 = -p.y - h; 139 | float q = p.y - h; 140 | float si = 0.5*(r1-r2)/h; 141 | float d2 = max( sqrt( dot(p.xz,p.xz)*(1.0-si*si)) + q*si - r2, q ); 142 | return length(max(float2(d1,d2),0.0)) + min(max(d1,d2), 0.); 143 | } 144 | 145 | float SdPryamid4(float3 p, float3 h ) // h = { cos a, sin a, height } 146 | { 147 | // Tetrahedron = Octahedron - Cube 148 | float box = SdBox( p - float3(0,-2.0*h.z,0), float3(2.0*h.z,2.0*h.z,2.0*h.z) ); 149 | 150 | float d = 0.0; 151 | d = max( d, abs( dot(p, float3( -h.x, h.y, 0 )) )); 152 | d = max( d, abs( dot(p, float3( h.x, h.y, 0 )) )); 153 | d = max( d, abs( dot(p, float3( 0, h.y, h.x )) )); 154 | d = max( d, abs( dot(p, float3( 0, h.y,-h.x )) )); 155 | float octa = d - h.z; 156 | return max(-box,octa); // Subtraction 157 | } 158 | 159 | 160 | float SdTorus82( float3 p, float2 t ) 161 | { 162 | float2 q = float2(length2(p.xz)-t.x,p.y); 163 | return length8(q)-t.y; 164 | } 165 | 166 | float SdTorus88( float3 p, float2 t ) 167 | { 168 | float2 q = float2(length8(p.xz)-t.x,p.y); 169 | return length8(q)-t.y; 170 | } 171 | 172 | float SdCylinder6( float3 p, float2 h ) 173 | { 174 | return max( length6(p.xz)-h.x, abs(p.y)-h.y ); 175 | } 176 | 177 | //圆柱切片 178 | float SdClipCylinder( float3 pos, float3 h) 179 | { 180 | pos.x += h.x*h.z*2. - h.x; 181 | float cy = SdCylinder(pos,h.xy); 182 | float bx = SdBox(pos-float3(h.x*(1.+2.*h.z),0.,0.),float3(h.x*2.,h.y+0.3,h.x*2.)); 183 | return OpS(cy,bx); 184 | } 185 | 186 | #endif // FMST_SDF -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/Ripple.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // all right reserve 4 | Shader "FishManShaderTutorial/Ripple" 5 | { 6 | Properties 7 | { 8 | _MainTex ("Texture", 2D) = "white" {} 9 | _Color ("color", Color) = (.34, .85, .92, 1) // color 10 | crossGridNum ("crossGridNum", float) = 1.//Maximum number of cells a ripple can cross. 11 | period ("period", float) = 1.//peroid 12 | spreadSpd ("spreadSpd", float) = 2.//wave move speed 13 | waveNum ("waveNum", float) = 1.//wave num in a grid 14 | waveInterval ("waveInterval", float) = 0.05//single wave 's width 15 | decaySpd ("decaySpd", float) = 5.//wave amptitude decrese speed 16 | waveHei ("waveHei", float) = .3// wave height 17 | tileNum ("tileNum", float) = 10.// grid tile num 18 | ttime ("ttime", float) = 10.// grid tile num 19 | 20 | } 21 | 22 | SubShader 23 | { 24 | Tags { "RenderType"="Opaque" } 25 | LOD 100 26 | 27 | Pass 28 | { 29 | CGPROGRAM 30 | #pragma vertex vert 31 | #pragma fragment frag 32 | #include "UnityCG.cginc" 33 | //#include "ShaderLibs/Noise.cginc" 34 | struct appdata 35 | { 36 | float4 vertex : POSITION; 37 | float2 uv : TEXCOORD0; 38 | }; 39 | 40 | struct v2f 41 | { 42 | float2 uv : TEXCOORD0; 43 | float4 vertex : SV_POSITION; 44 | }; 45 | 46 | sampler2D _MainTex; 47 | float4 _MainTex_ST; 48 | 49 | int crossGridNum ; // Maximum number of cells a ripple can cross. 50 | float period ;//peroid 51 | float spreadSpd;//wave move speed 52 | float waveNum ;//wave num in a grid 53 | float waveInterval;//single wave 's width 54 | float decaySpd;//wave amptitude decrese speed 55 | float waveHei;// wave height 56 | float tileNum;// wave height 57 | float4 _Color; 58 | float ttime;// wave height 59 | 60 | v2f vert (appdata v) 61 | { 62 | v2f o; 63 | o.vertex = UnityObjectToClipPos(v.vertex); 64 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 65 | return o; 66 | } 67 | float Hash12(float2 co){ 68 | return frac(sin(co.x*157.1147 + co.y*13.713) * 43751.1353); 69 | } 70 | fixed2 Hash22(fixed2 co){ 71 | fixed x = frac(sin(dot(co.xy ,fixed2(1232.9898,7183.233))) * 43758.5453); 72 | fixed y = frac(sin(dot(co.xy ,fixed2(4577.6537,5337.2793))) * 37573.5913); 73 | return fixed2(x,y); 74 | } 75 | float2 Hash21(float co){ 76 | fixed x = frac(sin(co*57.2793) * 438.5453); 77 | fixed y = frac(sin(co*47.6537) * 373.5453); 78 | return fixed2(x,y); 79 | } 80 | 81 | 82 | fixed4 frag (v2f i) : SV_Target 83 | { 84 | // sample the texture 85 | float waveWidth = -waveNum * .5 * waveInterval; 86 | float halfWaveWid = waveWidth * 0.5; 87 | float freq = waveNum * 2.*3.14159/waveInterval/(float(crossGridNum) + 1.); 88 | float totalCellNum = float((crossGridNum*2+1)*(crossGridNum*2+1)); 89 | float radius = (float(crossGridNum) + 1.); 90 | float mP = min(period,radius/spreadSpd); 91 | 92 | 93 | float2 uv = i.uv*tileNum; 94 | float2 p0 = floor(uv); 95 | float iTime = ttime; 96 | float2 circles = float2(0.,0.); 97 | 98 | 99 | for (float j = -crossGridNum; j <= crossGridNum; ++j) 100 | { 101 | for (float i = -crossGridNum; i <= crossGridNum; ++i) 102 | { 103 | float2 pi = p0 + float2(i, j); 104 | float2 hsh = Hash22(pi); 105 | float pd = period*(Hash12(hsh) + 1.); 106 | float time = iTime+pd*Hash12(pi); 107 | float t = modf(time,pd); 108 | float2 p = pi + Hash22(hsh + Hash21(floor(time/pd))); 109 | 110 | float lifeTime = (Hash12(Hash22(hsh)) * 0.8+ 0.2)* mP; 111 | float decay =pow(max(0.,lifeTime - t)/lifeTime,decaySpd); 112 | float amp = (lifeTime / period) * waveHei; 113 | 114 | float2 v = p - uv; 115 | float d = (length(v) - spreadSpd*t)/radius; 116 | 117 | float h = 1e-3; 118 | float d1 = d - h; 119 | float d2 = d + h; 120 | float p1 = amp*sin(freq*d1) * smoothstep(waveWidth, halfWaveWid, d1) * smoothstep(0., halfWaveWid, d1); 121 | float p2 = amp*sin(freq*d2) * smoothstep(waveWidth, halfWaveWid, d2) * smoothstep(0., halfWaveWid, d2); 122 | circles += 0.5 * normalize(v) * ((p2 - p1) / (2. * h) * decay); 123 | } 124 | } 125 | circles /= totalCellNum; 126 | float3 n = float3(circles, sqrt(1. - dot(circles, circles))); 127 | 128 | float3 col = tex2D(_MainTex, i.uv - n.xy).rgb 129 | +5.*pow(clamp(dot(n, normalize(float3(1., 0.7, 0.5))), 0., 1.), 6.); 130 | 131 | return float4(col,1.0); 132 | /**/ 133 | } 134 | ENDCG 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/LightScanWithDepthTexture.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // 2018-04-13 email: jiepengtan@gmail.com 4 | Shader "Unity Shaders Book/Chapter 13/Fog With Depth Texture" { 5 | Properties { 6 | _MainTex ("Base (RGB)", 2D) = "white" {} 7 | _SrcCenterPos("_SrcCenterPos", Vector) = (1, 1, 1, 1) 8 | _InnerRange("_InnerRange", float) = 10 9 | _RingWidth("_RingWidth", float) = 10 10 | _RingIntensity("_RingIntensity", float) = 10 11 | 12 | _TileTex("_TileTex", 2D) = "white" {} 13 | _TileSize("_TileSize", float) = 10 14 | _TileIntensity("_TileIntensity", float) = 0.8 15 | _TileColor("_TileColor", Color) = (1, 1, 1, 1) 16 | 17 | _NoiseTex("_NoiseTex", 2D) = "white" {} 18 | _NoiseCellSize("_NoiseCellSize", float) = 0.8 19 | _NoiseCellColor("_NoiseCellColor", Color) = (1, 1, 1, 1) 20 | 21 | _EdgeColor("_EdgeColor", Color) = (1, 1, 1, 1) 22 | } 23 | SubShader { 24 | CGINCLUDE 25 | 26 | #include "UnityCG.cginc" 27 | 28 | float4x4 _FrustumCornersRay; 29 | 30 | sampler2D _MainTex; 31 | half4 _MainTex_TexelSize;//存储纹理大小 32 | 33 | sampler2D _CameraDepthTexture; 34 | 35 | float4 _SrcCenterPos; 36 | float _InnerRange; 37 | float _RingWidth; 38 | float _RingIntensity; 39 | 40 | sampler2D _TileTex; 41 | float _TileSize; 42 | float _TileIntensity; 43 | float4 _TileColor; 44 | 45 | 46 | sampler2D _NoiseTex; 47 | float _NoiseCellSize; 48 | float4 _NoiseCellColor; 49 | 50 | float4 _EdgeColor; 51 | 52 | struct v2f { 53 | float4 pos : SV_POSITION; 54 | half2 mainUV : TEXCOORD0; 55 | half2 uv_depth : TEXCOORD1; 56 | float4 interpolatedRay : TEXCOORD2; 57 | float4 posWorld : TEXCOORD3; 58 | half2 edgeUV[9]: TEXCOORD4; 59 | }; 60 | 61 | 62 | fixed luminance(fixed4 color) { 63 | return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; 64 | } 65 | 66 | half ComputeEdgeValue(v2f i) 67 | { 68 | const half Gx[9] = { -1, 0, 1, 69 | -2, 0, 2, 70 | -1, 0, 1 }; 71 | const half Gy[9] = { -1, -2, -1, 72 | 0, 0, 0, 73 | 1, 2, 1 }; 74 | 75 | half texColor; 76 | half edgeX = 0; 77 | half edgeY = 0; 78 | for (int it = 0; it < 9; it++) { 79 | texColor = luminance(tex2D(_MainTex, i.edgeUV[it])); 80 | edgeX += texColor * Gx[it]; 81 | edgeY += texColor * Gy[it]; 82 | } 83 | 84 | half edge = abs(edgeX) + abs(edgeY); 85 | return edge; 86 | } 87 | float4 GpuGetCell3D(float3 pos) 88 | { 89 | float u = (pos.x*23.335 + pos.y * 31.361) / 255.451; 90 | float v = (pos.z*83.112 - pos.x * 71.214) / 157.7324; 91 | return(tex2D(_NoiseTex, float2(u, v))); 92 | } 93 | 94 | v2f vert(appdata_img v) { 95 | v2f o = (v2f)0; 96 | o.pos = UnityObjectToClipPos(v.vertex); 97 | 98 | o.mainUV = v.texcoord; 99 | o.uv_depth = v.texcoord; 100 | 101 | #if UNITY_UV_STARTS_AT_TOP 102 | if (_MainTex_TexelSize.y < 0) 103 | o.uv_depth.y = 1 - o.uv_depth.y; 104 | #endif 105 | 106 | int index = 0; 107 | if (v.texcoord.x < 0.5 && v.texcoord.y < 0.5) { 108 | index = 0; 109 | } else if (v.texcoord.x > 0.5 && v.texcoord.y < 0.5) { 110 | index = 1; 111 | } else if (v.texcoord.x > 0.5 && v.texcoord.y > 0.5) { 112 | index = 2; 113 | } else { 114 | index = 3; 115 | } 116 | 117 | #if UNITY_UV_STARTS_AT_TOP 118 | if (_MainTex_TexelSize.y < 0) 119 | index = 3 - index; 120 | #endif 121 | 122 | o.interpolatedRay = _FrustumCornersRay[index]; 123 | 124 | //Comp edge sample uv 125 | half2 mainUV = v.texcoord; 126 | o.edgeUV[0] = mainUV + _MainTex_TexelSize.xy * half2(-1, -1); 127 | o.edgeUV[1] = mainUV + _MainTex_TexelSize.xy * half2(0, -1); 128 | o.edgeUV[2] = mainUV + _MainTex_TexelSize.xy * half2(1, -1); 129 | o.edgeUV[3] = mainUV + _MainTex_TexelSize.xy * half2(-1, 0); 130 | o.edgeUV[4] = mainUV + _MainTex_TexelSize.xy * half2(0, 0); 131 | o.edgeUV[5] = mainUV + _MainTex_TexelSize.xy * half2(1, 0); 132 | o.edgeUV[6] = mainUV + _MainTex_TexelSize.xy * half2(-1, 1); 133 | o.edgeUV[7] = mainUV + _MainTex_TexelSize.xy * half2(0, 1); 134 | o.edgeUV[8] = mainUV + _MainTex_TexelSize.xy * half2(1, 1); 135 | 136 | return o; 137 | } 138 | 139 | 140 | 141 | fixed4 frag(v2f i) : SV_Target { 142 | float linearDepth = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv_depth)); 143 | float3 worldPos = _WorldSpaceCameraPos + linearDepth * i.interpolatedRay.xyz; 144 | float3 rawWorldPos = worldPos; 145 | worldPos = floor( worldPos / _NoiseCellSize)*_NoiseCellSize;//晶格化 146 | 147 | //Ring 148 | float dist = distance(worldPos, _SrcCenterPos.xyz); 149 | float distFactor = saturate(1 - abs((dist - _InnerRange)) / _RingWidth); 150 | distFactor = smoothstep(0, 1,distFactor); 151 | //tileTex 152 | float2 tileUV = rawWorldPos.xz / _TileSize; 153 | fixed4 tileIntensity = (tex2D(_TileTex, tileUV) * _TileIntensity).r; 154 | //edge 155 | half edgeIntensity = ComputeEdgeValue(i); 156 | //晶格化 157 | //distFactor = step(0.1, distFactor); 158 | 159 | //cell Noise 160 | float4 NoiseCellIntensity = GpuGetCell3D(worldPos).r; 161 | 162 | fixed4 finalColor = tex2D(_MainTex, i.mainUV); 163 | finalColor.rgb = finalColor.rgb 164 | + distFactor * (NoiseCellIntensity * _NoiseCellColor + tileIntensity *_TileColor + edgeIntensity * _EdgeColor) * _RingIntensity; 165 | 166 | //return _MainTex_TexelSize.y; 167 | return finalColor; 168 | } 169 | 170 | ENDCG 171 | 172 | Pass { 173 | ZTest Always Cull Off ZWrite Off 174 | 175 | CGPROGRAM 176 | 177 | #pragma vertex vert 178 | #pragma fragment frag 179 | 180 | ENDCG 181 | } 182 | } 183 | FallBack Off 184 | } 185 | -------------------------------------------------------------------------------- /Assets/FishManShaderTutorial/Shaders/RayMarchSimpleScene.shader: -------------------------------------------------------------------------------- 1 | // create by JiepengTan 2 | // https://github.com/JiepengTan/FishManShaderTutorial 3 | // date:2018-04-12 4 | // email: jiepengtan@gmail.com 5 | Shader "FishManShaderTutorial/RayMarchSimpleScene" 6 | { 7 | Properties 8 | { 9 | _MainTex ("Texture", 2D) = "white" {} 10 | 11 | } 12 | 13 | SubShader 14 | { 15 | Tags { "RenderType"="Opaque" } 16 | LOD 100 17 | 18 | Pass 19 | { 20 | CGPROGRAM 21 | #pragma vertex vert 22 | #pragma fragment frag 23 | #include "UnityCG.cginc" 24 | //#include "ShaderLibs/Noise.cginc" 25 | struct appdata 26 | { 27 | float4 vertex : POSITION; 28 | float2 uv : TEXCOORD0; 29 | }; 30 | 31 | struct v2f 32 | 33 | { 34 | float2 uv : TEXCOORD0; 35 | float4 vertex : SV_POSITION; 36 | }; 37 | 38 | sampler2D _MainTex; 39 | float4 _MainTex_ST; 40 | 41 | v2f vert (appdata v) 42 | { 43 | v2f o; 44 | o.vertex = UnityObjectToClipPos(v.vertex); 45 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 46 | return o; 47 | } 48 | 49 | #define SPHERE_ID (1.0) 50 | #define FLOOR_ID (2.0) 51 | #define lightDir (normalize(float3(5.,3.0,-1.0))) 52 | 53 | 54 | float MapSphere(float3 pos){ 55 | // center at float3(0.,0.,0.); 56 | float radius = 0.5; 57 | float3 centerPos = float3(0.,1.0+ sin(_Time.y*1.)*0.5,0.); 58 | return length(pos-centerPos) - radius; 59 | } 60 | float MapFloor(float3 pos ){ 61 | float3 n= float3(0.,1.,0.); 62 | float3 d = 0; 63 | return dot(n,pos)-d; 64 | } 65 | float2 Map(float3 pos){ 66 | float dist2Sphere = MapSphere(pos);// ID 1 67 | float dist2Plane = MapFloor(pos); // ID 2 68 | if(dist2Plane < dist2Sphere) { 69 | return float2(dist2Plane,FLOOR_ID); 70 | }else{ 71 | return float2(dist2Sphere,SPHERE_ID); 72 | } 73 | } 74 | 75 | 76 | #define MARCH_NUM 256 //最多光线检测次数 77 | float2 RayCast(float3 ro,float3 rd){ 78 | float tmin = 0.1; 79 | float tmax = 20.0; 80 | 81 | float t = tmin; 82 | float2 res = float2(0.,-1.0); 83 | for( int i=0; i tmax ) break; 89 | t += 0.5*res.x;// 加速检测速度 这里可以有不同的策略 90 | } 91 | if( t>tmax ) return float2(t,-1.0); 92 | return float2( t, res.y ); 93 | } 94 | float SoftShadow(float3 ro, float3 rd ) 95 | { 96 | float res = 1.0; 97 | float t = 0.001; 98 | for( int i=0; i<80; i++ ) 99 | { 100 | float3 p = ro + t*rd; 101 | float h = Map(p); 102 | res = min( res, 16.0*h/t ); 103 | t += h; 104 | if( res<0.001 ||p.y>(200.0) ) break; 105 | } 106 | return clamp( res, 0.0, 1.0 ); 107 | } 108 | 109 | float3 ShadingShpere(float3 rd,float3 pos, float3 n,float3 sd){ 110 | float3 col = float3(1.,0.,0.); 111 | float diff = clamp(dot(n,lightDir),0.,1.); 112 | float bklig = clamp(dot(n,-lightDir),0.,1.)*0.05;//加点背光 113 | return col *(diff+bklig); 114 | } 115 | float3 ShadingFloor(float3 rd,float3 pos, float3 n,float3 sd ){ 116 | float3 col = float3(0.,1.,0.); 117 | float diff = clamp(dot(n,lightDir),0.,1.); 118 | return col *diff*sd; 119 | } 120 | float3 ShadingBG(float3 rd,float3 pos, float3 n ){ 121 | float val = pow(rd.y,2.0); 122 | float3 bCol =float3(0.,0.,0.); 123 | float3 uCol =float3(0.1,0.2,0.9); 124 | return lerp(bCol,uCol,val); 125 | } 126 | float3 Shading(float3 rd,float3 pos, float3 n ,float matID){ 127 | float sd = SoftShadow(pos,lightDir); 128 | if(matID >= (FLOOR_ID-0.5)){ 129 | return ShadingFloor(rd,pos,n,sd); 130 | }else{ 131 | return ShadingShpere(rd,pos,n,sd); 132 | } 133 | } 134 | float3 Normal(float3 pos, float t){ 135 | float val = 0.0001 * t*t; 136 | float3 eps = float3(val,0.,0.); 137 | float3 nor = float3( 138 | Map(pos+eps.xyy).x - Map(pos-eps.xyy).x, 139 | Map(pos+eps.yxy).x - Map(pos-eps.yxy).x, 140 | Map(pos+eps.yyx).x - Map(pos-eps.yyx).x ); 141 | return normalize(nor); 142 | } 143 | void SetCamera(float2 uv,out float3 ro, out float3 rd){ 144 | ro = float3(0.,2.,-5.0);//获取相机的位置 145 | float3 ta = float3(0.,0.5,0.);//获取目标位置 146 | float3 forward = normalize( ta - ro);//计算 forward 方向 147 | float3 left = normalize(cross( float3(0.0,1.0,0.0), forward ));//计算 left 方向 148 | float3 up = normalize(cross(forward,left));////计算 up 方向 149 | const float zoom = 1.; 150 | rd = normalize( uv.x*left + uv.y*up + zoom*forward ); 151 | } 152 | fixed4 frag (v2f i) : SV_Target 153 | { 154 | float2 uv = (i.uv-0.5) * float2(_ScreenParams.x/_ScreenParams.y,1.0);// map into [-0.5,0.5] 155 | float3 ro,rd; 156 | SetCamera(uv,ro,rd); 157 | float2 ret = RayCast(ro,rd); 158 | float3 pos = ro+ret.x*rd; 159 | 160 | //4.计算碰撞点的法线信息 161 | float3 nor= Normal( pos, ret.x ); 162 | 163 | //5.使用步骤4获得的信息计算当前像素的的颜色值 164 | float3 col = Shading(rd, pos,nor,ret.y); 165 | if(ret.y < -0.5){ 166 | col = ShadingBG(rd,pos,nor); 167 | } 168 | return float4(col,1.0); 169 | } 170 | 171 | 172 | ENDCG 173 | }//end pass 174 | }//end SubShader 175 | FallBack Off 176 | } 177 | 178 | --------------------------------------------------------------------------------