Module material

Module material 

Source
Expand description

A collection of materials implementing the Material trait.

A material together with a geometry can be rendered directly (using Geometry::render_with_material or Geometry::render_with_effect). A Material can also be combined into an object (see Gm) and be used in a render call, for example RenderTarget::render.

Structs§

ColorMaterial
A material that renders a Geometry in a color defined by multiplying a color with an optional texture and optional per vertex colors. This material is not affected by lights.
CpuMaterial
A CPU-side version of a material used for physically based rendering (PBR).
DeferredPhysicalMaterial
Similar to PhysicalMaterial except that rendering happens in two stages which produces the same result, but is more efficient for complex scenes. This material does not support transparency but does support alpha cutout.
DepthMaterial
Used for rendering the distance from the camera to the object with this material in each pixel. Can be used for debug purposes but is also used to create shadow maps from light sources.
IntersectionMaterial
Used for intersection tests, see pick and ray_intersect. When rendering with this material, the output in each pixel is:
IsosurfaceMaterial
A material that renders the isosurface defined by the voxel data in the IsosurfaceMaterial::voxels and the IsosurfaceMaterial::threshold. The surface is defined by all the points in the volume where the red channel of the voxel data is equal to the threshold. This material should be applied to a cube with center in origo, for example CpuMesh::cube.
NormalMaterial
Render the object with colors that reflect its normals which primarily is used for debug purposes. A normal with an x value of -1 yields 0.0 in the red channel and an x value of 1 yields 1.0 in the red channel. The same mapping is applied from y value to green channel and z value to blue channel.
ORMMaterial
Render the object with colors that reflect its ORM (occlusion, roughness and metallic) values which primarily is used for debug purposes. Occlusion is red, roughness green and metallic blue.
PhysicalMaterial
A physically-based material that renders a Geometry in an approximate correct physical manner based on Physically Based Rendering (PBR). This material is affected by lights.
PositionMaterial
Render the object with colors that reflect its position which primarily is used for debug purposes. The x coordinate maps to the red channel, y to green and z to blue.
Texture2DRef
A reference to a 2D texture and a texture transformation.
UVMaterial
Render the object with colors that reflect its uv coordinates which primarily is used for debug purposes. The u coordinate maps to the red channel and the v coordinate to the green channel.

Enums§

GeometryFunction
The geometry function used in a Cook-Torrance lighting model.
LightingModel
Lighting models which specify how the lighting is computed when rendering a material. This is a trade-off between how fast the computations are versus how physically correct they look.
MaterialType
Defines the material type which is needed to render the objects in the correct order. For example, transparent objects need to be rendered back to front, whereas opaque objects need to be rendered front to back.
NormalDistributionFunction
The normal distribution function used in a Cook-Torrance lighting model.

Traits§

FromCpuMaterial
Implement this for a Material that can be created from a CpuMaterial.
FromCpuVoxelGrid
Implement this for a Material that can be created from a CpuVoxelGrid.
Material
Represents a material that, together with a geometry, can be rendered using Geometry::render_with_material. Alternatively, a geometry and a material can be combined in a Gm, thereby creating an Object which can be used in a render call, for example RenderTarget::render.