How about a single sheet scattering material, which simulates scattering of light with single sided geometry (like leaves) I feel that the current 2sided mtl can be better with support of sss, I mean it works fine but at ilm we had to do all kinds of tricks with real sss ontop of it to make it look good and its a pain in the ass a bit, and also 2sided mtl does not have a render element..
The archglass looks really cool but I’m struggling to understand a key concept
This shader allows you to simulate full window glass geometry with only one plane
Can this shader be used on a pane of glass that actually has a thickness? Would I be correct in assuming this would be achieved by setting both “VRay IOR Out and VRay IOR Glass” to 1.550.
Currently VRay IOR Out set to 1 which I think is why it is supposed to be used on a plane without a thickness?
Sorry for the double post, but Vlado, is there a difference between how Max and Maya interpret OSL shaders? It seems no normal map works with this particular glass OSL shader in Maya. I’m assuming it’s to do with the code itself, in that Max is Z up and Maya is Y up?
If anyone else could give me a pointer on where to start editing to fix this, I’d be happy experimenting with the code to get this working in Maya - it’s an awesome glass shader!
No, I’ve measured the values from 1, 2 and 3 panes of glass and fitted reflection and refraction curves to match them. When using more than one face/side of geo the calculations won’t work anymore and you’d get unexpected results. : )
The reason for this is that it’s pretty hard to get values right if you’re using only a plane as your geo for speed. Raytracing two or three actual panes of glass would be much slower.
IOR out would be the IOR of air usually (outside of the glass). You could for example simulate window glass under water (IOR 1.333) as well if you’d ever want to… probably not though hehe. Setting both to 1.55 would effectively cancel out any reflection.
Thanks for the shaders, Rens. I wanted to try the Arch Glass OSL shader but I get errors when I load it. Please see below. I’m using Max 2016 SP3 with Vray 3.40.02
[B][COLOR="#FF0000"]error: Input file "D:\Downloads\OSL shaders\OSL – ArchGlass\archGlass_mat_v002.osl" not found
Could not compile shader D:\Downloads\OSL shaders\OSL – ArchGlass\archGlass_mat_v002.osl (OSL to OSO)[/COLOR][/B]
That worked! Why would that be a problem though? I tried another OSL shader from Rens called Mix Normal Maps and it works fine in a folder with spaces.
It might not be the spaces as such, but some other character like the dash character ‘-’ which is maybe is a Unicode character and not plain ASCII… or something like that.
THanks for the shader and explanation rens. This is incredibly useful on projects where the architects give us sketchup models that have glass that is not thick! Massive timesaver!
If I try rendering with RT I get an error - “Error during V-Ray RT initialization in stage 2!”
and if I render with production I get a finished render except max hangs after the render is completed
No error readout in the VrayOSLMtl node…
I have double checked that i have rhfunctions.h in the same folder and the path contains no spaces…
Hey Rens,
I have a request for ya. You have several Fresnel implementations, each based I believe on viewing angle. It would be great if you could write an OSL Fresnel calculated per microfacet, rather than viewing angle, as described here (page 10-12). As you can see in the images, this is important for avoiding over-bright highlights as well as dark areas at glancing angles.
This is not possible in OSL; it must be supported in the BRDFs provided by the renderer. This will be implemented in the next SP of V-Ray, but in the meantime you can use the alSurface material here: https://github.com/ChaosGroup/vray\_al\_surface/releases
There is also a conceptual problem with OSL regarding this. Glossy Fresnel not only determines how a BRDF reacts to light, but its “transparency” as well (how it is combined with other BRDFs below it). OSL has no way for closures to return this transparency so it must be computed in another way, potentially duplicating the work done by the BRDF.
Thanks for the explanation. Some followup questions:
1) The only OSL brdf that has Fresnel currently is the microfacet_ggx (the eta parameter). Is it correct that this currently is not using per microfacet Fresnel, but will in the next SP?
2) Will a Fresnel term that uses per microfacet be added to the other brdf closures (for example to the vray_blinn) closure too?
3) In an energy conserving shader the diffuse transmission would be attenuated by the fresnel transmission of the specular/reflection. So in psuedo code: diffuseColor *= (1.0 - specColor)
This works if the specColor is multiplied with the Fresnel, but if the Fresnel is built into the brdf, how would one keep the shader energy conserving when combining closures?
2) Will a Fresnel term that uses per microfacet be added to the other brdf closures (for example to the vray_blinn) closure too?Yes.
3) In an energy conserving shader the diffuse transmission would be attenuated by the fresnel transmission of the specular/reflection. So in psuedo code: diffuseColor *= (1.0 - specColor)
This works if the specColor is multiplied with the Fresnel, but if the Fresnel is built into the brdf, how would one keep the shader energy conserving when combining closures?I have no idea. Like I said above, this is an oversight in OSL. You can ask on the OSL Google group and see if there is a recommended approach.
You could do the energy preservation but you’ll have to duplicate the Fresnel work done inside the closure as Vlado warned earlier.
You do the Fresnel term math (hopefully matching that of the microfacet_ggx) and figure out the reflection weight.
Then apply it only to the diffuse/refractive closure below: