AOVs Setting

Here we set multiple AOVs as rendering outputs. Each AOV needs its own framebuffer, and provides an output.

AOVs do not require a completely separate render pass for each, but do add a small amount of render time and, of course, use more framebuffer memory. Experiment with the various AOV types and see the different outputs which may be useful for debugging or compositing.

// Create framebuffer to store rendering result
rpr_framebuffer_desc desc = { 800,600 };

// 4 component 32-bit float value each
rpr_framebuffer_format fmt = { 4, RPR_COMPONENT_TYPE_FLOAT32 };
rpr_framebuffer frame_buffer = nullptr;
rpr_framebuffer frame_buffer_resolved = nullptr;
rpr_framebuffer frame_buffer2 = nullptr;
rpr_framebuffer frame_buffer2_resolved = nullptr;
CHECK(rprContextCreateFrameBuffer(context, fmt, &desc, &frame_buffer));
CHECK( rprContextCreateFrameBuffer(context, fmt, &desc, &frame_buffer_resolved) );
CHECK(rprContextCreateFrameBuffer(context, fmt, &desc, &frame_buffer2));
CHECK(rprContextCreateFrameBuffer(context, fmt, &desc, &frame_buffer2_resolved));

// Clear framebuffer to black color
CHECK(rprFrameBufferClear(frame_buffer));
CHECK(rprFrameBufferClear(frame_buffer2));

// Set framebuffer for the context.
CHECK(rprContextSetAOV(context, RPR_AOV_COLOR, frame_buffer));

// Select the desired AOV for frame_buffer2
CHECK(rprContextSetAOV(context, RPR_AOV_SHADING_NORMAL, frame_buffer2));
//CHECK(rprContextSetAOV(context, RPR_AOV_WORLD_COORDINATE, frame_buffer2));
//CHECK(rprContextSetAOV(context, RPR_AOV_DEPTH, frame_buffer2));
//CHECK(rprContextSetAOV(context, RPR_AOV_OBJECT_ID, frame_buffer2));

See full code