Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Consider the following simplified "glass" shader and compare it to the "glass" shader distributed with OSL:


3DelightOther Systems


Code Block
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);
}


Other Systems


Code Block
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. 

...

The following parameters are recognized recognised for the GGX and GTR micro-facet distributions:

ParameterDescriotionDescription
color realetaReal part of the index of refraction of the base layer.
color complexeetaImaginary part of the index of refraction the base layer.
Note that the pair (realeta, complexeeta) replaces the eta parameter. One can still use 'eta' to describe non-metallic surfaces.
float thinfilmthicknessThickness of the film on the surface. As an example, on metals, this corresponds to the thickness of the oxide.
float thinfilmetaThe index of refraction of the film. As an example, on metals, this corresponds to the index of refraction of the oxide.
float mediumetaIndex of refraction of the outside medium. Defaults to 1 (vacuum) if not specified. An example scenario where the this needs to be change: a varnish
float gammaPass this to the GTR closure to control the tail of the specular highlight. Setting this value to 2 renders a GGX distribution exactly.

...

Here is an example render of a steel sphere with a thin film of oxide ferum. It is rendered with varying roughness.


R=0.05R=0.1
Thin film interference caused by oxide ferum layer
R=0.2R=0.4
a


Arbitrary Output Variables

...

Info

Note that AOVs can be output in any node of the OSL tree.  If two different OSL nodes contribute to the specular_aov variable variable, 3Delight will correctly blend their contribution together in the final output and in the AOV.

...

A remnant of the RenderMan way of doing things is the 'lockgeom' parameter which hints of symbolic linking of data defined on the geometry to parameters defined in the shader. From our point of view, this is feature is useless, as-is, in the OSL world:

  • Symbolic linking is weak in that it is ill-defined : ; what happens if you have many parameters with the same name in an OSL network?
  • lockgeom can be elegantly implemented by a ... connection (explicit linking).  

...

Code Block
hair( dPdv, eta, absorption, sub-components , optional parameters );

Follows a description of each parameter of the hair closure:

...