U3D
Open-source, cross-platform 2D and 3D game engine built in C++
Loading...
Searching...
No Matches
Auxiliary views

Auxiliary views are viewports assigned to a RenderSurface by calling its SetViewport() function. By default these will be rendered on each frame that the texture containing the surface is visible, and can be typically used to implement for example camera displays or reflections. The texture in question must have been created in rendertarget mode, see Texture's SetSize() function.

The viewport is not assigned directly to the texture because of cube map support: a renderable cube map has 6 render surfaces, and done this way, a different camera could be assigned to each.

A "backup texture" can be assigned to the rendertarget texture: because it is illegal to sample a texture that is also being simultaneously rendered to (in cases where the texture becomes "recursively" visible in the auxiliary view), the backup texture can be used to specify which texture should be used in place instead.

Rendering detailed auxiliary views can easily have a large performance impact. Some things you can do for optimization with the auxiliary view camera:

  • Set the far clip distance as small as possible.
  • Use viewmasks on the camera and the scene objects to only render some of the objects in the auxiliary view.
  • Use the camera's SetViewOverrideFlags() function to disable shadows, to disable occlusion, or force the lowest material quality.

The surface can also be configured to always update its viewports, or to only update when manually requested. See SetUpdateMode(). For example an editor widget showing a rendered texture might use either of those modes. Call QueueUpdate() to request a manual update of the surface on the current frame.