Stefan Zellmann edited this page Nov 24, 2015 · 9 revisions

Visionaray is a cross-platform ray tracing framework.

Note that the current version of Visionaray is an early preview. At this stage, the framework, including the API, are likely to undergo frequent changes.

The basic building blocks of a Visionaray application are kernels and schedulers.

Kernels describe the control flow of a single ray or a packet of rays (i.e. a group of rays that form a logical group to exploit memory coherence). Schedulers execute kernels e.g. on a CPU using multi-threading or on a GPU using a compute SDK like NVIDIA CUDA.

The following block of code shows what a "Hello World" Visionaray application looks like.

// Visionaray's main namespace.
using namespace visionaray;

// Define some convenience types.
typedef basic_ray<float>       ray_type;
typedef simple_sched<ray_type> sched_type;
typedef vector<4, float>       color_type;

// Scheduler instance, probably a class member
// in a real-world example.
sched_type sched;
auto sparams = make_sched_params(
    camera,
    render_target
    );

// In this example, the kernel is passed to the
// scheduler as a lambda. It specifies the code
// path that a single ray or a ray packet executes.
sched.frame([=](ray_type r) -> color_type
{
    return color_type(1.0, 1.0, 1.0, 1.0);
},
sparams);

The way that a kernel is executed depends on the way the specific scheduler instance is implemented. Visionaray comes with a basic set of schedulers that execute kernels on a 2-D uniform grid and store their results in a storage region that corresponds to or imitates a frame buffer. In case that the builtin schedulers are not sufficient for her needs, the user can easily write custom schedulers that extend the functionality of Visionaray. Visionaray also comes with a set of predefined kernels for some of the most common ray tracing algorithms.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.