Skip to content

Unity Shader which achieves flat-shading, without the need for duplicating polygon vertices.

License

Notifications You must be signed in to change notification settings

cjurjiu/FlatShader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlatShader

A very simple shader which performs flatshading without the need for duplicating vertices when building the geometry.

Standard unity shader FlatShader

This is especially useful on mobile devices, which don't really enjoy pushing more vertices than they have to.

The basic idea behind how it works is that it computes a normal at the fragment level, which is then used in a custom lightning function. Original solution posted here. Also, this might also prove to be a useful reference.

The shader in this repository is not production ready in any way, and the lightning needs more tweaking. However, it ilustrates the concept.

Sample project used to create the images in the FlatShaderSampleProject folder. The Materials folder contains two materials: One uses the standard unity shader, the other uses the FlatShader presented here.

Just import the project in Unity, open the scene, hit play then swap the materials on the terrain in order to see how this behaves in comparison to the default Unity Standard shader.

Enjoy

About

Unity Shader which achieves flat-shading, without the need for duplicating polygon vertices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages