Adding a Background
The RED::IViewpointRenderList
interface offer all the services to setup some background before rendering all data from all scenes it has to display. First there can be two types of backgrounds managed by the VRL:
Colored backgrounds, based on a simple clear color
Image backgrounds, based on HOOPS Luminate images being displayed first, before everything else in the VRL
The rendering of the background occurs at the first clear time, before any rendering operation in the VRL.
Color Based Background
By default, the background of a VRL is black. The color of the background is specified using RED::IViewpointRenderList::SetClearColor
. Associated to this, the background depth is specified by RED::IViewpointRenderList::SetClearDepth
. The default clear depth is 1.0, which is standard for a framebuffer.
The clear depth is reused twice after the initial clear, before the scene camera list is rendered and finally before the front camera list is rendered. The depth buffer is not cleared again if there’s no viewpoint to draw after the clear operation. For instance, we don’t clear after the RED::VST_SCENE
list of cameras if we have no cameras in the RED::VST_FRONT
list.
Clear color is clamped to the buffer format storage limits. For instance, in a HDR format VRL, the clear color can be any positive or negative floating point value. In a RGBA 8 bits color buffer, each clear color component will be clamped to [ 0, 255 ].
Clear depth ranges between [ 0.0f, 1.0f ].
Image Based Background
Background images can be specified using RED::IViewpointRenderList::SetBackgroundImages
. HOOPS Luminate can simultaneously manage two background images:
A 2D image: This image is displayed when seen through direct rays (e.g. a ray starting from the camera eye going toward the scene)
A cube image: This image is displayed when seen through indirect rays (e.g. after a ray-tracer reflection or refraction bounce)
If there’s no 2D image, the cube image is also seen for direct rays.
Mixed 2D / 3D backgrounds are often used in the architectural market for ‘on site’ insertion of virtual 3D models into 2D photographs.
Practical Background Setup
Please refer to this tutorial: Background Setup: A CAD Style Example for an example of CAD style gradient background setup.