I'd like to implement a custom shader in OSL (Open Shading Language) to reproduce the Hapke reflectance model (it allows to visualize the opposition surge effect, visible on the moon for example).
I have seen that it has been done in some scientific papers (see paper references below). But when I try to reproduce it I face a problem: even if I can write the reflectance BRDF function in my script, the float value obtained from it is not sufficient to obtain a rendering. I also need to integrate it through all the incidence angle possible (see Rendering Equation).
This integral is usually done through the use of closures in Blender cycles, if I understood well. But only a few closures are available, such as Lambertian or Oren-Nayar (corresponding in OSL to the method diffuse(N)
). They would not fit my need, as Hapke's brdf function (f_r in the Rendering Equation) is dependent on the incidence angle and must be part of the integral, not multiplied afterwards to the integral result.
Do you know how I could create a custom closure in Blender Cycles? Knowing that I can have through nodes and drivers the input light incidence and the camera position.
If not, do you think I could use an existing closure to come close to the result I need?
Thanks in advance!
Paper references:
- J. Villa, J. W. McMahon, et I. A. Nesnas, « IMAGE RENDERING AND TERRAIN GENERATION OF PLANETARY SURFACES USING SOURCE-AVAILABLE TOOLS »
- L. Matthies et al., « Lunar Rover Localization Using Craters as Landmarks ».