├── .gitignore ├── Assets ├── CPU.meta ├── CPU │ ├── Billboard.shader │ ├── Billboard.shader.meta │ ├── Cell.cs │ ├── Cell.cs.meta │ ├── CellGrid.cs │ ├── CellGrid.cs.meta │ ├── PBD.cs │ ├── PBD.cs.meta │ ├── Particle.cs │ ├── Particle.cs.meta │ ├── Particle.mat │ └── Particle.mat.meta ├── GPU_Fast.meta ├── GPU_Fast │ ├── 2D.meta │ └── 2D │ │ ├── BitonicSort.compute │ │ ├── BitonicSort.compute.meta │ │ ├── DebugBitonicSort.cs │ │ ├── DebugBitonicSort.cs.meta │ │ ├── PBF.cs │ │ ├── PBF.cs.meta │ │ ├── PBF2D_Fast.compute │ │ ├── PBF2D_Fast.compute.meta │ │ ├── Render.mat │ │ ├── Render.mat.meta │ │ ├── Render.shader │ │ ├── Render.shader.meta │ │ ├── Renderer.cs │ │ ├── Renderer.cs.meta │ │ ├── WaveController.cs │ │ └── WaveController.cs.meta ├── GPU_SLOW.meta ├── GPU_SLOW │ ├── 2D_Circle.meta │ ├── 2D_Circle │ │ ├── PBF.cs │ │ ├── PBF.cs.meta │ │ ├── PBF2D_CIRCLE.compute │ │ ├── PBF2D_CIRCLE.compute.meta │ │ ├── Render.mat │ │ ├── Render.mat.meta │ │ ├── Render.shader │ │ ├── Render.shader.meta │ │ ├── Renderer.cs │ │ └── Renderer.cs.meta │ ├── 3D.meta │ └── 3D │ │ ├── PBF.cs │ │ ├── PBF.cs.meta │ │ ├── PBF3D_Slow.compute │ │ ├── PBF3D_Slow.compute.meta │ │ ├── Render.mat │ │ ├── Render.mat.meta │ │ ├── Render.shader │ │ ├── Render.shader.meta │ │ ├── Renderer.cs │ │ └── Renderer.cs.meta ├── Main.unity ├── Main.unity.meta ├── Standard Assets.meta ├── Standard Assets │ ├── Editor.meta │ ├── Editor │ │ ├── ImageEffects.meta │ │ └── ImageEffects │ │ │ ├── AntialiasingEditor.cs │ │ │ ├── AntialiasingEditor.cs.meta │ │ │ ├── BloomAndFlaresEditor.cs │ │ │ ├── BloomAndFlaresEditor.cs.meta │ │ │ ├── BloomEditor.cs │ │ │ ├── BloomEditor.cs.meta │ │ │ ├── CameraMotionBlurEditor.cs │ │ │ ├── CameraMotionBlurEditor.cs.meta │ │ │ ├── ColorCorrectionCurvesEditor.cs │ │ │ ├── ColorCorrectionCurvesEditor.cs.meta │ │ │ ├── ColorCorrectionLookupEditor.cs │ │ │ ├── ColorCorrectionLookupEditor.cs.meta │ │ │ ├── CreaseShadingEditor.cs │ │ │ ├── CreaseShadingEditor.cs.meta │ │ │ ├── DepthOfFieldDeprecatedEditor.cs │ │ │ ├── DepthOfFieldDeprecatedEditor.cs.meta │ │ │ ├── DepthOfFieldEditor.cs │ │ │ ├── DepthOfFieldEditor.cs.meta │ │ │ ├── EdgeDetectionEditor.cs │ │ │ ├── EdgeDetectionEditor.cs.meta │ │ │ ├── NoiseAndGrainEditor.cs │ │ │ ├── NoiseAndGrainEditor.cs.meta │ │ │ ├── SunShaftsEditor.cs │ │ │ ├── SunShaftsEditor.cs.meta │ │ │ ├── TonemappingEditor.cs │ │ │ ├── TonemappingEditor.cs.meta │ │ │ ├── VignetteAndChromaticAberrationEditor.cs │ │ │ └── VignetteAndChromaticAberrationEditor.cs.meta │ ├── Effects.meta │ └── Effects │ │ ├── ImageEffects.meta │ │ └── ImageEffects │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── Antialiasing.cs │ │ ├── Antialiasing.cs.meta │ │ ├── Bloom.cs │ │ ├── Bloom.cs.meta │ │ ├── BloomAndFlares.cs │ │ ├── BloomAndFlares.cs.meta │ │ ├── BloomOptimized.cs │ │ ├── BloomOptimized.cs.meta │ │ ├── Blur.cs │ │ ├── Blur.cs.meta │ │ ├── BlurOptimized.cs │ │ ├── BlurOptimized.cs.meta │ │ ├── CameraMotionBlur.cs │ │ ├── CameraMotionBlur.cs.meta │ │ ├── ColorCorrectionCurves.cs │ │ ├── ColorCorrectionCurves.cs.meta │ │ ├── ColorCorrectionLookup.cs │ │ ├── ColorCorrectionLookup.cs.meta │ │ ├── ColorCorrectionRamp.cs │ │ ├── ColorCorrectionRamp.cs.meta │ │ ├── ContrastEnhance.cs │ │ ├── ContrastEnhance.cs.meta │ │ ├── ContrastStretch.cs │ │ ├── ContrastStretch.cs.meta │ │ ├── CreaseShading.cs │ │ ├── CreaseShading.cs.meta │ │ ├── DepthOfField.cs │ │ ├── DepthOfField.cs.meta │ │ ├── DepthOfFieldDeprecated.cs │ │ ├── DepthOfFieldDeprecated.cs.meta │ │ ├── EdgeDetection.cs │ │ ├── EdgeDetection.cs.meta │ │ ├── Fisheye.cs │ │ ├── Fisheye.cs.meta │ │ ├── GlobalFog.cs │ │ ├── GlobalFog.cs.meta │ │ ├── Grayscale.cs │ │ ├── Grayscale.cs.meta │ │ ├── ImageEffectBase.cs │ │ ├── ImageEffectBase.cs.meta │ │ ├── ImageEffects.cs │ │ ├── ImageEffects.cs.meta │ │ ├── MotionBlur.cs │ │ ├── MotionBlur.cs.meta │ │ ├── NoiseAndGrain.cs │ │ ├── NoiseAndGrain.cs.meta │ │ ├── NoiseAndScratches.cs │ │ ├── NoiseAndScratches.cs.meta │ │ ├── PostEffectsBase.cs │ │ ├── PostEffectsBase.cs.meta │ │ ├── PostEffectsHelper.cs │ │ ├── PostEffectsHelper.cs.meta │ │ ├── Quads.cs │ │ ├── Quads.cs.meta │ │ ├── ScreenOverlay.cs │ │ ├── ScreenOverlay.cs.meta │ │ ├── ScreenSpaceAmbientObscurance.cs │ │ ├── ScreenSpaceAmbientObscurance.cs.meta │ │ ├── ScreenSpaceAmbientOcclusion.cs │ │ ├── ScreenSpaceAmbientOcclusion.cs.meta │ │ ├── SepiaTone.cs │ │ ├── SepiaTone.cs.meta │ │ ├── SunShafts.cs │ │ ├── SunShafts.cs.meta │ │ ├── TiltShift.cs │ │ ├── TiltShift.cs.meta │ │ ├── Tonemapping.cs │ │ ├── Tonemapping.cs.meta │ │ ├── Triangles.cs │ │ ├── Triangles.cs.meta │ │ ├── Twirl.cs │ │ ├── Twirl.cs.meta │ │ ├── VignetteAndChromaticAberration.cs │ │ ├── VignetteAndChromaticAberration.cs.meta │ │ ├── Vortex.cs │ │ └── Vortex.cs.meta │ │ ├── Shaders.meta │ │ ├── Shaders │ │ ├── BlendModesOverlay.shader │ │ ├── BlendModesOverlay.shader.meta │ │ ├── BlurEffectConeTaps.shader │ │ ├── BlurEffectConeTaps.shader.meta │ │ ├── CameraMotionBlur.shader │ │ ├── CameraMotionBlur.shader.meta │ │ ├── CameraMotionBlurDX11.shader │ │ ├── CameraMotionBlurDX11.shader.meta │ │ ├── ChromaticAberrationShader.shader │ │ ├── ChromaticAberrationShader.shader.meta │ │ ├── ColorCorrection3DLut.shader │ │ ├── ColorCorrection3DLut.shader.meta │ │ ├── ColorCorrectionCurves.shader │ │ ├── ColorCorrectionCurves.shader.meta │ │ ├── ColorCorrectionCurvesSimple.shader │ │ ├── ColorCorrectionCurvesSimple.shader.meta │ │ ├── ColorCorrectionEffect.shader │ │ ├── ColorCorrectionEffect.shader.meta │ │ ├── ColorCorrectionSelective.shader │ │ ├── ColorCorrectionSelective.shader.meta │ │ ├── Contrast Stretch.meta │ │ ├── Contrast Stretch │ │ │ ├── Adaptation.shader │ │ │ ├── Adaptation.shader.meta │ │ │ ├── Apply.shader │ │ │ ├── Apply.shader.meta │ │ │ ├── Luminance.shader │ │ │ ├── Luminance.shader.meta │ │ │ ├── MinMaxReduction.shader │ │ │ └── MinMaxReduction.shader.meta │ │ ├── ContrastComposite.shader │ │ ├── ContrastComposite.shader.meta │ │ ├── ConvertDepth.shader │ │ ├── ConvertDepth.shader.meta │ │ ├── CreaseApply.shader │ │ ├── CreaseApply.shader.meta │ │ ├── EdgeDetectNormals.shader │ │ ├── EdgeDetectNormals.shader.meta │ │ ├── FisheyeShader.shader │ │ ├── FisheyeShader.shader.meta │ │ ├── GlobalFog.shader │ │ ├── GlobalFog.shader.meta │ │ ├── GrayscaleEffect.shader │ │ ├── GrayscaleEffect.shader.meta │ │ ├── MotionBlur.shader │ │ ├── MotionBlur.shader.meta │ │ ├── MotionBlurClear.shader │ │ ├── MotionBlurClear.shader.meta │ │ ├── NoiseAndGrain.shader │ │ ├── NoiseAndGrain.shader.meta │ │ ├── NoiseAndGrainDX11.shader │ │ ├── NoiseAndGrainDX11.shader.meta │ │ ├── NoiseEffectShaderRGB.shader │ │ ├── NoiseEffectShaderRGB.shader.meta │ │ ├── NoiseEffectShaderYUV.shader │ │ ├── NoiseEffectShaderYUV.shader.meta │ │ ├── PrepareSunShaftsBlur.shader │ │ ├── PrepareSunShaftsBlur.shader.meta │ │ ├── RadialBlur.shader │ │ ├── RadialBlur.shader.meta │ │ ├── SSAOShader.shader │ │ ├── SSAOShader.shader.meta │ │ ├── ScreenSpaceAmbientObscurance.shader │ │ ├── ScreenSpaceAmbientObscurance.shader.meta │ │ ├── ScreenSpaceRaytrace.cginc │ │ ├── ScreenSpaceRaytrace.cginc.meta │ │ ├── SepiaToneEffect.shader │ │ ├── SepiaToneEffect.shader.meta │ │ ├── ShowAlphaChannel.shader │ │ ├── ShowAlphaChannel.shader.meta │ │ ├── SimpleClear.shader │ │ ├── SimpleClear.shader.meta │ │ ├── SunShaftsComposite.shader │ │ ├── SunShaftsComposite.shader.meta │ │ ├── Tonemapper.shader │ │ ├── Tonemapper.shader.meta │ │ ├── TwirlEffect.shader │ │ ├── TwirlEffect.shader.meta │ │ ├── VignettingShader.shader │ │ ├── VignettingShader.shader.meta │ │ ├── VortexEffect.shader │ │ ├── VortexEffect.shader.meta │ │ ├── _Antialiasing.meta │ │ ├── _Antialiasing │ │ │ ├── DLAA.shader │ │ │ ├── DLAA.shader.meta │ │ │ ├── FXAA2.shader │ │ │ ├── FXAA2.shader.meta │ │ │ ├── FXAA3Console.shader │ │ │ ├── FXAA3Console.shader.meta │ │ │ ├── FXAAPreset2.shader │ │ │ ├── FXAAPreset2.shader.meta │ │ │ ├── FXAAPreset3.shader │ │ │ ├── FXAAPreset3.shader.meta │ │ │ ├── NFAA.shader │ │ │ ├── NFAA.shader.meta │ │ │ ├── SSAA.shader │ │ │ └── SSAA.shader.meta │ │ ├── _BloomAndFlares.meta │ │ ├── _BloomAndFlares │ │ │ ├── Blend.shader │ │ │ ├── Blend.shader.meta │ │ │ ├── BlendForBloom.shader │ │ │ ├── BlendForBloom.shader.meta │ │ │ ├── BlendOneOne.shader │ │ │ ├── BlendOneOne.shader.meta │ │ │ ├── BlurAndFlares.shader │ │ │ ├── BlurAndFlares.shader.meta │ │ │ ├── BrightPassFilter.shader │ │ │ ├── BrightPassFilter.shader.meta │ │ │ ├── BrightPassFilter2.shader │ │ │ ├── BrightPassFilter2.shader.meta │ │ │ ├── LensFlareCreate.shader │ │ │ ├── LensFlareCreate.shader.meta │ │ │ ├── MobileBloom.shader │ │ │ ├── MobileBloom.shader.meta │ │ │ ├── MobileBlur.shader │ │ │ ├── MobileBlur.shader.meta │ │ │ ├── MultiPassHollywoodFlares.shader │ │ │ ├── MultiPassHollywoodFlares.shader.meta │ │ │ ├── SeparableBlurPlus.shader │ │ │ ├── SeparableBlurPlus.shader.meta │ │ │ ├── VignetteShader.shader │ │ │ └── VignetteShader.shader.meta │ │ ├── _DepthOfField.meta │ │ ├── _DepthOfField │ │ │ ├── Bokeh34.shader │ │ │ ├── Bokeh34.shader.meta │ │ │ ├── DepthOfField34.shader │ │ │ ├── DepthOfField34.shader.meta │ │ │ ├── DepthOfFieldDX11.shader │ │ │ ├── DepthOfFieldDX11.shader.meta │ │ │ ├── DepthOfFieldScatter.shader │ │ │ ├── DepthOfFieldScatter.shader.meta │ │ │ ├── SeparableBlur.shader │ │ │ ├── SeparableBlur.shader.meta │ │ │ ├── SeparableWeightedBlurDof34.shader │ │ │ ├── SeparableWeightedBlurDof34.shader.meta │ │ │ ├── TiltShiftHdrLensBlur.shader │ │ │ └── TiltShiftHdrLensBlur.shader.meta │ │ ├── frag_ao.cginc │ │ └── frag_ao.cginc.meta │ │ ├── Textures.meta │ │ └── Textures │ │ ├── ContrastEnhanced3D16.png │ │ ├── ContrastEnhanced3D16.png.meta │ │ ├── HexShape.psd │ │ ├── HexShape.psd.meta │ │ ├── MotionBlurJitter.png │ │ ├── MotionBlurJitter.png.meta │ │ ├── Neutral3D16.png │ │ ├── Neutral3D16.png.meta │ │ ├── Noise.png │ │ ├── Noise.png.meta │ │ ├── NoiseAndGrain.png │ │ ├── NoiseAndGrain.png.meta │ │ ├── NoiseEffectGrain.png │ │ ├── NoiseEffectGrain.png.meta │ │ ├── NoiseEffectScratch.png │ │ ├── NoiseEffectScratch.png.meta │ │ ├── RandomVectors.png │ │ ├── RandomVectors.png.meta │ │ ├── SphereShape.psd │ │ ├── SphereShape.psd.meta │ │ ├── VignetteMask.png │ │ ├── VignetteMask.png.meta │ │ ├── color correction ramp.png │ │ ├── color correction ramp.png.meta │ │ ├── grayscale ramp.png │ │ └── grayscale ramp.png.meta ├── Texture.meta ├── Texture │ ├── particle.png │ └── particle.png.meta ├── Tub.meta ├── Tub.unity ├── Tub.unity.meta └── Tub │ ├── PBF.cs │ ├── PBF.cs.meta │ ├── PBF2D_Slow_Tub.compute │ ├── PBF2D_Slow_Tub.compute.meta │ ├── Render.mat │ ├── Render.mat.meta │ ├── Render.shader │ ├── Render.shader.meta │ ├── Renderer.cs │ ├── Renderer.cs.meta │ ├── Sphere.prefab │ ├── Sphere.prefab.meta │ ├── TubCreator.cs │ └── TubCreator.cs.meta ├── PositionBasedFluid.VC.db └── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | 6 | UnityVS/ 7 | UnityVS.meta 8 | UnityVS.Aries.sln.DotSettings 9 | 10 | # Autogenerated VS/MD solution and project files 11 | *.csproj 12 | *.unityproj 13 | *.sln 14 | *.suo 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | 20 | #Unity3D Generated File On Crash Reports 21 | sysinfo.txt 22 | -------------------------------------------------------------------------------- /Assets/CPU.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d48356d2e78ea96439cbd7b6e974f3b5 3 | folderAsset: yes 4 | timeCreated: 1490019703 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CPU/Billboard.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/Billboard" { 2 | 3 | Properties{ 4 | _MainTex("Texture", 2D) = "white" {} 5 | _Size("Size", Range(0, 10)) = 1 6 | } 7 | 8 | 9 | SubShader{ 10 | Tags{ "RenderType" = "Transparent" } 11 | LOD 200 12 | 13 | CGINCLUDE 14 | 15 | #pragma target 5.0 16 | #include "UnityCG.cginc" 17 | 18 | float _Size; 19 | sampler2D _MainTex; 20 | 21 | struct appdata { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2g { 27 | float4 vertex : POSITION; 28 | float2 uv : TEXCOORD0; 29 | }; 30 | 31 | struct g2f { 32 | float4 pos : SV_POSITION; 33 | float2 uv : TEXCOORD0; 34 | }; 35 | 36 | v2g vert(appdata IN) { 37 | v2g OUT; 38 | 39 | OUT.vertex = IN.vertex; 40 | OUT.uv = IN.uv; 41 | 42 | return OUT; 43 | } 44 | 45 | [maxvertexcount(4)] 46 | void geom_square(point v2g IN[1], inout TriangleStream OUT) { 47 | 48 | float size = _Size; 49 | float halfS = 0.5f * size; 50 | 51 | g2f pIn; 52 | 53 | for (int x = 0; x < 2; x++) { 54 | for (int y = 0; y < 2; y++) { 55 | float4x4 billboardMatrix = UNITY_MATRIX_V; 56 | billboardMatrix._m03 = billboardMatrix._m13 = billboardMatrix._m23 = billboardMatrix._m33 = 0; 57 | 58 | float2 uv = float2(x, y); 59 | 60 | pIn.pos = IN[0].vertex + mul(float4((uv * 2 - float2(1, 1)) * halfS, 0, 1), billboardMatrix); 61 | 62 | pIn.pos = mul(UNITY_MATRIX_VP, pIn.pos); 63 | 64 | pIn.uv = uv; 65 | 66 | OUT.Append(pIn); 67 | } 68 | } 69 | 70 | } 71 | 72 | ENDCG 73 | 74 | Pass{ 75 | Blend SrcAlpha OneMinusSrcAlpha 76 | ZWrite Off 77 | 78 | CGPROGRAM 79 | 80 | #pragma vertex vert 81 | #pragma geometry geom_square 82 | #pragma fragment frag 83 | 84 | fixed4 frag(g2f IN) : SV_Target{ 85 | return tex2D(_MainTex, IN.uv); 86 | } 87 | 88 | ENDCG 89 | } 90 | 91 | } 92 | } -------------------------------------------------------------------------------- /Assets/CPU/Billboard.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c567f7bfd15e4824a9e4a7482b9fe511 3 | timeCreated: 1489940589 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CPU/Cell.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace CPU_PBD { 4 | 5 | public class Cell { 6 | public List particles; 7 | public List neighbors; 8 | 9 | public Cell() { 10 | particles = new List(); 11 | neighbors = new List(); 12 | } 13 | 14 | public void addNeighbor(Cell cell) { 15 | neighbors.Add(cell); 16 | } 17 | 18 | public List getNeighbors() { 19 | return neighbors; 20 | } 21 | 22 | public void setNeighbors(List neighbors) { 23 | this.neighbors = neighbors; 24 | } 25 | 26 | public void addParticle(Particle particle) { 27 | particles.Add(particle); 28 | } 29 | 30 | public void clearParticles() { 31 | particles.Clear(); 32 | } 33 | 34 | public List getParticles() { 35 | return particles; 36 | } 37 | 38 | public void setParticles(List particles) { 39 | this.particles = particles; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/CPU/Cell.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f34e4e3a92b6af4ba58b1bdcd0b8b15 3 | timeCreated: 1489936333 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/CPU/CellGrid.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace CPU_PBD { 6 | 7 | public class CellGrid { 8 | private int width; 9 | private int height; 10 | private int depth; 11 | private Cell[,,] cells; //fixed size uniform grid of cells 12 | 13 | public CellGrid(int width, int height, int depth) { 14 | this.width = width; 15 | this.height = height; 16 | this.depth = depth; 17 | cells = new Cell[width, height, depth]; 18 | for (int i = 0; i < width; i++) { 19 | for (int j = 0; j < height; j++) { 20 | for (int k = 0; k < depth; k++) { 21 | cells[i, j, k] = new Cell(); 22 | } 23 | } 24 | } 25 | 26 | for (int i = 0; i < width; i++) { 27 | for (int j = 0; j < height; j++) { 28 | for (int k = 0; k < depth; k++) { 29 | for (int x = -1; x < 2; x++) { 30 | for (int y = -1; y < 2; y++) { 31 | for (int z = -1; z < 2; z++) { 32 | if (i + x >= 0 && i + x < width && j + y >= 0 && j + y < height && k + z >= 0 && k + z < depth) { 33 | cells[i, j, k].addNeighbor(cells[i + x, j + y, k + z]); 34 | } 35 | } 36 | } 37 | } 38 | } 39 | } 40 | } 41 | } 42 | 43 | // 粒子位置のセルに、自身を追加する 44 | public void updateCells(List particles) { 45 | clearCells(); 46 | foreach (Particle p in particles) { 47 | Vector3 pos = p.getNewPos(); 48 | //assuming indices are always valid because the box keeps the particles contained 49 | Cell cell = cells[(int)pos.x, (int)pos.y, (int)pos.z]; 50 | cell.addParticle(p); 51 | p.setCell(cell); 52 | } 53 | } 54 | 55 | public void clearCells() { 56 | for (int i = 0; i < width; i++) { 57 | for (int j = 0; j < height; j++) { 58 | for (int k = 0; k < depth; k++) { 59 | cells[i, j, k].clearParticles(); 60 | } 61 | } 62 | } 63 | } 64 | 65 | public int getWidth() { 66 | return width; 67 | } 68 | 69 | public int getHeight() { 70 | return height; 71 | } 72 | 73 | public int getDepth() { 74 | return depth; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /Assets/CPU/CellGrid.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaf9be09f6bac6c4cb74af71db65a594 3 | timeCreated: 1489936342 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/CPU/PBD.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7e0e62d88c91f149ae7bca41c726939 3 | timeCreated: 1489935835 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/CPU/Particle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace CPU_PBD { 6 | 7 | public class Particle { 8 | public Vector3 oldPos; 9 | public Vector3 newPos; 10 | public Vector3 velocity; 11 | public Vector3 force; 12 | public Vector3 deltaP; 13 | public float mass; 14 | public float lambda; 15 | public float pConstraint; 16 | public List neighbors; 17 | public Cell cell; 18 | 19 | public Particle(Vector3 pos, float mass) { 20 | this.oldPos = pos; 21 | this.mass = mass; 22 | this.newPos = new Vector3(0f, 0f, 0f); 23 | this.velocity = new Vector3(0f, 0f, 0f); 24 | this.force = new Vector3(0f, 0f, 0f); 25 | this.deltaP = new Vector3(0f, 0f, 0f); 26 | this.neighbors = new List(); 27 | } 28 | 29 | public Vector3 getOldPos() { 30 | return oldPos; 31 | } 32 | 33 | public Vector3 getNewPos() { 34 | return newPos; 35 | } 36 | 37 | public Vector3 getVelocity() { 38 | return velocity; 39 | } 40 | 41 | public void setVelocity(Vector3 velocity) { 42 | this.velocity = velocity; 43 | } 44 | 45 | public Vector3 getForce() { 46 | return force; 47 | } 48 | 49 | public void setForce(float x, float y, float z) { 50 | force.x = x; 51 | force.y = y; 52 | force.z = z; 53 | } 54 | 55 | public float getMass() { 56 | return mass; 57 | } 58 | 59 | public List getNeighbors() { 60 | return neighbors; 61 | } 62 | 63 | public void setNeighbors(List neighbors) { 64 | this.neighbors = neighbors; 65 | } 66 | 67 | public float getPConstraint() { 68 | return pConstraint; 69 | } 70 | 71 | public void setPConstraint(float f) { 72 | pConstraint = f; 73 | } 74 | 75 | public void setNewPos(Vector3 v) { 76 | newPos = v; 77 | } 78 | 79 | public void setOldPos(Vector3 v) { 80 | oldPos = v; 81 | } 82 | 83 | public Vector3 getDeltaP() { 84 | return deltaP; 85 | } 86 | 87 | public void setDeltaP(Vector3 deltaP) { 88 | this.deltaP = deltaP; 89 | } 90 | 91 | public float getLambda() { 92 | return lambda; 93 | } 94 | 95 | public void setLambda(float lambda) { 96 | this.lambda = lambda; 97 | } 98 | 99 | public Cell getCell() { 100 | return cell; 101 | } 102 | 103 | public void setCell(Cell cell) { 104 | this.cell = cell; 105 | } 106 | } 107 | 108 | } -------------------------------------------------------------------------------- /Assets/CPU/Particle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 061dec67212376949813c1983496d892 3 | timeCreated: 1489936326 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/CPU/Particle.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/CPU/Particle.mat -------------------------------------------------------------------------------- /Assets/CPU/Particle.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3213e92c927127143988f91f32be2859 3 | timeCreated: 1489940576 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPU_Fast.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 818fb47dcbc0f504dba51843145441aa 3 | folderAsset: yes 4 | timeCreated: 1491371804 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe307a6ac26677b49ac71b5d4bd7045a 3 | folderAsset: yes 4 | timeCreated: 1491371842 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/BitonicSort.compute: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // Pragmas 3 | //-------------------------------------------------------------------------------------- 4 | 5 | #pragma kernel BitonicSort 6 | #pragma kernel MatrixTranspose 7 | 8 | //-------------------------------------------------------------------------------------- 9 | // Constants 10 | //-------------------------------------------------------------------------------------- 11 | 12 | #define BITONIC_BLOCK_SIZE 512 13 | #define TRANSPOSE_BLOCK_SIZE 16 14 | 15 | //-------------------------------------------------------------------------------------- 16 | // Constant Buffers 17 | //-------------------------------------------------------------------------------------- 18 | cbuffer CB 19 | { 20 | uint _Level; 21 | uint _LevelMask; 22 | uint _Width; 23 | uint _Height; 24 | }; 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Structured Buffers 28 | //-------------------------------------------------------------------------------------- 29 | StructuredBuffer Input : register(t0); 30 | RWStructuredBuffer Data : register(u0); 31 | 32 | //-------------------------------------------------------------------------------------- 33 | // Bitonic Sort Compute Shader 34 | //-------------------------------------------------------------------------------------- 35 | groupshared uint2 shared_data[BITONIC_BLOCK_SIZE]; 36 | 37 | bool Compare(uint2 left, uint2 right) 38 | { 39 | return (left.x == right.x) ? (left.y <= right.y) : (left.x <= right.x); 40 | } 41 | 42 | [numthreads(BITONIC_BLOCK_SIZE, 1, 1)] 43 | void BitonicSort(uint3 Gid : SV_GroupID, 44 | uint3 DTid : SV_DispatchThreadID, 45 | uint3 GTid : SV_GroupThreadID, 46 | uint GI : SV_GroupIndex) 47 | { 48 | // Load shared data 49 | shared_data[GI] = Data[DTid.x]; 50 | GroupMemoryBarrierWithGroupSync(); 51 | 52 | // Sort the shared data 53 | for (uint j = _Level >> 1; j > 0; j >>= 1) 54 | { 55 | uint2 result = (Compare(shared_data[GI & ~j], shared_data[GI | j]) == (bool)(_LevelMask & DTid.x)) ? shared_data[GI ^ j] : shared_data[GI]; 56 | GroupMemoryBarrierWithGroupSync(); 57 | shared_data[GI] = result; 58 | GroupMemoryBarrierWithGroupSync(); 59 | } 60 | 61 | // Store shared data 62 | Data[DTid.x] = shared_data[GI]; 63 | } 64 | 65 | //-------------------------------------------------------------------------------------- 66 | // Matrix Transpose Compute Shader 67 | //-------------------------------------------------------------------------------------- 68 | groupshared uint2 transpose_shared_data[TRANSPOSE_BLOCK_SIZE * TRANSPOSE_BLOCK_SIZE]; 69 | 70 | [numthreads(TRANSPOSE_BLOCK_SIZE, TRANSPOSE_BLOCK_SIZE, 1)] 71 | void MatrixTranspose(uint3 Gid : SV_GroupID, 72 | uint3 DTid : SV_DispatchThreadID, 73 | uint3 GTid : SV_GroupThreadID, 74 | uint GI : SV_GroupIndex) 75 | { 76 | transpose_shared_data[GI] = Input[DTid.y * _Width + DTid.x]; 77 | GroupMemoryBarrierWithGroupSync(); 78 | uint2 XY = DTid.yx - GTid.yx + GTid.xy; 79 | Data[XY.y * _Height + XY.x] = transpose_shared_data[GTid.x * TRANSPOSE_BLOCK_SIZE + GTid.y]; 80 | } -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/BitonicSort.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8671b2cb5133f1469c388bd1458e259 3 | timeCreated: 1491386250 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/DebugBitonicSort.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0128ffe0d1b2cb34db0511bb3dc39eaa 3 | timeCreated: 1491387824 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/GPU_Fast/2D/PBF.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8afe2dcfb8aacb4c8c866ea8ad00d79 3 | timeCreated: 1490669173 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/GPU_Fast/2D/PBF2D_Fast.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2bb682dc7c5bdb4f85604f133a33be0 3 | timeCreated: 1490669174 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/Render.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/GPU_Fast/2D/Render.mat -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/Render.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19cac338aac103148b70337bb185d925 3 | timeCreated: 1490669173 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/Render.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/PBF2D_GPU" { 2 | Properties{ 3 | _MainTex("Texture", 2D) = "white" {} 4 | _ParticleRad("ParticleRadius", Range(0.01, 1)) = 0.05 5 | } 6 | 7 | SubShader{ 8 | ZWrite Off 9 | Blend SrcAlpha OneMinusSrcAlpha 10 | 11 | Pass{ 12 | CGPROGRAM 13 | 14 | #pragma target 5.0 15 | #pragma vertex vert 16 | #pragma geometry geom 17 | #pragma fragment frag 18 | 19 | #include "UnityCG.cginc" 20 | 21 | sampler2D _MainTex; 22 | float _ParticleRad; 23 | 24 | struct Particle { 25 | float2 oldPos; 26 | float2 newPos; 27 | float2 velocity; 28 | float2 force; 29 | float2 deltaP; 30 | float mass; 31 | float lambda; 32 | float pConstraint; 33 | float3 color; 34 | }; 35 | 36 | StructuredBuffer _Particles; 37 | 38 | struct v2g { 39 | float4 pos : SV_POSITION; 40 | float2 tex : TEXCOORD0; 41 | float4 col : COLOR; 42 | }; 43 | 44 | v2g vert(uint id : SV_VertexID) { 45 | v2g output; 46 | output.pos = float4(_Particles[id].oldPos, 0, 1); 47 | output.tex = float2(0, 0); 48 | // output.col = float4(0.5 + normalize(_Particles[id].velocity) / 2, 0.5, 1); 49 | output.col = float4(1,1,1, 1); 50 | // output.col = float4(0.7 + 0.3 *_Particles[id].velocity, 0.7,1); 51 | return output; 52 | } 53 | 54 | [maxvertexcount(4)] 55 | void geom(point v2g input[1], inout TriangleStream outStream) { 56 | v2g output; 57 | 58 | float4 pos = input[0].pos; 59 | float4 col = input[0].col; 60 | 61 | for (int x = 0; x < 2; x++) { 62 | for (int y = 0; y < 2; y++) { 63 | float4x4 billboardMatrix = UNITY_MATRIX_V; 64 | billboardMatrix._m03 = 65 | billboardMatrix._m13 = 66 | billboardMatrix._m23 = 67 | billboardMatrix._m33 = 0; 68 | 69 | float2 tex = float2(x, y); 70 | output.tex = tex; 71 | 72 | output.pos = pos + mul(float4((tex * 2 - float2(1, 1)) * _ParticleRad, 0, 1), billboardMatrix); 73 | output.pos = mul(UNITY_MATRIX_VP, output.pos); 74 | 75 | output.col = col; 76 | 77 | outStream.Append(output); 78 | } 79 | } 80 | 81 | outStream.RestartStrip(); 82 | } 83 | 84 | fixed4 frag(v2g i) : COLOR{ 85 | float4 col = tex2D(_MainTex, i.tex) * i.col; 86 | if (col.a < 0.3) discard; 87 | return col; 88 | } 89 | 90 | ENDCG 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/Render.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 471b9106092015d4f896d0ae5a3aa8b2 3 | timeCreated: 1490669173 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/Renderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PBF_GPU_FAST_2D { 4 | 5 | public class Renderer : MonoBehaviour { 6 | 7 | public PBF GPUScript; 8 | 9 | public Material ParticleRenderMat; 10 | 11 | void OnRenderObject(){ 12 | DrawObject(); 13 | } 14 | 15 | void DrawObject(){ 16 | Material m = ParticleRenderMat; 17 | m.SetPass(0); 18 | m.SetBuffer("_Particles", GPUScript.GetBuffer()); 19 | Graphics.DrawProcedural(MeshTopology.Points, GPUScript.GetMaxParticleNum()); 20 | } 21 | 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/Renderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 552a21009b38be54b9f93efa372d9a81 3 | timeCreated: 1490669173 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/GPU_Fast/2D/WaveController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace PBF_GPU_FAST_2D { 6 | 7 | public class WaveController : MonoBehaviour { 8 | 9 | public PBF script; 10 | 11 | float initialRangeX; 12 | float time; 13 | public float speed; 14 | public float waveStrength = 0.1f; 15 | 16 | void Start() { 17 | initialRangeX = script.range.x; 18 | time = 0; 19 | } 20 | 21 | void Update() { 22 | time += Time.deltaTime; 23 | script.range.x = (initialRangeX - waveStrength) - waveStrength * Mathf.Sin(speed * (time-5f)); 24 | } 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /Assets/GPU_Fast/2D/WaveController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd7f9459dda400e4e953bc9dc2483e1c 3 | timeCreated: 1491364026 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/GPU_SLOW.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b9aad61b0c3a4b42a220fff31f601cb 3 | folderAsset: yes 4 | timeCreated: 1490097894 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b7c6c274618afd4793750cccc3f62af 3 | folderAsset: yes 4 | timeCreated: 1493020792 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/PBF.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89142feb1e0c572499633df406c05f54 3 | timeCreated: 1493020825 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/GPU_SLOW/2D_Circle/PBF2D_CIRCLE.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8297f9e8294529b49b6894da8c816420 3 | timeCreated: 1493020828 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/Render.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/GPU_SLOW/2D_Circle/Render.mat -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/Render.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80549e4480f62174fbe4cdf9cdbf4364 3 | timeCreated: 1493020828 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: -1 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/Render.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/PBF2D_GPU_CIRCLE" { 2 | Properties{ 3 | _Color("Color", Color) = (1,1,1,1) 4 | _MainTex("Texture", 2D) = "white" {} 5 | _ParticleRad("ParticleRadius", Range(0.01, 1)) = 0.05 6 | } 7 | 8 | SubShader{ 9 | ZWrite Off 10 | Blend SrcAlpha OneMinusSrcAlpha 11 | 12 | Pass{ 13 | CGPROGRAM 14 | 15 | #pragma target 5.0 16 | #pragma vertex vert 17 | #pragma geometry geom 18 | #pragma fragment frag 19 | 20 | #include "UnityCG.cginc" 21 | 22 | float4 _Color; 23 | sampler2D _MainTex; 24 | float _ParticleRad; 25 | 26 | struct Particle { 27 | float2 oldPos; 28 | float2 newPos; 29 | float2 velocity; 30 | float2 force; 31 | float2 deltaP; 32 | float mass; 33 | float lambda; 34 | float pConstraint; 35 | }; 36 | 37 | StructuredBuffer _Particles; 38 | 39 | struct v2g { 40 | float4 pos : SV_POSITION; 41 | float2 tex : TEXCOORD0; 42 | float4 col : COLOR; 43 | }; 44 | 45 | v2g vert(uint id : SV_VertexID) { 46 | v2g output; 47 | output.pos = float4(_Particles[id].oldPos, 0, 1); 48 | output.tex = float2(0, 0); 49 | // output.col = float4(0.5 + normalize(_Particles[id].velocity) / 2, 0.5, 1); 50 | output.col = float4(1,1,1, 1); 51 | return output; 52 | } 53 | 54 | [maxvertexcount(4)] 55 | void geom(point v2g input[1], inout TriangleStream outStream) { 56 | v2g output; 57 | 58 | float4 pos = input[0].pos; 59 | float4 col = input[0].col; 60 | 61 | for (int x = 0; x < 2; x++) { 62 | for (int y = 0; y < 2; y++) { 63 | float4x4 billboardMatrix = UNITY_MATRIX_V; 64 | billboardMatrix._m03 = 65 | billboardMatrix._m13 = 66 | billboardMatrix._m23 = 67 | billboardMatrix._m33 = 0; 68 | 69 | float2 tex = float2(x, y); 70 | output.tex = tex; 71 | 72 | output.pos = pos + mul(float4((tex * 2 - float2(1, 1)) * _ParticleRad, 0, 1), billboardMatrix); 73 | output.pos = mul(UNITY_MATRIX_VP, output.pos); 74 | 75 | output.col = col; 76 | 77 | outStream.Append(output); 78 | } 79 | } 80 | 81 | outStream.RestartStrip(); 82 | } 83 | 84 | fixed4 frag(v2g i) : COLOR{ 85 | float4 col = tex2D(_MainTex, i.tex) * i.col * _Color; 86 | if (col.a < 0.3) discard; 87 | return col; 88 | } 89 | 90 | ENDCG 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/Render.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f71e9c7c8b3769e4b9e74c86955c2e15 3 | timeCreated: 1493020828 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/Renderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PBF_GPU_SLOW_2D_CIRCLE { 4 | 5 | public class Renderer : MonoBehaviour { 6 | 7 | public PBF GPUScript; 8 | 9 | public Material ParticleRenderMat; 10 | 11 | void OnRenderObject(){ 12 | DrawObject(); 13 | } 14 | 15 | void DrawObject(){ 16 | Material m = ParticleRenderMat; 17 | m.SetPass(0); 18 | m.SetBuffer("_Particles", GPUScript.GetBuffer()); 19 | Graphics.DrawProcedural(MeshTopology.Points, GPUScript.GetMaxParticleNum()); 20 | } 21 | 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /Assets/GPU_SLOW/2D_Circle/Renderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29df61f5285368b41a5f5864ebaca2d3 3 | timeCreated: 1493020825 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/GPU_SLOW/3D.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f28f76ef8a2f7146abdea755cafac2c 3 | folderAsset: yes 4 | timeCreated: 1490668807 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/PBF.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6783ab3b481471f4aaa13e6e3b264074 3 | timeCreated: 1490020201 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/GPU_SLOW/3D/PBF3D_Slow.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d108aabfc5b9af6418a3a64adb962b9c 3 | timeCreated: 1490019751 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/Render.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/GPU_SLOW/3D/Render.mat -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/Render.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 858108fa89a2c9f4bb959622cc40e06e 3 | timeCreated: 1490088043 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/Render.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/PBD3D" { 2 | Properties{ 3 | _MainTex("Texture", 2D) = "white" {} 4 | _ParticleRad("ParticleRadius", Range(0.01, 1)) = 0.05 5 | } 6 | 7 | SubShader{ 8 | ZWrite Off 9 | Blend SrcAlpha OneMinusSrcAlpha 10 | 11 | Pass{ 12 | CGPROGRAM 13 | 14 | #pragma target 5.0 15 | #pragma vertex vert 16 | #pragma geometry geom 17 | #pragma fragment frag 18 | 19 | #include "UnityCG.cginc" 20 | 21 | sampler2D _MainTex; 22 | float _ParticleRad; 23 | 24 | struct Particle { 25 | float3 oldPos; 26 | float3 newPos; 27 | float3 velocity; 28 | float3 force; 29 | float3 deltaP; 30 | float mass; 31 | float lambda; 32 | float pConstraint; 33 | }; 34 | 35 | StructuredBuffer _Particles; 36 | 37 | struct v2g { 38 | float4 pos : SV_POSITION; 39 | float2 tex : TEXCOORD0; 40 | float4 col : COLOR; 41 | }; 42 | 43 | v2g vert(uint id : SV_VertexID) { 44 | v2g output; 45 | output.pos = float4(_Particles[id].oldPos, 1); 46 | output.tex = float2(0, 0); 47 | output.col = float4(0.5 + normalize(_Particles[id].velocity) / 2, 1); 48 | 49 | return output; 50 | } 51 | 52 | [maxvertexcount(4)] 53 | void geom(point v2g input[1], inout TriangleStream outStream) { 54 | v2g output; 55 | 56 | float4 pos = input[0].pos; 57 | float4 col = input[0].col; 58 | 59 | for (int x = 0; x < 2; x++) { 60 | for (int y = 0; y < 2; y++) { 61 | float4x4 billboardMatrix = UNITY_MATRIX_V; 62 | billboardMatrix._m03 = 63 | billboardMatrix._m13 = 64 | billboardMatrix._m23 = 65 | billboardMatrix._m33 = 0; 66 | 67 | float2 tex = float2(x, y); 68 | output.tex = tex; 69 | 70 | output.pos = pos + mul(float4((tex * 2 - float2(1, 1)) * _ParticleRad, 0, 1), billboardMatrix); 71 | output.pos = mul(UNITY_MATRIX_VP, output.pos); 72 | 73 | output.col = col; 74 | 75 | outStream.Append(output); 76 | } 77 | } 78 | 79 | outStream.RestartStrip(); 80 | } 81 | 82 | fixed4 frag(v2g i) : COLOR{ 83 | float4 col = tex2D(_MainTex, i.tex) * i.col; 84 | if (col.a < 0.3) discard; 85 | return col; 86 | } 87 | 88 | ENDCG 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/Render.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 628a9d50fa55eb34396911e0815af43c 3 | timeCreated: 1490087314 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/Renderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PBF_GPU_SLOW_3D { 4 | 5 | public class Renderer : MonoBehaviour { 6 | 7 | public PBF GPUScript; 8 | 9 | public Material ParticleRenderMat; 10 | 11 | void OnRenderObject(){ 12 | DrawObject(); 13 | } 14 | 15 | void DrawObject(){ 16 | Material m = ParticleRenderMat; 17 | m.SetPass(0); 18 | m.SetBuffer("_Particles", GPUScript.GetBuffer()); 19 | Graphics.DrawProcedural(MeshTopology.Points, GPUScript.GetMaxParticleNum()); 20 | } 21 | 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /Assets/GPU_SLOW/3D/Renderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 101047bf5b7c3004587f41a5714f86fc 3 | timeCreated: 1490086852 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/Main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Main.unity -------------------------------------------------------------------------------- /Assets/Main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22ea5f2631015fc43939b0a92d3c047d 3 | timeCreated: 1489942322 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 785e9f60729a7394698babf15a88c585 3 | folderAsset: yes 4 | timeCreated: 1490670833 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58d4021863ef4b94b822ce992e4fef5b 3 | folderAsset: yes 4 | timeCreated: 1490670833 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 225198e07aaae3547a6d1f6e7177555f 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/AntialiasingEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba15fa37442517749a3c4640a4ad4054 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/BloomAndFlaresEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4deca87cb459d1642ac8f734856ca84e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/BloomEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43fcc28c40e404d4eabfc88b1dbda7b5 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/CameraMotionBlurEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80cbbe1c107bf5e43a96347d3dfc2658 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/ColorCorrectionCurvesEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4a9489f73e4f0344ab3fc97bdf5170b 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/ColorCorrectionLookupEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66c17be95fbf398439ea09f8892a8b43 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/CreaseShadingEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEditor.AnimatedValues; 4 | using UnityEngine; 5 | 6 | namespace UnityStandardAssets.ImageEffects 7 | { 8 | [CustomEditor(typeof(CreaseShading))] 9 | class CreaseShadingEditor : Editor { 10 | SerializedObject serObj; 11 | 12 | SerializedProperty m_intensity; 13 | SerializedProperty m_softness; 14 | SerializedProperty m_spread; 15 | 16 | AnimBool m_showSoftnessWarning = new AnimBool(); 17 | AnimBool m_showSpreadWarning = new AnimBool(); 18 | 19 | private bool softnessWarningValue { get { return m_softness.intValue > 4; } } 20 | private bool spreadWarningValue { get { return m_spread.floatValue > 4; } } 21 | 22 | void OnEnable () { 23 | serObj = new SerializedObject (target); 24 | 25 | m_intensity = serObj.FindProperty("intensity"); 26 | m_softness = serObj.FindProperty("softness"); 27 | m_spread = serObj.FindProperty("spread"); 28 | 29 | m_showSoftnessWarning.valueChanged.AddListener(Repaint); 30 | m_showSpreadWarning.valueChanged.AddListener(Repaint); 31 | 32 | m_showSoftnessWarning.value = softnessWarningValue; 33 | m_showSpreadWarning.value = spreadWarningValue; 34 | } 35 | 36 | public override void OnInspectorGUI () { 37 | serObj.Update (); 38 | 39 | EditorGUILayout.Slider(m_intensity, -5.0f, 5.0f, new GUIContent("Intensity")); 40 | 41 | EditorGUILayout.IntSlider(m_softness, 0, 15, new GUIContent("Softness")); 42 | m_showSoftnessWarning.target = softnessWarningValue; 43 | if (EditorGUILayout.BeginFadeGroup(m_showSoftnessWarning.faded)) 44 | { 45 | EditorGUILayout.HelpBox("High Softness value might reduce performance.", MessageType.Warning, false); 46 | } 47 | EditorGUILayout.EndFadeGroup(); 48 | 49 | EditorGUILayout.Slider(m_spread, 0.0f, 50.0f, new GUIContent("Spread")); 50 | m_showSpreadWarning.target = spreadWarningValue; 51 | if (EditorGUILayout.BeginFadeGroup(m_showSpreadWarning.faded)) 52 | { 53 | EditorGUILayout.HelpBox("High Spread value might introduce visual artifacts.", MessageType.Warning, false); 54 | } 55 | EditorGUILayout.EndFadeGroup(); 56 | 57 | serObj.ApplyModifiedProperties (); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/CreaseShadingEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6788af605d2f1244789565913bb4e7f6 3 | timeCreated: 1434032656 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/Standard Assets/Editor/ImageEffects/DepthOfFieldDeprecatedEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 943c59645eb905144a0990b57e13a6f9 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/DepthOfFieldEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 427fdf36119bab44a9131abd19b90f57 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/EdgeDetectionEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UnityStandardAssets.ImageEffects 6 | { 7 | [CustomEditor (typeof(EdgeDetection))] 8 | class EdgeDetectionEditor : Editor 9 | { 10 | SerializedObject serObj; 11 | 12 | SerializedProperty mode; 13 | SerializedProperty sensitivityDepth; 14 | SerializedProperty sensitivityNormals; 15 | 16 | SerializedProperty lumThreshold; 17 | 18 | SerializedProperty edgesOnly; 19 | SerializedProperty edgesOnlyBgColor; 20 | 21 | SerializedProperty edgeExp; 22 | SerializedProperty sampleDist; 23 | 24 | 25 | void OnEnable () { 26 | serObj = new SerializedObject (target); 27 | 28 | mode = serObj.FindProperty("mode"); 29 | 30 | sensitivityDepth = serObj.FindProperty("sensitivityDepth"); 31 | sensitivityNormals = serObj.FindProperty("sensitivityNormals"); 32 | 33 | lumThreshold = serObj.FindProperty("lumThreshold"); 34 | 35 | edgesOnly = serObj.FindProperty("edgesOnly"); 36 | edgesOnlyBgColor = serObj.FindProperty("edgesOnlyBgColor"); 37 | 38 | edgeExp = serObj.FindProperty("edgeExp"); 39 | sampleDist = serObj.FindProperty("sampleDist"); 40 | } 41 | 42 | 43 | public override void OnInspectorGUI () { 44 | serObj.Update (); 45 | 46 | GUILayout.Label("Detects spatial differences and converts into black outlines", EditorStyles.miniBoldLabel); 47 | EditorGUILayout.PropertyField (mode, new GUIContent("Mode")); 48 | 49 | if (mode.intValue < 2) { 50 | EditorGUILayout.PropertyField (sensitivityDepth, new GUIContent(" Depth Sensitivity")); 51 | EditorGUILayout.PropertyField (sensitivityNormals, new GUIContent(" Normals Sensitivity")); 52 | } 53 | else if (mode.intValue < 4) { 54 | EditorGUILayout.PropertyField (edgeExp, new GUIContent(" Edge Exponent")); 55 | } 56 | else { 57 | // lum based mode 58 | EditorGUILayout.PropertyField (lumThreshold, new GUIContent(" Luminance Threshold")); 59 | } 60 | 61 | EditorGUILayout.PropertyField (sampleDist, new GUIContent(" Sample Distance")); 62 | 63 | EditorGUILayout.Separator (); 64 | 65 | GUILayout.Label ("Background Options"); 66 | edgesOnly.floatValue = EditorGUILayout.Slider (" Edges only", edgesOnly.floatValue, 0.0f, 1.0f); 67 | EditorGUILayout.PropertyField (edgesOnlyBgColor, new GUIContent (" Color")); 68 | 69 | serObj.ApplyModifiedProperties(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/EdgeDetectionEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5f1618d14cd80f4da910f00b04af37f 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/NoiseAndGrainEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: abd63abcc46fbcb4588164b671b52d3b 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/SunShaftsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54f6f6313f2aecc4d81035ec0031e313 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/TonemappingEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f7cab214f141f642b87a5bdbd14653e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/VignetteAndChromaticAberrationEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UnityStandardAssets.ImageEffects 6 | { 7 | [CustomEditor (typeof(VignetteAndChromaticAberration))] 8 | class VignetteAndChromaticAberrationEditor : Editor 9 | { 10 | private SerializedObject m_SerObj; 11 | private SerializedProperty m_Mode; 12 | private SerializedProperty m_Intensity; // intensity == 0 disables pre pass (optimization) 13 | private SerializedProperty m_ChromaticAberration; 14 | private SerializedProperty m_AxialAberration; 15 | private SerializedProperty m_Blur; // blur == 0 disables blur pass (optimization) 16 | private SerializedProperty m_BlurSpread; 17 | private SerializedProperty m_BlurDistance; 18 | private SerializedProperty m_LuminanceDependency; 19 | 20 | 21 | void OnEnable () 22 | { 23 | m_SerObj = new SerializedObject (target); 24 | m_Mode = m_SerObj.FindProperty ("mode"); 25 | m_Intensity = m_SerObj.FindProperty ("intensity"); 26 | m_ChromaticAberration = m_SerObj.FindProperty ("chromaticAberration"); 27 | m_AxialAberration = m_SerObj.FindProperty ("axialAberration"); 28 | m_Blur = m_SerObj.FindProperty ("blur"); 29 | m_BlurSpread = m_SerObj.FindProperty ("blurSpread"); 30 | m_LuminanceDependency = m_SerObj.FindProperty ("luminanceDependency"); 31 | m_BlurDistance = m_SerObj.FindProperty ("blurDistance"); 32 | } 33 | 34 | 35 | public override void OnInspectorGUI () 36 | { 37 | m_SerObj.Update (); 38 | 39 | EditorGUILayout.LabelField("Simulates the common lens artifacts 'Vignette' and 'Aberration'", EditorStyles.miniLabel); 40 | 41 | EditorGUILayout.Slider(m_Intensity, 0.0f, 1.0f, new GUIContent("Vignetting")); 42 | EditorGUILayout.Slider(m_Blur, 0.0f, 1.0f, new GUIContent(" Blurred Corners")); 43 | if (m_Blur.floatValue>0.0f) 44 | EditorGUILayout.Slider(m_BlurSpread, 0.0f, 1.0f, new GUIContent(" Blur Distance")); 45 | 46 | EditorGUILayout.Separator (); 47 | 48 | EditorGUILayout.PropertyField (m_Mode, new GUIContent("Aberration")); 49 | if (m_Mode.intValue>0) 50 | { 51 | EditorGUILayout.Slider(m_ChromaticAberration, 0.0f, 5.0f, new GUIContent(" Tangential Aberration")); 52 | EditorGUILayout.Slider(m_AxialAberration, 0.0f, 5.0f, new GUIContent(" Axial Aberration")); 53 | m_LuminanceDependency.floatValue = EditorGUILayout.Slider(" Contrast Dependency", m_LuminanceDependency.floatValue, 0.001f, 1.0f); 54 | m_BlurDistance.floatValue = EditorGUILayout.Slider(" Blur Distance", m_BlurDistance.floatValue, 0.001f, 5.0f); 55 | } 56 | else 57 | EditorGUILayout.PropertyField (m_ChromaticAberration, new GUIContent(" Chromatic Aberration")); 58 | 59 | m_SerObj.ApplyModifiedProperties(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Editor/ImageEffects/VignetteAndChromaticAberrationEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08126bf2baa528c4cb9c60340a24e5d6 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 115d1f9d9bd29064ab981e57c8fc8cdf 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6e0c95a128e14227939c51b5d9ad74e 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd3e1490c3d9a7a498538315414d5129 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Antialiasing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 646b5bc27a658f447b1d929fd5ffbd70 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - ssaaShader: {fileID: 4800000, guid: b3728d1488b02490cbd196c7941bf1f8, type: 3} 7 | - dlaaShader: {fileID: 4800000, guid: 017ca72b9e8a749058d13ebd527e98fa, type: 3} 8 | - nfaaShader: {fileID: 4800000, guid: ce0cb2621f6d84e21a87414e471a3cce, type: 3} 9 | - shaderFXAAPreset2: {fileID: 4800000, guid: 6f1418cffd12146f2a83be795f6fa5a7, type: 3} 10 | - shaderFXAAPreset3: {fileID: 4800000, guid: c182fa94a5a0a4c02870641efcd38cd5, type: 3} 11 | - shaderFXAAII: {fileID: 4800000, guid: cd5b323dcc592457790ff18b528f5e67, type: 3} 12 | - shaderFXAAIII: {fileID: 4800000, guid: c547503fff0e8482ea5793727057041c, type: 3} 13 | executionOrder: 0 14 | icon: {instanceID: 0} 15 | userData: 16 | assetBundleName: 17 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Bloom.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fceaeb339b971b429c4cc600acabd13 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - lensFlareVignetteMask: {fileID: 2800000, guid: 95ef4804fe0be4c999ddaa383536cde8, 7 | type: 3} 8 | - lensFlareShader: {fileID: 4800000, guid: 459fe69d2f6d74ddb92f04dbf45a866b, type: 3} 9 | - screenBlendShader: {fileID: 4800000, guid: 7856cbff0a0ca45c787d5431eb805bb0, type: 3} 10 | - blurAndFlaresShader: {fileID: 4800000, guid: be6e39cf196f146d5be72fbefb18ed75, 11 | type: 3} 12 | - brightPassFilterShader: {fileID: 4800000, guid: 0aeaa4cb29f5d4e9c8455f04c8575c8c, 13 | type: 3} 14 | executionOrder: 0 15 | icon: {instanceID: 0} 16 | userData: 17 | assetBundleName: 18 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/BloomAndFlares.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02536f33053638549ab5c50ff3ecc0de 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - lensFlareVignetteMask: {fileID: 2800000, guid: 95ef4804fe0be4c999ddaa383536cde8, 7 | type: 3} 8 | - lensFlareShader: {fileID: 4800000, guid: 459fe69d2f6d74ddb92f04dbf45a866b, type: 3} 9 | - vignetteShader: {fileID: 4800000, guid: 627943dc7a9a74286b70a4f694a0acd5, type: 3} 10 | - separableBlurShader: {fileID: 4800000, guid: a9df009a214e24a5ebbf271595f8d5b6, 11 | type: 3} 12 | - addBrightStuffOneOneShader: {fileID: 4800000, guid: f7898d203e9b94c0dbe2bf9dd5cb32c0, 13 | type: 3} 14 | - screenBlendShader: {fileID: 4800000, guid: 53b3960ee3d3d4a5caa8d5473d120187, type: 3} 15 | - hollywoodFlaresShader: {fileID: 4800000, guid: e2baf3cae8edc4daf94c9adc2154be00, 16 | type: 3} 17 | - brightPassFilterShader: {fileID: 4800000, guid: 186c4c0d31e314f049595dcbaf4ca129, 18 | type: 3} 19 | executionOrder: 0 20 | icon: {instanceID: 0} 21 | userData: 22 | assetBundleName: 23 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/BloomOptimized.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4975a6e437fc3b149a8cd508ce5bdd69 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - fastBloomShader: {fileID: 4800000, guid: 68a00c837b82e4c6d92e7da765dc5f1d, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Blur.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34382083ad114a07d000fbfb8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - blurShader: {fileID: 4800000, guid: 57e6deea7c2924e22a5138e2b70bb4dc, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/BlurOptimized.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fc6bde01469c7b4badee5362f191d96 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - blurShader: {fileID: 4800000, guid: f9d5fa183cd6b45eeb1491f74863cd91, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/CameraMotionBlur.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97e9b95cf609d96409b6c40519432957 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: 85a88efa8c871af4a9d17c64791b6f4f, type: 3} 7 | - dx11MotionBlurShader: {fileID: 4800000, guid: f1b13d7a80660504a858ea24cfa418c6, 8 | type: 3} 9 | - replacementClear: {fileID: 4800000, guid: 7699c5fbfa27745a1abe111ab7bf9785, type: 3} 10 | - noiseTexture: {fileID: 2800000, guid: 31f5a8611c4ed1245b18456206e798dc, type: 3} 11 | executionOrder: 0 12 | icon: {instanceID: 0} 13 | userData: 14 | assetBundleName: 15 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ColorCorrectionCurves.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fd999d1b2cf94a45a5b0a47ce074bef 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - colorCorrectionCurvesShader: {fileID: 4800000, guid: 62bcade1028c24ca1a39760ed84b9487, 7 | type: 3} 8 | - simpleColorCorrectionCurvesShader: {fileID: 4800000, guid: 438ddd58d82c84d9eb1fdc56111702e1, 9 | type: 3} 10 | - colorCorrectionSelectiveShader: {fileID: 4800000, guid: e515e0f94cefc4c0db54b45cba621544, 11 | type: 3} 12 | executionOrder: 0 13 | icon: {instanceID: 0} 14 | userData: 15 | assetBundleName: 16 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ColorCorrectionLookup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cde8c0fd649d9b46bb403ba5e157391 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: b61f0d8d8244b4b28aa66b0c8cb46a8d, type: 3} 7 | - converted3DLut: {instanceID: 0} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ColorCorrectionRamp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [AddComponentMenu("Image Effects/Color Adjustments/Color Correction (Ramp)")] 8 | public class ColorCorrectionRamp : ImageEffectBase { 9 | public Texture textureRamp; 10 | 11 | // Called by camera to apply image effect 12 | void OnRenderImage (RenderTexture source, RenderTexture destination) { 13 | material.SetTexture ("_RampTex", textureRamp); 14 | Graphics.Blit (source, destination, material); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ColorCorrectionRamp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea59781cad112c75d0008dfa8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: 67f8781cad112c75d0008dfa8d76c639, type: 3} 7 | - textureRamp: {fileID: 2800000, guid: d440902fad11e807d00044888d76c639, type: 3} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ContrastEnhance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [RequireComponent(typeof(Camera))] 8 | [AddComponentMenu("Image Effects/Color Adjustments/Contrast Enhance (Unsharp Mask)")] 9 | public class ContrastEnhance : PostEffectsBase 10 | { 11 | [Range(0.0f, 1.0f)] 12 | public float intensity = 0.5f; 13 | [Range(0.0f,0.999f)] 14 | public float threshold = 0.0f; 15 | 16 | private Material separableBlurMaterial; 17 | private Material contrastCompositeMaterial; 18 | 19 | [Range(0.0f,1.0f)] 20 | public float blurSpread = 1.0f; 21 | 22 | public Shader separableBlurShader = null; 23 | public Shader contrastCompositeShader = null; 24 | 25 | 26 | public override bool CheckResources () 27 | { 28 | CheckSupport (false); 29 | 30 | contrastCompositeMaterial = CheckShaderAndCreateMaterial (contrastCompositeShader, contrastCompositeMaterial); 31 | separableBlurMaterial = CheckShaderAndCreateMaterial (separableBlurShader, separableBlurMaterial); 32 | 33 | if (!isSupported) 34 | ReportAutoDisable (); 35 | return isSupported; 36 | } 37 | 38 | void OnRenderImage (RenderTexture source, RenderTexture destination) 39 | { 40 | if (CheckResources()==false) 41 | { 42 | Graphics.Blit (source, destination); 43 | return; 44 | } 45 | 46 | int rtW = source.width; 47 | int rtH = source.height; 48 | 49 | RenderTexture color2 = RenderTexture.GetTemporary (rtW/2, rtH/2, 0); 50 | 51 | // downsample 52 | 53 | Graphics.Blit (source, color2); 54 | RenderTexture color4a = RenderTexture.GetTemporary (rtW/4, rtH/4, 0); 55 | Graphics.Blit (color2, color4a); 56 | RenderTexture.ReleaseTemporary (color2); 57 | 58 | // blur 59 | 60 | separableBlurMaterial.SetVector ("offsets", new Vector4 (0.0f, (blurSpread * 1.0f) / color4a.height, 0.0f, 0.0f)); 61 | RenderTexture color4b = RenderTexture.GetTemporary (rtW/4, rtH/4, 0); 62 | Graphics.Blit (color4a, color4b, separableBlurMaterial); 63 | RenderTexture.ReleaseTemporary (color4a); 64 | 65 | separableBlurMaterial.SetVector ("offsets", new Vector4 ((blurSpread * 1.0f) / color4a.width, 0.0f, 0.0f, 0.0f)); 66 | color4a = RenderTexture.GetTemporary (rtW/4, rtH/4, 0); 67 | Graphics.Blit (color4b, color4a, separableBlurMaterial); 68 | RenderTexture.ReleaseTemporary (color4b); 69 | 70 | // composite 71 | 72 | contrastCompositeMaterial.SetTexture ("_MainTexBlurred", color4a); 73 | contrastCompositeMaterial.SetFloat ("intensity", intensity); 74 | contrastCompositeMaterial.SetFloat ("threshold", threshold); 75 | Graphics.Blit (source, destination, contrastCompositeMaterial); 76 | 77 | RenderTexture.ReleaseTemporary (color4a); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ContrastEnhance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3309686a9fbbe6e42a182d5e0257704c 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - separableBlurShader: {fileID: 4800000, guid: e97c14fbb5ea04c3a902cc533d7fc5d1, 7 | type: 3} 8 | - contrastCompositeShader: {fileID: 4800000, guid: 273404942eede4ea1883ca1fb2942507, 9 | type: 3} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ContrastStretch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec92b071d2d424aecb3e46f28eb63174 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shaderLum: {fileID: 4800000, guid: befbb4b9c320b4b18a08ef7afb93b6c9, type: 3} 7 | - shaderReduce: {fileID: 4800000, guid: 57b33a14b6d5347c5a85c36f6cb3b280, type: 3} 8 | - shaderAdapt: {fileID: 4800000, guid: 257bc83cbeb544540bd0e558aa9b1383, type: 3} 9 | - shaderApply: {fileID: 4800000, guid: f4901f25d4e1542589348bbb89563d8e, type: 3} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/CreaseShading.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d64b4f3a592f28b44bf19223ac8b6cd2 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - blurShader: {fileID: 4800000, guid: e97c14fbb5ea04c3a902cc533d7fc5d1, type: 3} 7 | - depthFetchShader: {fileID: 4800000, guid: 14768d3865b1342e3a861fbe19ba2db2, type: 3} 8 | - creaseApplyShader: {fileID: 4800000, guid: b59984d82af624bd3b0c777f038276f2, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/DepthOfField.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd70d448b18cfbc46af26466f752332c 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - focalTransform: {instanceID: 0} 7 | - dofHdrShader: {fileID: 4800000, guid: acd613035ff3e455e8abf23fdc8c8c24, type: 3} 8 | - dx11BokehShader: {fileID: 4800000, guid: d8e82664aa8686642a424c88ab10164a, type: 3} 9 | - dx11BokehTexture: {fileID: 2800000, guid: a4cdca73d61814d33ac1587f6c163bca, type: 3} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/DepthOfFieldDeprecated.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83d8db0ec466c14429f58c68c16398a1 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - objectFocus: {instanceID: 0} 7 | - dofBlurShader: {fileID: 4800000, guid: bb4af680337344a4abad65a4e8873c50, type: 3} 8 | - dofShader: {fileID: 4800000, guid: 987fb0677d01f43ce8a9dbf12271e668, type: 3} 9 | - bokehShader: {fileID: 4800000, guid: 57cdacf9b217546aaa18edf39a6151c0, type: 3} 10 | - bokehTexture: {fileID: 2800000, guid: fc00ec05a89da4ff695a4273715cd5ce, type: 3} 11 | executionOrder: 0 12 | icon: {instanceID: 0} 13 | userData: 14 | assetBundleName: 15 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/EdgeDetection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 730475ee64f9a894bbac0d9e6f22e813 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - edgeDetectShader: {fileID: 4800000, guid: 0d1644bdf064147baa97f235fc5b4903, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Fisheye.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [RequireComponent (typeof(Camera))] 8 | [AddComponentMenu ("Image Effects/Displacement/Fisheye")] 9 | public class Fisheye : PostEffectsBase 10 | { 11 | [Range(0.0f, 1.5f)] 12 | public float strengthX = 0.05f; 13 | [Range(0.0f, 1.5f)] 14 | public float strengthY = 0.05f; 15 | 16 | public Shader fishEyeShader = null; 17 | private Material fisheyeMaterial = null; 18 | 19 | 20 | public override bool CheckResources () 21 | { 22 | CheckSupport (false); 23 | fisheyeMaterial = CheckShaderAndCreateMaterial(fishEyeShader,fisheyeMaterial); 24 | 25 | if (!isSupported) 26 | ReportAutoDisable (); 27 | return isSupported; 28 | } 29 | 30 | void OnRenderImage (RenderTexture source, RenderTexture destination) 31 | { 32 | if (CheckResources()==false) 33 | { 34 | Graphics.Blit (source, destination); 35 | return; 36 | } 37 | 38 | float oneOverBaseSize = 80.0f / 512.0f; // to keep values more like in the old version of fisheye 39 | 40 | float ar = (source.width * 1.0f) / (source.height * 1.0f); 41 | 42 | fisheyeMaterial.SetVector ("intensity", new Vector4 (strengthX * ar * oneOverBaseSize, strengthY * oneOverBaseSize, strengthX * ar * oneOverBaseSize, strengthY * oneOverBaseSize)); 43 | Graphics.Blit (source, destination, fisheyeMaterial); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Fisheye.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4739c22ef73ad62488fe344c8fe9addd 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - fishEyeShader: {fileID: 4800000, guid: 874ceab4425f64bccb1d14032f4452b1, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/GlobalFog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76b5ec6153a1d55438228df10fe66844 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - fogShader: {fileID: 4800000, guid: 70d8568987ac0499f952b54c7c13e265, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Grayscale.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [AddComponentMenu("Image Effects/Color Adjustments/Grayscale")] 8 | public class Grayscale : ImageEffectBase { 9 | public Texture textureRamp; 10 | 11 | [Range(-1.0f,1.0f)] 12 | public float rampOffset; 13 | 14 | // Called by camera to apply image effect 15 | void OnRenderImage (RenderTexture source, RenderTexture destination) { 16 | material.SetTexture("_RampTex", textureRamp); 17 | material.SetFloat("_RampOffset", rampOffset); 18 | Graphics.Blit (source, destination, material); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Grayscale.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 243a781cad112c75d0008dfa8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: daf9781cad112c75d0008dfa8d76c639, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ImageEffectBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [RequireComponent(typeof (Camera))] 7 | [AddComponentMenu("")] 8 | public class ImageEffectBase : MonoBehaviour 9 | { 10 | /// Provides a shader property that is set in the inspector 11 | /// and a material instantiated from the shader 12 | public Shader shader; 13 | 14 | private Material m_Material; 15 | 16 | 17 | protected virtual void Start() 18 | { 19 | // Disable if we don't support image effects 20 | if (!SystemInfo.supportsImageEffects) 21 | { 22 | enabled = false; 23 | return; 24 | } 25 | 26 | // Disable the image effect if the shader can't 27 | // run on the users graphics card 28 | if (!shader || !shader.isSupported) 29 | enabled = false; 30 | } 31 | 32 | 33 | protected Material material 34 | { 35 | get 36 | { 37 | if (m_Material == null) 38 | { 39 | m_Material = new Material(shader); 40 | m_Material.hideFlags = HideFlags.HideAndDontSave; 41 | } 42 | return m_Material; 43 | } 44 | } 45 | 46 | 47 | protected virtual void OnDisable() 48 | { 49 | if (m_Material) 50 | { 51 | DestroyImmediate(m_Material); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ImageEffectBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6469eb0ad1119d6d00011d98d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ImageEffects.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | /// A Utility class for performing various image based rendering tasks. 7 | [AddComponentMenu("")] 8 | public class ImageEffects 9 | { 10 | public static void RenderDistortion(Material material, RenderTexture source, RenderTexture destination, float angle, Vector2 center, Vector2 radius) 11 | { 12 | bool invertY = source.texelSize.y < 0.0f; 13 | if (invertY) 14 | { 15 | center.y = 1.0f - center.y; 16 | angle = -angle; 17 | } 18 | 19 | Matrix4x4 rotationMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, angle), Vector3.one); 20 | 21 | material.SetMatrix("_RotationMatrix", rotationMatrix); 22 | material.SetVector("_CenterRadius", new Vector4(center.x, center.y, radius.x, radius.y)); 23 | material.SetFloat("_Angle", angle*Mathf.Deg2Rad); 24 | 25 | Graphics.Blit(source, destination, material); 26 | } 27 | 28 | 29 | [Obsolete("Use Graphics.Blit(source,dest) instead")] 30 | public static void Blit(RenderTexture source, RenderTexture dest) 31 | { 32 | Graphics.Blit(source, dest); 33 | } 34 | 35 | 36 | [Obsolete("Use Graphics.Blit(source, destination, material) instead")] 37 | public static void BlitWithMaterial(Material material, RenderTexture source, RenderTexture dest) 38 | { 39 | Graphics.Blit(source, dest, material); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ImageEffects.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89a037199d11087f1100e2b844295342 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - blitCopyShader: {fileID: 4800000, guid: 3338b5ea2f3cb594698fae65cf060346, type: 3} 7 | - blitMultiplyShader: {fileID: 4800000, guid: 7034c801b78acab448cdcf845f7c352d, 8 | type: 3} 9 | - blitMultiply2XShader: {fileID: 4800000, guid: cde82987e0a884c4788c65f7b54390e8, 10 | type: 3} 11 | - blitAddShader: {fileID: 4800000, guid: c7515f214a63bdb42b6ae6335a00a8a4, type: 3} 12 | - blitAddSmoothShader: {fileID: 4800000, guid: 7741a77a7c455d0418bc429bd508dc87, 13 | type: 3} 14 | - blitBlendShader: {fileID: 4800000, guid: f1cf7e9c98754c4429ff0f7cc1d9dd7b, type: 3} 15 | executionOrder: 0 16 | icon: {instanceID: 0} 17 | userData: 18 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/MotionBlur.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | // This class implements simple ghosting type Motion Blur. 5 | // If Extra Blur is selected, the scene will allways be a little blurred, 6 | // as it is scaled to a smaller resolution. 7 | // The effect works by accumulating the previous frames in an accumulation 8 | // texture. 9 | namespace UnityStandardAssets.ImageEffects 10 | { 11 | [ExecuteInEditMode] 12 | [AddComponentMenu("Image Effects/Blur/Motion Blur (Color Accumulation)")] 13 | [RequireComponent(typeof(Camera))] 14 | public class MotionBlur : ImageEffectBase 15 | { 16 | [Range(0.0f, 0.92f)] 17 | public float blurAmount = 0.8f; 18 | public bool extraBlur = false; 19 | 20 | private RenderTexture accumTexture; 21 | 22 | override protected void Start() 23 | { 24 | base.Start(); 25 | } 26 | 27 | override protected void OnDisable() 28 | { 29 | base.OnDisable(); 30 | DestroyImmediate(accumTexture); 31 | } 32 | 33 | // Called by camera to apply image effect 34 | void OnRenderImage (RenderTexture source, RenderTexture destination) 35 | { 36 | // Create the accumulation texture 37 | if (accumTexture == null || accumTexture.width != source.width || accumTexture.height != source.height) 38 | { 39 | DestroyImmediate(accumTexture); 40 | accumTexture = new RenderTexture(source.width, source.height, 0); 41 | accumTexture.hideFlags = HideFlags.HideAndDontSave; 42 | Graphics.Blit( source, accumTexture ); 43 | } 44 | 45 | // If Extra Blur is selected, downscale the texture to 4x4 smaller resolution. 46 | if (extraBlur) 47 | { 48 | RenderTexture blurbuffer = RenderTexture.GetTemporary(source.width/4, source.height/4, 0); 49 | accumTexture.MarkRestoreExpected(); 50 | Graphics.Blit(accumTexture, blurbuffer); 51 | Graphics.Blit(blurbuffer,accumTexture); 52 | RenderTexture.ReleaseTemporary(blurbuffer); 53 | } 54 | 55 | // Clamp the motion blur variable, so it can never leave permanent trails in the image 56 | blurAmount = Mathf.Clamp( blurAmount, 0.0f, 0.92f ); 57 | 58 | // Setup the texture and floating point values in the shader 59 | material.SetTexture("_MainTex", accumTexture); 60 | material.SetFloat("_AccumOrig", 1.0F-blurAmount); 61 | 62 | // We are accumulating motion over frames without clear/discard 63 | // by design, so silence any performance warnings from Unity 64 | accumTexture.MarkRestoreExpected(); 65 | 66 | // Render the image using the motion blur shader 67 | Graphics.Blit (source, accumTexture, material); 68 | Graphics.Blit (accumTexture, destination); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/MotionBlur.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 478a2083ad114a07d000fbfb8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: e9ba2083ad114a07d000fbfb8d76c639, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/NoiseAndGrain.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9191284b058eef549b7108b5f04e1117 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - noiseTexture: {fileID: 2800000, guid: 7a632f967e8ad42f5bd275898151ab6a, type: 3} 7 | - noiseShader: {fileID: 4800000, guid: b0249d8c935344451aa4de6db76f0688, type: 3} 8 | - dx11NoiseShader: {fileID: 4800000, guid: 8b30686bb4322ab42ad5eb50a0210b58, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/NoiseAndScratches.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a88a26a276b4e47619ce2c5adad33fab 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - grainTexture: {fileID: 2800000, guid: ffa9c02760c2b4e8eb9814ec06c4b05b, type: 3} 7 | - scratchTexture: {fileID: 2800000, guid: 6205c27cc031f4e66b8ea90d1bfaa158, type: 3} 8 | - shaderRGB: {fileID: 4800000, guid: 5d7f4c401ae8946bcb0d6ff68a9e7466, type: 3} 9 | - shaderYUV: {fileID: 4800000, guid: 0e447868506ba49f0a73235b8a8b647a, type: 3} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/PostEffectsBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6f4318ec6c2bf643a0f9edfeeaba0ec 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/PostEffectsHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50b03df8f04b5c441aaac5b7fccb4734 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Quads.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a20852ce049f64e4695a48b6a354be83 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ScreenOverlay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [RequireComponent (typeof(Camera))] 8 | [AddComponentMenu ("Image Effects/Other/Screen Overlay")] 9 | public class ScreenOverlay : PostEffectsBase 10 | { 11 | public enum OverlayBlendMode 12 | { 13 | Additive = 0, 14 | ScreenBlend = 1, 15 | Multiply = 2, 16 | Overlay = 3, 17 | AlphaBlend = 4, 18 | } 19 | 20 | public OverlayBlendMode blendMode = OverlayBlendMode.Overlay; 21 | public float intensity = 1.0f; 22 | public Texture2D texture = null; 23 | 24 | public Shader overlayShader = null; 25 | private Material overlayMaterial = null; 26 | 27 | 28 | public override bool CheckResources () 29 | { 30 | CheckSupport (false); 31 | 32 | overlayMaterial = CheckShaderAndCreateMaterial (overlayShader, overlayMaterial); 33 | 34 | if (!isSupported) 35 | ReportAutoDisable (); 36 | return isSupported; 37 | } 38 | 39 | void OnRenderImage (RenderTexture source, RenderTexture destination) 40 | { 41 | if (CheckResources() == false) 42 | { 43 | Graphics.Blit (source, destination); 44 | return; 45 | } 46 | 47 | Vector4 UV_Transform = new Vector4(1, 0, 0, 1); 48 | 49 | #if UNITY_WP8 50 | // WP8 has no OS support for rotating screen with device orientation, 51 | // so we do those transformations ourselves. 52 | if (Screen.orientation == ScreenOrientation.LandscapeLeft) { 53 | UV_Transform = new Vector4(0, -1, 1, 0); 54 | } 55 | if (Screen.orientation == ScreenOrientation.LandscapeRight) { 56 | UV_Transform = new Vector4(0, 1, -1, 0); 57 | } 58 | if (Screen.orientation == ScreenOrientation.PortraitUpsideDown) { 59 | UV_Transform = new Vector4(-1, 0, 0, -1); 60 | } 61 | #endif 62 | 63 | overlayMaterial.SetVector("_UV_Transform", UV_Transform); 64 | overlayMaterial.SetFloat ("_Intensity", intensity); 65 | overlayMaterial.SetTexture ("_Overlay", texture); 66 | Graphics.Blit (source, destination, overlayMaterial, (int) blendMode); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ScreenOverlay.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f19108706fdce9469603d07980eb8ad 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - texture: {instanceID: 0} 7 | - overlayShader: {fileID: 4800000, guid: 8c81db0e527d24acc9bcec04e87781bd, type: 3} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ScreenSpaceAmbientObscurance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75febd242c999f04d9654522a10c006b 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - rand: {fileID: 2800000, guid: a181ca8e3c62f3e4b8f183f6c586b032, type: 3} 7 | - aoShader: {fileID: 4800000, guid: 95616c020c5604dda96cf76afbbc0272, type: 3} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/ScreenSpaceAmbientOcclusion.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0923359e9e352a4b9b11c7b7161ad67 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - m_SSAOShader: {fileID: 4800000, guid: 43ca18288c424f645aaa1e9e07f04c50, type: 3} 7 | - m_RandomTexture: {fileID: 2800000, guid: a181ca8e3c62f3e4b8f183f6c586b032, type: 3} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/SepiaTone.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [AddComponentMenu("Image Effects/Color Adjustments/Sepia Tone")] 8 | public class SepiaTone : ImageEffectBase 9 | { 10 | // Called by camera to apply image effect 11 | void OnRenderImage (RenderTexture source, RenderTexture destination) 12 | { 13 | Graphics.Blit (source, destination, material); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/SepiaTone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a07a781cad112c75d0008dfa8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: b6aa781cad112c75d0008dfa8d76c639, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/SunShafts.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60e318a6043c1cb4a8ce1c8805bab930 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - sunTransform: {instanceID: 0} 7 | - sunShaftsShader: {fileID: 4800000, guid: d3b1c8c1036784176946f5cfbfb7fe4c, type: 3} 8 | - simpleClearShader: {fileID: 4800000, guid: f688f89ed5eb847c5b19c934a0f1e772, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/TiltShift.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [RequireComponent (typeof(Camera))] 7 | [AddComponentMenu ("Image Effects/Camera/Tilt Shift (Lens Blur)")] 8 | class TiltShift : PostEffectsBase { 9 | public enum TiltShiftMode 10 | { 11 | TiltShiftMode, 12 | IrisMode, 13 | } 14 | public enum TiltShiftQuality 15 | { 16 | Preview, 17 | Low, 18 | Normal, 19 | High, 20 | } 21 | 22 | public TiltShiftMode mode = TiltShiftMode.TiltShiftMode; 23 | public TiltShiftQuality quality = TiltShiftQuality.Normal; 24 | 25 | [Range(0.0f, 15.0f)] 26 | public float blurArea = 1.0f; 27 | 28 | [Range(0.0f, 25.0f)] 29 | public float maxBlurSize = 5.0f; 30 | 31 | [Range(0, 1)] 32 | public int downsample = 0; 33 | 34 | public Shader tiltShiftShader = null; 35 | private Material tiltShiftMaterial = null; 36 | 37 | 38 | public override bool CheckResources () { 39 | CheckSupport (false); 40 | 41 | tiltShiftMaterial = CheckShaderAndCreateMaterial (tiltShiftShader, tiltShiftMaterial); 42 | 43 | if (!isSupported) 44 | ReportAutoDisable (); 45 | return isSupported; 46 | } 47 | 48 | void OnRenderImage (RenderTexture source, RenderTexture destination) { 49 | if (CheckResources() == false) { 50 | Graphics.Blit (source, destination); 51 | return; 52 | } 53 | 54 | tiltShiftMaterial.SetFloat("_BlurSize", maxBlurSize < 0.0f ? 0.0f : maxBlurSize); 55 | tiltShiftMaterial.SetFloat("_BlurArea", blurArea); 56 | source.filterMode = FilterMode.Bilinear; 57 | 58 | RenderTexture rt = destination; 59 | if (downsample > 0f) { 60 | rt = RenderTexture.GetTemporary (source.width>>downsample, source.height>>downsample, 0, source.format); 61 | rt.filterMode = FilterMode.Bilinear; 62 | } 63 | 64 | int basePassNr = (int) quality; basePassNr *= 2; 65 | Graphics.Blit (source, rt, tiltShiftMaterial, mode == TiltShiftMode.TiltShiftMode ? basePassNr : basePassNr + 1); 66 | 67 | if (downsample > 0) { 68 | tiltShiftMaterial.SetTexture ("_Blurred", rt); 69 | Graphics.Blit (source, destination, tiltShiftMaterial, 8); 70 | } 71 | 72 | if (rt != destination) 73 | RenderTexture.ReleaseTemporary (rt); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/TiltShift.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a22b3a7095a744a428c134b5e26ad68e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - tiltShiftShader: {fileID: 4800000, guid: bf34d2a25450349699e8ae6456fa7ca9, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Tonemapping.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e50e925fb93c78246bf995d9dc3a2330 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - tonemapper: {fileID: 4800000, guid: 003377fc2620a44939dadde6fe3f8190, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Triangles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18b91636de2ba3445913e4cf38528dc8 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Twirl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [AddComponentMenu("Image Effects/Displacement/Twirl")] 8 | public class Twirl : ImageEffectBase 9 | { 10 | public Vector2 radius = new Vector2(0.3F,0.3F); 11 | [Range(0.0f,360.0f)] 12 | public float angle = 50; 13 | public Vector2 center = new Vector2 (0.5F, 0.5F); 14 | 15 | 16 | // Called by camera to apply image effect 17 | void OnRenderImage (RenderTexture source, RenderTexture destination) 18 | { 19 | ImageEffects.RenderDistortion (material, source, destination, angle, center, radius); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Twirl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdda781cad112c75d0008dfa8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: 641b781cad112c75d0008dfa8d76c639, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/VignetteAndChromaticAberration.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd6d4281e5d7cd44d8c6e38bc2c1b8d8 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - vignetteShader: {fileID: 4800000, guid: 627943dc7a9a74286b70a4f694a0acd5, type: 3} 7 | - separableBlurShader: {fileID: 4800000, guid: e97c14fbb5ea04c3a902cc533d7fc5d1, 8 | type: 3} 9 | - chromAberrationShader: {fileID: 4800000, guid: 2b4f29398d9484ccfa9fd220449f5eee, 10 | type: 3} 11 | executionOrder: 0 12 | icon: {instanceID: 0} 13 | userData: 14 | assetBundleName: 15 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Vortex.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [AddComponentMenu("Image Effects/Displacement/Vortex")] 8 | public class Vortex : ImageEffectBase 9 | { 10 | public Vector2 radius = new Vector2(0.4F,0.4F); 11 | public float angle = 50; 12 | public Vector2 center = new Vector2(0.5F, 0.5F); 13 | 14 | // Called by camera to apply image effect 15 | void OnRenderImage (RenderTexture source, RenderTexture destination) 16 | { 17 | ImageEffects.RenderDistortion (material, source, destination, angle, center, radius); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Vortex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a94b781cad112c75d0008dfa8d76c639 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: 708b781cad112c75d0008dfa8d76c639, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2145489f7c704db8acb14a52bddeee9 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/BlendModesOverlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c81db0e527d24acc9bcec04e87781bd 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/BlurEffectConeTaps.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/BlurEffectConeTap" { 4 | Properties { _MainTex ("", any) = "" {} } 5 | CGINCLUDE 6 | #include "UnityCG.cginc" 7 | struct v2f { 8 | float4 pos : SV_POSITION; 9 | half2 uv : TEXCOORD0; 10 | half2 taps[4] : TEXCOORD1; 11 | }; 12 | sampler2D _MainTex; 13 | half4 _MainTex_TexelSize; 14 | half4 _MainTex_ST; 15 | half4 _BlurOffsets; 16 | v2f vert( appdata_img v ) { 17 | v2f o; 18 | o.pos = UnityObjectToClipPos(v.vertex); 19 | 20 | o.uv = v.texcoord - _BlurOffsets.xy * _MainTex_TexelSize.xy; // hack, see BlurEffect.cs for the reason for this. let's make a new blur effect soon 21 | #ifdef UNITY_SINGLE_PASS_STEREO 22 | // we need to keep texel size correct after the uv adjustment. 23 | o.taps[0] = UnityStereoScreenSpaceUVAdjust(o.uv + _MainTex_TexelSize * _BlurOffsets.xy * (1.0f / _MainTex_ST.xy), _MainTex_ST); 24 | o.taps[1] = UnityStereoScreenSpaceUVAdjust(o.uv - _MainTex_TexelSize * _BlurOffsets.xy * (1.0f / _MainTex_ST.xy), _MainTex_ST); 25 | o.taps[2] = UnityStereoScreenSpaceUVAdjust(o.uv + _MainTex_TexelSize * _BlurOffsets.xy * half2(1, -1) * (1.0f / _MainTex_ST.xy), _MainTex_ST); 26 | o.taps[3] = UnityStereoScreenSpaceUVAdjust(o.uv - _MainTex_TexelSize * _BlurOffsets.xy * half2(1, -1) * (1.0f / _MainTex_ST.xy), _MainTex_ST); 27 | #else 28 | o.taps[0] = o.uv + _MainTex_TexelSize * _BlurOffsets.xy; 29 | o.taps[1] = o.uv - _MainTex_TexelSize * _BlurOffsets.xy; 30 | o.taps[2] = o.uv + _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1); 31 | o.taps[3] = o.uv - _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1); 32 | #endif 33 | return o; 34 | } 35 | half4 frag(v2f i) : SV_Target { 36 | half4 color = tex2D(_MainTex, i.taps[0]); 37 | color += tex2D(_MainTex, i.taps[1]); 38 | color += tex2D(_MainTex, i.taps[2]); 39 | color += tex2D(_MainTex, i.taps[3]); 40 | return color * 0.25; 41 | } 42 | ENDCG 43 | SubShader { 44 | Pass { 45 | ZTest Always Cull Off ZWrite Off 46 | 47 | CGPROGRAM 48 | #pragma vertex vert 49 | #pragma fragment frag 50 | ENDCG 51 | } 52 | } 53 | Fallback off 54 | } 55 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/BlurEffectConeTaps.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57e6deea7c2924e22a5138e2b70bb4dc 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/CameraMotionBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85a88efa8c871af4a9d17c64791b6f4f 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/CameraMotionBlurDX11.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1b13d7a80660504a858ea24cfa418c6 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ChromaticAberrationShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b4f29398d9484ccfa9fd220449f5eee 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrection3DLut.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/ColorCorrection3DLut" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | _ClutTex ("-", 3D) = "" {} 7 | } 8 | 9 | CGINCLUDE 10 | 11 | #include "UnityCG.cginc" 12 | 13 | struct v2f { 14 | float4 pos : SV_POSITION; 15 | float2 uv : TEXCOORD0; 16 | }; 17 | 18 | sampler2D _MainTex; 19 | sampler3D _ClutTex; 20 | 21 | half4 _MainTex_ST; 22 | 23 | float _Scale; 24 | float _Offset; 25 | 26 | v2f vert( appdata_img v ) 27 | { 28 | v2f o; 29 | o.pos = UnityObjectToClipPos(v.vertex); 30 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 31 | return o; 32 | } 33 | 34 | float4 frag(v2f i) : SV_Target 35 | { 36 | float4 c = tex2D(_MainTex, i.uv); 37 | c.rgb = tex3D(_ClutTex, c.rgb * _Scale + _Offset).rgb; 38 | return c; 39 | } 40 | 41 | float4 fragLinear(v2f i) : SV_Target 42 | { 43 | float4 c = tex2D(_MainTex, i.uv); 44 | c.rgb= sqrt(c.rgb); 45 | c.rgb = tex3D(_ClutTex, c.rgb * _Scale + _Offset).rgb; 46 | c.rgb = c.rgb*c.rgb; 47 | return c; 48 | } 49 | 50 | ENDCG 51 | 52 | 53 | Subshader 54 | { 55 | Pass 56 | { 57 | ZTest Always Cull Off ZWrite Off 58 | 59 | CGPROGRAM 60 | #pragma vertex vert 61 | #pragma fragment frag 62 | #pragma target 3.0 63 | ENDCG 64 | } 65 | 66 | Pass 67 | { 68 | ZTest Always Cull Off ZWrite Off 69 | 70 | CGPROGRAM 71 | #pragma vertex vert 72 | #pragma fragment fragLinear 73 | #pragma target 3.0 74 | ENDCG 75 | } 76 | } 77 | 78 | Fallback off 79 | } 80 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrection3DLut.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b61f0d8d8244b4b28aa66b0c8cb46a8d 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionCurves.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/ColorCorrectionCurves" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | 7 | _RgbTex ("_RgbTex (RGB)", 2D) = "" {} 8 | 9 | _ZCurve ("_ZCurve (RGB)", 2D) = "" {} 10 | 11 | _RgbDepthTex ("_RgbDepthTex (RGB)", 2D) = "" {} 12 | } 13 | 14 | // note: also have a look at ColorCorrectionCurvesSimple 15 | // for a much simpler color correction without use of 16 | // depth texture lookups 17 | 18 | // Shader code pasted into all further CGPROGRAM blocks 19 | CGINCLUDE 20 | 21 | #include "UnityCG.cginc" 22 | 23 | struct v2f { 24 | float4 pos : SV_POSITION; 25 | float2 uv : TEXCOORD0; 26 | float2 uv2 : TEXCOORD1; 27 | }; 28 | 29 | sampler2D _MainTex; 30 | sampler2D_float _CameraDepthTexture; 31 | 32 | float4 _CameraDepthTexture_ST; 33 | uniform float4 _MainTex_TexelSize; 34 | half4 _MainTex_ST; 35 | 36 | sampler2D _RgbTex; 37 | sampler2D _ZCurve; 38 | sampler2D _RgbDepthTex; 39 | 40 | fixed _Saturation; 41 | 42 | v2f vert( appdata_img v ) 43 | { 44 | v2f o; 45 | o.pos = UnityObjectToClipPos(v.vertex); 46 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 47 | o.uv2 = TRANSFORM_TEX(v.texcoord, _CameraDepthTexture); 48 | 49 | #if UNITY_UV_STARTS_AT_TOP 50 | if (_MainTex_TexelSize.y < 0) 51 | o.uv2.y = 1-o.uv2.y; 52 | #endif 53 | 54 | return o; 55 | } 56 | 57 | half4 frag(v2f i) : SV_Target 58 | { 59 | half4 color = tex2D(_MainTex, i.uv); 60 | 61 | half3 ycoords = half3(0.5,1.5,2.5) * 0.25; 62 | 63 | half3 red = tex2D(_RgbTex, half2(color.r, ycoords.x)).rgb * half3(1,0,0); 64 | half3 green = tex2D(_RgbTex, half2(color.g, ycoords.y)).rgb * half3(0,1,0); 65 | half3 blue = tex2D(_RgbTex, half2(color.b, ycoords.z)).rgb * half3(0,0,1); 66 | 67 | half theDepth = SAMPLE_DEPTH_TEXTURE( _CameraDepthTexture, i.uv2) ; 68 | half zval = tex2D(_ZCurve, half2( Linear01Depth (theDepth), 0.5)); 69 | 70 | half3 depthRed = tex2D(_RgbDepthTex, half2(color.r, ycoords.x)).rgb * half3(1,0,0); 71 | half3 depthGreen = tex2D(_RgbDepthTex, half2(color.g, ycoords.y)).rgb * half3(0,1,0); 72 | half3 depthBlue = tex2D(_RgbDepthTex, half2(color.b, ycoords.z)).rgb * half3(0,0,1); 73 | 74 | color = half4( lerp(red+green+blue, depthRed+depthBlue+depthGreen, zval), color.a); 75 | 76 | half lum = Luminance(color.rgb); 77 | color.rgb = lerp(half3(lum,lum,lum), color.rgb, _Saturation); 78 | return color; 79 | } 80 | 81 | ENDCG 82 | 83 | Subshader { 84 | Pass { 85 | ZTest Always Cull Off ZWrite Off 86 | 87 | CGPROGRAM 88 | #pragma vertex vert 89 | #pragma fragment frag 90 | ENDCG 91 | } 92 | } 93 | 94 | Fallback off 95 | 96 | } // shader 97 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionCurves.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62bcade1028c24ca1a39760ed84b9487 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionCurvesSimple.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/ColorCorrectionCurvesSimple" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | _RgbTex ("_RgbTex (RGB)", 2D) = "" {} 7 | } 8 | 9 | // Shader code pasted into all further CGPROGRAM blocks 10 | CGINCLUDE 11 | 12 | #include "UnityCG.cginc" 13 | 14 | struct v2f { 15 | float4 pos : SV_POSITION; 16 | half2 uv : TEXCOORD0; 17 | }; 18 | 19 | sampler2D _MainTex; 20 | sampler2D _RgbTex; 21 | fixed _Saturation; 22 | 23 | half4 _MainTex_ST; 24 | 25 | v2f vert( appdata_img v ) 26 | { 27 | v2f o; 28 | o.pos = UnityObjectToClipPos(v.vertex); 29 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 30 | return o; 31 | } 32 | 33 | fixed4 frag(v2f i) : SV_Target 34 | { 35 | fixed4 color = tex2D(_MainTex, i.uv); 36 | 37 | fixed3 red = tex2D(_RgbTex, half2(color.r, 0.5/4.0)).rgb * fixed3(1,0,0); 38 | fixed3 green = tex2D(_RgbTex, half2(color.g, 1.5/4.0)).rgb * fixed3(0,1,0); 39 | fixed3 blue = tex2D(_RgbTex, half2(color.b, 2.5/4.0)).rgb * fixed3(0,0,1); 40 | 41 | color = fixed4(red+green+blue, color.a); 42 | 43 | fixed lum = Luminance(color.rgb); 44 | color.rgb = lerp(fixed3(lum,lum,lum), color.rgb, _Saturation); 45 | return color; 46 | } 47 | 48 | ENDCG 49 | 50 | Subshader { 51 | Pass { 52 | ZTest Always Cull Off ZWrite Off 53 | 54 | CGPROGRAM 55 | #pragma vertex vert 56 | #pragma fragment frag 57 | ENDCG 58 | } 59 | } 60 | 61 | Fallback off 62 | 63 | } // shader 64 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionCurvesSimple.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 438ddd58d82c84d9eb1fdc56111702e1 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionEffect.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Color Correction Effect" { 2 | Properties { 3 | _MainTex ("Base (RGB)", 2D) = "white" {} 4 | _RampTex ("Base (RGB)", 2D) = "grayscaleRamp" {} 5 | } 6 | 7 | SubShader { 8 | Pass { 9 | ZTest Always Cull Off ZWrite Off 10 | 11 | CGPROGRAM 12 | #pragma vertex vert_img 13 | #pragma fragment frag 14 | #include "UnityCG.cginc" 15 | 16 | uniform sampler2D _MainTex; 17 | uniform sampler2D _RampTex; 18 | 19 | half4 _MainTex_ST; 20 | 21 | fixed4 frag (v2f_img i) : SV_Target 22 | { 23 | fixed4 orig = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)); 24 | 25 | fixed rr = tex2D(_RampTex, orig.rr).r; 26 | fixed gg = tex2D(_RampTex, orig.gg).g; 27 | fixed bb = tex2D(_RampTex, orig.bb).b; 28 | 29 | fixed4 color = fixed4(rr, gg, bb, orig.a); 30 | 31 | return color; 32 | } 33 | ENDCG 34 | 35 | } 36 | } 37 | 38 | Fallback off 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionEffect.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67f8781cad112c75d0008dfa8d76c639 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionSelective.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/ColorCorrectionSelective" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | float4 pos : SV_POSITION; 14 | float2 uv : TEXCOORD0; 15 | }; 16 | 17 | sampler2D _MainTex; 18 | half4 _MainTex_ST; 19 | 20 | float4 selColor; 21 | float4 targetColor; 22 | 23 | v2f vert( appdata_img v ) { 24 | v2f o; 25 | o.pos = UnityObjectToClipPos (v.vertex); 26 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 27 | return o; 28 | } 29 | 30 | fixed4 frag(v2f i) : SV_Target { 31 | fixed4 color = tex2D (_MainTex, i.uv); 32 | 33 | fixed diff = saturate (2.0 * length (color.rgb - selColor.rgb)); 34 | color = lerp (targetColor, color, diff); 35 | return color; 36 | } 37 | 38 | ENDCG 39 | 40 | Subshader { 41 | Pass { 42 | ZTest Always Cull Off ZWrite Off 43 | 44 | CGPROGRAM 45 | 46 | #pragma vertex vert 47 | #pragma fragment frag 48 | 49 | ENDCG 50 | } 51 | } 52 | 53 | Fallback off 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ColorCorrectionSelective.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e515e0f94cefc4c0db54b45cba621544 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a40c1b84cf7fe418bae97a29041b85a4 3 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/Adaptation.shader: -------------------------------------------------------------------------------- 1 | // Calculates adaptation to minimum/maximum luminance values, 2 | // based on "currently adapted" and "new values to adapt to" 3 | // textures (both 1x1). 4 | 5 | Shader "Hidden/Contrast Stretch Adaptation" { 6 | Properties { 7 | _MainTex ("Base (RGB)", 2D) = "white" {} 8 | _CurTex ("Base (RGB)", 2D) = "white" {} 9 | } 10 | 11 | Category { 12 | SubShader { 13 | Pass { 14 | ZTest Always Cull Off ZWrite Off 15 | 16 | CGPROGRAM 17 | #pragma vertex vert_img 18 | #pragma fragment frag 19 | #include "UnityCG.cginc" 20 | 21 | uniform sampler2D _MainTex; // currently adapted to 22 | uniform sampler2D _CurTex; // new value to adapt to 23 | uniform float4 _AdaptParams; // x=adaptLerp, y=limitMinimum, z=limitMaximum 24 | half4 _MainTex_ST; 25 | half4 _CurTex_ST; 26 | 27 | float4 frag (v2f_img i) : SV_Target { 28 | // value is: max, min 29 | float2 valAdapted = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)).xy; 30 | float2 valCur = tex2D(_CurTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)).xy; 31 | 32 | // Calculate new adapted values: interpolate 33 | // from valAdapted to valCur by script-supplied amount. 34 | // 35 | // Because we store adaptation levels in a simple 8 bit/channel 36 | // texture, we might not have enough precision - the interpolation 37 | // amount might be too small to change anything, and we'll never 38 | // arrive at the needed values. 39 | // 40 | // So we make sure the change we do is at least 1/255th of the 41 | // color range - this way we'll always change the value. 42 | const float kMinChange = 1.0/255.0; 43 | float2 delta = (valCur-valAdapted) * _AdaptParams.x; 44 | delta.x = sign(delta.x) * max( kMinChange, abs(delta.x) ); 45 | delta.y = sign(delta.y) * max( kMinChange, abs(delta.y) ); 46 | 47 | float4 valNew; 48 | valNew.xy = valAdapted + delta; 49 | 50 | // Impose user limits on maximum/minimum values 51 | valNew.x = max( valNew.x, _AdaptParams.z ); 52 | valNew.y = min( valNew.y, _AdaptParams.y ); 53 | 54 | // Optimization so that our final apply pass is faster: 55 | // z = max-min (plus a small amount to prevent division by zero) 56 | valNew.z = valNew.x - valNew.y + 0.01; 57 | // w = min/(max-min) 58 | valNew.w = valNew.y / valNew.z; 59 | 60 | return valNew; 61 | } 62 | ENDCG 63 | 64 | } 65 | } 66 | } 67 | 68 | Fallback off 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/Adaptation.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 257bc83cbeb544540bd0e558aa9b1383 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/Apply.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | // Final pass in the contrast stretch effect: apply 4 | // color stretch to the original image, based on currently 5 | // adapted to minimum/maximum luminances. 6 | 7 | Shader "Hidden/Contrast Stretch Apply" { 8 | Properties { 9 | _MainTex ("Base (RGB)", 2D) = "white" {} 10 | _AdaptTex ("Base (RGB)", 2D) = "white" {} 11 | } 12 | 13 | Category { 14 | SubShader { 15 | Pass { 16 | ZTest Always Cull Off ZWrite Off 17 | 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | #include "UnityCG.cginc" 22 | 23 | struct v2f { 24 | float4 pos : SV_POSITION; 25 | float2 uv[2] : TEXCOORD0; 26 | }; 27 | 28 | uniform sampler2D _MainTex; 29 | uniform sampler2D _AdaptTex; 30 | half4 _MainTex_ST; 31 | 32 | v2f vert (appdata_img v) 33 | { 34 | v2f o; 35 | o.pos = UnityObjectToClipPos (v.vertex); 36 | o.uv[0] = MultiplyUV (UNITY_MATRIX_TEXTURE0, UnityStereoScreenSpaceUVAdjust(v.texcoord, _MainTex_ST)); 37 | o.uv[1] = float2(0.5,0.5); 38 | return o; 39 | } 40 | 41 | float4 frag (v2f i) : SV_Target 42 | { 43 | float4 col = tex2D(_MainTex, i.uv[0]); 44 | float4 adapted = tex2D(_AdaptTex, i.uv[1]); 45 | float vmul = 1.0 / adapted.z; 46 | float vadd = -adapted.w; 47 | col.rgb = col.rgb * vmul + vadd; 48 | return col; 49 | } 50 | ENDCG 51 | 52 | } 53 | } 54 | } 55 | 56 | Fallback off 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/Apply.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4901f25d4e1542589348bbb89563d8e 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/Luminance.shader: -------------------------------------------------------------------------------- 1 | // Outputs luminance (grayscale) of the input image _MainTex 2 | 3 | Shader "Hidden/Contrast Stretch Luminance" { 4 | 5 | Properties { 6 | _MainTex ("Base (RGB)", 2D) = "white" {} 7 | } 8 | 9 | Category { 10 | SubShader { 11 | Pass { 12 | ZTest Always Cull Off ZWrite Off 13 | 14 | CGPROGRAM 15 | #pragma vertex vert_img 16 | #pragma fragment frag 17 | #include "UnityCG.cginc" 18 | 19 | uniform sampler2D _MainTex; 20 | half4 _MainTex_ST; 21 | 22 | float4 frag (v2f_img i) : SV_Target 23 | { 24 | float4 col = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)); 25 | col.rgb = Luminance(col.rgb) * (1+col.a*2); 26 | return col; 27 | } 28 | ENDCG 29 | 30 | } 31 | } 32 | } 33 | 34 | Fallback off 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/Luminance.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: befbb4b9c320b4b18a08ef7afb93b6c9 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/MinMaxReduction.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | // Reduces input image (_MainTex) by 2x2. 4 | // Outputs maximum value in R, minimum in G. 5 | Shader "Hidden/Contrast Stretch Reduction" { 6 | 7 | Properties { 8 | _MainTex ("Base (RGB)", 2D) = "white" {} 9 | } 10 | 11 | Category { 12 | SubShader { 13 | Pass { 14 | ZTest Always Cull Off ZWrite Off 15 | 16 | CGPROGRAM 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | #include "UnityCG.cginc" 20 | 21 | struct v2f { 22 | float4 position : SV_POSITION; 23 | float2 uv[4] : TEXCOORD0; 24 | }; 25 | 26 | uniform sampler2D _MainTex; 27 | half4 _MainTex_ST; 28 | 29 | v2f vert (appdata_img v) { 30 | v2f o; 31 | o.position = UnityObjectToClipPos (v.vertex); 32 | float2 uv = MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord); 33 | 34 | // Compute UVs to sample 2x2 pixel block. 35 | o.uv[0] = UnityStereoScreenSpaceUVAdjust(uv + float2(0,0), _MainTex_ST); 36 | o.uv[1] = UnityStereoScreenSpaceUVAdjust(uv + float2(0,1), _MainTex_ST); 37 | o.uv[2] = UnityStereoScreenSpaceUVAdjust(uv + float2(1,0), _MainTex_ST); 38 | o.uv[3] = UnityStereoScreenSpaceUVAdjust(uv + float2(1,1), _MainTex_ST); 39 | return o; 40 | } 41 | 42 | float4 frag (v2f i) : SV_Target 43 | { 44 | // Sample pixel block 45 | float4 v00 = tex2D(_MainTex, i.uv[0]); 46 | float2 v01 = tex2D(_MainTex, i.uv[1]).xy; 47 | float2 v10 = tex2D(_MainTex, i.uv[2]).xy; 48 | float2 v11 = tex2D(_MainTex, i.uv[3]).xy; 49 | 50 | float4 res; 51 | // output x: maximum of the four values 52 | res.x = max( max(v00.x,v01.x), max(v10.x,v11.x) ); 53 | // output y: minimum of the four values 54 | res.y = min( min(v00.y,v01.y), min(v10.y,v11.y) ); 55 | // output zw unchanged from the first pixel 56 | res.zw = v00.zw; 57 | 58 | return res; 59 | } 60 | ENDCG 61 | 62 | } 63 | } 64 | } 65 | 66 | Fallback off 67 | 68 | } 69 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Contrast Stretch/MinMaxReduction.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57b33a14b6d5347c5a85c36f6cb3b280 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ContrastComposite.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/ContrastComposite" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | _MainTexBlurred ("Base Blurred (RGB)", 2D) = "" {} 7 | } 8 | 9 | // Shader code pasted into all further CGPROGRAM blocks 10 | CGINCLUDE 11 | 12 | #include "UnityCG.cginc" 13 | 14 | struct v2f { 15 | float4 pos : SV_POSITION; 16 | float2 uv[2] : TEXCOORD0; 17 | }; 18 | 19 | sampler2D _MainTex; 20 | sampler2D _MainTexBlurred; 21 | 22 | float4 _MainTex_TexelSize; 23 | half4 _MainTex_ST; 24 | 25 | half4 _MainTexBlurred_ST; 26 | 27 | float intensity; 28 | float threshold; 29 | 30 | v2f vert( appdata_img v ) { 31 | v2f o; 32 | o.pos = UnityObjectToClipPos(v.vertex); 33 | 34 | o.uv[0] = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTexBlurred_ST); 35 | o.uv[1] = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 36 | #if UNITY_UV_STARTS_AT_TOP 37 | if (_MainTex_TexelSize.y < 0) 38 | o.uv[0].y = 1-o.uv[0].y; 39 | #endif 40 | return o; 41 | } 42 | 43 | half4 frag(v2f i) : SV_Target 44 | { 45 | half4 color = tex2D (_MainTex, i.uv[1]); 46 | half4 blurred = tex2D (_MainTexBlurred, (i.uv[0])); 47 | 48 | half4 difference = color - blurred; 49 | half4 signs = sign (difference); 50 | 51 | half4 enhancement = saturate (abs(difference) - threshold) * signs * 1.0/(1.0-threshold); 52 | color += enhancement * intensity; 53 | 54 | return color; 55 | } 56 | 57 | ENDCG 58 | 59 | Subshader { 60 | Pass { 61 | ZTest Always Cull Off ZWrite Off 62 | 63 | CGPROGRAM 64 | #pragma vertex vert 65 | #pragma fragment frag 66 | ENDCG 67 | } 68 | } 69 | 70 | Fallback off 71 | 72 | } // shader 73 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ContrastComposite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 273404942eede4ea1883ca1fb2942507 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ConvertDepth.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/ConvertDepth" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | // Shader code pasted into all further CGPROGRAM blocks 9 | CGINCLUDE 10 | 11 | #include "UnityCG.cginc" 12 | 13 | struct v2f { 14 | float4 pos : SV_POSITION; 15 | float2 uv : TEXCOORD0; 16 | }; 17 | 18 | sampler2D _MainTex; 19 | sampler2D_float _CameraDepthTexture; 20 | 21 | half4 _CameraDepthTexture_ST; 22 | 23 | v2f vert( appdata_img v ) 24 | { 25 | v2f o; 26 | o.pos = UnityObjectToClipPos(v.vertex); 27 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _CameraDepthTexture_ST); 28 | return o; 29 | } 30 | 31 | half4 frag(v2f i) : SV_Target 32 | { 33 | float d = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv.xy); 34 | d = Linear01Depth(d); 35 | 36 | if(d>0.99999) 37 | return half4(1,1,1,1); 38 | else 39 | return EncodeFloatRGBA(d); 40 | } 41 | 42 | ENDCG 43 | 44 | Subshader { 45 | 46 | Pass { 47 | ZTest Always Cull Off ZWrite Off 48 | 49 | CGPROGRAM 50 | #pragma vertex vert 51 | #pragma fragment frag 52 | ENDCG 53 | } 54 | } 55 | 56 | Fallback off 57 | 58 | } // shader 59 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ConvertDepth.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14768d3865b1342e3a861fbe19ba2db2 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/CreaseApply.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | 5 | Shader "Hidden/CreaseApply" { 6 | Properties { 7 | _MainTex ("Base (RGB)", 2D) = "white" {} 8 | _HrDepthTex ("Base (RGB)", 2D) = "white" {} 9 | _LrDepthTex ("Base (RGB)", 2D) = "white" {} 10 | } 11 | 12 | SubShader { 13 | Pass { 14 | ZTest Always Cull Off ZWrite Off 15 | 16 | CGPROGRAM 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | #include "UnityCG.cginc" 20 | 21 | sampler2D _MainTex; 22 | sampler2D _HrDepthTex; 23 | sampler2D _LrDepthTex; 24 | 25 | uniform float4 _MainTex_TexelSize; 26 | half4 _MainTex_ST; 27 | half4 _HrDepthTex_ST; 28 | half4 _LrDepthTex_ST; 29 | uniform float intensity; 30 | 31 | struct v2f { 32 | float4 pos : SV_POSITION; 33 | float2 uv : TEXCOORD0; 34 | }; 35 | 36 | v2f vert( appdata_img v ) 37 | { 38 | v2f o; 39 | o.pos = UnityObjectToClipPos (v.vertex); 40 | o.uv.xy = v.texcoord.xy; 41 | return o; 42 | } 43 | 44 | half4 frag (v2f i) : SV_Target 45 | { 46 | float4 hrDepth = tex2D(_HrDepthTex, UnityStereoScreenSpaceUVAdjust(i.uv, _HrDepthTex_ST)); 47 | float4 lrDepth = tex2D(_LrDepthTex, UnityStereoScreenSpaceUVAdjust(i.uv, _LrDepthTex_ST)); 48 | 49 | hrDepth.a = DecodeFloatRGBA(hrDepth); 50 | lrDepth.a = DecodeFloatRGBA(lrDepth); 51 | 52 | float4 color = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)); 53 | 54 | return color * (1.0-abs(hrDepth.a-lrDepth.a)*intensity); 55 | } 56 | 57 | ENDCG 58 | 59 | 60 | } 61 | } 62 | 63 | Fallback off 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/CreaseApply.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b59984d82af624bd3b0c777f038276f2 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/EdgeDetectNormals.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d1644bdf064147baa97f235fc5b4903 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/FisheyeShader.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/FisheyeShader" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | // Shader code pasted into all further CGPROGRAM blocks 9 | CGINCLUDE 10 | 11 | #include "UnityCG.cginc" 12 | 13 | struct v2f { 14 | float4 pos : SV_POSITION; 15 | float2 uv : TEXCOORD0; 16 | }; 17 | 18 | sampler2D _MainTex; 19 | half4 _MainTex_ST; 20 | 21 | float2 intensity; 22 | 23 | v2f vert( appdata_img v ) 24 | { 25 | v2f o; 26 | o.pos = UnityObjectToClipPos(v.vertex); 27 | o.uv = v.texcoord.xy; 28 | return o; 29 | } 30 | 31 | half4 frag(v2f i) : SV_Target 32 | { 33 | half2 coords = i.uv; 34 | coords = (coords - 0.5) * 2.0; 35 | 36 | half2 realCoordOffs; 37 | realCoordOffs.x = (1-coords.y * coords.y) * intensity.y * (coords.x); 38 | realCoordOffs.y = (1-coords.x * coords.x) * intensity.x * (coords.y); 39 | 40 | half4 color = tex2D (_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv - realCoordOffs, _MainTex_ST)); 41 | 42 | return color; 43 | } 44 | 45 | ENDCG 46 | 47 | Subshader { 48 | Pass { 49 | ZTest Always Cull Off ZWrite Off 50 | 51 | CGPROGRAM 52 | #pragma vertex vert 53 | #pragma fragment frag 54 | ENDCG 55 | } 56 | 57 | } 58 | 59 | Fallback off 60 | 61 | } // shader 62 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/FisheyeShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 874ceab4425f64bccb1d14032f4452b1 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/GlobalFog.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70d8568987ac0499f952b54c7c13e265 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/GrayscaleEffect.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Grayscale Effect" { 2 | Properties { 3 | _MainTex ("Base (RGB)", 2D) = "white" {} 4 | _RampTex ("Base (RGB)", 2D) = "grayscaleRamp" {} 5 | } 6 | 7 | SubShader { 8 | Pass { 9 | ZTest Always Cull Off ZWrite Off 10 | 11 | CGPROGRAM 12 | #pragma vertex vert_img 13 | #pragma fragment frag 14 | #include "UnityCG.cginc" 15 | 16 | uniform sampler2D _MainTex; 17 | uniform sampler2D _RampTex; 18 | uniform half _RampOffset; 19 | half4 _MainTex_ST; 20 | 21 | fixed4 frag (v2f_img i) : SV_Target 22 | { 23 | fixed4 original = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)); 24 | fixed grayscale = Luminance(original.rgb); 25 | half2 remap = half2 (grayscale + _RampOffset, .5); 26 | fixed4 output = tex2D(_RampTex, remap); 27 | output.a = original.a; 28 | return output; 29 | } 30 | ENDCG 31 | 32 | } 33 | } 34 | 35 | Fallback off 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/GrayscaleEffect.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: daf9781cad112c75d0008dfa8d76c639 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/MotionBlur.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/MotionBlur" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "white" {} 6 | _AccumOrig("AccumOrig", Float) = 0.65 7 | } 8 | 9 | SubShader { 10 | ZTest Always Cull Off ZWrite Off 11 | Pass { 12 | Blend SrcAlpha OneMinusSrcAlpha 13 | ColorMask RGB 14 | BindChannels { 15 | Bind "vertex", vertex 16 | Bind "texcoord", texcoord 17 | } 18 | 19 | CGPROGRAM 20 | #pragma vertex vert 21 | #pragma fragment frag 22 | 23 | #include "UnityCG.cginc" 24 | 25 | struct appdata_t { 26 | float4 vertex : POSITION; 27 | float2 texcoord : TEXCOORD; 28 | }; 29 | 30 | struct v2f { 31 | float4 vertex : SV_POSITION; 32 | float2 texcoord : TEXCOORD; 33 | }; 34 | 35 | float4 _MainTex_ST; 36 | float _AccumOrig; 37 | 38 | v2f vert (appdata_t v) 39 | { 40 | v2f o; 41 | o.vertex = UnityObjectToClipPos(v.vertex); 42 | o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); 43 | return o; 44 | } 45 | 46 | sampler2D _MainTex; 47 | 48 | half4 frag (v2f i) : SV_Target 49 | { 50 | return half4(tex2D(_MainTex, i.texcoord).rgb, _AccumOrig ); 51 | } 52 | ENDCG 53 | } 54 | 55 | Pass { 56 | Blend One Zero 57 | ColorMask A 58 | 59 | BindChannels { 60 | Bind "vertex", vertex 61 | Bind "texcoord", texcoord 62 | } 63 | 64 | CGPROGRAM 65 | #pragma vertex vert 66 | #pragma fragment frag 67 | 68 | #include "UnityCG.cginc" 69 | 70 | struct appdata_t { 71 | float4 vertex : POSITION; 72 | float2 texcoord : TEXCOORD; 73 | }; 74 | 75 | struct v2f { 76 | float4 vertex : SV_POSITION; 77 | float2 texcoord : TEXCOORD; 78 | }; 79 | 80 | float4 _MainTex_ST; 81 | 82 | v2f vert (appdata_t v) 83 | { 84 | v2f o; 85 | o.vertex = UnityObjectToClipPos(v.vertex); 86 | o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); 87 | return o; 88 | } 89 | 90 | sampler2D _MainTex; 91 | 92 | half4 frag (v2f i) : SV_Target 93 | { 94 | return tex2D(_MainTex, i.texcoord); 95 | } 96 | ENDCG 97 | } 98 | 99 | } 100 | 101 | SubShader { 102 | ZTest Always Cull Off ZWrite Off 103 | Pass { 104 | Blend SrcAlpha OneMinusSrcAlpha 105 | ColorMask RGB 106 | SetTexture [_MainTex] { 107 | ConstantColor (0,0,0,[_AccumOrig]) 108 | Combine texture, constant 109 | } 110 | } 111 | Pass { 112 | Blend One Zero 113 | ColorMask A 114 | SetTexture [_MainTex] { 115 | Combine texture 116 | } 117 | } 118 | } 119 | 120 | Fallback off 121 | 122 | } 123 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/MotionBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9ba2083ad114a07d000fbfb8d76c639 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/MotionBlurClear.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | Shader "Hidden/MotionBlurClear" 5 | { 6 | 7 | Properties { } 8 | 9 | SubShader { 10 | Pass { 11 | //ZTest LEqual 12 | ZTest Always // lame depth test 13 | ZWrite Off // lame depth test 14 | 15 | CGPROGRAM 16 | 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct vs_input { 23 | float4 vertex : POSITION; 24 | }; 25 | 26 | struct ps_input { 27 | float4 pos : SV_POSITION; 28 | float4 screen : TEXCOORD0; 29 | }; 30 | 31 | sampler2D_float _CameraDepthTexture; 32 | 33 | ps_input vert (vs_input v) 34 | { 35 | ps_input o; 36 | o.pos = UnityObjectToClipPos (v.vertex); 37 | o.screen = ComputeScreenPos(o.pos); 38 | COMPUTE_EYEDEPTH(o.screen.z); 39 | return o; 40 | } 41 | 42 | float4 frag (ps_input i) : SV_Target 43 | { 44 | // superlame: manual depth test needed as we can't bind depth, FIXME for 4.x 45 | // alternatively implement SM > 3 version where we write out custom depth 46 | 47 | float d = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screen)); 48 | d = LinearEyeDepth(d); 49 | 50 | clip(d - i.screen.z + 1e-2f); 51 | return float4(0, 0, 0, 0); 52 | } 53 | 54 | ENDCG 55 | 56 | } 57 | } 58 | 59 | Fallback Off 60 | } 61 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/MotionBlurClear.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7699c5fbfa27745a1abe111ab7bf9785 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/NoiseAndGrain.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0249d8c935344451aa4de6db76f0688 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/NoiseAndGrainDX11.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b30686bb4322ab42ad5eb50a0210b58 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/NoiseEffectShaderRGB.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/Noise Shader RGB" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "white" {} 6 | _GrainTex ("Base (RGB)", 2D) = "gray" {} 7 | _ScratchTex ("Base (RGB)", 2D) = "gray" {} 8 | } 9 | 10 | SubShader { 11 | Pass { 12 | ZTest Always Cull Off ZWrite Off 13 | 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | #include "UnityCG.cginc" 18 | 19 | struct v2f { 20 | float4 pos : SV_POSITION; 21 | float2 uv : TEXCOORD0; 22 | float2 uvg : TEXCOORD1; // grain 23 | float2 uvs : TEXCOORD2; // scratch 24 | }; 25 | 26 | uniform sampler2D _MainTex; 27 | uniform sampler2D _GrainTex; 28 | uniform sampler2D _ScratchTex; 29 | 30 | uniform float4 _GrainOffsetScale; 31 | uniform float4 _ScratchOffsetScale; 32 | uniform fixed4 _Intensity; // x=grain, y=scratch 33 | 34 | half4 _MainTex_ST; 35 | 36 | v2f vert (appdata_img v) 37 | { 38 | v2f o; 39 | o.pos = UnityObjectToClipPos (v.vertex); 40 | o.uv = UnityStereoScreenSpaceUVAdjust(MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord), _MainTex_ST); 41 | o.uvg = v.texcoord.xy * _GrainOffsetScale.zw + _GrainOffsetScale.xy; 42 | o.uvs = v.texcoord.xy * _ScratchOffsetScale.zw + _ScratchOffsetScale.xy; 43 | return o; 44 | } 45 | 46 | fixed4 frag (v2f i) : SV_Target 47 | { 48 | fixed4 col = tex2D(_MainTex, i.uv); 49 | 50 | // sample noise texture and do a signed add 51 | fixed3 grain = tex2D(_GrainTex, i.uvg).rgb * 2 - 1; 52 | col.rgb += grain * _Intensity.x; 53 | 54 | // sample scratch texture and do a signed add 55 | fixed3 scratch = tex2D(_ScratchTex, i.uvs).rgb * 2 - 1; 56 | col.rgb += scratch * _Intensity.y; 57 | 58 | return col; 59 | } 60 | ENDCG 61 | } 62 | } 63 | 64 | Fallback off 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/NoiseEffectShaderRGB.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d7f4c401ae8946bcb0d6ff68a9e7466 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/NoiseEffectShaderYUV.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/Noise Shader YUV" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "white" {} 6 | _GrainTex ("Base (RGB)", 2D) = "gray" {} 7 | _ScratchTex ("Base (RGB)", 2D) = "gray" {} 8 | } 9 | 10 | SubShader { 11 | Pass { 12 | ZTest Always Cull Off ZWrite Off 13 | 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | #include "UnityCG.cginc" 18 | 19 | struct v2f { 20 | float4 pos : SV_POSITION; 21 | float2 uv : TEXCOORD0; 22 | float2 uvg : TEXCOORD1; // grain 23 | float2 uvs : TEXCOORD2; // scratch 24 | }; 25 | 26 | uniform sampler2D _MainTex; 27 | uniform sampler2D _GrainTex; 28 | uniform sampler2D _ScratchTex; 29 | 30 | uniform float4 _GrainOffsetScale; 31 | uniform float4 _ScratchOffsetScale; 32 | uniform fixed4 _Intensity; // x=grain, y=scratch 33 | 34 | half4 _MainTex_ST; 35 | 36 | v2f vert (appdata_img v) 37 | { 38 | v2f o; 39 | o.pos = UnityObjectToClipPos (v.vertex); 40 | o.uv = UnityStereoScreenSpaceUVAdjust(MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord), _MainTex_ST); 41 | o.uvg = v.texcoord.xy * _GrainOffsetScale.zw + _GrainOffsetScale.xy; 42 | o.uvs = v.texcoord.xy * _ScratchOffsetScale.zw + _ScratchOffsetScale.xy; 43 | return o; 44 | } 45 | 46 | fixed4 frag (v2f i) : SV_Target 47 | { 48 | fixed4 col = tex2D(_MainTex, i.uv); 49 | 50 | // convert to YUV 51 | fixed3 yuv; 52 | yuv.x = dot( col.rgb, half3(0.299,0.587,0.114) ); 53 | yuv.y = (col.b-yuv.x)*0.492; 54 | yuv.z = (col.r-yuv.x)*0.877; 55 | 56 | // sample noise texture and do a signed add 57 | fixed3 grain = tex2D(_GrainTex, i.uvg).rgb * 2 - 1; 58 | yuv.rgb += grain * _Intensity.x; 59 | 60 | // convert back to rgb 61 | col.r = yuv.z * 1.140 + yuv.x; 62 | col.g = yuv.z * (-0.581) + yuv.y * (-0.395) + yuv.x; 63 | col.b = yuv.y * 2.032 + yuv.x; 64 | 65 | // sample scratch texture and add 66 | fixed3 scratch = tex2D(_ScratchTex, i.uvs).rgb * 2 - 1; 67 | col.rgb += scratch * _Intensity.y; 68 | 69 | return col; 70 | } 71 | ENDCG 72 | } 73 | } 74 | 75 | Fallback off 76 | 77 | } 78 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/NoiseEffectShaderYUV.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e447868506ba49f0a73235b8a8b647a 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/PrepareSunShaftsBlur.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | Shader "Hidden/PrepareSunShaftsBlur" { 5 | Properties { 6 | _MainTex ("Base", 2D) = "" {} 7 | _Skybox ("Skybox", 2D) = "" {} 8 | } 9 | 10 | CGINCLUDE 11 | 12 | #include "UnityCG.cginc" 13 | 14 | struct v2f { 15 | float4 pos : SV_POSITION; 16 | float2 uv : TEXCOORD0; 17 | }; 18 | 19 | sampler2D _MainTex; 20 | sampler2D _Skybox; 21 | sampler2D_float _CameraDepthTexture; 22 | 23 | uniform half _NoSkyBoxMask; 24 | uniform half4 _SunPosition; 25 | 26 | v2f vert (appdata_img v) { 27 | v2f o; 28 | o.pos = UnityObjectToClipPos(v.vertex); 29 | o.uv = v.texcoord.xy; 30 | return o; 31 | } 32 | 33 | half TransformColor (half4 skyboxValue) { 34 | return max (skyboxValue.a, _NoSkyBoxMask * dot (skyboxValue.rgb, float3 (0.59,0.3,0.11))); 35 | } 36 | 37 | half4 frag (v2f i) : SV_Target { 38 | float depthSample = SAMPLE_DEPTH_TEXTURE( _CameraDepthTexture, i.uv.xy); 39 | half4 tex = tex2D (_MainTex, i.uv.xy); 40 | 41 | depthSample = Linear01Depth (depthSample); 42 | 43 | // consider maximum radius 44 | half2 vec = _SunPosition.xy - i.uv.xy; 45 | half dist = saturate (_SunPosition.w - length (vec.xy)); 46 | 47 | half4 outColor = 0; 48 | 49 | // consider shafts blockers 50 | if (depthSample > 0.99) 51 | outColor = TransformColor (tex) * dist; 52 | 53 | return outColor; 54 | } 55 | 56 | half4 fragNoDepthNeeded (v2f i) : SV_Target { 57 | float4 sky = (tex2D (_Skybox, i.uv.xy)); 58 | float4 tex = (tex2D (_MainTex, i.uv.xy)); 59 | 60 | // consider maximum radius 61 | half2 vec = _SunPosition.xy - i.uv.xy; 62 | half dist = saturate (_SunPosition.w - length (vec)); 63 | 64 | half4 outColor = 0; 65 | 66 | if (Luminance ( abs(sky.rgb - tex.rgb)) < 0.2) 67 | outColor = TransformColor (sky) * dist; 68 | 69 | return outColor; 70 | } 71 | 72 | ENDCG 73 | 74 | Subshader { 75 | Pass { 76 | ZTest Always Cull Off ZWrite Off 77 | 78 | CGPROGRAM 79 | 80 | #pragma vertex vert 81 | #pragma fragment frag 82 | 83 | ENDCG 84 | } 85 | Pass { 86 | ZTest Always Cull Off ZWrite Off 87 | 88 | CGPROGRAM 89 | 90 | #pragma vertex vert 91 | #pragma fragment fragNoDepthNeeded 92 | 93 | ENDCG 94 | } 95 | } 96 | 97 | Fallback off 98 | 99 | } // shader 100 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/PrepareSunShaftsBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ad381ed8492840ab9f165df743e4826 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/RadialBlur.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/RadialBlur" 4 | { 5 | Properties { 6 | _MainTex ("Base (RGB)", 2D) = "" {} 7 | } 8 | 9 | // Shader code pasted into all further CGPROGRAM blocks 10 | CGINCLUDE 11 | 12 | #include "UnityCG.cginc" 13 | 14 | struct v2f { 15 | float4 pos : SV_POSITION; 16 | float2 uv : TEXCOORD0; 17 | float2 blurVector : TEXCOORD1; 18 | }; 19 | 20 | sampler2D _MainTex; 21 | 22 | float4 _BlurRadius4; 23 | float4 _SunPosition; 24 | 25 | float4 _MainTex_TexelSize; 26 | 27 | v2f vert( appdata_img v ) { 28 | v2f o; 29 | o.pos = UnityObjectToClipPos(v.vertex); 30 | o.uv.xy = v.texcoord.xy; 31 | 32 | o.blurVector = (_SunPosition.xy - v.texcoord.xy) * _BlurRadius4.xy; 33 | 34 | return o; 35 | } 36 | 37 | #define SAMPLES_FLOAT 6.0f 38 | #define SAMPLES_INT 6 39 | 40 | half4 frag(v2f i) : SV_Target 41 | { 42 | half4 color = half4(0,0,0,0); 43 | 44 | for(int j = 0; j < SAMPLES_INT; j++) 45 | { 46 | half4 tmpColor = tex2D(_MainTex, i.uv.xy); 47 | color += tmpColor; 48 | 49 | i.uv.xy += i.blurVector; 50 | } 51 | 52 | return color / SAMPLES_FLOAT; 53 | } 54 | 55 | ENDCG 56 | 57 | Subshader 58 | { 59 | Blend One Zero 60 | Pass { 61 | ZTest Always Cull Off ZWrite Off 62 | 63 | CGPROGRAM 64 | #pragma vertex vert 65 | #pragma fragment frag 66 | 67 | ENDCG 68 | } // Pass 69 | } // Subshader 70 | 71 | Fallback off 72 | 73 | } // shader 74 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/RadialBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f58445347fe2e4b8396487ed2bfa02ad 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/SSAOShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43ca18288c424f645aaa1e9e07f04c50 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ScreenSpaceAmbientObscurance.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95616c020c5604dda96cf76afbbc0272 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ScreenSpaceRaytrace.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26c67b7245085cf438e3d42d50d94f55 3 | timeCreated: 1425661779 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/SepiaToneEffect.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Sepiatone Effect" { 2 | Properties { 3 | _MainTex ("Base (RGB)", 2D) = "white" {} 4 | } 5 | 6 | SubShader { 7 | Pass { 8 | ZTest Always Cull Off ZWrite Off 9 | 10 | CGPROGRAM 11 | #pragma vertex vert_img 12 | #pragma fragment frag 13 | #include "UnityCG.cginc" 14 | 15 | uniform sampler2D _MainTex; 16 | half4 _MainTex_ST; 17 | 18 | fixed4 frag (v2f_img i) : SV_Target 19 | { 20 | fixed4 original = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)); 21 | 22 | // get intensity value (Y part of YIQ color space) 23 | fixed Y = dot (fixed3(0.299, 0.587, 0.114), original.rgb); 24 | 25 | // Convert to Sepia Tone by adding constant 26 | fixed4 sepiaConvert = float4 (0.191, -0.054, -0.221, 0.0); 27 | fixed4 output = sepiaConvert + Y; 28 | output.a = original.a; 29 | 30 | return output; 31 | } 32 | ENDCG 33 | 34 | } 35 | } 36 | 37 | Fallback off 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/SepiaToneEffect.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6aa781cad112c75d0008dfa8d76c639 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ShowAlphaChannel.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | 5 | Shader "Hidden/ShowAlphaChannel" { 6 | Properties { 7 | _MainTex ("Base (RGB)", 2D) = "white" {} 8 | _EdgeTex ("_EdgeTex", 2D) = "white" {} 9 | } 10 | 11 | SubShader { 12 | Pass { 13 | ZTest Always Cull Off ZWrite Off 14 | 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | 19 | #include "UnityCG.cginc" 20 | 21 | uniform sampler2D _MainTex; 22 | uniform sampler2D _EdgeTex; 23 | 24 | uniform float4 _MainTex_TexelSize; 25 | 26 | float filterRadius; 27 | 28 | struct v2f { 29 | float4 pos : SV_POSITION; 30 | float2 uv : TEXCOORD0; 31 | }; 32 | 33 | v2f vert( appdata_img v ) 34 | { 35 | v2f o; 36 | o.pos = UnityObjectToClipPos (v.vertex); 37 | o.uv = v.texcoord.xy; 38 | 39 | return o; 40 | } 41 | 42 | half4 frag (v2f i) : SV_Target 43 | { 44 | 45 | half4 color = tex2D(_MainTex, i.uv.xy); 46 | half edges = color.a; 47 | 48 | return edges; 49 | } 50 | ENDCG 51 | } 52 | } 53 | 54 | Fallback off 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/ShowAlphaChannel.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da310021e2a4142429d95c537846dc38 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/SimpleClear.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | 5 | Shader "Hidden/SimpleClear" { 6 | Properties { 7 | _MainTex ("Base (RGB)", 2D) = "white" {} 8 | } 9 | 10 | SubShader { 11 | Pass { 12 | ZTest Always Cull Off ZWrite Off 13 | 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | #include "UnityCG.cginc" 18 | 19 | uniform sampler2D _MainTex; 20 | uniform float4 _MainTex_TexelSize; 21 | 22 | struct v2f { 23 | float4 pos : SV_POSITION; 24 | }; 25 | 26 | v2f vert( appdata_img v ) 27 | { 28 | v2f o; 29 | o.pos = UnityObjectToClipPos(v.vertex); 30 | return o; 31 | } 32 | 33 | half4 frag (v2f i) : SV_Target 34 | { 35 | return half4(0,0,0,0); 36 | } 37 | ENDCG 38 | } 39 | } 40 | 41 | Fallback off 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/SimpleClear.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f688f89ed5eb847c5b19c934a0f1e772 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/SunShaftsComposite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3b1c8c1036784176946f5cfbfb7fe4c 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Tonemapper.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 003377fc2620a44939dadde6fe3f8190 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/TwirlEffect.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/Twirt Effect Shader" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "white" {} 6 | } 7 | 8 | SubShader { 9 | Pass { 10 | ZTest Always Cull Off ZWrite Off 11 | 12 | CGPROGRAM 13 | #pragma vertex vert 14 | #pragma fragment frag 15 | #include "UnityCG.cginc" 16 | 17 | uniform sampler2D _MainTex; 18 | uniform float4 _MainTex_TexelSize; 19 | half4 _MainTex_ST; 20 | uniform float4 _CenterRadius; 21 | uniform float4x4 _RotationMatrix; 22 | 23 | struct v2f { 24 | float4 pos : SV_POSITION; 25 | float2 uv : TEXCOORD0; 26 | }; 27 | 28 | v2f vert( appdata_img v ) 29 | { 30 | v2f o; 31 | o.pos = UnityObjectToClipPos (v.vertex); 32 | o.uv = v.texcoord - _CenterRadius.xy; 33 | return o; 34 | } 35 | 36 | float4 frag (v2f i) : SV_Target 37 | { 38 | float2 offset = i.uv; 39 | float2 distortedOffset = MultiplyUV (_RotationMatrix, offset.xy); 40 | float2 tmp = offset / _CenterRadius.zw; 41 | float t = min (1, length(tmp)); 42 | 43 | offset = lerp (distortedOffset, offset, t); 44 | offset += _CenterRadius.xy; 45 | 46 | return tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(offset, _MainTex_ST)); 47 | } 48 | ENDCG 49 | 50 | } 51 | } 52 | 53 | Fallback off 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/TwirlEffect.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 641b781cad112c75d0008dfa8d76c639 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/VignettingShader.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/Vignetting" { 4 | Properties { 5 | _MainTex ("Base", 2D) = "white" {} 6 | _VignetteTex ("Vignette", 2D) = "white" {} 7 | } 8 | 9 | CGINCLUDE 10 | 11 | #include "UnityCG.cginc" 12 | 13 | struct v2f { 14 | float4 pos : SV_POSITION; 15 | float2 uv : TEXCOORD0; 16 | float2 uv2 : TEXCOORD1; 17 | }; 18 | 19 | sampler2D _MainTex; 20 | sampler2D _VignetteTex; 21 | 22 | half _Intensity; 23 | half _Blur; 24 | 25 | float4 _MainTex_TexelSize; 26 | half4 _MainTex_ST; 27 | half4 _VignetteTex_ST; 28 | 29 | v2f vert( appdata_img v ) { 30 | v2f o; 31 | o.pos = UnityObjectToClipPos(v.vertex); 32 | o.uv = v.texcoord.xy; 33 | o.uv2 = v.texcoord.xy; 34 | 35 | #if UNITY_UV_STARTS_AT_TOP 36 | if (_MainTex_TexelSize.y < 0) 37 | o.uv2.y = 1.0 - o.uv2.y; 38 | #endif 39 | 40 | return o; 41 | } 42 | 43 | half4 frag(v2f i) : SV_Target { 44 | half2 coords = i.uv; 45 | half2 uv = i.uv; 46 | 47 | coords = (coords - 0.5) * 2.0; 48 | half coordDot = dot (coords,coords); 49 | half4 color = tex2D (_MainTex, UnityStereoScreenSpaceUVAdjust(uv, _MainTex_ST)); 50 | 51 | float mask = 1.0 - coordDot * _Intensity; 52 | 53 | half4 colorBlur = tex2D (_VignetteTex, UnityStereoScreenSpaceUVAdjust(i.uv2, _VignetteTex_ST)); 54 | color = lerp (color, colorBlur, saturate (_Blur * coordDot)); 55 | 56 | return color * mask; 57 | } 58 | 59 | ENDCG 60 | 61 | Subshader { 62 | Pass { 63 | ZTest Always Cull Off ZWrite Off 64 | 65 | CGPROGRAM 66 | #pragma vertex vert 67 | #pragma fragment frag 68 | ENDCG 69 | } 70 | } 71 | 72 | Fallback off 73 | } 74 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/VignettingShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 627943dc7a9a74286b70a4f694a0acd5 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/VortexEffect.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/Twist Effect" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "white" {} 6 | } 7 | 8 | SubShader 9 | { 10 | Pass 11 | { 12 | ZTest Always Cull Off ZWrite Off 13 | 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | uniform sampler2D _MainTex; 21 | 22 | uniform float4 _MainTex_ST; 23 | 24 | uniform float4 _MainTex_TexelSize; 25 | uniform float _Angle; 26 | uniform float4 _CenterRadius; 27 | 28 | struct v2f { 29 | float4 pos : SV_POSITION; 30 | float2 uv : TEXCOORD0; 31 | float2 uvOrig : TEXCOORD1; 32 | }; 33 | 34 | v2f vert (appdata_img v) 35 | { 36 | v2f o; 37 | o.pos = UnityObjectToClipPos(v.vertex); 38 | float2 uv = v.texcoord.xy - _CenterRadius.xy; 39 | o.uv = TRANSFORM_TEX(uv, _MainTex); //MultiplyUV (UNITY_MATRIX_TEXTURE0, uv); 40 | o.uvOrig = uv; 41 | return o; 42 | } 43 | 44 | float4 frag (v2f i) : SV_Target 45 | { 46 | float2 offset = i.uvOrig; 47 | float angle = 1.0 - length(offset / _CenterRadius.zw); 48 | angle = max (0, angle); 49 | angle = angle * angle * _Angle; 50 | float cosLength, sinLength; 51 | sincos (angle, sinLength, cosLength); 52 | 53 | float2 uv; 54 | uv.x = cosLength * offset[0] - sinLength * offset[1]; 55 | uv.y = sinLength * offset[0] + cosLength * offset[1]; 56 | uv += _CenterRadius.xy; 57 | 58 | return tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(uv, _MainTex_ST)); 59 | } 60 | ENDCG 61 | 62 | } 63 | } 64 | 65 | Fallback off 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/VortexEffect.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 708b781cad112c75d0008dfa8d76c639 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d55b5e91b95c41739cdf4f804dd383d 3 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/DLAA.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 017ca72b9e8a749058d13ebd527e98fa 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/FXAA2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd5b323dcc592457790ff18b528f5e67 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/FXAA3Console.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c547503fff0e8482ea5793727057041c 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/FXAAPreset2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f1418cffd12146f2a83be795f6fa5a7 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/FXAAPreset3.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c182fa94a5a0a4c02870641efcd38cd5 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/NFAA.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce0cb2621f6d84e21a87414e471a3cce 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/SSAA.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | 4 | Shader "Hidden/SSAA" { 5 | Properties { 6 | _MainTex ("Base (RGB)", 2D) = "white" {} 7 | } 8 | 9 | // very simple & fast AA by Emmanuel Julien 10 | 11 | SubShader { 12 | Pass { 13 | 14 | ZTest Always Cull Off ZWrite Off 15 | 16 | CGPROGRAM 17 | 18 | #pragma vertex vert 19 | #pragma fragment frag 20 | 21 | #include "UnityCG.cginc" 22 | 23 | uniform sampler2D _MainTex; 24 | uniform float4 _MainTex_TexelSize; 25 | half4 _MainTex_ST; 26 | 27 | struct v2f { 28 | float4 pos : SV_POSITION; 29 | float2 uv[5] : TEXCOORD0; 30 | }; 31 | 32 | v2f vert( appdata_img v ) { 33 | v2f o; 34 | o.pos = UnityObjectToClipPos (v.vertex); 35 | 36 | float2 uv = v.texcoord.xy; 37 | 38 | float w = 1.75; 39 | 40 | float2 up = float2(0.0, _MainTex_TexelSize.y) * w; 41 | float2 right = float2(_MainTex_TexelSize.x, 0.0) * w; 42 | 43 | o.uv[0].xy = uv - up; 44 | o.uv[1].xy = uv - right; 45 | o.uv[2].xy = uv + right; 46 | o.uv[3].xy = uv + up; 47 | 48 | o.uv[4].xy = uv; 49 | 50 | return o; 51 | } 52 | 53 | half4 frag (v2f i) : SV_Target 54 | { 55 | half4 outColor; 56 | 57 | float t = Luminance( tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[0], _MainTex_ST)).xyz ); 58 | float l = Luminance( tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[1], _MainTex_ST)).xyz); 59 | float r = Luminance( tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[2], _MainTex_ST)).xyz); 60 | float b = Luminance( tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[3], _MainTex_ST)).xyz); 61 | 62 | half2 n = half2( -( t - b ), r - l ); 63 | float nl = length( n ); 64 | 65 | if ( nl < (1.0 / 16.0) ) 66 | outColor = tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[4], _MainTex_ST) ); 67 | else { 68 | n *= _MainTex_TexelSize.xy / nl; 69 | 70 | half4 o = tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[4], _MainTex_ST)); 71 | half4 t0 = tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[4] + n * 0.5, _MainTex_ST)) * 0.9; 72 | half4 t1 = tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[4] - n * 0.5, _MainTex_ST)) * 0.9; 73 | half4 t2 = tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[4] + n, _MainTex_ST)) * 0.75; 74 | half4 t3 = tex2D( _MainTex, UnityStereoScreenSpaceUVAdjust(i.uv[4] - n, _MainTex_ST)) * 0.75; 75 | 76 | outColor = (o + t0 + t1 + t2 + t3) / 4.3; 77 | } 78 | 79 | return outColor; 80 | } 81 | 82 | ENDCG 83 | } 84 | } 85 | 86 | Fallback off 87 | 88 | } 89 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_Antialiasing/SSAA.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3728d1488b02490cbd196c7941bf1f8 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6ef58fc6f637406bbe6814a19c377f8 3 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/Blend.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53b3960ee3d3d4a5caa8d5473d120187 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BlendForBloom.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7856cbff0a0ca45c787d5431eb805bb0 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BlendOneOne.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/BlendOneOne" { 4 | Properties { 5 | _MainTex ("-", 2D) = "" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | float4 pos : SV_POSITION; 14 | float2 uv : TEXCOORD0; 15 | }; 16 | 17 | sampler2D _MainTex; 18 | half4 _MainTex_ST; 19 | half _Intensity; 20 | 21 | v2f vert( appdata_img v ) { 22 | v2f o; 23 | o.pos = UnityObjectToClipPos(v.vertex); 24 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 25 | return o; 26 | } 27 | 28 | half4 frag(v2f i) : SV_Target { 29 | return tex2D(_MainTex, i.uv) * _Intensity; 30 | } 31 | 32 | ENDCG 33 | 34 | Subshader { 35 | 36 | Pass { 37 | BlendOp Add 38 | Blend One One 39 | 40 | ZTest Always Cull Off ZWrite Off 41 | 42 | CGPROGRAM 43 | #pragma vertex vert 44 | #pragma fragment frag 45 | ENDCG 46 | } 47 | } 48 | 49 | Fallback off 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BlendOneOne.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7898d203e9b94c0dbe2bf9dd5cb32c0 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BlurAndFlares.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be6e39cf196f146d5be72fbefb18ed75 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BrightPassFilter.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/BrightPassFilterForBloom" 4 | { 5 | Properties 6 | { 7 | _MainTex ("Base (RGB)", 2D) = "" {} 8 | } 9 | 10 | CGINCLUDE 11 | 12 | #include "UnityCG.cginc" 13 | 14 | struct v2f 15 | { 16 | float4 pos : SV_POSITION; 17 | float2 uv : TEXCOORD0; 18 | }; 19 | 20 | sampler2D _MainTex; 21 | half4 _MainTex_ST; 22 | 23 | half4 threshold; 24 | half useSrcAlphaAsMask; 25 | 26 | v2f vert( appdata_img v ) 27 | { 28 | v2f o; 29 | o.pos = UnityObjectToClipPos(v.vertex); 30 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 31 | return o; 32 | } 33 | 34 | half4 frag(v2f i) : SV_Target 35 | { 36 | half4 color = tex2D(_MainTex, i.uv); 37 | //color = color * saturate((color-threshhold.x) * 75.0); // didn't go well with HDR and din't make sense 38 | color = color * lerp(1.0, color.a, useSrcAlphaAsMask); 39 | color = max(half4(0,0,0,0), color-threshold.x); 40 | return color; 41 | } 42 | 43 | ENDCG 44 | 45 | Subshader 46 | { 47 | Pass 48 | { 49 | ZTest Always Cull Off ZWrite Off 50 | 51 | CGPROGRAM 52 | 53 | #pragma vertex vert 54 | #pragma fragment frag 55 | 56 | ENDCG 57 | } 58 | } 59 | Fallback off 60 | } 61 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BrightPassFilter.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 186c4c0d31e314f049595dcbaf4ca129 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BrightPassFilter2.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/BrightPassFilter2" 4 | { 5 | Properties 6 | { 7 | _MainTex ("Base (RGB)", 2D) = "" {} 8 | } 9 | 10 | CGINCLUDE 11 | 12 | #include "UnityCG.cginc" 13 | 14 | struct v2f 15 | { 16 | float4 pos : SV_POSITION; 17 | float2 uv : TEXCOORD0; 18 | }; 19 | 20 | sampler2D _MainTex; 21 | half4 _MainTex_ST; 22 | 23 | half4 _Threshhold; 24 | 25 | v2f vert( appdata_img v ) 26 | { 27 | v2f o; 28 | o.pos = UnityObjectToClipPos(v.vertex); 29 | o.uv = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 30 | return o; 31 | } 32 | 33 | half4 fragScalarThresh(v2f i) : SV_Target 34 | { 35 | half4 color = tex2D(_MainTex, i.uv); 36 | color.rgb = color.rgb; 37 | color.rgb = max(half3(0,0,0), color.rgb-_Threshhold.xxx); 38 | return color; 39 | } 40 | 41 | half4 fragColorThresh(v2f i) : SV_Target 42 | { 43 | half4 color = tex2D(_MainTex, i.uv); 44 | color.rgb = max(half3(0,0,0), color.rgb-_Threshhold.rgb); 45 | return color; 46 | } 47 | 48 | ENDCG 49 | 50 | Subshader 51 | { 52 | Pass 53 | { 54 | ZTest Always Cull Off ZWrite Off 55 | 56 | CGPROGRAM 57 | 58 | #pragma vertex vert 59 | #pragma fragment fragScalarThresh 60 | 61 | ENDCG 62 | } 63 | 64 | Pass 65 | { 66 | ZTest Always Cull Off ZWrite Off 67 | 68 | CGPROGRAM 69 | 70 | #pragma vertex vert 71 | #pragma fragment fragColorThresh 72 | 73 | ENDCG 74 | } 75 | } 76 | Fallback off 77 | } 78 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/BrightPassFilter2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0aeaa4cb29f5d4e9c8455f04c8575c8c 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/LensFlareCreate.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/LensFlareCreate" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | float4 pos : SV_POSITION; 14 | float2 uv[4] : TEXCOORD0; 15 | }; 16 | 17 | fixed4 colorA; 18 | fixed4 colorB; 19 | fixed4 colorC; 20 | fixed4 colorD; 21 | 22 | sampler2D _MainTex; 23 | half4 _MainTex_ST; 24 | 25 | v2f vert( appdata_img v ) { 26 | v2f o; 27 | o.pos = UnityObjectToClipPos(v.vertex); 28 | 29 | o.uv[0] = UnityStereoScreenSpaceUVAdjust(( ( v.texcoord.xy - 0.5 ) * -0.85 ) + 0.5, _MainTex_ST); 30 | o.uv[1] = UnityStereoScreenSpaceUVAdjust(( ( v.texcoord.xy - 0.5 ) * -1.45 ) + 0.5, _MainTex_ST); 31 | o.uv[2] = UnityStereoScreenSpaceUVAdjust(( ( v.texcoord.xy - 0.5 ) * -2.55 ) + 0.5, _MainTex_ST); 32 | o.uv[3] = UnityStereoScreenSpaceUVAdjust(( ( v.texcoord.xy - 0.5 ) * -4.15 ) + 0.5, _MainTex_ST); 33 | return o; 34 | } 35 | 36 | fixed4 frag(v2f i) : SV_Target { 37 | fixed4 color = float4 (0,0,0,0); 38 | color += tex2D(_MainTex, i.uv[0] ) * colorA; 39 | color += tex2D(_MainTex, i.uv[1] ) * colorB; 40 | color += tex2D(_MainTex, i.uv[2] ) * colorC; 41 | color += tex2D(_MainTex, i.uv[3] ) * colorD; 42 | return color; 43 | } 44 | 45 | ENDCG 46 | 47 | Subshader { 48 | Blend One One 49 | Pass { 50 | ZTest Always Cull Off ZWrite Off 51 | 52 | CGPROGRAM 53 | 54 | #pragma vertex vert 55 | #pragma fragment frag 56 | 57 | ENDCG 58 | } 59 | } 60 | 61 | Fallback off 62 | 63 | } // shader 64 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/LensFlareCreate.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 459fe69d2f6d74ddb92f04dbf45a866b 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/MobileBloom.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68a00c837b82e4c6d92e7da765dc5f1d 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/MobileBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9d5fa183cd6b45eeb1491f74863cd91 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/MultiPassHollywoodFlares.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2baf3cae8edc4daf94c9adc2154be00 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/SeparableBlurPlus.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/SeparableBlurPlus" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | half4 pos : SV_POSITION; 14 | half2 uv : TEXCOORD0; 15 | half4 uv01 : TEXCOORD1; 16 | half4 uv23 : TEXCOORD2; 17 | half4 uv45 : TEXCOORD3; 18 | half4 uv67 : TEXCOORD4; 19 | }; 20 | 21 | half4 offsets; 22 | 23 | sampler2D _MainTex; 24 | half4 _MainTex_ST; 25 | 26 | v2f vert (appdata_img v) { 27 | v2f o; 28 | o.pos = UnityObjectToClipPos(v.vertex); 29 | 30 | o.uv.xy = v.texcoord.xy; 31 | 32 | o.uv01 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1); 33 | o.uv23 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 2.0; 34 | o.uv45 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 3.0; 35 | o.uv67 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 4.5; 36 | o.uv67 = v.texcoord.xyxy + offsets.xyxy * half4(1,1, -1,-1) * 6.5; 37 | 38 | return o; 39 | } 40 | 41 | half4 frag (v2f i) : SV_Target { 42 | half4 color = half4 (0,0,0,0); 43 | 44 | color += 0.225 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST)); 45 | color += 0.150 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv01.xy, _MainTex_ST)); 46 | color += 0.150 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv01.zw, _MainTex_ST)); 47 | color += 0.110 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv23.xy, _MainTex_ST)); 48 | color += 0.110 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv23.zw, _MainTex_ST)); 49 | color += 0.075 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv45.xy, _MainTex_ST)); 50 | color += 0.075 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv45.zw, _MainTex_ST)); 51 | color += 0.0525 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv67.xy, _MainTex_ST)); 52 | color += 0.0525 * tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv67.zw, _MainTex_ST)); 53 | 54 | return color; 55 | } 56 | 57 | ENDCG 58 | 59 | Subshader { 60 | Pass { 61 | ZTest Always Cull Off ZWrite Off 62 | 63 | CGPROGRAM 64 | #pragma vertex vert 65 | #pragma fragment frag 66 | ENDCG 67 | } 68 | } 69 | 70 | Fallback off 71 | 72 | } // shader 73 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/SeparableBlurPlus.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9df009a214e24a5ebbf271595f8d5b6 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/VignetteShader.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/VignetteShader" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | float4 pos : SV_POSITION; 14 | float2 uv : TEXCOORD0; 15 | }; 16 | 17 | sampler2D _MainTex; 18 | 19 | float4 _MainTex_TexelSize; 20 | float vignetteIntensity; 21 | 22 | v2f vert( appdata_img v ) { 23 | v2f o; 24 | o.pos = UnityObjectToClipPos(v.vertex); 25 | 26 | o.uv = v.texcoord.xy; 27 | return o; 28 | } 29 | 30 | half4 frag(v2f i) : SV_Target { 31 | half2 coords = i.uv; 32 | half2 uv = i.uv; 33 | 34 | coords = (coords - 0.5) * 2.0; 35 | half coordDot = dot (coords,coords); 36 | half4 color = tex2D (_MainTex, uv); 37 | 38 | float mask = 1.0 - coordDot * vignetteIntensity; 39 | return color * mask; 40 | } 41 | 42 | ENDCG 43 | 44 | Subshader { 45 | Pass { 46 | ZTest Always Cull Off ZWrite Off 47 | 48 | CGPROGRAM 49 | 50 | #pragma vertex vert 51 | #pragma fragment frag 52 | 53 | ENDCG 54 | } 55 | } 56 | 57 | Fallback off 58 | 59 | } // shader 60 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares/VignetteShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 562f620336e024ac99992ff05725a89a 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9cccf980fcb7441d85b8b3b5c2d2c34 3 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/Bokeh34.shader: -------------------------------------------------------------------------------- 1 | 2 | Shader "Hidden/Dof/Bokeh34" { 3 | Properties { 4 | _MainTex ("Base (RGB)", 2D) = "white" {} 5 | _Source ("Base (RGB)", 2D) = "black" {} 6 | } 7 | 8 | SubShader { 9 | CGINCLUDE 10 | 11 | #include "UnityCG.cginc" 12 | 13 | sampler2D _MainTex; 14 | sampler2D _Source; 15 | 16 | uniform half4 _ArScale; 17 | uniform half _Intensity; 18 | uniform half4 _Source_TexelSize; 19 | half4 _Source_ST; 20 | 21 | struct v2f { 22 | half4 pos : SV_POSITION; 23 | half2 uv2 : TEXCOORD0; 24 | half4 source : TEXCOORD1; 25 | }; 26 | 27 | #define COC bokeh.a 28 | 29 | v2f vert (appdata_full v) 30 | { 31 | v2f o; 32 | 33 | o.pos = v.vertex; 34 | 35 | o.uv2.xy = v.texcoord.xy;// * 2.0; <- needed when using Triangles.js and not Quads.js 36 | 37 | #if UNITY_UV_STARTS_AT_TOP 38 | float4 bokeh = tex2Dlod (_Source, half4 (UnityStereoScreenSpaceUVAdjust(v.texcoord1.xy * half2(1,-1) + half2(0,1), _Source_ST), 0, 0)); 39 | #else 40 | float4 bokeh = tex2Dlod (_Source, half4 (UnityStereoScreenSpaceUVAdjust(v.texcoord1.xy, _Source_ST), 0, 0)); 41 | #endif 42 | 43 | o.source = bokeh; 44 | 45 | o.pos.xy += (v.texcoord.xy * 2.0 - 1.0) * _ArScale.xy * COC;// + _ArScale.zw * coc; 46 | o.source.rgb *= _Intensity; 47 | 48 | return o; 49 | } 50 | 51 | 52 | half4 frag (v2f i) : SV_Target 53 | { 54 | half4 color = tex2D (_MainTex, i.uv2.xy); 55 | color.rgb *= i.source.rgb; 56 | color.a *= Luminance(i.source.rgb*0.25); 57 | return color; 58 | } 59 | 60 | ENDCG 61 | 62 | Pass { 63 | Blend OneMinusDstColor One 64 | ZTest Always Cull Off ZWrite Off 65 | 66 | CGPROGRAM 67 | 68 | #pragma target 3.0 69 | #pragma vertex vert 70 | #pragma fragment frag 71 | 72 | ENDCG 73 | } 74 | 75 | } 76 | 77 | Fallback off 78 | 79 | } 80 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/Bokeh34.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57cdacf9b217546aaa18edf39a6151c0 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/DepthOfField34.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 987fb0677d01f43ce8a9dbf12271e668 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/DepthOfFieldDX11.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8e82664aa8686642a424c88ab10164a 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/DepthOfFieldScatter.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acd613035ff3e455e8abf23fdc8c8c24 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/SeparableBlur.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | Shader "Hidden/SeparableBlur" { 4 | Properties { 5 | _MainTex ("Base (RGB)", 2D) = "" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | float4 pos : SV_POSITION; 14 | float2 uv : TEXCOORD0; 15 | 16 | float4 uv01 : TEXCOORD1; 17 | float4 uv23 : TEXCOORD2; 18 | float4 uv45 : TEXCOORD3; 19 | }; 20 | 21 | float4 offsets; 22 | 23 | sampler2D _MainTex; 24 | half4 _MainTex_ST; 25 | 26 | v2f vert (appdata_img v) { 27 | v2f o; 28 | o.pos = UnityObjectToClipPos(v.vertex); 29 | 30 | o.uv.xy = UnityStereoScreenSpaceUVAdjust(v.texcoord.xy, _MainTex_ST); 31 | 32 | o.uv01 = UnityStereoScreenSpaceUVAdjust(v.texcoord.xyxy + offsets.xyxy * float4(1,1, -1,-1), _MainTex_ST); 33 | o.uv23 = UnityStereoScreenSpaceUVAdjust(v.texcoord.xyxy + offsets.xyxy * float4(1,1, -1,-1) * 2.0, _MainTex_ST); 34 | o.uv45 = UnityStereoScreenSpaceUVAdjust(v.texcoord.xyxy + offsets.xyxy * float4(1,1, -1,-1) * 3.0, _MainTex_ST); 35 | 36 | return o; 37 | } 38 | 39 | half4 frag (v2f i) : SV_Target { 40 | half4 color = float4 (0,0,0,0); 41 | 42 | color += 0.40 * tex2D (_MainTex, i.uv); 43 | color += 0.15 * tex2D (_MainTex, i.uv01.xy); 44 | color += 0.15 * tex2D (_MainTex, i.uv01.zw); 45 | color += 0.10 * tex2D (_MainTex, i.uv23.xy); 46 | color += 0.10 * tex2D (_MainTex, i.uv23.zw); 47 | color += 0.05 * tex2D (_MainTex, i.uv45.xy); 48 | color += 0.05 * tex2D (_MainTex, i.uv45.zw); 49 | 50 | return color; 51 | } 52 | 53 | ENDCG 54 | 55 | Subshader { 56 | Pass { 57 | ZTest Always Cull Off ZWrite Off 58 | 59 | CGPROGRAM 60 | #pragma vertex vert 61 | #pragma fragment frag 62 | ENDCG 63 | } 64 | } 65 | 66 | Fallback off 67 | 68 | 69 | } // shader 70 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/SeparableBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e97c14fbb5ea04c3a902cc533d7fc5d1 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/SeparableWeightedBlurDof34.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb4af680337344a4abad65a4e8873c50 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/_DepthOfField/TiltShiftHdrLensBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf34d2a25450349699e8ae6456fa7ca9 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/frag_ao.cginc: -------------------------------------------------------------------------------- 1 | 2 | half frag_ao (v2f_ao i, int sampleCount, float3 samples[INPUT_SAMPLE_COUNT]) 3 | { 4 | // read random normal from noise texture 5 | half3 randN = tex2D (_RandomTexture, i.uvr).xyz * 2.0 - 1.0; 6 | 7 | // read scene depth/normal 8 | float4 depthnormal = tex2D (_CameraDepthNormalsTexture, i.uv); 9 | float3 viewNorm; 10 | float depth; 11 | DecodeDepthNormal (depthnormal, depth, viewNorm); 12 | depth *= _ProjectionParams.z; 13 | float scale = _Params.x / depth; 14 | 15 | // accumulated occlusion factor 16 | float occ = 0.0; 17 | for (int s = 0; s < sampleCount; ++s) 18 | { 19 | // Reflect sample direction around a random vector 20 | half3 randomDir = reflect(samples[s], randN); 21 | 22 | // Make it point to the upper hemisphere 23 | half flip = (dot(viewNorm,randomDir)<0) ? 1.0 : -1.0; 24 | randomDir *= -flip; 25 | // Add a bit of normal to reduce self shadowing 26 | randomDir += viewNorm * 0.3; 27 | 28 | float2 offset = randomDir.xy * scale; 29 | float sD = depth - (randomDir.z * _Params.x); 30 | 31 | // Sample depth at offset location 32 | float4 sampleND = tex2D (_CameraDepthNormalsTexture, i.uv + offset); 33 | float sampleD; 34 | float3 sampleN; 35 | DecodeDepthNormal (sampleND, sampleD, sampleN); 36 | sampleD *= _ProjectionParams.z; 37 | float zd = saturate(sD-sampleD); 38 | if (zd > _Params.y) { 39 | // This sample occludes, contribute to occlusion 40 | occ += pow(1-zd,_Params.z); // sc2 41 | //occ += 1.0-saturate(pow(1.0 - zd, 11.0) + zd); // nullsq 42 | //occ += 1.0/(1.0+zd*zd*10); // iq 43 | } 44 | } 45 | occ /= sampleCount; 46 | return 1-occ; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/frag_ao.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51ae11a5cd82fda468a85179946d672a 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9372f23586ef470b97d53856af88487 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | assetBundleName: 7 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/ContrastEnhanced3D16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/ContrastEnhanced3D16.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/ContrastEnhanced3D16.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ecd9a2c463dcb476891e43d7c9f16ffa 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 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: 1 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: -3 24 | maxTextureSize: 2048 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: -1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: 5 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/HexShape.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/HexShape.psd -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/HexShape.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4cdca73d61814d33ac1587f6c163bca 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 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 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 64 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: 1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/MotionBlurJitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/MotionBlurJitter.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/MotionBlurJitter.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31f5a8611c4ed1245b18456206e798dc 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: 3 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 1 27 | aniso: 1 28 | mipBias: -1 29 | wrapMode: 0 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/Neutral3D16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/Neutral3D16.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/Neutral3D16.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4b474cd484494a4aaa4bbf928219d09 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 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: 1 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: -3 24 | maxTextureSize: 2048 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: -1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: 5 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/Noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/Noise.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/Noise.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e80c3c84ea861404d8a427db8b7abf04 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: 3 24 | maxTextureSize: 64 25 | textureSettings: 26 | filterMode: 2 27 | aniso: 1 28 | mipBias: -1 29 | wrapMode: 0 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseAndGrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseAndGrain.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseAndGrain.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a632f967e8ad42f5bd275898151ab6a 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 8 | linearTexture: 1 9 | correctGamma: 1 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: 1 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 64 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: -1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: 5 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseEffectGrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseEffectGrain.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseEffectGrain.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ffa9c02760c2b4e8eb9814ec06c4b05b 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 1 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: 3 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 1 27 | aniso: 1 28 | mipBias: 0 29 | wrapMode: 0 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseEffectScratch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseEffectScratch.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/NoiseEffectScratch.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6205c27cc031f4e66b8ea90d1bfaa158 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 1 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 1 27 | aniso: 1 28 | mipBias: 0 29 | wrapMode: 0 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: 0 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/RandomVectors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/RandomVectors.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/RandomVectors.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a181ca8e3c62f3e4b8f183f6c586b032 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: 3 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 0 27 | aniso: 1 28 | mipBias: -1 29 | wrapMode: 0 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/SphereShape.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/SphereShape.psd -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/SphereShape.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc00ec05a89da4ff695a4273715cd5ce 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 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 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 64 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: 1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/VignetteMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/VignetteMask.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/VignetteMask.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95ef4804fe0be4c999ddaa383536cde8 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 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 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 1 27 | aniso: 1 28 | mipBias: 0 29 | wrapMode: 1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/color correction ramp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/color correction ramp.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/color correction ramp.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d440902fad11e807d00044888d76c639 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 8 | linearTexture: 1 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: -3 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 0 27 | aniso: 1 28 | mipBias: 0 29 | wrapMode: 1 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/grayscale ramp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Standard Assets/Effects/ImageEffects/Textures/grayscale ramp.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Textures/grayscale ramp.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9a9781cad112c75d0008dfa8d76c639 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 1 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 2 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 | seamlessCubemap: 0 23 | textureFormat: 3 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: 1 27 | aniso: 1 28 | mipBias: 0 29 | wrapMode: 1 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | textureType: -1 34 | buildTargetSettings: [] 35 | userData: 36 | -------------------------------------------------------------------------------- /Assets/Texture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a81fa53fe7cc4854181c18db9d00ac02 3 | folderAsset: yes 4 | timeCreated: 1490669139 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Texture/particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Texture/particle.png -------------------------------------------------------------------------------- /Assets/Texture/particle.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7cfd1d4dd21f6794389e71a79e766b30 3 | timeCreated: 1490669139 4 | licenseType: Pro 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: 1 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 | spriteSheet: 70 | serializedVersion: 2 71 | sprites: [] 72 | outline: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/Tub.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8470940e56212e44ba91a4471491da47 3 | folderAsset: yes 4 | timeCreated: 1493104524 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Tub.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Tub.unity -------------------------------------------------------------------------------- /Assets/Tub.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ddcead031996df4fa43481173f1778c 3 | timeCreated: 1493104359 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Tub/PBF.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d260a03609139bf479d503a2b69a4fa9 3 | timeCreated: 1491371959 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/Tub/PBF2D_Slow_Tub.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63fb32455c6da524d87e9bd254a1b2dd 3 | timeCreated: 1491371960 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 4 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Tub/Render.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Tub/Render.mat -------------------------------------------------------------------------------- /Assets/Tub/Render.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ab5772f3de606a4a821b68a21be9bbf 3 | timeCreated: 1491371960 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Tub/Render.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/PBF2D_GPU_TUB" { 2 | Properties{ 3 | _MainTex("Texture", 2D) = "white" {} 4 | _ParticleRad("ParticleRadius", Range(0.01, 1)) = 0.05 5 | } 6 | 7 | SubShader{ 8 | ZWrite Off 9 | Blend SrcAlpha OneMinusSrcAlpha 10 | 11 | Pass{ 12 | CGPROGRAM 13 | 14 | #pragma target 5.0 15 | #pragma vertex vert 16 | #pragma geometry geom 17 | #pragma fragment frag 18 | 19 | #include "UnityCG.cginc" 20 | 21 | sampler2D _MainTex; 22 | float _ParticleRad; 23 | 24 | struct Particle { 25 | bool wall; 26 | float2 oldPos; 27 | float2 newPos; 28 | float2 velocity; 29 | float2 force; 30 | float2 deltaP; 31 | float mass; 32 | float lambda; 33 | float pConstraint; 34 | }; 35 | 36 | StructuredBuffer _Particles; 37 | 38 | struct v2g { 39 | float4 pos : SV_POSITION; 40 | float2 tex : TEXCOORD0; 41 | float4 col : COLOR; 42 | }; 43 | 44 | v2g vert(uint id : SV_VertexID) { 45 | v2g output; 46 | output.pos = float4(_Particles[id].oldPos, 0, 1); 47 | output.tex = float2(0, 0); 48 | // output.col = float4(0.5 + normalize(_Particles[id].velocity) / 2, 0.5, 1); 49 | output.col = float4(1,1,1, 1); 50 | if (_Particles[id].wall) output.col = float4(1,0,0,1); 51 | return output; 52 | } 53 | 54 | [maxvertexcount(4)] 55 | void geom(point v2g input[1], inout TriangleStream outStream) { 56 | v2g output; 57 | 58 | float4 pos = input[0].pos; 59 | float4 col = input[0].col; 60 | 61 | for (int x = 0; x < 2; x++) { 62 | for (int y = 0; y < 2; y++) { 63 | float4x4 billboardMatrix = UNITY_MATRIX_V; 64 | billboardMatrix._m03 = 65 | billboardMatrix._m13 = 66 | billboardMatrix._m23 = 67 | billboardMatrix._m33 = 0; 68 | 69 | float2 tex = float2(x, y); 70 | output.tex = tex; 71 | 72 | output.pos = pos + mul(float4((tex * 2 - float2(1, 1)) * _ParticleRad, 0, 1), billboardMatrix); 73 | output.pos = mul(UNITY_MATRIX_VP, output.pos); 74 | 75 | output.col = col; 76 | 77 | outStream.Append(output); 78 | } 79 | } 80 | 81 | outStream.RestartStrip(); 82 | } 83 | 84 | fixed4 frag(v2g i) : COLOR{ 85 | float4 col = tex2D(_MainTex, i.tex) * i.col; 86 | if (col.a < 0.3) discard; 87 | return col; 88 | } 89 | 90 | ENDCG 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /Assets/Tub/Render.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 678a8ad4edf95354aa2a712176f8baf0 3 | timeCreated: 1491371960 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Tub/Renderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PBF_GPU_SLOW_2D_TUB { 4 | 5 | public class Renderer : MonoBehaviour { 6 | 7 | public PBF GPUScript; 8 | 9 | public Material ParticleRenderMat; 10 | 11 | void OnRenderObject(){ 12 | DrawObject(); 13 | } 14 | 15 | void DrawObject(){ 16 | Material m = ParticleRenderMat; 17 | m.SetPass(0); 18 | m.SetBuffer("_Particles", GPUScript.GetBuffer()); 19 | Graphics.DrawProcedural(MeshTopology.Points, GPUScript.GetMaxParticleNum()); 20 | } 21 | 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /Assets/Tub/Renderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2b6e334c1cdeee4db6fc3e63fc4b18a 3 | timeCreated: 1491371959 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/Tub/Sphere.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kodai100/Unity_PositionBasedFluid/b710f80368918ad70a8f329ebb31e0212c6a4d6b/Assets/Tub/Sphere.prefab -------------------------------------------------------------------------------- /Assets/Tub/Sphere.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4acbb3af3f2808c44bf5ec23ce5a48ee 3 | timeCreated: 1493104727 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Tub/TubCreator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class TubCreator : MonoBehaviour { 6 | 7 | public float width = 30; 8 | public float height = 5; 9 | 10 | public int num_layers = 1; 11 | 12 | public float radius = 0.5f; 13 | private float diameter; 14 | 15 | public GameObject sphere; 16 | 17 | public Vector3 pos; 18 | 19 | void Start () { 20 | diameter = radius * 2; 21 | pos = transform.position - new Vector3(width / 2, 0, 0); 22 | 23 | int num_height = (int)(height / diameter); 24 | int num_width = (int)(width / diameter); 25 | 26 | // 下の壁 27 | for(int l = 0; l < num_layers; l++) { 28 | for(int i = 0; i