Render passes configuration

Render passes allow to perform offsceen rendering into intermediate textures for use in the main pass rendering. All render passes are executed before the main pass in the order of declaration in the pass array in effect cfg.toml file. Each pass is configured by it's own TOML config file.

Global render pass settings

  • width - width of render pass attachments
  • height - height of render pass attachments
  • size_factor - attachment size as a scale of the main framebuffer size

3 cases of attachment sizes possible:

  1. explicit width and height, size_factor is ignored in this case for example width = 256, height = 256 for a shadow map

  2. proportional to main framebuffer, width and height are set to 0 here, and will be calculated as size_factor multiplied by main framebuffer width and height for example width = 0, height = 0, size_factor = 0.5 for quarter-size of the main framebuffer

  3. explicit width OR height, other dimension is proportional to the main framebuffer size, for example width = 0, height = 320 for morph offsets texture with a same aspect ratio as the main framebuffer

Attachments

Rander pass can contain multiple color attachments confugured as a color_attachment array of tables and a depth attachment confugured as a single entry in a depth_attachment array of tables.

Attachment Parameters:

  • format - pixel format, "r8", "rg8", "rgb8", "rgba8", "r16f", "rg16f", "rgba16f", "rgb10a2" for color attachments and "depth16", "depth24", "depth32f" for depth attachment

  • clear - array of up to 4 clear values in rgba order

  • start - render pass start behaviour, "dont_care" (attachment contains is undefined at the pass start), "clear" (attachment contains is cleared at the pass start), "load" (attachment contents is loaded from the previous frame)

  • finish - render pass finish behaviour, "discard" (no need to store pixels after pass finish), "save" (save pixels, to be read later by sampler or loaded in the next frame)

  • sampler - name of the texture sampler, which can be used by material shaders in other render passes

  • sampler_type - "none", "2D", "2DShadow"

Pipelines

Pipelines correspond to material shaders. They are configured as a pipeline array of tables. Each table entry have same format as material table from cfg.toml with an addition of a material name field. This allows attaching multiple pipelines to a single material.

Order of pipelines in the pipeline array define order of draw operations with those pipelines.

Last updated on