OSL
The OSL Camera node is a scriptable node. You can create custom camera types for any purpose (such as VR warping) with OSL (Open Shader Language) scripts. It is a flexible camera used to match the rendering to the existing footage. OSL is a standard created by Sony Imageworks. To learn about the generic OSL standard, information is provided from the OSL Readme and PDF documentation. To load an OSL Camera, a Shader Editor node material needs to be created and then assign to the Camera Properties panel.
Figure 1: An OSL Camera node loaded into the Camera Properties
There are two options to add scripts for the OSL texture. The Internal option is available by opening another area in Blender® for the Text Editor, creating a new text, and writing the OSL script. The External option lets you to select a pre-coded OSL file from the File Explorer window.
You can create your own custom Camera using an OSL camera node. As a starting point, below is a basic OSL implementation of a Lens camera:
shader OslCamera(
float FocalLength = 1 [[ float min = 0.1, float max = 1000, float sliderexponent = 4]],
output point pos = 0,
output vector dir = 0,
output float tMax = 1.0/0.0)
{
float pa;
int res[2];
getattribute("camera:pixelaspect", pa);
getattribute("camera:resolution", res);
float u1 = 2 * (u - .5);
float v1 = 2 * (v - .5) * pa * res[1] / res[0];
pos = P;
vector right = cross(I, N);
dir = 2*FocalLength * I + v1 * N + u1 * right;
dir = transform("camera", "world", dir);
}
For a list of OSL variable declaration input/output types in the OSL Specification that OctaneRender® supports, refer to the Appendix topic on OSL Implementation in the OctaneRender® Standalone manual. To learn more about scripting within OctaneRender® using OSL, see to The Octane OSL Guide.