Improvement of tangent shading
Open, NormalPublic

Description

Patch for: T17899

Currently the tangent shading (TANGENT_V) produces disappointing results which are quite unphysical and show stupid artifacts like stairs. (See tangent_shading_original.png)

Many people have also reported the same problem:

http://projects.blender.org/tracker/index.php?func=detail&aid=17899&group_id=9&atid=264
http://blenderartists.org/forum/showthread.php?112347-tangent-shader-rayshadow-artifacts
http://blenderartists.org/forum/showthread.php?136684-strange-pixilated-effect-with-tangent-shading
http://blenderartists.org/forum/showthread.php?170493-Specular-Lightning-issue-with-Tangent-V
http://blenderartists.org/forum/showthread.php?206292-Problem-with-Tangent-V-Shading-Shadows

So I tried improving it as follows:

1. Don't show the artifacts
2. Use proper method for determining fake face normal
3. Consider self-shadowing and self-occlusion due to microfacets
4. Add 'Anisotropy' slider to material panel (anisotropy_ui.png)

I noticed the expressions to determine the fake face normal are mathematically incorrect, then I replaced them with exact one. The calculations of 3 and 4 are not so physically accurate, but we should be able to obtain sufficiently nice results. (See sample pictures)

Note that the self-shadowing/occlusion doesn't work for toon shaders.

Details

Type
Patch

Updated for r35822 and cleaned up a little.

I uploaded a YouTube video:

http://www.youtube.com/watch?v=va7AVfyKvLk

Updated for r47152.

- Change default value of anisotropy to 1.0
- Style cleanup

Note that this patch bumps BLENDER_SUBVERSION from 7 to 8 to convert older .blend files in readfile.c.

If it allows to get rid of these horrible artefacts that every blender user encounters; it is not just useful : it is a must have.

Will have a closer look and give feedback later.