EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
EBGeometry::Render::Settings< T > Struct Template Reference

What to render and how. A plain value; every field has a default. More...

#include <EBGeometry_Render.hpp>

Collaboration diagram for EBGeometry::Render::Settings< T >:
Collaboration graph
[legend]

Public Member Functions

bool isHighlighted (const uint32_t a_primitive) const noexcept
 Whether a primitive is highlighted.
 
bool hides (uint32_t a_primitive) const noexcept
 Whether a primitive is in m_hidden.
 
bool hidesAny () const noexcept
 Whether anything is hidden.
 

Static Public Member Functions

static Array< Vec3T< T >, PrimitiveColors > unsetColors () noexcept
 Every entry of m_primitiveColors unset.
 
static Array< uint32_t, HiddenPrimitives > noneHidden () noexcept
 Every entry of m_hidden unused.
 

Public Attributes

uint32_t m_width = 960
 Image width in pixels.
 
uint32_t m_height = 960
 Image height in pixels.
 
uint32_t m_supersampling = 2
 Rays per pixel along each axis (n x n per pixel), from 1 to 15; the cost views trace one.
 
uint32_t m_threads = 0
 Host threads for render(); 0 uses one per hardware thread.
 
bool m_shadows = true
 Soft shadows cast by the shape.
 
bool m_occlusion = true
 Ambient occlusion: darker creases and corners.
 
bool m_floor = true
 A floor just under the shape, perpendicular to the camera's up axis (only under a shape that is bounded below).
 
Backdrop m_backdrop = Backdrop::Sky
 What is drawn behind the shape.
 
ColorBy m_colorBy = ColorBy::Normal
 How surfaces are colored.
 
Vec3T< T > m_color = Vec3T<T>(T(0.80), T(0.42), T(0.18))
 The surface color for ColorBy::Uniform (linear RGB in [0, 1]).
 
Array< Vec3T< T >, PrimitiveColors > m_primitiveColors = unsetColors()
 Colors for ColorBy::Primitive by primitive id (linear RGB in [0, 1]): entry i colors primitive i. An entry left unset (a negative component, as all are by default), and every id from PrimitiveColors on, takes the built-in palette's color.
 
Array< Vec3T< T >, PrimitiveColors > m_materialColors = unsetColors()
 Colors of the materials of a view of regions, for the section plane's fill (m_sectionFill), by material number (linear RGB in [0, 1]), whatever the surfaces are colored by. An entry left unset, and every number from PrimitiveColors on, takes the built-in palette's color, as the surfaces colored by material do.
 
bool m_recordPrimitives = false
 Whether a render records each pixel's object in Image::m_primitives (for a viewer's pick outline); off, the image's m_primitives stays empty and a render stores and copies less per pixel.
 
uint32_t m_highlightPrimitive = NoPrimitive
 A primitive to highlight (see HitT::m_primitive): its surface is tinted with m_highlightColor, whatever the coloring. NoPrimitive highlights none, AllPrimitives the whole shape.
 
uint32_t m_highlightCount = 1U
 How many keys are highlighted, from m_highlightPrimitive on (several selected surfaces, each its own key, so that each is outlined).
 
Vec3T< T > m_highlightColor = Vec3T<T>(T(1.0), T(0.72), T(0.10))
 The highlight's color.
 
Vec3T< T > m_insideColor = Vec3T<T>(T(0.90), T(0.08), T(0.08))
 The color a surface seen from inside the solid is tinted towards.
 
Vec3T< T > m_cutColor = Vec3T<T>(T(0.95), T(0.86), T(0.50))
 The color of faces cut by the section plane when coloring by primitive; otherwise a cut face is colored as a surface facing along the plane's normal would be (or uniformly).
 
T m_cutOpacity = T(1)
 Opacity of the cut face (1: opaque): below 1, the shape's next surface behind it along the ray shows through, seen from inside the solid without the inside tint (cavities, bores, the far wall).
 
T m_seenThroughOpacity = T(0.3)
 Opacity of the surfaces of a view of regions that are seen through (RegionSettings::setSeenThrough()): drawn translucent over what lies behind them, up to four along each ray, the nearest ones; 0 leaves them out. What is picked or highlighted is drawn solid. However opaque they are drawn, a pick passes through them.
 
T m_ghostOpacity = T(0)
 Opacity of the shape on the side the section plane removes (m_section), drawn over what the cut shows: the first surface a camera ray meets there, translucent, so that the kept side and the plane show through it. The plane's fill (m_sectionFill) then covers only the cut, and outside the shape the plane is the sheet. 0 (the default) leaves the removed side out.
 
Vec3T< T > m_floorColor = Vec3T<T>(T(0.58), T(0.59), T(0.61))
 The floor's color.
 
bool m_lightFromCamera = true
 Whether m_light is given in the camera's frame (x to the image's right, y to its top, z towards the viewer), so that the light turns with the camera and the side in view stays lit; otherwise it is a direction in the scene.
 
Vec3T< T > m_light = Vec3T<T>(T(-0.45), T(0.75), T(0.55))
 Direction towards the light (need not be of unit length): in the camera's frame with m_lightFromCamera (by default from above, to the left and in front), in the scene's otherwise.
 
T m_lightIntensity = T(1.05)
 How strongly the light lights a surface facing it (the diffuse term's factor).
 
T m_ambient = T(0.35)
 How much light comes from the sky, on a surface facing up (the ambient term's factor).
 
T m_fillIntensity = T(0.35)
 How strongly the fill light lights a surface facing it, not negative (0: no fill light).
 
T m_shoulder = T(0.8)
 Where the brightness of lit surfaces starts to roll off towards white, from 0 to 1 (1: no roll-off, clipped at 1).
 
T m_specular = T(0.45)
 How bright the light's highlights are (0: a matte surface).
 
T m_shininess = T(32)
 How small the light's highlights are: the specular exponent, at least 1 (larger: a shinier surface).
 
Vec3T< T > m_skyHorizon = Vec3T<T>(T(0.82), T(0.84), T(0.88))
 The sky's color at the horizon.
 
Vec3T< T > m_skyZenith = Vec3T<T>(T(0.32), T(0.45), T(0.66))
 The sky's color straight up.
 
Vec3T< T > m_background = Vec3T<T>(T(0.16), T(0.17), T(0.19))
 The background of Backdrop::Plain.
 
Vec3T< T > m_gradientFrom = Vec3T<T>(T(0.40), T(0.50), T(0.68))
 Backdrop::Gradient's color at the top of the view, Backdrop::Vignette's at its center.
 
Vec3T< T > m_gradientTo = Vec3T<T>(T(0.93), T(0.95), T(0.97))
 Backdrop::Gradient's color at the bottom of the view, Backdrop::Vignette's at its corners.
 
FloorStyle m_floorStyle = FloorStyle::Checker
 How the floor is drawn.
 
T m_floorCellSize = T(0)
 The side of the floor's checker squares, or the spacing of its grid lines; 0 takes a sixth of the scene's length scale.
 
Vec3T< T > m_floorLineColor = Vec3T<T>(T(0.40), T(0.43), T(0.49))
 The color of the floor's grid lines (FloorStyle::Grid).
 
uint32_t m_floorMajorEvery = 4
 Every how many grid lines one is heavier (FloorStyle::Grid); 0 draws them all alike.
 
T m_floorFade = T(6)
 How far the floor reaches before it has faded into the backdrop, in the scene's length scales (the diagonal of the shape's box): it is seen at exp(-(t / (m_floorFade scale))^2) along a camera ray at distance t.
 
T m_floorReflectance = T(0.5)
 How much of the shape the floor reflects (FloorStyle::Mirror), from 0 to 1, looking straight down at it; more towards the horizon.
 
T m_lightSize = T(0.04)
 The light's size: its width as seen from the shape, as a fraction of its distance (about 0.017 a degree). With supersampling, a pixel's rays each see the light from a different point of a disc of this width, which softens the edges of the shadows; a preview of one ray per pixel draws them hard.
 
bool m_section = false
 Whether the section plane cuts the shape.
 
Vec3T< T > m_sectionPoint = Vec3T<T>::zeros()
 A point on the section plane.
 
Vec3T< T > m_sectionNormal = Vec3T<T>(T(0), T(0), T(1))
 The section plane's normal: the part of the shape on the side it points to is removed.
 
T m_contourWidth = T(3.5)
 Width in pixels of the line drawn on the section plane where it meets the shape's surface (the shape's contour in the plane); 0 draws none.
 
Vec3T< T > m_contourColor = Vec3T<T>(T(0.04), T(0.04), T(0.05))
 The contour's color.
 
T m_isoSpacing = T(0)
 Spacing of lines of equal signed distance drawn on the section plane, inside and outside the shape (0: none). Spaced like a simulation grid, they show what the grid resolves. Where they would lie only a few pixels apart on screen, every second is left out, as often as needed: farther along a plane seen at a slant, fewer are drawn, and a line can end where the next is left out.
 
Vec3T< T > m_isoColor = Vec3T<T>(T(0.10), T(0.11), T(0.13))
 The color of those lines: outside the shape, drawn over the sheet (m_sheetOpacity), as strongly as the sheet is clear.
 
Vec3T< T > m_isoSecondaryColor = Vec3T<T>(T(0.60), T(0.12), T(0.10))
 The color of those lines where a shape marks them secondary: a view of regions showing a whole domain, in the regions it excludes (RegionSettings::m_sectionDomain).
 
bool m_isoSecondary = false
 Whether lines of equal distance are drawn where a shape marks them secondary (where a view of regions' domain or subdomain does not compute); the zero line is drawn either way.
 
T m_sheetOpacity = T(0.35)
 Opacity of the section plane where it lies outside the shape, within the shape's box: a frosted sheet that shows where the plane is, edged by a line where it meets the box (0: none, 1: opaque).
 
T m_sectionFill = T(1)
 Opacity of the section plane's fill by what each point of it is in, within the shape's box (0: none, 1: opaque): a shape's sectionKey(point) (a view of regions: the material of the region there), in its material's color (m_materialColors, else the palette); gray where the region has no material, and where a domain shown on the plane does not compute (m_fillSecondaryColor). Where it fills, it takes the sheet's place. Shapes without a key are not filled.
 
bool m_sectionFillOutside = true
 Whether the fill (m_sectionFill) also covers the plane outside the shape, within its box (a view of regions: outside its visible regions, where the regions hidden lie); false fills only the cut, as a CAD section does.
 
Vec3T< T > m_fillSecondaryColor = Vec3T<T>(T(0.45), T(0.45), T(0.47))
 The fill's color where a shape marks the field secondary (where a view of regions' domain or subdomain does not compute): not computed, whatever the material.
 
Vec3T< T > m_sheetColor = Vec3T<T>(T(0.95), T(0.96), T(0.97))
 The sheet's color.
 
Vec3T< T > m_sheetEdgeColor = Vec3T<T>(T(0.45), T(0.47), T(0.50))
 The color of the sheet's edge.
 
RayOptions< T > m_rays
 How rays march (see firstHit()). A scale of 0 takes the shape's box diagonal, or the camera distance for an unbounded shape.
 
ViewMode m_viewMode = ViewMode::Shaded
 What the render shows.
 
T m_xrayOpacity = T(0.25)
 In ViewMode::XRay, how opaque each surface a ray crosses is, from 0 to 1: how brightly it glows, and how much of what lies behind it it hides. Its highlights follow m_specular and m_shininess, at half strength.
 
Array< uint32_t, HiddenPrimitives > m_hidden = noneHidden()
 Primitives to see through (see HitT::m_primitive): a camera ray that meets one goes on as if it were not there, and the surface behind it is shaded as one seen from outside; it casts no shadow and no ambient occlusion either. The solid's inside is the whole shape's. NoPrimitive marks an unused entry.
 
uint32_t m_peel = 0
 How many surfaces each camera ray passes before the one it shows, peeling the frame layer by layer (0: the first, below Renderer::MaxCrossings). Every crossing counts, entering or leaving, a cut face too; a surface seen through (m_hidden) does not. The surface shown is shaded as one seen from outside, and what lies in front of it is left out (the section plane's drawing too); where a ray meets fewer surfaces, the floor or the backdrop shows. In the x-ray view, the surfaces peeled do not glow; the depth view and a pick see the surface shown. Shadows and ambient occlusion are the whole shape's.
 
uint32_t m_volumePrimitive = NoPrimitive
 A part (see HitT::m_primitive) whose inside is filled with m_volumeColor wherever it lies along a camera ray, in front of or behind the surface seen; NoPrimitive fills none, AllPrimitives the whole solid. A stretch inside the solid is counted as the part's when the ray enters it through that part's surface.
 
Vec3T< T > m_volumeColor = Vec3T<T>(T(0.10), T(0.75), T(1.0))
 The fill's color.
 
RegionSettings m_regions
 How a view of regions (RegionView) is shown: the visible regions, what a surface is colored by, the surfaces shown alone or seen through, and a domain's surface groups. The renderer gives them to the view; other shapes ignore them.
 
T m_volumeOpacity = T(0.7)
 The fill's opacity where the part is thickest along a ray, from 0 to 1.
 

Static Public Attributes

static constexpr uint32_t PrimitiveColors = 16
 How many primitive colors m_primitiveColors holds.
 
static constexpr uint32_t NoPrimitive = 0xFFFFFFFFU
 The value of m_highlightPrimitive that highlights nothing.
 
static constexpr uint32_t AllPrimitives = 0xFFFFFFFEU
 The value of m_highlightPrimitive that highlights the whole shape.
 
static constexpr uint32_t HiddenPrimitives = 8
 How many primitives m_hidden holds.
 

Detailed Description

template<class T>
struct EBGeometry::Render::Settings< T >

What to render and how. A plain value; every field has a default.

Template Parameters
TFloating-point precision.

Member Function Documentation

◆ hides()

template<class T >
bool EBGeometry::Render::Settings< T >::hides ( uint32_t  a_primitive) const
inlinenoexcept

Whether a primitive is in m_hidden.

Parameters
[in]a_primitivePrimitive.
Returns
True if it is hidden.

◆ hidesAny()

template<class T >
bool EBGeometry::Render::Settings< T >::hidesAny ( ) const
inlinenoexcept

Whether anything is hidden.

Returns
True if any entry of m_hidden is used.

◆ isHighlighted()

template<class T >
bool EBGeometry::Render::Settings< T >::isHighlighted ( const uint32_t  a_primitive) const
inlinenoexcept

Whether a primitive is highlighted.

Parameters
[in]a_primitiveThe primitive (HitT::m_primitive).
Returns
True if its surface is tinted with m_highlightColor.

◆ noneHidden()

template<class T >
static Array< uint32_t, HiddenPrimitives > EBGeometry::Render::Settings< T >::noneHidden ( )
inlinestaticnoexcept

Every entry of m_hidden unused.

Returns
The table.

◆ unsetColors()

template<class T >
static Array< Vec3T< T >, PrimitiveColors > EBGeometry::Render::Settings< T >::unsetColors ( )
inlinestaticnoexcept

Every entry of m_primitiveColors unset.

Returns
The table.

Member Data Documentation

◆ m_fillIntensity

template<class T >
T EBGeometry::Render::Settings< T >::m_fillIntensity = T(0.35)

How strongly the fill light lights a surface facing it, not negative (0: no fill light).

The fill light lights the sides the light (m_light) leaves dark, which would otherwise get only the ambient term. It comes from the camera's other side: m_light mirrored left to right in the camera's frame, from in front and a little below the scene's horizon (Camera::m_up). That holds with or without m_lightFromCamera, so it follows the light as it is moved. It casts no shadow and makes no highlights, so it costs no rays. Because it comes from below, an upward-facing floor gets none of it.

◆ m_shoulder

template<class T >
T EBGeometry::Render::Settings< T >::m_shoulder = T(0.8)

Where the brightness of lit surfaces starts to roll off towards white, from 0 to 1 (1: no roll-off, clipped at 1).

Each component c of the light a surface reflects (the shape's surfaces and the floor; never the backdrop, whose white stays white) is mapped above s = m_shoulder to c - (c - s)^2 / (4(1 - s)). This curve continues c with the same slope at s and reaches 1, flat, at 2 - s. Above 2 - s it is 1. Highlights and surfaces facing the light keep some shading instead of clipping to flat white.


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