scimesh 0.3.2
Headless CPU-only 3D software renderer for scientific mesh visualization
Loading...
Searching...
No Matches
scimesh::RenderOptions Struct Reference

All settings that control rendering output. More...

#include <render_options.h>

Collaboration diagram for scimesh::RenderOptions:

Public Attributes

Output size
int width = 800
 Image width in pixels (default: 800).
 
int height = 600
 Image height in pixels (default: 600).
 
Shading
ShadingMode shading = ShadingMode::SMOOTH
 Shading mode (default: SMOOTH).
 
bool backface_culling = true
 Enable backface culling (default: true).
 
bool invert_normals = false
 Flip all surface normals (default: false).
 
Colors
Color background_color = WHITE
 Background color (default: opaque white).
 
Color default_color = DEFAULT_COLOR
 Default color for meshes without explicit vertex/face colors.
 
Wireframe
bool wireframe = false
 Draw triangle edges as lines (default: false).
 
Color wireframe_color = Color(0.0f, 0.0f, 0.0f, 1.0f)
 Color of the wireframe lines (default: black).
 
Anti-aliasing
int aa_samples = 1
 Anti-aliasing sample count (default: 1 = no AA).
 
Specular highlights
Color specular_color = Color(0.0f, 0.0f, 0.0f, 0.0f)
 Specular highlight color (default: transparent = no specular).
 
float shininess = 0.0f
 Shininess exponent (default: 0.0 = no specular).
 
Projection
ProjectionType projection = ProjectionType::PERSPECTIVE
 Projection type (default: PERSPECTIVE).
 
Lighting
std::vector< Lightlights
 List of light sources.
 
float ambient = 0.3f
 Ambient light level (default: 0.3).
 
Post-processing
float contrast = 1.0f
 Contrast adjustment (default: 1.0 = no change).
 
Clipping planes
std::vector< ClipPlaneclip_planes
 Optional clip planes for cross-section views.
 
Fog
bool fog_enabled = false
 Enable depth fog (default: false).
 
float fog_start = 0.0f
 Distance at which fog begins (in world units).
 
float fog_end = 1.0f
 Distance at which fog is fully opaque (in world units).
 
Color fog_color = TRANSPARENT_BLACK
 The color that distant objects fade into.
 
Threading
int threads = 0
 Number of render threads (default: 0 = auto-detect).
 
Screen-space ambient occlusion (SSAO)
bool ssao_enabled = false
 Enable SSAO (default: false).
 
float ssao_radius = 16.0f
 SSAO sample radius in pixels (default: 16).
 
float ssao_intensity = 0.8f
 SSAO darkening intensity (default: 0.8).
 
Clipping distances
float near_plane = 0.1f
 Near clipping plane distance (default: 0.1).
 
float far_plane = 10000.0f
 Far clipping plane distance (default: 10000.0).
 

Detailed Description

All settings that control rendering output.

Quick start

The defaults produce a reasonable result for most cases:

RenderOptions opts; // all defaults
opts.width = 1920;
opts.height = 1080; // Full HD output
All settings that control rendering output.
int height
Image height in pixels (default: 600).
int width
Image width in pixels (default: 800).

Adding lights

opts.lights.push_back(Light{Vec3(0,0,1), Color(1,1,1), 1.0f, true});
opts.ambient = 0.4f; // brighter ambient light
glm::vec3 Vec3
3-component floating-point vector (xyz).
Definition types.h:46
An RGBA color with floating-point components.
Definition types.h:88
A light source for the Blinn-Phong shading model.
Definition types.h:179
std::vector< Light > lights
List of light sources.
float ambient
Ambient light level (default: 0.3).

Anti-aliasing

opts.aa_samples = 4; // 4Ɨ supersampling for smooth edges
int aa_samples
Anti-aliasing sample count (default: 1 = no AA).

Wireframe overlay

opts.wireframe = true;
opts.wireframe_color = Color(0,0,0); // black edges
Color wireframe_color
Color of the wireframe lines (default: black).
bool wireframe
Draw triangle edges as lines (default: false).
See also
Renderer, Light, ClipPlane, ShadingMode

Definition at line 74 of file render_options.h.

Member Data Documentation

◆ aa_samples

int scimesh::RenderOptions::aa_samples = 1

Anti-aliasing sample count (default: 1 = no AA).

Super-sampling anti-aliasing: each pixel is sampled aa_samples times in each direction, then averaged. A value of 4 means 16 samples per pixel total. Higher values produce smoother edges but are slower and use more memory.

Definition at line 151 of file render_options.h.

◆ ambient

float scimesh::RenderOptions::ambient = 0.3f

Ambient light level (default: 0.3).

Ambient light is uniform "fill" light that illuminates all surfaces equally, preventing shadowed areas from being completely black. Range: 0.0 (no ambient) to 1.0 (fully lit). Typical: 0.2–0.4.

Definition at line 195 of file render_options.h.

◆ backface_culling

bool scimesh::RenderOptions::backface_culling = true

Enable backface culling (default: true).

When enabled, triangles facing away from the camera are not drawn. This is an optimization and is almost always what you want. Disable only if you need to see both sides of single-sided geometry.

Definition at line 102 of file render_options.h.

◆ background_color

Color scimesh::RenderOptions::background_color = WHITE

Background color (default: opaque white).

Pixels not covered by any triangle get this color.

See also
WHITE

Definition at line 118 of file render_options.h.

◆ clip_planes

std::vector<ClipPlane> scimesh::RenderOptions::clip_planes

Optional clip planes for cross-section views.

Each plane removes geometry on its negative side.

See also
ClipPlane

Definition at line 216 of file render_options.h.

◆ contrast

float scimesh::RenderOptions::contrast = 1.0f

Contrast adjustment (default: 1.0 = no change).

‍1.0 increases contrast, < 1.0 reduces it.

Definition at line 205 of file render_options.h.

◆ default_color

Color scimesh::RenderOptions::default_color = DEFAULT_COLOR

Default color for meshes without explicit vertex/face colors.

Overridden by per-mesh Mesh::default_color.

See also
DEFAULT_COLOR

Definition at line 124 of file render_options.h.

◆ far_plane

float scimesh::RenderOptions::far_plane = 10000.0f

Far clipping plane distance (default: 10000.0).

Geometry farther than this is not rendered. Increase for massive scenes; decrease to improve depth precision.

Definition at line 282 of file render_options.h.

◆ fog_color

Color scimesh::RenderOptions::fog_color = TRANSPARENT_BLACK

The color that distant objects fade into.

Definition at line 236 of file render_options.h.

◆ fog_enabled

bool scimesh::RenderOptions::fog_enabled = false

Enable depth fog (default: false).

When enabled, objects fade toward fog_color based on their distance from the camera.

Definition at line 227 of file render_options.h.

◆ fog_end

float scimesh::RenderOptions::fog_end = 1.0f

Distance at which fog is fully opaque (in world units).

Definition at line 233 of file render_options.h.

◆ fog_start

float scimesh::RenderOptions::fog_start = 0.0f

Distance at which fog begins (in world units).

Definition at line 230 of file render_options.h.

◆ height

int scimesh::RenderOptions::height = 600

Image height in pixels (default: 600).

Definition at line 82 of file render_options.h.

◆ invert_normals

bool scimesh::RenderOptions::invert_normals = false

Flip all surface normals (default: false).

Useful when normals from a file point inward instead of outward.

Definition at line 107 of file render_options.h.

◆ lights

std::vector<Light> scimesh::RenderOptions::lights

List of light sources.

If empty, a default single directional light from +Z is used.

See also
Light

Definition at line 188 of file render_options.h.

◆ near_plane

float scimesh::RenderOptions::near_plane = 0.1f

Near clipping plane distance (default: 0.1).

Geometry closer than this is not rendered. Reduce if you need to see very close objects; increase if you have z-fighting issues.

Definition at line 276 of file render_options.h.

◆ projection

ProjectionType scimesh::RenderOptions::projection = ProjectionType::PERSPECTIVE

Projection type (default: PERSPECTIVE).

See also
ProjectionType

Definition at line 177 of file render_options.h.

◆ shading

ShadingMode scimesh::RenderOptions::shading = ShadingMode::SMOOTH

Shading mode (default: SMOOTH).

SMOOTH interpolates normals across triangles for a rounded look. FLAT uses one normal per triangle for a faceted look.

See also
ShadingMode

Definition at line 95 of file render_options.h.

◆ shininess

float scimesh::RenderOptions::shininess = 0.0f

Shininess exponent (default: 0.0 = no specular).

Higher values produce sharper, more focused highlights. Typical range: 16–128. Only used when specular_color.a > 0.

Definition at line 167 of file render_options.h.

◆ specular_color

Color scimesh::RenderOptions::specular_color = Color(0.0f, 0.0f, 0.0f, 0.0f)

Specular highlight color (default: transparent = no specular).

Set to white or a tinted color to add shiny highlights.

Definition at line 161 of file render_options.h.

◆ ssao_enabled

bool scimesh::RenderOptions::ssao_enabled = false

Enable SSAO (default: false).

SSAO darkens crevices and corners to add depth and realism.

Definition at line 257 of file render_options.h.

◆ ssao_intensity

float scimesh::RenderOptions::ssao_intensity = 0.8f

SSAO darkening intensity (default: 0.8).

0.0 = no effect, 1.0 = full effect.

Definition at line 265 of file render_options.h.

◆ ssao_radius

float scimesh::RenderOptions::ssao_radius = 16.0f

SSAO sample radius in pixels (default: 16).

Definition at line 260 of file render_options.h.

◆ threads

int scimesh::RenderOptions::threads = 0

Number of render threads (default: 0 = auto-detect).

The renderer can use multiple threads for triangle rasterization. Set to 1 to force single-threaded rendering.

Definition at line 247 of file render_options.h.

◆ width

int scimesh::RenderOptions::width = 800

Image width in pixels (default: 800).

Definition at line 79 of file render_options.h.

◆ wireframe

bool scimesh::RenderOptions::wireframe = false

Draw triangle edges as lines (default: false).

When enabled, each triangle edge is drawn on top of the filled triangle. Wireframe thickness is 1 pixel.

Definition at line 135 of file render_options.h.

◆ wireframe_color

Color scimesh::RenderOptions::wireframe_color = Color(0.0f, 0.0f, 0.0f, 1.0f)

Color of the wireframe lines (default: black).

Definition at line 138 of file render_options.h.


The documentation for this struct was generated from the following file: