Artistic Experiments
  • Home
  • Reel
  • Shaders
    • Stylized Shaders
    • Lighting Techniques
    • Shader Effects
    • Cubemaps
    • Pixel Lit Shaders (Basic)
    • Vertex Lit Shaders (Basic)
    • Unlit Shaders (Basic)
  • Tools
  • WIP
  • Contact

CG Shaders - Flat Translucency

2/1/2014

0 Comments

 
After a bit of experimenting in Unity, I found that while Z test is impossible to run in alpha blending, you can get away with it in Alpha Clip. This opens up a few nice possibilities, namely that you could turn backface culling off with alpha clip without sorting issues. This means you can have a  2 sided material for about the same cost as a one sided material - 2 passes as normal, instead of 4 passes to cover base and fill lights for 2 sides. I flip the normals on the backfaces so that normals are accounted for correctly. This works OK but you may run into weird shadowing on high angles of incidence. For now i'm rolling with it, but I am open to any other suggestions :)

Thanks to this, I thought it would be a good time to try out flat translucency. It's basically a super cheap subsurface scattering approximation. This is useful for leaves or other paper thin materials that allow some light to pass through. I based my implementation on Crytek's implementation of light transmission, featured in this paper. My implementation is a bit simpler to save a few instructions, but the idea is basically the same. Just skip past the vertex animation for now, I'll get to that later :)
Picture
Lit from the front
Picture
Lit from the back

Maya CGFX File:

phongnormalflattranslucency.cgfx
File Size: 8 kb
File Type: cgfx
Download File

Unity SHADER File:

phongnormalflattranslucency.shader
File Size: 11 kb
File Type: shader
Download File

0 Comments



Leave a Reply.

    CG Shaders

    Shaders I've built as i teach myself CG. Feel free to download and use for whatever. If you like them you can buy me a beer or something.

    Archives

    December 2014
    April 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.