Page 1 of 1

Diffraction grating OSL Shader

Posted: Tue Dec 20, 2022 9:35 pm
by adzrozanski
Hi there, I am reposting this question here (I also made a thread for this under C4D plugins)

I am trying to create an OSL shader that simulates realistic diffraction grating - like you would find on CDs or holographic stickers. I would love help creating an OSL shader for this as I have very limited coding experience.

I have tried a lot of various approaches manually (without OSL shaders) to create the specific iridescent grating effect with some success, but unfortunately it is not accurate under all lighting conditions and breaks when viewed from certain angles. I have seen users of other 3D programs share diffraction grating OSL shaders, however they unfortunately don't work inside of Octane / C4D. I can share those OSL shaders if it would be a helpful jumping off point.

I imagine the OSL shader would plug into the "film" slot with black to white float values to control the effect.

Here are some examples of my faux grating effect I created using manual methods.

Any help would be greatly appreciated!

Thanks

Re: Diffraction grating OSL Shader

Posted: Wed Dec 21, 2022 8:08 am
by bepeg4d
Hi,
I have already answered you in the c4doctane forum section:
viewtopic.php?f=30&t=80972&p=420214#p420214

ciao,
Beppe