# Thin film OSL shader

**URL:** <https://forums.chaos.com/t/thin-film-osl-shader/52567>\
**Category:** Tutorials, Tips & Tricks\
**Created:** [February 5, 2015, 6:18pm UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567 "2015-02-05T18:18:08Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![jonnybefree](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jonnybefree](https://forums.chaos.com/u/jonnybefree)\
**Post date:** [February 12, 2015, 9:42am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/21 "2015-02-12T09:42:40Z")

</div>

nice tests lele. wonder the differents in rendertimes from start to end?

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [February 12, 2015, 11:30am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/22 "2015-02-12T11:30:59Z")

</div>

seconds.  
The effect of the shader itself on rendertime is negligible, and so quick i’d call it invariant from test to test.

---

<div class="post-metadata">

**Author:** ![Joelaff](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/joelaff/32/71647_2.png) [@Joelaff](https://forums.chaos.com/u/Joelaff)\
**Post date:** [February 13, 2015, 4:10am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/23 "2015-02-13T04:10:17Z")

</div>

We used this thin film map just yesterday to add extra realism to a CU of an old plaster type picture frame. The frame is the really ornate type, painted gold. Took a pretty complex shader flow graph to get it to look the way I wanted it. The thin film was used in screen mode on top of the reflection channel of the base layer (in a composite map). Then we VRayBlended some VRayFlakes on top, which turned out great. Client was blown away by the subtle color variations.

So, thanks, Vlado!

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [February 13, 2015, 8:01am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/24 "2015-02-13T08:01:20Z")

</div>

Nice! I’m glad this came in useful 🙂

Best regards,  
Vlado

---

<div class="post-metadata">

**Author:** ![Art48](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Art48](https://forums.chaos.com/u/Art48)\
**Post date:** [February 13, 2015, 9:23am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/25 "2015-02-13T09:23:19Z")

</div>

Ah, good idea on the screen mode composite map. It’s still magic to me how this works 😛

---

<div class="post-metadata">

**Author:** ![Joelaff](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/joelaff/32/71647_2.png) [@Joelaff](https://forums.chaos.com/u/Joelaff)\
**Post date:** [February 14, 2015, 4:24am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/26 "2015-02-14T04:24:34Z")

</div>

> [@VRayCam EV settings](https://forums.chaos.com/t/vraycam-ev-settings/46615/2):
>
> Ah, good idea on the screen mode composite map. It’s still magic to me how this works 😛

I dunno if that is the ideal way to use it, but it worked nicely for my purpose, and renders faster than a whole second material with a blend. My surface is already slow enough with VRayFlakes as a second material blended 😛

---

<div class="post-metadata">

**Author:** ![R2J2](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/r2j2/32/61464_2.png) [@R2J2](https://forums.chaos.com/u/R2J2)\
**Post date:** [February 15, 2015, 7:33am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/27 "2015-02-15T07:33:46Z")

</div>

I desaturated and played with the hue a bit so I’m not sure how accurate this is but it’s an awesome shader.

 ![thinFilmOSL_ottoman.jpg](https://europe1.discourse-cdn.com/chaosprd/original/3X/e/c/ec7e6492bc7bb78022ce9b2715160e15183689be.jpeg)

---

<div class="post-metadata">

**Author:** ![zeronovestudio](https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/32.png) [@zeronovestudio](https://forums.chaos.com/u/zeronovestudio)\
**Post date:** [February 15, 2015, 4:26pm UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/28 "2015-02-15T16:26:23Z")

</div>

I would like to test this OSL shader but it crashes max 2011 every time I try to load it! …any idea? …is it supposed to work with older releases?  
PS the same happens with the other OSL (AFMFresnel)

---

<div class="post-metadata">

**Author:** ![Joelaff](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/joelaff/32/71647_2.png) [@Joelaff](https://forums.chaos.com/u/Joelaff)\
**Post date:** [February 15, 2015, 4:42pm UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/29 "2015-02-15T16:42:16Z")

</div>

Looking nice!

In the past we would achieve somewhat similar results with Tri planar falloff maps of different colors. More artist control, I guess, but more of a pain, and not accurate (though I don’t know how accurate this is after you tweak it).

LightWave has had a thin film shader for twenty years, and it was fun to play with. This one is much easier to use in production.

---

<div class="post-metadata">

**Author:** ![Morbid\_Angel](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/morbid_angel/32/21272_2.png) [@Morbid\_Angel](https://forums.chaos.com/u/Morbid_Angel)\
**Post date:** [February 24, 2015, 10:52pm UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/30 "2015-02-24T22:52:34Z")

</div>

nvm got it to work, but only as osl texture in reflection map mode.

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [February 25, 2015, 1:24am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/31 "2015-02-25T01:24:37Z")

</div>

that’s how it ought to be used.  
Make sure you turn fresnel off, as it’s got its own one!

---

<div class="post-metadata">

**Author:** ![Morbid\_Angel](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/morbid_angel/32/21272_2.png) [@Morbid\_Angel](https://forums.chaos.com/u/Morbid_Angel)\
**Post date:** [February 25, 2015, 3:04am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/32 "2015-02-25T03:04:52Z")

</div>

makes sense…that’s why I had to crank the shader fresnel! I’ll correct it tomorrow.

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [February 25, 2015, 4:27am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/33 "2015-02-25T04:27:00Z")

</div>

lol! yeas, that’d make sense!  
You can wire me a few hundred bucks at your own leisure 😉

---

<div class="post-metadata">

**Author:** ![Fredrik\_Averpil](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/fredrik_averpil/32/35925_2.png) [@Fredrik\_Averpil](https://forums.chaos.com/u/Fredrik_Averpil)\
**Post date:** [February 27, 2015, 10:31am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/34 "2015-02-27T10:31:11Z")

</div>

Wow!

Simon, who sits next to me in our office saw this and downloaded, gave it a test run … and wow, just wow!  
Thanks so much for sharing!

---

<div class="post-metadata">

**Author:** ![Fredrik\_Averpil](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/fredrik_averpil/32/35925_2.png) [@Fredrik\_Averpil](https://forums.chaos.com/u/Fredrik_Averpil)\
**Post date:** [February 27, 2015, 10:34am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/35 "2015-02-27T10:34:48Z")

</div>

By the way - I totally missed this just because you’re posting this in a max sub-forum. God knows how much goodies I’ve missed because of this (being a Maya user) … 😉

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [February 27, 2015, 10:58am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/36 "2015-02-27T10:58:15Z")

</div>

A particular use of the iridescence shader, coupled with a flakes normal texture, in a blend material, to generate a carpaint with iridescent flakes.  
Scene and shaders are attached, just grab yourself an HDRI in place of mine.

 ![carpaint_OSLTex-based.jpg](https://europe1.discourse-cdn.com/chaosprd/original/3X/5/f/5f89521025563a5ded76729768ca30a8fd3aa02a.jpeg)  
 ![carpaint_OSLTex-based_FLAKES.jpg](https://europe1.discourse-cdn.com/chaosprd/original/3X/b/7/b7d35afa8b800b0d78f0f233356b9047c59fbcb7.jpeg)  
[OSL\_carPaint\_with\_iridescence.zip](https://forums.chaos.com/uploads/short-url/moi8gQEqL6SpfkqKnM44Xp2tjrU.zip) (30 KB)

---

<div class="post-metadata">

**Author:** ![\_Lele](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/_lele/32/49986_2.png) [@\_Lele](https://forums.chaos.com/u/_Lele)\
**Post date:** [February 27, 2015, 11:36am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/37 "2015-02-27T11:36:54Z")

</div>

And a slightly tweaked, less pronounced, shader (chiefly, i changed each layer’s influence, and the flakes’ normals orientation variance).

A word of notice: you WILL need many AA Rays AND a **reconstructive** filter on the rendered image to make sure the flakes won’t shimmer in an animation.  
This is a need forced by the fact that the flakes map does no filtering on its own, so we have to burden VRay with it.  
This last one was rendered with a fixed-12 and a sharp quadratic filter.

EDIT: made a mistake earlier. Corrected now, max 2014 scene added, along with the flakes OSL shader with descriptions for each spinner.

 ![carpaint_OSLTex-based_B.jpg](https://europe1.discourse-cdn.com/chaosprd/original/3X/0/2/02a46399b41344b44b2c7cf946746ef7324af29b.jpeg)  
 ![carpaint_OSLTex-based_FLAKES_B.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/4/0/40c2d1e5742751d161bee27c9770345b50f6c91f.png)  
[OSL\_carPaint\_with\_iridescence\_B.zip](https://forums.chaos.com/uploads/short-url/nqG2hMSgXFATxTffc1X8lv1yC39.zip) (28.4 KB)

---

<div class="post-metadata">

**Author:** ![Joelaff](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/joelaff/32/71647_2.png) [@Joelaff](https://forums.chaos.com/u/Joelaff)\
**Post date:** [February 28, 2015, 1:09am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/38 "2015-02-28T01:09:03Z")

</div>

Cool, Lele!

---

<div class="post-metadata">

**Author:** ![pg1](https://avatars.discourse-cdn.com/v4/letter/p/ac8455/32.png) [@pg1](https://forums.chaos.com/u/pg1)\
**Post date:** [June 2, 2015, 6:17am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/39 "2015-06-02T06:17:00Z")

</div>

Seems to broken on 2015?

I get this error  
In the material compiler output  
Could not compile shader J:\Jobs\46761M\_Mazda2Headlight\_CP\3d\Projects\Maps\irridescence.osl (OSL to OSO)

---

<div class="post-metadata">

**Author:** ![Morbid\_Angel](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/morbid_angel/32/21272_2.png) [@Morbid\_Angel](https://forums.chaos.com/u/Morbid_Angel)\
**Post date:** [June 20, 2015, 1:10am UTC](https://forums.chaos.com/t/thin-film-osl-shader/52567/40 "2015-06-20T01:10:39Z")

</div>

> [@On another topic](https://forums.chaos.com/t/47697/2):
>
> Seems to broken on 2015?
> 
> I get this error  
> In the material compiler output  
> Could not compile shader J:\Jobs\46761M\_Mazda2Headlight\_CP\3d\Projects\Maps\irridescence.osl (OSL to OSO)

yup same here…any ideas?

[Previous page](https://forums.chaos.com/t/thin-film-osl-shader/52567.md?page=1)

[Next page](https://forums.chaos.com/t/thin-film-osl-shader/52567.md?page=3)
