Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thnewlands/unity-surfaceshader-flipbook
Surface shaders with flipbook / spritesheet animation functionality
https://github.com/thnewlands/unity-surfaceshader-flipbook
animation flipbook shader shaders sprites spritesheet unity unity3d
Last synced: about 2 months ago
JSON representation
Surface shaders with flipbook / spritesheet animation functionality
- Host: GitHub
- URL: https://github.com/thnewlands/unity-surfaceshader-flipbook
- Owner: thnewlands
- License: mit
- Created: 2017-07-04T02:15:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-04T17:10:33.000Z (over 7 years ago)
- Last Synced: 2024-08-03T19:09:05.336Z (5 months ago)
- Topics: animation, flipbook, shader, shaders, sprites, spritesheet, unity, unity3d
- Language: ShaderLab
- Size: 616 KB
- Stars: 50
- Watchers: 4
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-unity-open-source-on-github - unity-surfaceshader-flipbook - Surface shaders with flipbook / spritesheet animation functionality (Other Shaders)
README
# Flipbook Surface Shader for Unity
![](http://i.imgur.com/ezGY1yf.gif)
This is a surface shader solution for flipbook animation with spritesheets in Unity. I've been using this so that I can add shadows to flipbook animations without going through Unity's sprite system.
Setup is relatively simple:
1. Create a spritesheet with even spacing between sprites. For my spritesheets I've been using: https://www.johnwordsworth.com/projects/photoshop-sprite-sheet-generator-script/ and generating source sprite images in 3d Studio MAX. This makes it especially easy to get normal information for renderings.
2. Plug in your spritesheets to a new material with Custom/SurfaceSpriteSheet
3. Set the number of rows / columns and then the number of overall frames.
--- I count the number of overall frames in case of incomplete rows ---
4. Set it loose! You can use the animator to set the frame number over time or make it loop using the built in animation speed variable!Improvements / suggestions for other variations:
For foliage -- blend the bottom of the geometry with the ground by orienting the normals to the surface. This is easiest for flat surfaces with which you can just set the normals to point upward in a vertex shader.
Try implimenting billboarding -- In the past I've used this solution to good effect: https://gist.github.com/renaudbedard/7a90ec4a5a7359712202, note that it won't batch correctly out of the box.