├── ProjectSettings ├── ProjectVersion.txt ├── TagManager.asset ├── AudioManager.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── TimeManager.asset ├── DynamicsManager.asset ├── EditorSettings.asset ├── NetworkManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── GraphicsSettings.asset ├── Physics2DSettings.asset ├── UnityAdsSettings.asset ├── ClusterInputManager.asset ├── EditorBuildSettings.asset └── UnityConnectSettings.asset ├── Assets ├── Materials │ ├── DoomSprite.mat │ ├── DoomSprite2.mat │ ├── DoomSprite3.mat │ ├── groundtexture.mat │ ├── DoomSprite.mat.meta │ ├── DoomSpriteAnimated.mat │ ├── DoomSpriteAnimated2.mat │ ├── groundtexture.mat.meta │ ├── Shaders.meta │ ├── Shaders │ │ ├── DoomSprite.shader.meta │ │ ├── DoomSprite2.shader.meta │ │ ├── DoomSprite3.shader.meta │ │ ├── DoomSpriteAnimated.shader.meta │ │ ├── DoomSpriteAnimated2.shader.meta │ │ ├── DoomSprite2.shader │ │ ├── DoomSprite3.shader │ │ ├── DoomSprite.shader │ │ ├── DoomSpriteAnimated.shader │ │ └── DoomSpriteAnimated2.shader │ ├── DoomSprite2.mat.meta │ ├── DoomSprite3.mat.meta │ ├── DoomSpriteAnimated.mat.meta │ └── DoomSpriteAnimated2.mat.meta ├── Textures │ ├── TextureSheet.png │ ├── TextureSheetAnimTest.png │ ├── 30110-checkermap_b_zps5f23918f.png │ ├── 30110-checkermap_b_zps5f23918f.png.meta │ ├── TextureSheet.png.meta │ └── TextureSheetAnimTest.png.meta ├── Mesh │ ├── Plane1x1W1L1VBH_2.asset │ └── Plane1x1W1L1VBH_2.asset.meta ├── Scenes │ ├── scene_DoomSprite.unity │ └── scene_DoomSprite.unity.meta ├── Mesh.meta ├── Scenes.meta ├── Scripts.meta ├── Textures.meta ├── Materials.meta └── Scripts │ ├── GetAngle.cs.meta │ └── GetAngle.cs ├── .gitignore └── README.md /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.0f4 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /Assets/Materials/DoomSprite.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Materials/DoomSprite.mat -------------------------------------------------------------------------------- /Assets/Materials/DoomSprite2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Materials/DoomSprite2.mat -------------------------------------------------------------------------------- /Assets/Materials/DoomSprite3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Materials/DoomSprite3.mat -------------------------------------------------------------------------------- /Assets/Textures/TextureSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Textures/TextureSheet.png -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /Assets/Materials/groundtexture.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Materials/groundtexture.mat -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /Assets/Mesh/Plane1x1W1L1VBH_2.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Mesh/Plane1x1W1L1VBH_2.asset -------------------------------------------------------------------------------- /Assets/Scenes/scene_DoomSprite.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Scenes/scene_DoomSprite.unity -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /Assets/Materials/DoomSprite.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a16a059aa49232a4daa821a1bd93e8b6 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Materials/DoomSpriteAnimated.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Materials/DoomSpriteAnimated.mat -------------------------------------------------------------------------------- /Assets/Scenes/scene_DoomSprite.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b30828f40f05654f8ef9627d3c60803 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /Assets/Materials/DoomSpriteAnimated2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Materials/DoomSpriteAnimated2.mat -------------------------------------------------------------------------------- /Assets/Materials/groundtexture.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43acdcd30bc32be41a380dcb78386ea2 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Mesh/Plane1x1W1L1VBH_2.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55a5ce67042010f459239672ac0e68b7 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Textures/TextureSheetAnimTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Textures/TextureSheetAnimTest.png -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /Assets/Materials/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1d8d525de2aca04fbfdbd4421bd082d 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Textures/30110-checkermap_b_zps5f23918f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/DoomStyleBillboardTest/HEAD/Assets/Textures/30110-checkermap_b_zps5f23918f.png -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSprite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97ba80a1b9e6c8a46bf3bc90f2b13969 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Materials/DoomSprite2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bdef04223a479243916fbc7cd7724fa 3 | timeCreated: 1449272805 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/DoomSprite3.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 477ad76b2a2098a4b9e12a26ec2d769f 3 | timeCreated: 1450306746 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/DoomSpriteAnimated.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45980fa5cbc4dcb4aad33367a6d75c20 3 | timeCreated: 1441657911 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/DoomSpriteAnimated2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 477da69a9408f6d4b90f138518aa203b 3 | timeCreated: 1449326690 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Mesh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7aef757712a8ecd4987db23c0b661c50 3 | folderAsset: yes 4 | timeCreated: 1428268244 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed0927d91a2720a4299d0f1e820e71ec 3 | folderAsset: yes 4 | timeCreated: 1428268212 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61d67ca3d65737548b65c2de860d9a9b 3 | folderAsset: yes 4 | timeCreated: 1450302337 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f3c27c766dc2d440b2e16576a9d11c7 3 | folderAsset: yes 4 | timeCreated: 1428268212 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60edb28952a36af4983b230128f73e43 3 | folderAsset: yes 4 | timeCreated: 1428268212 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSprite2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6795247f459cf8749bc3f6c604d7f27f 3 | timeCreated: 1449275938 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSprite3.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b2edd32a635f904da0c0e0d714e4998 3 | timeCreated: 1450291454 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSpriteAnimated.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0b237ac6d694ff47ac28f5461d2f034 3 | timeCreated: 1441658330 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSpriteAnimated2.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89cad4cb12f92ed499b0c168d8e7a358 3 | timeCreated: 1449324532 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/GetAngle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f800115617fbab4d9ce4b3f94350d9a 3 | timeCreated: 1450302347 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # =============== # 2 | # Unity generated # 3 | # =============== # 4 | # temporary files that you do not want to share with other users 5 | Temp/ 6 | Obj/ 7 | UnityGenerated/ 8 | Library/ 9 | # optional, but you likely do not want to store 10 | # your builds in your git repo due to size 11 | Builds/ 12 | # ===================================== # 13 | # Visual Studio / MonoDevelop generated # 14 | # ===================================== # 15 | # these are generated by Mono itself are specific to the user and machine 16 | # sharing these with others in your repo will lead to issues 17 | ExportedObj/ 18 | *.svd 19 | *.userprefs 20 | *.csproj 21 | *.pidb 22 | *.suo 23 | *.sln 24 | *.user 25 | *.unityproj 26 | *.booproj 27 | # ============ # 28 | # OS generated # 29 | # ============ # 30 | # Mac OS X 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | Icon? 37 | ehthumbs.db 38 | Thumbs.db 39 | 40 | # EXTRA 41 | InspectorExpandedItems.asset 42 | EditorUserBuildSettings.asset 43 | Assembly-CSharp.pidb 44 | Assembly-CSharp-Editor.pidb 45 | Assembly-UnityScript.pidb 46 | Assembly-UnityScript-Editor.pidb 47 | -------------------------------------------------------------------------------- /Assets/Textures/30110-checkermap_b_zps5f23918f.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1899e5e88ce06694384bd8fe8b12cf16 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -1 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: 16 29 | mipBias: -1 30 | wrapMode: 0 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: 0 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/Textures/TextureSheet.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0df235e153587b419411c462d10d64c 3 | timeCreated: 1428268439 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | linearTexture: 0 12 | correctGamma: 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: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 512 31 | textureSettings: 32 | filterMode: 0 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: 0 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 1 49 | textureType: 5 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Textures/TextureSheetAnimTest.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22fa3db986062bd4581edd02c7c55bea 3 | timeCreated: 1441657956 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: 7 | 8900000: generatedCubemap 8 | serializedVersion: 2 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | linearTexture: 0 13 | correctGamma: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: .25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 0 26 | cubemapConvolution: 0 27 | cubemapConvolutionSteps: 8 28 | cubemapConvolutionExponent: 1.5 29 | seamlessCubemap: 0 30 | textureFormat: -1 31 | maxTextureSize: 512 32 | textureSettings: 33 | filterMode: 0 34 | aniso: -1 35 | mipBias: -1 36 | wrapMode: 0 37 | nPOTScale: 0 38 | lightmap: 0 39 | rGBM: 0 40 | compressionQuality: 50 41 | allowsAlphaSplitting: 0 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: .5, y: .5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaIsTransparency: 1 50 | textureType: 5 51 | buildTargetSettings: [] 52 | spriteSheet: 53 | sprites: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DoomStyleBillboardTest 2 | Shader to display camera facing billboard, with different texture based on player position angle 3 | 4 | *Nothing to do with actual Doom game, havent checked how the sprites are drawn there 5 | 6 | ## Website 7 | http://unitycoder.com/blog/2015/04/06/doom-style-billboard-shader/ 8 | 9 | ## Whats new 10 | 11 | Optimized original DoomSprite1.shader into DoomSprite2.shader. 12 | Moved all the code into vertex shader and into precalculated defines. 13 | 14 | ``` 15 | BEFORE (v1) 16 | // Stats for Vertex shader: 17 | // d3d11 : 25 math 18 | // d3d11_9x : 25 math 19 | // d3d9 : 47 math 20 | // Stats for Fragment shader: 21 | // d3d11 : 38 math, 1 texture 22 | // d3d11_9x : 38 math, 1 texture 23 | // d3d9 : 49 math, 1 texture 24 | 25 | AFTER (v2) 26 | // Stats for Vertex shader: 27 | // d3d11 : 52 math 28 | // d3d11_9x : 52 math 29 | // d3d9 : 82 math 30 | // Stats for Fragment shader: 31 | // d3d11 : 0 math, 1 texture 32 | // d3d11_9x : 0 math, 1 texture 33 | // d3d9 : 1 math, 1 texture 34 | 35 | AFTER (v3) 36 | // Stats for Vertex shader: 37 | // d3d11 : 44 math 38 | // d3d11_9x : 44 math 39 | // d3d9 : 71 math 40 | // Stats for Fragment shader: 41 | // d3d11 : 0 math, 1 texture 42 | // d3d11_9x : 0 math, 1 texture 43 | // d3d9 : 1 math, 1 texture 44 | ``` 45 | 46 | ## Preview 47 | ![gif](https://raw.githubusercontent.com/unitycoder/GitImageDump/master/gifs/doom_billboard_sprites.gif) 48 | 49 | -------------------------------------------------------------------------------- /Assets/Scripts/GetAngle.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | // helper script for testing angle calculation 5 | // USAGE: 6 | // - Attach this script to objectA and assign objectB as target 7 | // - Then select objectA and move it around ObjectB and you can see angle values in inspector 8 | 9 | [ExecuteInEditMode] 10 | public class GetAngle : MonoBehaviour 11 | { 12 | public Transform target; 13 | public float angle; 14 | public float angleOpt; 15 | 16 | void Update () 17 | { 18 | var myPos = transform.position; 19 | myPos.y = 0; 20 | 21 | var targetPos = target.position; 22 | targetPos.y = 0; 23 | 24 | Vector3 toOther = (myPos - targetPos).normalized; 25 | 26 | angle = Mathf.Atan2(toOther.z, toOther.x) * Mathf.Rad2Deg + 180; 27 | angleOpt = atan2Approximation(toOther.z, toOther.x) * Mathf.Rad2Deg + 180; 28 | 29 | Debug.DrawLine (myPos, targetPos, Color.yellow); 30 | } 31 | 32 | float atan2Approximation(float y, float x) // http://http.developer.nvidia.com/Cg/atan2.html 33 | { 34 | float t0, t1, t2, t3, t4; 35 | t3 = Mathf.Abs(x); 36 | t1 = Mathf.Abs(y); 37 | t0 = Mathf.Max(t3, t1); 38 | t1 = Mathf.Min(t3, t1); 39 | t3 = 1f / t0; 40 | t3 = t1 * t3; 41 | t4 = t3 * t3; 42 | t0 = - 0.013480470f; 43 | t0 = t0 * t4 + 0.057477314f; 44 | t0 = t0 * t4 - 0.121239071f; 45 | t0 = t0 * t4 + 0.195635925f; 46 | t0 = t0 * t4 - 0.332994597f; 47 | t0 = t0 * t4 + 0.999995630f; 48 | t3 = t0 * t3; 49 | t3 = (Mathf.Abs(y) > Mathf.Abs(x)) ? 1.570796327f-t3 : t3; 50 | t3 = (x < 0) ? 3.141592654f-t3:t3; 51 | t3 = (y < 0) ? -t3 : t3; 52 | return t3; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSprite2.shader: -------------------------------------------------------------------------------- 1 | //https://github.com/unitycoder/DoomStyleBillboardTest 2 | 3 | Shader "UnityCoder/DoomSprite2" 4 | { 5 | 6 | Properties 7 | { 8 | _MainTex ("Base (RGB)", 2D) = "white" {} 9 | _Frames ("Frames", Float) = 8 10 | } 11 | 12 | SubShader 13 | { 14 | Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "DisableBatching"="True"} 15 | 16 | ZWrite Off 17 | Blend SrcAlpha OneMinusSrcAlpha 18 | 19 | Pass 20 | { 21 | CGPROGRAM 22 | 23 | #pragma vertex vert 24 | #pragma fragment frag 25 | #define PI 3.1415926535897932384626433832795 26 | #define RAD2DEG 57.2957795131 27 | #define SINGLEFRAMEANGLE (360/_Frames) 28 | #define UVOFFSETX (1/_Frames) 29 | #include "UnityCG.cginc" 30 | 31 | uniform sampler2D _MainTex; 32 | uniform float4 _MainTex_ST; 33 | 34 | struct appdata { 35 | float4 vertex : POSITION; 36 | float4 texcoord : TEXCOORD0; 37 | }; 38 | 39 | struct v2f { 40 | float4 pos : SV_POSITION; 41 | half2 uv : TEXCOORD0; 42 | }; 43 | 44 | float4x4 _CameraToWorld; 45 | float _Frames; 46 | 47 | float atan2Approximation(float y, float x) // http://http.developer.nvidia.com/Cg/atan2.html 48 | { 49 | float t0, t1, t2, t3, t4; 50 | t3 = abs(x); 51 | t1 = abs(y); 52 | t0 = max(t3, t1); 53 | t1 = min(t3, t1); 54 | t3 = float(1) / t0; 55 | t3 = t1 * t3; 56 | t4 = t3 * t3; 57 | t0 = - 0.013480470; 58 | t0 = t0 * t4 + 0.057477314; 59 | t0 = t0 * t4 - 0.121239071; 60 | t0 = t0 * t4 + 0.195635925; 61 | t0 = t0 * t4 - 0.332994597; 62 | t0 = t0 * t4 + 0.999995630; 63 | t3 = t0 * t3; 64 | t3 = (abs(y) > abs(x)) ? 1.570796327 - t3 : t3; 65 | t3 = (x < 0) ? 3.141592654 - t3 : t3; 66 | t3 = (y < 0) ? -t3 : t3; 67 | return t3; 68 | } 69 | 70 | v2f vert (appdata v) 71 | { 72 | v2f o; 73 | o.pos = mul (UNITY_MATRIX_MVP, v.vertex); 74 | 75 | // get direction 76 | float3 cameraUp = UNITY_MATRIX_IT_MV[1].xyz; 77 | float3 cameraForward = normalize(UNITY_MATRIX_IT_MV[2].xyz); 78 | float3 towardsRight = normalize(cross(cameraUp, cameraForward)); 79 | 80 | // get angle & current frame 81 | float angle = (atan2Approximation(towardsRight.z,towardsRight.x)*RAD2DEG) % 360; 82 | int index = angle/SINGLEFRAMEANGLE; 83 | 84 | o.uv = float2(v.texcoord.x*UVOFFSETX+UVOFFSETX*index,v.texcoord.y); 85 | 86 | // billboard towards camera 87 | float3 vpos=mul((float3x3)_Object2World, v.vertex.xyz); 88 | float4 worldCoord=float4(_Object2World._m03,_Object2World._m13,_Object2World._m23,1); 89 | float4 viewPos=mul(UNITY_MATRIX_V,worldCoord)+float4(vpos,0); 90 | float4 outPos=mul(UNITY_MATRIX_P,viewPos); 91 | 92 | o.pos = UnityPixelSnap(outPos); // uses pixelsnap 93 | 94 | return o; 95 | } 96 | 97 | fixed4 frag(v2f i) : SV_Target 98 | { 99 | return tex2D(_MainTex,i.uv); 100 | } 101 | ENDCG 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSprite3.shader: -------------------------------------------------------------------------------- 1 | //https://github.com/unitycoder/DoomStyleBillboardTest 2 | 3 | Shader "UnityCoder/DoomSprite3" 4 | { 5 | 6 | Properties 7 | { 8 | _MainTex ("Base (RGB)", 2D) = "white" {} 9 | _Frames ("Frames", Float) = 8 10 | } 11 | 12 | SubShader 13 | { 14 | Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "DisableBatching"="True"} 15 | 16 | ZWrite Off 17 | Blend SrcAlpha OneMinusSrcAlpha 18 | 19 | Pass 20 | { 21 | CGPROGRAM 22 | 23 | #pragma vertex vert 24 | #pragma fragment frag 25 | #define PI 3.1415926535897932384626433832795 26 | #define RAD2DEG 57.2957795131 27 | #define SINGLEFRAMEANGLE (360/_Frames) 28 | #define UVOFFSETX (1/_Frames) 29 | #include "UnityCG.cginc" 30 | 31 | uniform sampler2D _MainTex; 32 | uniform float4 _MainTex_ST; 33 | 34 | struct appdata { 35 | float4 vertex : POSITION; 36 | float4 texcoord : TEXCOORD0; 37 | }; 38 | 39 | struct v2f { 40 | float4 pos : SV_POSITION; 41 | half2 uv : TEXCOORD0; 42 | }; 43 | 44 | float4x4 _CameraToWorld; 45 | float _Frames; 46 | 47 | float atan2Approximation(float y, float x) // http://http.developer.nvidia.com/Cg/atan2.html 48 | { 49 | float t0, t1, t2, t3, t4; 50 | t3 = abs(x); 51 | t1 = abs(y); 52 | t0 = max(t3, t1); 53 | t1 = min(t3, t1); 54 | t3 = float(1) / t0; 55 | t3 = t1 * t3; 56 | t4 = t3 * t3; 57 | t0 = - 0.013480470; 58 | t0 = t0 * t4 + 0.057477314; 59 | t0 = t0 * t4 - 0.121239071; 60 | t0 = t0 * t4 + 0.195635925; 61 | t0 = t0 * t4 - 0.332994597; 62 | t0 = t0 * t4 + 0.999995630; 63 | t3 = t0 * t3; 64 | t3 = (abs(y) > abs(x)) ? 1.570796327 - t3 : t3; 65 | t3 = (x < 0) ? PI - t3 : t3; 66 | t3 = (y < 0) ? -t3 : t3; 67 | return t3; 68 | } 69 | 70 | v2f vert (appdata v) 71 | { 72 | v2f o; 73 | o.pos = mul (UNITY_MATRIX_MVP, v.vertex); 74 | 75 | // object world position 76 | float3 objWorldPos=float3(_Object2World._m03,_Object2World._m13,_Object2World._m23); 77 | 78 | // get angle between object and camera 79 | float3 fromCameraToObject = normalize(objWorldPos - _WorldSpaceCameraPos.xyz); 80 | float angle = atan2Approximation(fromCameraToObject.z, fromCameraToObject.x)*RAD2DEG+180; 81 | 82 | // get current tilesheet frame and feed it to UV 83 | int index = angle/SINGLEFRAMEANGLE; 84 | o.uv = float2(v.texcoord.x*UVOFFSETX+UVOFFSETX*index,v.texcoord.y); 85 | 86 | // billboard mesh towards camera 87 | float3 vpos=mul((float3x3)_Object2World, v.vertex.xyz); 88 | float4 worldCoord=float4(_Object2World._m03,_Object2World._m13,_Object2World._m23,1); 89 | float4 viewPos=mul(UNITY_MATRIX_V,worldCoord)+float4(vpos,0); 90 | float4 outPos=mul(UNITY_MATRIX_P,viewPos); 91 | 92 | o.pos = UnityPixelSnap(outPos); // uses pixelsnap 93 | 94 | return o; 95 | } 96 | 97 | fixed4 frag(v2f i) : SV_Target 98 | { 99 | return tex2D(_MainTex,i.uv); 100 | } 101 | ENDCG 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSprite.shader: -------------------------------------------------------------------------------- 1 | //https://github.com/unitycoder/DoomStyleBillboardTest 2 | 3 | Shader "UnityCoder/DoomSprite" 4 | { 5 | 6 | Properties 7 | { 8 | _MainTex ("Base (RGB)", 2D) = "white" {} 9 | } 10 | 11 | SubShader 12 | { 13 | Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "DisableBatching"="True"} 14 | 15 | ZWrite Off 16 | Blend SrcAlpha OneMinusSrcAlpha 17 | 18 | Pass 19 | { 20 | CGPROGRAM 21 | 22 | #pragma vertex vert 23 | #pragma fragment frag 24 | #define PI 3.1415926535897932384626433832795 25 | #include "UnityCG.cginc" 26 | 27 | uniform sampler2D _MainTex; 28 | uniform float4 _MainTex_ST; 29 | 30 | struct appdata { 31 | float4 vertex : POSITION; 32 | float3 normal : NORMAL; 33 | float4 texcoord : TEXCOORD0; 34 | }; 35 | 36 | struct v2f { 37 | float4 pos : SV_POSITION; 38 | half2 uv : TEXCOORD0; 39 | float3 normal : TEXCOORD1; 40 | float3 viewRight : TEXCOORD3; 41 | float3 viewFront : TEXCOORD4; 42 | }; 43 | 44 | float4x4 _CameraToWorld; 45 | 46 | v2f vert (appdata v) 47 | { 48 | v2f o; 49 | o.pos = mul (UNITY_MATRIX_MVP, v.vertex); 50 | o.normal = float3(0,0,-1); //v.normal; // using fixed normal direction 51 | o.uv = v.texcoord.xy; 52 | 53 | // Convert from camera to world space. 54 | float3 viewUpW = mul((float3x3)_CameraToWorld, float3(0,1,0)); 55 | float3 viewRightW = mul((float3x3)_CameraToWorld, float3(1,0,0)); 56 | float3 viewFrontW = mul((float3x3)_CameraToWorld, float3(0,0,-_ProjectionParams.x)); 57 | 58 | // Convert from world to object space. 59 | o.viewRight = mul((float3x3)_Object2World, viewRightW); 60 | o.viewFront = mul((float3x3)_Object2World, viewFrontW); 61 | 62 | // billboard towards camera 63 | float3 vpos=mul((float3x3)_Object2World, v.vertex.xyz); 64 | float4 worldCoord=float4(_Object2World._m03,_Object2World._m13,_Object2World._m23,1); 65 | float4 viewPos=mul(UNITY_MATRIX_V,worldCoord)+float4(vpos,0); 66 | float4 outPos=mul(UNITY_MATRIX_P,viewPos); 67 | o.pos = UnityPixelSnap (outPos); 68 | 69 | return o; 70 | } 71 | 72 | fixed4 frag(v2f i) : SV_Target 73 | { 74 | i.normal = normalize(i.normal); 75 | i.viewRight = normalize(i.viewRight); 76 | i.viewFront = normalize(i.viewFront); 77 | 78 | fixed4 c = 0; 79 | float angle = (atan2(i.normal.y,i.viewFront.z))*(180/PI); 80 | 81 | float si = i.normal.x * i.viewRight.z - i.viewRight.x * i.normal.z; 82 | float co = i.normal.x * i.viewRight.x + i.normal.z * i.viewRight.z; 83 | angle = atan2(si, co)*(180/PI); 84 | 85 | if (angle<0) angle=360+angle; // get angle value 0-360, instead of 0-180 86 | 87 | float frames = 8; // texture has 8 frames (side by side images) 88 | int index = angle/45; 89 | float s = 1/frames; 90 | c = tex2D(_MainTex, float2(i.uv.x*s + s*(index) ,i.uv.y)); 91 | return c; 92 | } 93 | ENDCG 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSpriteAnimated.shader: -------------------------------------------------------------------------------- 1 | //https://github.com/unitycoder/DoomStyleBillboardTest 2 | 3 | Shader "UnityCoder/DoomSpriteAnimated" 4 | { 5 | 6 | Properties 7 | { 8 | _MainTex ("Base (RGB)", 2D) = "white" {} 9 | } 10 | 11 | SubShader 12 | { 13 | Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "DisableBatching"="True"} 14 | 15 | ZWrite Off 16 | Blend SrcAlpha OneMinusSrcAlpha 17 | 18 | Pass 19 | { 20 | CGPROGRAM 21 | 22 | #pragma vertex vert 23 | #pragma fragment frag 24 | #define PI 3.1415926535897932384626433832795 25 | #include "UnityCG.cginc" 26 | 27 | uniform sampler2D _MainTex; 28 | uniform float4 _MainTex_ST; 29 | 30 | struct appdata { 31 | float4 vertex : POSITION; 32 | float3 normal : NORMAL; 33 | float4 texcoord : TEXCOORD0; 34 | }; 35 | 36 | struct v2f { 37 | float4 pos : SV_POSITION; 38 | half2 uv : TEXCOORD0; 39 | float3 normal : TEXCOORD1; 40 | float3 viewRight : TEXCOORD3; 41 | float3 viewFront : TEXCOORD4; 42 | }; 43 | 44 | float4x4 _CameraToWorld; 45 | 46 | v2f vert (appdata v) 47 | { 48 | v2f o; 49 | o.pos = mul (UNITY_MATRIX_MVP, v.vertex); 50 | o.normal = float3(0,0,-1); //v.normal; // using fixed normal direction 51 | o.uv = v.texcoord.xy; 52 | 53 | // Convert from camera to world space. 54 | float3 viewUpW = mul((float3x3)_CameraToWorld, float3(0,1,0)); 55 | float3 viewRightW = mul((float3x3)_CameraToWorld, float3(1,0,0)); 56 | float3 viewFrontW = mul((float3x3)_CameraToWorld, float3(0,0,-_ProjectionParams.x)); 57 | 58 | // Convert from world to object space. 59 | o.viewRight = mul((float3x3)_Object2World, viewRightW); 60 | o.viewFront = mul((float3x3)_Object2World, viewFrontW); 61 | 62 | // billboard towards camera 63 | float3 vpos=mul((float3x3)_Object2World, v.vertex.xyz); 64 | float4 worldCoord=float4(_Object2World._m03,_Object2World._m13,_Object2World._m23,1); 65 | float4 viewPos=mul(UNITY_MATRIX_V,worldCoord)+float4(vpos,0);//+matr; 66 | float4 outPos=mul(UNITY_MATRIX_P,viewPos); 67 | o.pos = UnityPixelSnap (outPos); // pixelsnap is optional 68 | 69 | return o; 70 | } 71 | 72 | fixed4 frag(v2f i) : COLOR 73 | { 74 | i.normal = normalize(i.normal); 75 | i.viewRight = normalize(i.viewRight); 76 | i.viewFront = normalize(i.viewFront); 77 | 78 | fixed4 c = fixed4(0,0,0,0); 79 | 80 | // get angle 81 | float angle = (atan2(i.normal.y,i.viewFront.z))*(180/PI); 82 | float si = i.normal.x * i.viewRight.z - i.viewRight.x * i.normal.z; 83 | float co = i.normal.x * i.viewRight.x + i.normal.z * i.viewRight.z; 84 | angle = atan2(si, co)*(180/PI); 85 | 86 | if (angle<0) angle=360+angle; // get angle value 0-360, instead of 0-180 87 | 88 | float frames = 8; // texture has 8 frames 89 | 90 | int index = angle/45; 91 | float s = 1/frames; // scalar 92 | 93 | // animated frames 94 | float totalAnimFrames=3; // 3 rows vertically stacked 95 | float animFrame= totalAnimFrames-(1+round(_Time.y) % totalAnimFrames); 96 | 97 | c = tex2D(_MainTex, float2(i.uv.x*s + s*(index) , (i.uv.y+animFrame)/totalAnimFrames) ); 98 | 99 | return c; 100 | } 101 | 102 | ENDCG 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Assets/Materials/Shaders/DoomSpriteAnimated2.shader: -------------------------------------------------------------------------------- 1 | //https://github.com/unitycoder/DoomStyleBillboardTest 2 | 3 | Shader "UnityCoder/DoomSpriteAnimated2" 4 | { 5 | 6 | Properties 7 | { 8 | _MainTex ("Base (RGB)", 2D) = "white" {} 9 | _Frames ("Frames (rows)", Float) = 8 10 | _Columns ("Columns", Float) = 3 11 | _AnimSpeed ("Animation Speed", Float) = 1 12 | } 13 | 14 | SubShader 15 | { 16 | Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "DisableBatching"="True"} 17 | 18 | ZWrite Off 19 | Blend SrcAlpha OneMinusSrcAlpha 20 | 21 | Pass 22 | { 23 | CGPROGRAM 24 | 25 | #pragma vertex vert 26 | #pragma fragment frag 27 | #define PI 3.1415926535897932384626433832795 28 | #define RAD2DEG 57.2957795131 29 | #define SINGLEFRAMEANGLE (360/_Frames) 30 | #define UVOFFSETX (1/_Frames) 31 | #include "UnityCG.cginc" 32 | 33 | uniform sampler2D _MainTex; 34 | uniform float4 _MainTex_ST; 35 | 36 | struct appdata { 37 | float4 vertex : POSITION; 38 | float4 texcoord : TEXCOORD0; 39 | }; 40 | 41 | struct v2f { 42 | float4 pos : SV_POSITION; 43 | half2 uv : TEXCOORD0; 44 | }; 45 | 46 | float4x4 _CameraToWorld; 47 | float _Frames; 48 | float _Columns; 49 | float _AnimSpeed; 50 | 51 | float2 atan2Approximation(float2 y, float2 x) // http://http.developer.nvidia.com/Cg/atan2.html 52 | { 53 | float2 t0, t1, t2, t3, t4; 54 | t3 = abs(x); 55 | t1 = abs(y); 56 | t0 = max(t3, t1); 57 | t1 = min(t3, t1); 58 | t3 = float(1) / t0; 59 | t3 = t1 * t3; 60 | t4 = t3 * t3; 61 | t0 = - float(0.013480470); 62 | t0 = t0 * t4 + float(0.057477314); 63 | t0 = t0 * t4 - float(0.121239071); 64 | t0 = t0 * t4 + float(0.195635925); 65 | t0 = t0 * t4 - float(0.332994597); 66 | t0 = t0 * t4 + float(0.999995630); 67 | t3 = t0 * t3; 68 | t3 = (abs(y) > abs(x)) ? float(1.570796327) - t3 : t3; 69 | t3 = (x < 0) ? float(3.141592654) - t3 : t3; 70 | t3 = (y < 0) ? -t3 : t3; 71 | return t3; 72 | } 73 | 74 | v2f vert (appdata v) 75 | { 76 | v2f o; 77 | o.pos = mul (UNITY_MATRIX_MVP, v.vertex); 78 | 79 | // get direction 80 | float3 cameraUp = UNITY_MATRIX_IT_MV[1].xyz; 81 | float3 cameraForward = normalize(UNITY_MATRIX_IT_MV[2].xyz); 82 | float3 towardsRight = normalize(cross(cameraUp, cameraForward)); 83 | 84 | // get angle & current frame 85 | float angle = (atan2Approximation(towardsRight.z,towardsRight.x)*RAD2DEG) % 360; 86 | int index = angle/SINGLEFRAMEANGLE; 87 | 88 | // animated frames 89 | float animFrame= _Columns-(1+round(_Time.y*_AnimSpeed) % _Columns); 90 | 91 | // set uv to display current frame 92 | o.uv = float2(v.texcoord.x*UVOFFSETX+UVOFFSETX*index,(v.texcoord.y+animFrame)/_Columns); 93 | 94 | // billboard towards camera 95 | float3 vpos=mul((float3x3)_Object2World, v.vertex.xyz); 96 | float4 worldCoord=float4(_Object2World._m03,_Object2World._m13,_Object2World._m23,1); 97 | float4 viewPos=mul(UNITY_MATRIX_V,worldCoord)+float4(vpos,0); 98 | float4 outPos=mul(UNITY_MATRIX_P,viewPos); 99 | 100 | o.pos = UnityPixelSnap(outPos); // uses pixelsnap 101 | 102 | return o; 103 | } 104 | 105 | fixed4 frag(v2f i) : SV_Target 106 | { 107 | return tex2D(_MainTex,i.uv); 108 | } 109 | 110 | ENDCG 111 | } 112 | } 113 | } 114 | --------------------------------------------------------------------------------