Skip to content

Engine → Renderer

render_settings.h

What the project and scene layers resolve, one member per render_settings_group (92 bytes). Not engine_config.h's rendering_settings, which holds the backend and validation choices.

Structs

File Description
anti_aliasing_settings Anti-aliasing settings for every view the renderer draws: msaaSampleCount is the sample count of the HDR, depth and normal targets; post is the filter for the tonemapped image before the screen sprites (views without post-processing skip it). The two are independent: either, both or neither can be on. The anti-aliasing group of render_settings (project.json "rendering.defaults.anti_aliasing", the scene's render_settings component, render_scene::antiAliasing) and the value of renderer::set_anti_aliasing, which overrides the scene's group while it is set (see the top of this header). 12 bytes, align 4: msaaSampleCount at 0, post at 4, three padding bytes, fxaaSubpixel at 8.
environment_settings The image-based lighting environment of the scene.
post_process_settings HDR chain settings: exposure, bloom and the tonemap operator. 36 bytes.
render_settings What the project and scene layers resolve, one member per render_settings_group (92 bytes). Not engine_config.h's rendering_settings, which holds the backend and validation choices.
render_settings_problem One problem of a "rendering.defaults" value: the slash path of the member ("rendering/defaults/ssao/radius") and what is wrong with it.
render_settings_reading What read_render_settings() found.
shadow_settings Shadow settings shared by every light and every view. 28 bytes.
ssao_settings GTAO settings. 16 bytes.

Classes

File Description
render_defaults The live project defaults (project.json "rendering.defaults"), for the engine to own and publish. Not synchronised: set() and get() belong to the main thread.

Enumerations

agx_look

enum class agx_look : u8 {
    DEFAULT = 0,
    GOLDEN,
    PUNCHY
};

The look of the AgX operator (tonemap_operator::AGX only): neutral, golden or punchy.

exposure_mode

enum class exposure_mode : u8 {
    AUTOMATIC = 0,
    MANUAL
};

post_anti_aliasing

enum class post_anti_aliasing : u8 {
    NONE = 0,
    FXAA
};

The edge filter to run on the tonemapped image of every view that post-processes (anti_aliasing_settings::post).

render_settings_group

enum class render_settings_group : u8 {
    POST_PROCESS = 0,
    SHADOWS,
    SSAO,
    ANTI_ALIASING,
    COUNT
};

The settings groups, in the order render_settings holds them. Each group is overridden as a whole by the scene component; the camera component overrides POST_PROCESS and SSAO only (shadows and anti-aliasing are shared by every view). COUNT is the number of groups, not a group.

tonemap_operator

enum class tonemap_operator : u8 {
    ACES_FITTED = 0,
    REINHARD_EXTENDED,
    AGX,
    NONE
};

view_settings_override_flags

enum class view_settings_override_flags : u8 {
    NONE = 0,
    POST_PROCESS = 1 << 0,
    SSAO = 1 << 1
};

The groups a view replaces with its own values instead of the scene's (render_view::settingsOverride). Bit 2 is kept free for a later group.

Constants

Name Type Value Description
MAX_ADAPTATION_SPEED inline constexpr f32 100.0f
MAX_BLOOM_INTENSITY inline constexpr f32 1.0f
MAX_CASTER_PADDING inline constexpr f32 1000.0f
MAX_EV100 inline constexpr f32 24.0f
MAX_EXPOSURE_COMPENSATION inline constexpr f32 10.0f
MAX_MSAA_SAMPLE_COUNT inline constexpr u32 8
MAX_REINHARD_WHITE_POINT inline constexpr f32 100.0f
MAX_SHADOW_DISTANCE inline constexpr f32 10000.0f
MAX_SHADOW_FILTER_TEXELS inline constexpr f32 8.0f
MAX_SSAO_INTENSITY inline constexpr f32 8.0f
MAX_SSAO_RADIUS inline constexpr f32 10.0f
MIN_EV100 inline constexpr f32 -16.0f
MIN_REINHARD_WHITE_POINT inline constexpr f32 1.0f
MIN_SHADOW_DISTANCE inline constexpr f32 1.0f
MIN_SSAO_RADIUS inline constexpr f32 0.05f

Macros

CONJURE_ENUM_FLAGS

CONJURE_ENUM_FLAGS(view_settings_override_flags)

CONJURE_REFLECT_ENUM

CONJURE_REFLECT_ENUM(conjure::renderer::shadow_filter, "conjure.renderer.shadow_filter", DEFAULT, HARD, PCF, PCSS)

CONJURE_REFLECT_STRUCT

CONJURE_REFLECT_STRUCT(conjure::renderer::post_process_settings, "conjure.renderer.post_process_settings", CONJURE_FIELD(manualEv100, .min = conjure::renderer::MIN_EV100, .max = conjure::renderer::MAX_EV100, .tooltip = "EV100 (exposure value at ISO 100) of the scene; manual exposure only"), CONJURE_FIELD(exposureCompensation, .min = -conjure::renderer::MAX_EXPOSURE_COMPENSATION, .max = conjure::renderer::MAX_EXPOSURE_COMPENSATION, .tooltip = "EV added to the exposure in both modes"), CONJURE_FIELD(adaptationSpeedUp, .min = 0.0, .max = conjure::renderer::MAX_ADAPTATION_SPEED, .tooltip = "Per second: how fast automatic exposure adapts to a brighter scene"), CONJURE_FIELD(adaptationSpeedDown, .min = 0.0, .max = conjure::renderer::MAX_ADAPTATION_SPEED, .tooltip = "Per second: how fast automatic exposure adapts to a darker scene"), CONJURE_FIELD(minEv100, .min = conjure::renderer::MIN_EV100, .max = conjure::renderer::MAX_EV100, .tooltip = "EV100 (exposure value at ISO 100): the lowest automatic exposure"), CONJURE_FIELD(maxEv100, .min = conjure::renderer::MIN_EV100, .max = conjure::renderer::MAX_EV100, .tooltip = "EV100 (exposure value at ISO 100): the highest automatic exposure, at least the lowest"), CONJURE_FIELD(bloomIntensity, .min = 0.0, .max = conjure::renderer::MAX_BLOOM_INTENSITY, .tooltip = "Unitless share of the bloom in the image"), CONJURE_FIELD(reinhardWhitePoint, .min = conjure::renderer::MIN_REINHARD_WHITE_POINT, .max = conjure::renderer::MAX_REINHARD_WHITE_POINT, .tooltip = "Linear luminance that maps to white (extended Reinhard only)"), CONJURE_FIELD(exposure, .tooltip = "Automatic (metered) or manual exposure"), CONJURE_FIELD(tonemap, .tooltip = "The operator that maps HDR to the display"), CONJURE_FIELD(agxLook, .tooltip = "The look of the AgX operator"), CONJURE_FIELD(bloomEnabled, .tooltip = "Adds the glow around bright pixels"))

Functions

Public

effective_msaa_sample_count

[[nodiscard]] CONJURE_API u32 effective_msaa_sample_count(
    u32 requested,
    u32 supportedMask) noexcept;

The sample count a device can give for a request: the largest of 1, 2, 4 and 8 that is at most requested and whose bit is set in supportedMask (bit value = sample count, as rhi::device_capabilities::msaaSampleCounts); 1 for a request of 0 or 1, and when no larger count qualifies. A request above 8 is treated as 8. Bit 1 of the mask is not needed: 1 is always possible.

read_render_settings

[[nodiscard]] CONJURE_API render_settings_reading read_render_settings(
    const core::json::value &defaults);

Reads a project.json "rendering.defaults" value: an object with the optional members "post_process", "shadows", "ssao" and "anti_aliasing", each an object of snake_case keys (render_settings_to_json lists them all). Numbers must be finite and inside the field's range, whole for cascade_count; msaa_sample_count must be 1, 2, 4 or 8; booleans are true or false; enumerators are strings matched without regard to ASCII case. Never fails: a bad leaf keeps its engine default and is listed in errors, a group that is not an object keeps all its defaults, and max_ev100 below min_ev100 (after the leaves are read) puts both back to their defaults with one error at max_ev100 (at min_ev100 when only that key is present). Unknown keys are listed, never errors. A null or absent (invalid) value means engine defaults; any other non-object is an error at "rendering/defaults". The result always passes sanitise() unchanged.

render_setting_leaf_to_json

[[nodiscard]] CONJURE_API core::json::document render_setting_leaf_to_json(
    render_settings_group group,
    std::string_view camelField,
    const core::json::value &reflectedValue);

One leaf in project.json form, the edit payload of the project settings panel: the group's key holding one member, the field's snake_case key, with the value as reflection JSON gives it ("bloomIntensity", 0.06 gives {"post_process": {"bloom_intensity": 0.06}}). An enumerator string is written lower case; every other value, null included (a merge patch that removes the key), is copied as it is, and an invalid value is written as null. A group outside the enum or a field the group does not have asserts and gives an empty object.

render_settings_from_json

[[nodiscard]] CONJURE_API core::result<render_settings> render_settings_from_json(
    const core::json::value &defaults);

The strict form of read_render_settings(): the settings, or the first error as renderer_error::INVALID_SETTINGS with the message "<path>: <reason>". Unknown keys are not errors.

render_settings_to_json

[[nodiscard]] CONJURE_API core::json::document render_settings_to_json(
    const render_settings &settings);

Every field of every group in project.json form (snake_case keys, enumerators lower case), which read_render_settings() reads back to the same settings. An enumerator value outside its enum is written as its number, which the reader rejects.

sanitise

[[nodiscard]] CONJURE_API std::string_view sanitise(
    post_process_settings &value) noexcept;

Clamps every field of the group into its range: a NaN takes the field's default, an infinity the bound it passes, maxEv100 below minEv100 becomes minEv100 and an enumerator outside its enum takes the default one. Returns the project.json key of the first field it changed ("bloom_intensity", in declaration order), or "" when the value was already valid.

[[nodiscard]] CONJURE_API std::string_view sanitise(
    shadow_settings &value) noexcept;

As the post-process form; defaultFilter DEFAULT (a per-light choice) also becomes PCF, so it never survives.

[[nodiscard]] CONJURE_API std::string_view sanitise(
    ssao_settings &value) noexcept;

As the post-process form, for the SSAO group.

[[nodiscard]] CONJURE_API std::string_view sanitise(
    anti_aliasing_settings &value) noexcept;

As the post-process form, for anti-aliasing: msaaSampleCount is rounded down to 1, 2, 4 or 8 (0 becomes 1, anything above 8 becomes 8), fxaaSubpixel is clamped to [0, 1] (a NaN becomes 0.75, an infinity the bound it passes) and a post filter outside its enum becomes NONE. The names returned are the snake_case field names ("msaa_sample_count", "post", "fxaa_subpixel"). The count is not checked against a device: effective_msaa_sample_count() does that.

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    tonemap_operator value) noexcept;

The enumerator name of an operator ("ACES_FITTED").

[[nodiscard]] CONJURE_API std::string_view to_string(
    exposure_mode value) noexcept;

The enumerator name of an exposure mode ("AUTOMATIC").

[[nodiscard]] CONJURE_API std::string_view to_string(
    agx_look value) noexcept;

The enumerator name of an AgX look ("GOLDEN"); "DEFAULT" for values outside the enum.

[[nodiscard]] CONJURE_API std::string_view to_string(
    post_anti_aliasing value) noexcept;

The enumerator name of a post anti-aliasing filter ("FXAA"); "NONE" for values outside the enum.

[[nodiscard]] CONJURE_API std::string_view to_string(
    render_settings_group value) noexcept;

The project.json key of a group ("post_process", "shadows", "ssao", "anti_aliasing"); "" for COUNT and values outside the enum.