Nowadays the only possibly way of achieving flat shaded and low poly effect, consists in removing smooth info from mesh and baking color data(texture) inside mesh.
And here problems begin:
- The most important - vertex count is tripled for every face, as all face must have unique vertices at each corner.
- Original mesh vertex count is limited to 21.666 (after conversion vertex count will be tripled - 65.000).
- Every converted mesh is unique. If required different colored mesh - another copy must be generated.
- Not all mesh data is supported (e.g Blendshapes).
- Converted mesh needs much more GPU and HDD memory than original.
- Increased vertex count and worse batching leads to slow rendering.
- CPU time wasting for run-time converted meshes. Even more wasting if need Normal/ Tangent re-calculations.
All mesh packages in the Asset Store offering faceted style look are done by that way. Yes, they really are not ‘low poly’.
And all editor tools generating faceted meshes do exactly that.
I want to introduce my new solution
Yes, it’s a shader. All “texture to vertex color” calculations are done inside shader and final effect is 100% the same as from converted meshes, but has much more advantages:
-
No mesh converting - just apply shader to any mesh and it will be rendered in ‘low poly’ and ‘flat-shaded’ style.
-
Important - vertex count is not increased. Mesh is rendered using its own vertices. New vertices are not generated at all!
-
Better mesh batching → Less draw calls → Faster rendering.
-
No limit on source mesh vertex count.
-
No need to duplicate meshes for various color styles. Just use different material with desired texture.
-
Even effect is calculated from texture - no need to have them in HD resolution. Compressed texture with 256 resolution is pretty enough.
-
No increased memory because of mesh on HDD and GPU. Texture require much less space.
-
No CPU time wasting on mesh conversion and Normal/Tangent re-calculation.
-
Perfect for run-time generated meshes.
-
Supports all mesh features, including Blendshapes.
-
No limit on complex meshes (e.g Terrain, SpeedTree).
Note:
This is shader! Do not confuse with mesh decimation tool.
Geometry Shaders support is required, check your device before purchasing with this test shaders.
Compatible with Wireframe shader for achieving better paper-craft effect.
Here are some benchmarks:
Test scene contains only opaque meshes, one directional light without shadow cast, camera in Forward Rendering.
No skybox, GI, image effects or other run-time scripts. All possible features that can somehow effect rendering are disabled.
Rendering resolution 1920x1080. PC build (GTX 660M).
Update History
v2019.1
• Updated for Unity 2018.3
• Package can be placed anywhere inside project and has no more restriction to be in the specific installation location.
v2018.3
• Added Dissolve effect for Cutout shaders
v2018.2
• Updated for Unity 2017.4 and Unity 2018.2
• Added Specular map option for LegacyShaders.
• Added Metallic/Smoothness map option for PBS shaders.
v2018.1
• Fixed shader compilation errors in Unity 2017.3
v2017.3
•Added Emission
v2017.2
• Compatible with 5.6
• Added Unity 5.6 GPU Instancing
• Added quad wireframe effect support
v2017.1
• Reflection with Bump will now produce better low poly look.
• Several micro improvements.
• All known bugs fixed. Package is not in beta any more.
v0.92 beta
• Added compatibility with Wireframe shader for creating paper-craft effect
v0.91 beta
• Unity 5.5 ready
• Added physically based shaders (Standard shading model)
v0.90 beta
• Initial release