General Guidelines
3Delight supports all the required functions to properly run OSL shaders. That being said, the philosophy of writing OSL shaders for 3Delight differs very slightly from other renderers. In a nutshell, the 3Delight rendering core is organized so that OSL shaders can remain as abstract as possible. For example, it is discouraged (and indeed wrong) to use functions such as backfacing()
to write shaders. Also, some shadeops have seen their definition slightly changed to simplify shader writing or to allow 3Delight make a better job at sampling the final image.
Consider the following simplified "glass" shader and compare it to the "glass" shader distributed with OSL:
3Delight | Other Systems |
---|---|
surface glass [[ string help = "Simple dielectric material" ]] ( float Ks = 1, color Cs = 1, float eta = 1.5 ) { Ci = Ks * reflection(N, eta) + Cs * refraction(N, eta); } | surface glass [[ string help = "Simple dielectric material" ]] ( float Ks = 1, color Cs = 1, float eta = 1.5 ) { float _eta = backfacing() ? 1/eta : eta; Ci = Ks * reflection(N, _eta) + Cs * refraction(N, _eta); } |
As you can see, there are no fresnel terms and no backfacing()
call. 3Delight will take the proper decision, based on many factors including the fresnel factors, to properly sample the surface.
Supported Closures
3Delight supports all the most advanced closures. Some of the BRDF went through extensive research in order to extend them beyond the original specs. As an example, 3Delight's GTR can also model refractions, allowing to render realistic forested glass and other effects.
Closure | Description | Ray Types |
---|---|---|
microfacet – ggx | Models isotropic or anisotropic GGX BRDF. This model can handle reflection, refraction or both at the same time. | reflection, refraction, glossy |
microfacet – gtr | Models isotropic GTR BRDF. A "gamma" parameter can be supplied to control the "tail" of the highlight to model highly realistic materials. | reflection, refraction, glossy |
microfacet – cooktorrance | Models an anisotropic Cook-Torrance BRDF. | reflection, glossy |
microfacet – blinn | Models a Blinn specular BRDF | reflection, glossy |
oren_nayar | Models a diffuse reflector based on the Oren-Nayar model. | diffuse |
diffuse | Models a diffuse reflector. | |
reflection | Models a perfect reflector. Note that fresnel factor is automatically computed by 3Delight. If no fresnel component is wanted, one can pass 0 as the "eta" parameter. | reflection |
refraction | Models a refraction. Fresnel factor is included by 3Delight. | refraction |
hair | Models a Marschner BRDF for hair. Simulates the R, TT and TRT lobe as suitable for a monte carlo simulation. | reflection, refraction, glossy. |
Unified Budgeted Sampling
For the first time, a renderer provides only one sampling control for all the lighting components: specular, diffuse and light. By adjusting only one "Shading Samples" value, the artist can reduce noise without having to fiddle around with per-material or per-component sampling. 3Delight uses space varying heuristics to select the best element to sample (specular, diffuse, light) by respecting the total allotted rays budget.
For the anti-aliasing component, 3Delight provides a non-multiplicative "PixelSamples" control. This control is detached from the "Shading Samples" parameter so that artists can control shading quality and anti-aliasing quality independently.
The following simple renders illustre how "Shading Samples" control the various lighting elements all at once. The scene is mostly matte (diffuse) with a GGX material applied to the tall cube.
AA=2x2, Shading Samples = 16 | AA=2x2, Shading Samples = 64 | AA=2x2, Shading Samples 256 | AA=4x4, Shading Samples 256 | |
---|---|---|---|---|
Number of Rays | 12.7 millions | 48.7 millions | 191 millions | 194 millions |
Time | 6.5 seconds | 26.5 seconds | 100 seconds | 108 seconds |
Remarks | Draft render | Notice how diffuse, specular and shadows improve together. | High quality render with linear improvement among all lighting elements. | Increasing pixel samples do not affect |
A very important feature of the Unified Budget Sampling is that sampling quality is independent of the number of lights. Consider the following two renders. One is done using 3Delight the other is using PrMan.