Projected Texture

Projected textures are images that exist in space and are mapped to their corresponding elements. Unlike data, they do not need to correspond to mesh nodes or cell centers. This image shows how textures are mapped to a surface. Their position is defined by an origin and axis vectors then they are mapped laterally to the element position.

../_images/ImageTexture.png

Like data, multiple textures can be applied to a element; simply provide a list of textures. Each of these textures provides an origin point and two extent vectors for the plane defining where images rests. The axis_* properties define the extent of that image out from the origin. Given a rectangular PNG image, the origin is the bottom left, origin + axis_u is the bottom right, and origin + axis_v is the top left. This allows the image to be rotated and/or skewed. These values are independent of the corresponding Surface; in fact, there is nothing requiring the image to actually align with the Surface.

>> ...
>> my_surface = omf.SurfaceElement(...)
>> ...
>> my_tex_1 = omf.ProjectedTexture(
       origin=[0.0, 0.0, 0.0],
       axis_u=[1.0, 0.0, 0.0],
       axis_v=[0.0, 1.0, 0.0],
       image='image1.png'
   )
>> my_tex_2 = omf.ProjectedTexture(
       origin=[0.0, 0.0, 0.0],
       axis_u=[1.0, 0.0, 0.0],
       axis_v=[0.0, 0.0, 1.0],
       image='image2.png'
   )
>> my_surface.textures = [
       my_tex_1,
       my_tex_2
   ]
class omf.texture.ProjectedTexture(**kwargs)[source]

Contains an image that can be projected onto a point set or surface

Required Properties:

  • axis_u (Vector3): Vector corresponding to the image x-axis, a 3D Vector of <type ‘float’> with shape (3), Default: X
  • axis_v (Vector3): Vector corresponding to the image y-axis, a 3D Vector of <type ‘float’> with shape (3), Default: Y
  • description (String): Description of the object, a unicode string
  • image (ImagePNG): PNG image file, a PNG image file, valid modes include (u’ab+’, u’rb+’, u’wb+’, u’rb’)
  • metadata (ArbitraryMetadataDict): Basic object metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against BaseMetadata
  • name (String): Title of the object, a unicode string
  • origin (Vector3): Origin point of the texture, a 3D Vector of <type ‘float’> with shape (3), Default: [0.0, 0.0, 0.0]
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode

UV Mapped Textures

Rather than being projected onto points or a surface, UV Mapped Textures are given normalized UV coordinates which correspond to element vertices. This allows arbitrary mapping of images to surfaces.

class omf.texture.UVMappedTexture(**kwargs)[source]

Contains an image that is UV mapped to a geometry

Required Properties:

  • description (String): Description of the object, a unicode string
  • image (ImagePNG): PNG image file, a PNG image file, valid modes include (u’ab+’, u’rb+’, u’wb+’, u’rb’)
  • metadata (ArbitraryMetadataDict): Basic object metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against BaseMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode
  • uv_coordinates (Array): Normalized UV coordinates mapping the image to element vertices; for values outside 0-1 the texture repeats at every integer level, and NaN indicates no texture at a vertex, an instance of Array