Single-sided rendering
Most renderers use back-face culling to improve performance. However when meshes are cut open with cut planes, users will often look at the back side of triangles. If those triangles are culled away, the result does not look convincing.
The way to reliably prevent this problem, is to render triangles double-sided. As not using back-face culling has performance implications, by default Azure Remote Rendering only switches to double-sided rendering for meshes that are intersecting with a cut plane.
The single-sided rendering setting allows you to customize this behavior.
Caution
The single-sided rendering setting is an experimental feature. It may get removed again in the future. Please don't change the default setting, unless it really solves a critical problem in your application.
Prerequisites
The single-sided rendering setting only has an effect for meshes that have been converted with the opaqueMaterialDefaultSidedness
option set to SingleSided
. By default this option is set to DoubleSided
.
Single-sided rendering setting
There are three different modes:
Normal: In this mode, meshes are always rendered as they are converted. That means meshes converted with opaqueMaterialDefaultSidedness
set to SingleSided
will always get rendered with back-face culling enabled, even when they intersect a cut plane.
DynamicDoubleSiding: In this mode, when a cut plane intersects a mesh, it is automatically switched to double-sided rendering. This mode is the default mode.
AlwaysDoubleSided: Forces all single-sided geometry to be rendered double-sided at all times. This mode is mostly exposed so you can easily compare the performance impact between single-sided and double-sided rendering.
Changing the single-sided rendering settings can be done as follows:
void ChangeSingleSidedRendering(RenderingSession session)
{
SingleSidedSettings settings = session.Connection.SingleSidedSettings;
// Single-sided geometry is rendered as is
settings.Mode = SingleSidedMode.Normal;
// Single-sided geometry is always rendered double-sided
settings.Mode = SingleSidedMode.AlwaysDoubleSided;
}
void ChangeSingleSidedRendering(ApiHandle<RenderingSession> session)
{
ApiHandle<SingleSidedSettings> settings = session->Connection()->GetSingleSidedSettings();
// Single-sided geometry is rendered as is
settings->SetMode(SingleSidedMode::Normal);
// Single-sided geometry is always rendered double-sided
settings->SetMode(SingleSidedMode::AlwaysDoubleSided);
}