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§
- 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.
- A CPU-side version of a material used for physically based rendering (PBR).
- 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.
- 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.
- Describes the set of attributes provided by a geometry and consumed by a Material, ie. calculated in the vertex shader and then sent to the fragment shader. To use an attribute for a material, add the relevant shader code to the fragment shader source (documented for each attribute) and return this struct from Material::fragment_attributes with the relevant attribute set to true.
- 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.
- 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.
- 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.
- 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.
- 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.
- A reference to a 2D texture and a texture transformation.
- 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§
- The geometry function used in a Cook-Torrance lighting model.
- 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.
- 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.
- The normal distribution function used in a Cook-Torrance lighting model.
Traits§
- Implement this for a Material that can be created from a CpuMaterial.
- Implement this for a Material that can be created from a CpuVoxelGrid.
- 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.