Last year, at Blender conference, I’ve show Layered Shading for Physically Correct Materials made of layers or coating, like Car Paint, Polished Nails, Carbon Fiber, etc.
I’ve wrote a very simple OSL Shader to do it, and I’m using it for near every of my projects. It’s now time to release it!
Why now?
Just because NVIDIA / MentalRay annonced MILA, the Physically correct Layer solution for Mental Ray.
MILA is incredibly close to what I’ve done with PYLA, using Cycles and OSL!!! And I wouldn’t let Blender Users do not having features available in MentalRay!
PYLA is in version 1.0, and it still needs some enhancement.
Currently, it could be slow if you use a lot of layers. It doesn’t support tranparency or refractive layers. There is nothing for diffractive layer (irisation).
But it is very simple to use and it works very well ! It’s a very short and very effective script.
here is a little video (using some other OSL shaders soon to be released…) :
Thanks for sharing too Youpi3D,
Cycle est vraiment excellent, n’est ce pas?
Dommage qu’il soit encore un peu lent mais ça va s’arranger…:yes::yes:
Spirou4D
It seems that I have to apologize to Youpi3D. The PYLA shader is not as taxing as I thought. OSL is the culprit here. Just enabling OSL makes the scene render up to 5 times slower when compared to rendering with OSL disabled.
Hi Youpi,
thanks a lot for your osl script
I can confirm that just activating OSL without using it makes redering about 4-5 times slower. Is it normal ?
@DingTo Slower would be normal if I was actually using it, but it’s just activated and I’ve no OSL Node in my file. Is the OSL code filling the CPU cache and taking the place away for the scene data making each CPU work only with the RAM ? Maybe the code could only be activated for tiles where an OSL node is detected (maybe a bit longer to dynamically load it, but on 2000 tiles with a 4-5 time slower factor, losing some microsecondes for a 100 tiles is not a big deal)? Just a question, I’m really bad in programming, sorry if I just say nonsense.
matali : the slowdown is probably caused by image textures. I made some tests replacing image texture nodes with rgb nodes and the rendering times dropped dramatically:
DingTo told me that OSL uses the texture filtering code of OIIO (better but slower). Maybe you can try the same experiment and see if it is the same problem.
@RC Tested on a glossy cube with a diffuse plane (no osl nodes) :
Textures + OSL:1 = 0:0:29
Textures + OSL:0 = 0:1:14
RGB + OSL:1 = 0:0:35
RGB + OSL:0 = 0:0:23
Conclusion : image texture and OSL are the problem for me too in this test, but Cycles with OSL enabled already needs about 50% more time, even without a single OSL node.
I’ve been looking at this thread for a little while now, and I have to say, this shader seems to me like it’s an excellent example of what can be done in OSL.
In fact, I went ahead to see if I could copy it with the SVM system and I got this result (it may not be quite as fancy in terms of available options judging from your blog article, but it seems to work quite well and is designed in a way to add as many layers as you need).