How to configure and animate 2d effects
The material inspector is disabled once you are in 2d mode. While in this mode, you can configure the plane to face one direction (Locked to a 2d axis determined by Facing direction), or billboarded to the player's camera for a sprite game feel. Feel free to revert to 3d to make more material changes, or edit the sliders directly.
You can animate the _2d_coef and _lock_2d_axis material values for switching between 2d, billboard, and 3d modes. You must do this on every mesh to avoid clipping. You may want to also animate the outline width to be smaller when in 3d.
Note that this shader cheats and produces falsified depth values to minimize Z-fighting. However, if you wish to mix parts in 2d and 3d, you can adjust the "Squash Z" value to some value usually around 0.95 or 0.975 so that they line up.
Other notes about 2d
This shader requires that *all* meshes have the same **Root Bone** slot set in the SkinnedMeshRenderer. Changing the Root Bone is mostly safe, but you must adjust the Mesh Bounds to compensate. If you have any meshes which are not skinned, they will not align to the same 2d plane and may look unusual. This is best fixed from within blender by combining meshes.
"See self in 3d" has been removed. If you need this functionality use the Avatar 3.0 IsLocal parameter.
Note that this includes a copy of the built-in Standard shader for metallic setup only. Specular setup is not implemented yet, but would be easy to add if requested.
Includes other shaders
Includes some extra shader:
- StarNestAvatar: StarNest shader, but optimized and significantly lower iteration count, designed for use on Avatars.
- Standard shader designed for 2D.
- DropShadow to create a 2D background shader behind your 2D avatar.
- Hidden shader shows a texture for users with shaders disabled.
License and Source Code
Licensed under the terms of MIT License
Code is available on GitHub: