Files
test2/scripts/templates_osl/basic_camera.osl
Brecht Van Lommel 2167a65e11 Fix: OSL camera templates should not have copyright and license header
For consistency with other templates, these can be used in new code without
restrictions.
2025-06-04 19:24:52 +02:00

15 lines
437 B
Plaintext

/* A basic perspective camera. */
shader camera(float focal_length = 90.0,
output point position = 0.0,
output vector direction = 0.0,
output color throughput = 1.0)
{
vector sensor_size;
getattribute("cam:sensor_size", sensor_size);
point Pcam = camera_shader_raster_position() - point(0.5);
Pcam *= sensor_size / focal_length;
direction = normalize(vector(Pcam.x, Pcam.y, 1.0));
}