Materials

Improviz now has configurable materials that can be used when drawing shapes. In technical terms, these are just defining the vertex and fragment shaders that are being used when rendering geometries.

The material files themselves are all just YAML files that by default live in the materials folder, but similar to textures and geometries, more folders can be added and the existing ones changed. The YAML files specify a name, a list of attributes and uniforms that tell Improviz what data needs to be passed to the shaders, and then the vertex and fragment shaders themselves.

Usage

To use a material, just use the material function and pass it the name of a material as a symbol. This works in a similar fashion to other styling functions like fill or stroke.

rotate(time)

material(:ceed)
	cube(3)

material(:weird)
	sphere(3)

move(3)
cylinder(3)

To see what materials are available, look the in materials folder of your Improviz installation. The filenames should match the required usage names for each.

Creating Custom Materials

There are four sets of attribute data and eight uniforms that Improviz can pass to the material shaders.

Attributes

The attributes are all vertex arrays that are defined by the geometry files loaded or in some cases calculated from that data. They all have to use specific layout locations when using them in a shader.

Uniforms

There are eight uniforms that Improviz can pass to the shaders.