The (chickadee graphics mesh)
modules provides procedures for
programmatically creating 3D objects (to load 3D models from a file on
disk, see Meshes.)
Before we talk about meshes themselves, let’s discuss “materials.” Materials control the appearance of 3D objects. Whether an object appears like a rough rock, a smooth and shiny metal, etc. depends on the material that is applied to it. Different types of materials use different lighting models. Chickadee supports two lighting models: The classic Blinn-Phong model and a more modern physically based rendering (PBR) model.
All materials share some common data:
Return #t
if obj is a material.
Return the name of material.
Return the shader of material.
Return the blend mode of material.
Return the polygon mode of material.
Return the cull face mode of material.
Return the depth test of material.
Return the stencil test of material.
Return #t
if material uses multisampling.
Materials support 5 textures. What each texture is used for depends on the lighting model.
Return the first texture of material.
Return the second texture of material.
Return the third texture of material.
Return the fourth texture of material.
Return the fifth texture of material.
For all data that is specific to the lighting model, materials have a “properties” field.
Return the lighting model specific properties of material.
The (chickadee graphics phong)
module has the Blinn-Phong
lighting model:
Return a new Blinn-Phong material.
Return a new Blinn-Phong properties object.
Return #t
if obj is a Blinn-Phong properties object.
Return the ambient factor of properties.
Return the diffuse factor of properties.
Return the specular factor of properties.
Return the shininess factor of properties.
The (chickadee graphics pbr)
module has the PBR lighting model:
Return a new PBR material.
Return a new PBR properties object.
Return #t
if obj is a PBR properties object.
Return the base color factor of properties.
Return the base color texture coordinate attribute index of properties.
Return the metallic factor of properties.
Return the roughness factor of properties.
Return the metallic-roughness texture coordinate attribute index of properties.
Return the normal texture coordinate attribute index of properties.
Return the ambient occlusion texture coordinate attribute index of properties.
Return the emissive factor of properties.
Return the emissive texture coordinate attribute index of properties.
Return the alpha mode of properties.
Return the alpha cutoff threshold of properties.
A mesh is a collection of “primitives,” so we should discuss those next. A primitive contains vertex data and a material.
Return a new primitive named name that renders vertex-array (see Buffers) using material.
Return #t
if obj is a primitive.
Return the name of primitive.
Return the vertex array of primitive.
Return the material of primitive.
Okay, now we can talk about meshes, which are just a glorified list of primitive objects.
Return a new mesh named name that is composed of the list primitives.
Return #t
if obj is a mesh.
Return the name of mesh.
Return the list of primitives for mesh.
The mesh module also conveniently provides procedures to build several basic 3D shapes.
Return a new mesh that forms a flat plane on the XZ axis that is width units long along the X axis and length units long along the Z axis.
Return a new mesh that forms a tesselated plane on the XZ axis that is width units long along the X axis and length units long along the Z axis.
A regular plane is a single rectangle, but a tesselated plane is subdivided into many smaller rectangles by resolution. This allows for transforming the vertices in a shader to achieve effects such as waves in water or mountainous terrain.
Return a new mesh that forms a cube that is size units big.
Return a new mesh that forms a sphere that has a radius of radius units. Since 3D models are composed of triangles, the quality of a sphere is entirely dependent upon how many triangles are used to appromixate the shape. The higher the value of quality, the better the appromixation, but the more time it will take to generate and the more expensive it will be to draw. The number of triangles in the resulting sphere increases exponentially with each increment to quality.