Hidden OSL Closures?

So How many people are aware of all the closures that CYCLES makes available?

For reference, lets just say I’m only talking about blender 3.5.x…

The documentation at docs.blender.org clearly state that, “The available closures in Cycles correspond to the shader nodes and their sockets”. Shortly after it lists the available closures as

"BSDF

  • diffuse(N)
  • oren_nayar(N, roughness)
  • diffuse_ramp(N, colors[8])
  • phong_ramp(N, exponent, colors[8])
  • diffuse_toon(N, size, smooth)
  • glossy_toon(N, size, smooth)
  • translucent(N)
  • reflection(N)
  • refraction(N, ior)
  • transparent()
  • microfacet_ggx(N, roughness)
  • microfacet_ggx_aniso(N, T, ax, ay)
  • microfacet_ggx_refraction(N, roughness, ior)
  • microfacet_beckmann(N, roughness)
  • microfacet_beckmann_aniso(N, T, ax, ay)
  • microfacet_beckmann_refraction(N, roughness, ior)
  • ashikhmin_shirley(N, T, ax, ay)
  • ashikhmin_velvet(N, roughness)

Hair

  • hair_reflection(N, roughnessu, roughnessv, T, offset)
  • hair_transmission(N, roughnessu, roughnessv, T, offset)
  • principled_hair(N, absorption, roughness, radial_roughness, coat, offset, IOR)

BSSRDF

  • bssrdf_cubic(N, radius, texture_blur, sharpness)
  • bssrdf_gaussian(N, radius, texture_blur)

Volume

  • henyey_greenstein(g)
  • absorption()

Other

  • emission()
  • ambient_occlusion()
  • holdout()
  • background()"

However, recently while I was looking through the source code it very quickly became clear that this is not true, there is at least a handful of undocumented closures!

My question is this, How many people know about this? am I just late to the party and this is old news? Its hard for me to imagine that I just uncovered such a shader-writers-goldmine as this… and yet a Google search for 'blender undocumented cycles osl closures" returns no relevant information…

Most likely the documentation is not updated. Maybe try the devtalk.blender.org/ or https://blender.chat/channel/blender-coders

Actually… i think the OSL part was always somekind of “neglected”… and the word of choice is also a bit unfortunate…

…and not

The available closures of OSL in blender is…

…because this a bit un–

–ed:wink:

Also there are only these modules nowadays…

Features

Module Topics
EEVEE & Viewport EEVEE, workbench, overlays, GPU, OpenGL, Vulkan, Metal, multi-view, virtual reality
Render & Cycles Cycles, render pipeline, materisl, textures, Freestyle, baking and color management

…i don’t even know who is “in charge” of OSL ??

So… :
:+1:
…for looking into the source code.

1 Like

The extra OSL Closures are included in Blender mainly because they are part of the OSL Specifications (Chapter 7.10).

Those are:

  • oren_nayar_diffuse_bsdf
  • burley_diffuse_bsdf
  • dieletric_bsdf
  • conductor_bsdf
  • generalized_schlick_bsdf
  • translucent_bsdf
  • transparent_bsdf
  • subsurface_bssrdf
  • sheen_bsdf
  • anisotropic_vdf (volumetric)
  • medium_vdf (volumetric)
  • uniform_edf (emission)
  • hair_transmission ( not part of OSL specs )
  • hair_chiang ( not part of OSL specs )
  • hair_huang ( not part of OSL specs )

and also:

  • layer
  • holdout
  • debug

And Cycles still includes some ‘deprecated’ Closures (some already gone in OSL 1.12, the others will be in OSL 2.0):

  • diffuse
  • diffuse_ramp
  • phong
  • phong_ramp
  • oren_nayar
  • ward
  • microfacet
  • reflection
  • refraction
  • transparent
  • translucent
  • isotropic (volumetric)
  • henyey_greenstein (volumetric)
  • absorption (volumetric)
  • emission (emission!)
  • background (emission)
2 Likes