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 - Kajiya-Kay

3/30/2014

0 Comments

 
In my searches for the more advanced hair shading techniques, i stumbled upon the full paper that discussed the sorting technique from before. It cleared a few things up, but also demonstrated a Kajiya-Kay specular lighting technique with a few ideas taken from Marschner. So I stole it (for learning of course). Here is my previous implementation on the left and Kajiya Kay on the right. The differences are subtle, mostly manifesting in a differently colored highlight and the ability to shift the highlight along the hair. 
Picture
EDIT: I finally came back and figured out Ambient Occlusion with transparency. It improves hair layering quite a bit. Before and After:
Picture
Picture
In order to generate Ambient Occlusion with an alpha map, you have to follow a slightly hacky procedure: First assign your texture with alpha to a lambert material and unlink all lights in your scene. Next, add some shadow casting ambient lights. Cast shadows are off by default, so you will need to check the options. I used 4 to surround the hair from above, but you will probably need more for objects like trees. Here is my baking setup, ugly alpha sorting and all: 
Picture
Next, go to the texture bake set and set it to bake 'Light Only' - higher samples generally looks better, everything else is pretty irrelevant. Finally, open the Mental Ray Baking Options and and ensure bake shadows is checked before baking your lighting. And you are done. Oddly enough this tends to bake faster than true Occlusion, even on high sample amounts. WTF Maya?

I've updated both these and my previous anisotropic hair shaders to handle ambient occlusion. I use the second UV set for Ambient Occlusion

Maya CGFX File:

kajiyakay.cgfx
File Size: 15 kb
File Type: cgfx
Download File

Unity Shader File:

kajiyakay.shader
File Size: 25 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.