► DirectX 11 Low Poly Shader ◄

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

DirectX 11 Low Poly Shader

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

VacuumShaders - Facebook Twitter YouTube

6 Likes

This is looking like a useful alternative to the common workflows.

Could you provide a couple more visual examples side by side, original and flat shaded, a couple characters at different original resolutions would be good and a simple tree.

Question - does the shader support animated color changes? Example - if I wanted to show a characters face changing from normal shade to a reddish tinted color when he getting angry.

2647923--186561--Bear.jpg
Play GIF animation

I’ve just finished working on shader core and have no much visual examples to show, but will definitely share more progress info, stay-turned.

Shaders will have wide range of visual controllers including tint color, two texture blending for low poly effect, textures animation and many others.

2647923--186562--Elephant.jpg
Play GIF animation

VacuumShaders - Facebook Twitter YouTube

2 Likes

It looks really great. One question though. I heard that if i select to have hard edges in Maya to get this look, it would kill a game engine as it would make it a draw call for each face as it would put each one in its own strip. Is that the case?

Low poly shader renders faceted effect just in one pass, one draw call.
You can import smooth model without hard edges and using this shader achieve desired effect.
Also importing mesh with hard edges will increase mesh vertex count (by triangle count * 3), that will have very bad influence on rendering(check charts in the #1 post) and mesh batching.

VacuumShaders - Facebook Twitter YouTube

This a really interesting project - you have a habit of coming up with some of the most interesting assets, haha. However, I’m not sure I understand your figures (?) The low poly shader isn’t showing benefits except for texture memory and VRAM, but is outperforming flat / faceted mesh in almost all categories, which is good. Could you explain why flat / faceted mesh is performing so poorly compared to the original mesh in these samples?

Main reasons is increased mesh vertex count → that leads to worse static and dynamic batching → that leads to increased draw calls.
Also GPU handles 432K vertices better than 992K. Same as pixel shader that rasterizes each polygon.

VacuumShaders - Facebook Twitter YouTube

Right, I forgot this was a realtime solution, so we’re gaining vertices, not losing them as we would if we were to decimate in modeling software. Your asset Mesh Materializer does something like this, correct? It bakes out a reduced polycount version of the original mesh?

Vertex count will increase in any case - it is the only possible solution nowadays for faceted style rendering.

Before texture baking inside mesh vertex color its vertices are split because each polygon (consisting of 3 vertices) must have unique color → that leads to increased vertex count, final mesh always will have triangle count * 3 vertices.

All mesh packages in the Asset Store offering faceted style look are done by that way. Yes, they really are not ‘low poly’ meshes.
And all editor tools generating faceted meshes do exactly that.

And here comes DirectX 11 Low Poly Shader, that creates faceted style without increasing vertex count :sunglasses:.

VacuumShaders - Facebook Twitter YouTube

And this is where a drop the mic smiley would be great.

2 Likes

Was able to transform built-in skybox shader into low poly style. It is visible to GI and reflection probes.
New shader is even faster as there is no calculations inside pixel shader at all.

Play GIF animation

VacuumShaders - Facebook Twitter YouTube

3 Likes

Unity renders terrain in several passes depending on used paint textures.
DirectX 11 Low Poly Shader will render it just in one pass and without any texture rasterization inside pixel shader.

VacuumShaders - Facebook Twitter YouTube

2 Likes

Achieved Paper-craft effect by combining DirectX 11 Low Poly Shader and Wireframe Shader

Play GIF animation

Animation is modified with custom script (will be included in pack).

Wireframe is completely generated inside shader and has 0 cost.
But it’s rendering with low poly effect will require Wireframe Shader pack.

VacuumShaders - Facebook Twitter YouTube

2 Likes

This sounds really promising! Can’t wait to see it on the Asset Store. Any idea of an ETA?

I am using Mesh Materializer & PolyWorld at the moment but would love this for performance reasons.

All the best!

Unfortunately no ETA, want to release as soon as possible.

VacuumShaders - Facebook Twitter YouTube

Experimenting with water shader.


VacuumShaders - Facebook Twitter YouTube

2 Likes

Somehow the lighting makes parts look smooth instead of faced. I think it’s because the light changes smoothly instead of jumping from shadow to light?

It’s just a game of options.
2670714--188490--Water_compare.png

VacuumShaders - Facebook Twitter YouTube

1 Like

Oooooooo
This shader is going to be great for a pop-up book type of thing as well.

The water shader looks amazing! Every shot is increasing my interest. Can’t wait to get this from the Asset Store.