# An assortment of OSL shaders for your perusal

**URL:** <https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619>\
**Category:** General\
**Tags:** fresnel, osl\
**Created:** [May 23, 2016, 5:14pm UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619 "2016-05-23T17:14:40Z")\
**Posts on this page:** 10\
**Page:** 8

<div class="post-metadata">

**Author:** ![snivlem](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@snivlem](https://forums.chaos.com/u/snivlem)\
**Post date:** [October 20, 2016, 4:00am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/141 "2016-10-20T04:00:45Z")

</div>

Just about to send you a PM with a link to the scene. 😉

---

<div class="post-metadata">

**Author:** ![Mihail.Djurev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/mihail.djurev/32/71038_2.png) [@Mihail.Djurev](https://forums.chaos.com/u/Mihail.Djurev)\
**Post date:** [October 20, 2016, 11:22am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/142 "2016-10-20T11:22:28Z")

</div>

> [@vlado](#):
>
> Just about to send you a PM with a link to the scene. 😉

It seems that you are missing the “rhfunctions.h” file, which comes with the archglass shader. It seems to work fine if I add it beside the OSL file.

---

<div class="post-metadata">

**Author:** ![snivlem](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@snivlem](https://forums.chaos.com/u/snivlem)\
**Post date:** [October 20, 2016, 11:43am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/143 "2016-10-20T11:43:48Z")

</div>

I forgot to attach it in the upload but it is there on the disk. I didn’t make up that renderlog either, it came from that scene.

---

<div class="post-metadata">

**Author:** ![t.petrov](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@t.petrov](https://forums.chaos.com/u/t.petrov)\
**Post date:** [October 24, 2016, 11:22am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/144 "2016-10-24T11:22:19Z")

</div>

> [@DR Spawner refusing connection](https://forums.chaos.com/t/dr-spawner-refusing-connection/52757/3):
>
> Is this safe to ignore (maya) - using the archglass shader.

I think it is safe to ignore it. But if you can tell us the exact steps needed to get to this error it will be quite helpful.  
A ready made scene is not useful, because there we’ll see only the consequences of the bug, but won’t find how it had happened.

How are you creating the material and how are you manipulating the parameters/attributes? Do you use some scripts?

---

<div class="post-metadata">

**Author:** ![MANUEL\_MOUSIOL](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/manuel_mousiol/32/2905_2.png) [@MANUEL\_MOUSIOL](https://forums.chaos.com/u/MANUEL_MOUSIOL)\
**Post date:** [May 19, 2018, 12:33am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/145 "2018-05-19T00:33:38Z")

</div>

> [@Rens](#):
>
> **ArchGlass**  
> Simulate multi-paned window glass with only a single-sided plane! And also the first OSL material (not texture) of these.  
> An OSL shader for creating realistic glass window panes. Window reflections are amazingly complex; you get for one pane of glass reflections from the front, back, and scattering from inbetween, light gets absorbed and passed through to the other side only to be reflected back by the next pane of glass. This shader allows you to simulate full window glass geometry with only one plane. Useful for everything but close-ups.
> 
> **Links**  
> Page:  
> [OSL – ArchGlass – Rens Heeren](http://www.rensheeren.com/blog/osl-archglass/)  
> Download links:  
> [http://www.rensheeren.com/osl/archGlass\_mat\_v002.osl](http://www.rensheeren.com/osl/archGlass%5C_mat%5C_v002.osl)  
> [http://www.rensheeren.com/osl/rhfunctions.h](http://www.rensheeren.com/osl/rhfunctions.h)  
> Right-click and save both in the same folder, both are needed for the shader to work. Overwrite rhfunctions.h if asked.
> 
> **Features**  
> - Specify the amount of window panes (1-3).  
> - Absorbtion/tint colour.  
> - Reflective coating layer, for example a one-way mirror or high reflectance building glass.  
> - Dirt layer, like a layer of dust or sand on the outside.  
> - IOR of glass and surrounding medium (air usually).  
> - Normal map inputs for creating warped reflections for each pane separately.  
> - Supports ray traced refraction, transparency, and black opaque for the refraction/transmission.
> 
> **How to use**  
> – Create a VRay OSL _Material_.  
> – Load in the downloaded OSL shader.  
> – Set how many panes are in your window. Most modern windows in temperate and cooler climates have two panes for insulation.  
> – Optionally set a colour for the reflective coating if your window needs one.  
> – Same for the dirt. The colour is usually fine, you define how much dirt there is on top of the windows with the dirt amount input.  
> – Set the refraction mode, 1 – ray traced refraction, 2 – transparency, 3 – no refraction, just black, for mixing with a self-illuminated interior or to just have only the glass reflection.  
> – Normal map inputs need a normal map with RGB 0.5 0.5 1.0 as the ‘base’, meaning that there won’t be any normal difference with that colour.  
> – Apply to a one-sided plane object.

I know this thread is kind of old, but I just bumped into it and got excited about that glass shader.  
With vray next this doesnt seem to work.  
Get following message:  
\<buffer\>:264: error: function ‘microfacet\_ggx’ was not declared in this scope

Any idea if this is fixable?

---

<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:** [May 19, 2018, 4:41am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/146 "2018-05-19T04:41:19Z")

</div>

We’ll check it out, thanks for the report!

Best regards,  
Vlado

---

<div class="post-metadata">

**Author:** ![ikomitov](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ikomitov](https://forums.chaos.com/u/ikomitov)\
**Post date:** [May 19, 2018, 6:08pm UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/147 "2018-05-19T18:08:33Z")

</div>

Hi Manuel, V-Ray Next switched to OSL 1.8 which deprecated all specific microfacet\_NNN() functions in favor of the more generic microfacet(). I’ve patched the original code by Rens so that it compiles in Next as well.

Best regards,  
Ivan  
[archGlass\_mat\_v002.txt](https://forums.chaos.com/uploads/short-url/cDRdc2JBsuU2nGutd7AzKPblPsO.txt) (9.51 KB)

---

<div class="post-metadata">

**Author:** ![MANUEL\_MOUSIOL](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/manuel_mousiol/32/2905_2.png) [@MANUEL\_MOUSIOL](https://forums.chaos.com/u/MANUEL_MOUSIOL)\
**Post date:** [May 19, 2018, 7:23pm UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/148 "2018-05-19T19:23:11Z")

</div>

Great, thank you!  
I’ll try it out.

---

<div class="post-metadata">

**Author:** ![3d-laboratory](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/3d-laboratory/32/72830_2.png) [@3d-laboratory](https://forums.chaos.com/u/3d-laboratory)\
**Post date:** [August 24, 2019, 8:37am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/149 "2019-08-24T08:37:42Z")

</div>

Thank you ikomotov for editing the file.  
Ok, it loads without the error message now . But in the shader parameters nothing is visible. It renders the material on my workstation, but not on the render node in distributed rendering. Black where a window should be. (I copied the OSL file and the \*.h file to the render node Plugins folder). I seems I have to learn first, how to use and configure OSL shaders. I thing, this Arch\_glass shader is essential for windows reflections. Until now I distorted the things to be reflected in Photoshop and mapped this to a box. But if the windows reflect other parts of the model it doesn´t work of course.

---

<div class="post-metadata">

**Author:** ![dreidesign](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dreidesign](https://forums.chaos.com/u/dreidesign)\
**Post date:** [June 30, 2020, 10:37am UTC](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619/150 "2020-06-30T10:37:25Z")

</div>

Hey guys,  
I thought of hjacking this thread. I wanted to dive in a little bit into the whole osl shader thing. At the moment I wanted to create a possible BerconTile alternative as a pure osl shader.

I looked into the SimpleTiles osl, which comes with 3dsMax. But I struggle with the uvw mapping per tile. I would to have a proper uvw mapping per tile. Can anyone point me to maybe some tutorials or further stuff to read, which could help me in this regard?

[Previous page](https://forums.chaos.com/t/an-assortment-of-osl-shaders-for-your-perusal/58619.md?page=7)
