blendersynth.blender.aov

Shader AOV manager

class blendersynth.blender.aov.AOV(*, name=None, **kwargs)[source]

A generic Arbitrary Output Value. An AOV is a float or color value per-point that is calculated at the rendering stage, and can be output in a compositor to form an image. See Blender docs for more info.

__init__(*, name=None, **kwargs)[source]
add_to_shader(shader_node_tree)[source]

Add AOV to shader node tree

update()[source]

Some AOVs need an update before rendering (to change certain node properties)

class blendersynth.blender.aov.AttrAOV(*, name=None, **kwargs)[source]

Take an object attribute, and output it as an AOV

class blendersynth.blender.aov.AttrRGBAOV(*, name=None)[source]

For a given numerical attribute, outputs a color corresponding to the attribute’s value. Object with attribute value i has HSV color (i/N, 1, 1). N can be a property of the object to update. Runs update() method to change the value of N, which is called before rendering.

__init__(*, name=None)[source]
update()[source]

Some AOVs need an update before rendering (to change certain node properties)

class blendersynth.blender.aov.ClassIDAOV(*, name=None, **kwargs)[source]

Class ID - given to each object on creation. Output is an integer corresponding to the object’s class ID (0-indexed) Class IDs can be manually set either when creating a Mesh, or by using the Mesh’s set_class_id() method. If not set, will default to a different index from each primitive.

class blendersynth.blender.aov.ClassRGBAOV(*, name=None)[source]

ClassIDAOV but as an AttrRGBAOV for visualisation. Updates N at render time by reading the scene property MAX_CLASSES

property N

Update the divisor node with the current number of classes

class blendersynth.blender.aov.DisplacementGeneratedAOV(*, name=None, mesh=None, bbox_min=None, bbox_max=None, vmin=-1, vmax=1)[source]

In the same co-ordinate space as GeneratedAOV, give the displacement vector for each point under modifiers (e.g. pose).

By default, this deformation is mapped from the range [-1 to 1] to [0 to 1], with 0.5 representing no deformation. Any values outside of this range are clamped. This can be modified through the input kwargs vmin and vmax.

__init__(*, name=None, mesh=None, bbox_min=None, bbox_max=None, vmin=-1, vmax=1)[source]

Create AOV for displacement under modifiers.

Parameters:
  • name (str) – Name of AOV

  • mesh (blendersynth.blender.mesh.Mesh) – Mesh to calculate bounds for. Will be used to find bbox_min and bbox_max if given

  • bbox_min (Union[mathutils.Vector, ndarray, List, Tuple]) – Minimum of bounding box. If not given, calculated from Mesh

  • bbox_max (Union[mathutils.Vector, ndarray, List, Tuple]) – Maximum of bounding box. If not given, calculated from Mesh

  • vmin (float) – Minimum deformation to map to 0

  • vmax (float) – Maximum value to map to 1

set_bounds(mesh=None, bbox_min=None, bbox_max=None)[source]

Set bounds for DeformedGeneratedTextureCoordinates node group

Parameters:
  • mesh (blendersynth.blender.mesh.Mesh) – Mesh to calculate bounds for. Will be used to find bbox_min and bbox_max if given

  • bbox_min (Union[mathutils.Vector, ndarray, List, Tuple]) – Minimum of bounding box. If not given, calculated from Mesh

  • bbox_max (Union[mathutils.Vector, ndarray, List, Tuple]) – Maximum of bounding box. If not given, calculated from Mesh

class blendersynth.blender.aov.GeneratedAOV(*, name=None, **kwargs)[source]

‘Generated Texture Coordinates’.

These are coordinates normalized to 0-1 for the object’s undeformed bounding box, not taking into account deformation (pose, modifiers). See Blender docs for more info.

class blendersynth.blender.aov.InstanceIDAOV(*, name=None, **kwargs)[source]

Instance ID - given to each object on creation. Output is an integer corresponding to the object’s instance ID (0-indexed)

class blendersynth.blender.aov.InstanceRGBAOV(*, name=None)[source]

InstanceIDAOV as an AttrRGBAOV for visualisation. Updates N at render time by reading the scene property ‘NUM_MESHES’

property N

Total number of meshes in the scene

class blendersynth.blender.aov.NormalsAOV(*, name=None, ref_frame='CAMERA', order='XYZ', polarity=(1, 1, 1))[source]
__init__(*, name=None, ref_frame='CAMERA', order='XYZ', polarity=(1, 1, 1))[source]

Given a shader node tree, add surface normals as output.

Parameters:
  • name (str) – Name of AOV to add

  • ref_frame (str) – Reference frame to use for normals

  • order (str) – Order of components in RGB (default: XYZ)

  • polarity (Union[tuple, list]) – Polarity of XYZ (1 or -1)

class blendersynth.blender.aov.UVAOV(*, name=None, **kwargs)[source]

UV coordinates. See Blender docs for more info.

class blendersynth.blender.aov.ValueAOV(value=0, name=None, **kwargs)[source]

A generic AOV that outputs a single value

__init__(value=0, name=None, **kwargs)[source]
Parameters:
  • value (float) – Value to output

  • name – Name of AOV

  • kwargs – Additional kwargs to pass to AOV