pygfx.objects.Mesh

class pygfx.objects.Mesh(geometry=None, material=None, *args, **kwargs)

Bases: WorldObject

A mesh.

An object consisting of triangular faces represented by a set of vertices (3D positions) and a set of vertex indices indicating which vertex triplets form mesh triangles.

The picking info of a Mesh (the result of renderer.get_pick_info()) will for most materials include instance_index (int), face_index (int), and face_coord (tuple of 3 floats). The latter are the barycentric coordinates for each vertex of the face (with values 0..1).

Parameters:
  • geometry (Geometry) – The data defining the shape of the object. Must contain at least a “positions” and “indices” buffers. Depending on the usage of the material, can also include buffers “normals”, “colors”, “texcoords”, “texcoords2”, etc. Advanced use of meshes also support “tangents”, “skin_indices”, and “skin_weights”.

  • material (Material) – The data defining the appearance of the object.

  • visible (bool) – Whether the object is visible.

  • render_order (int) – The render order (when applicable for the renderer’s blend mode).

  • render_mask (str) – Determines the render passes that the object is rendered in. It’s recommended to let the renderer decide, using “auto”.

  • position (Vector) – The position of the object in the world. Default (0, 0, 0).

property morph_target_influences

An ndarray of weights typically from 0-1 that specify how much of the morph is applied.

Note: When using this attribute, its geometry needs to have the relevant attributes of morph targets.

property morph_target_names

A list of names for the morph targets.

Examples

Anisotropy Barn Lamp

Anisotropy Barn Lamp

Ambient occlusion

Ambient occlusion

Clearcoat effect

Clearcoat effect

Clearcoat effect

Clearcoat effect

Colormap Channels

Colormap Channels

Colormap Mesh

Colormap Mesh

Types of Cylinders

Types of Cylinders

Dynamic Environment Map

Dynamic Environment Map

Earth

Earth

Environment Map Effects

Environment Map Effects

Flat Shading

Flat Shading

Geometry Cubes

Geometry Cubes

Klein Bottle Geometry

Klein Bottle Geometry

Möbius strip Geometry

Möbius strip Geometry

Geometry Plane

Geometry Plane

Rotating Polyhedra

Rotating Polyhedra

Subdivision

Subdivision

Torus knot

Torus knot

glTF Unlit Material Example

glTF Unlit Material Example

Remote glTF Viewer

Remote glTF Viewer

Gizmo to transform world objects

Gizmo to transform world objects

Stats helper (Manual)

Stats helper (Manual)

Displaying an image in a scene

Displaying an image in a scene

Instancing

Instancing

Iridescence Abalone

Iridescence Abalone

Iridescence

Iridescence

Directional Shadow 1

Directional Shadow 1

Directional Shadow 2

Directional Shadow 2

Spotlight Shadow

Spotlight Shadow

Spotlights

Spotlights

Lightmap

Lightmap

Look At

Look At

Look At (Instanced Mesh)

Look At (Instanced Mesh)

Transform Control without Matrix Updating

Transform Control without Matrix Updating

Measure distances in 3D

Measure distances in 3D

Depth Material

Depth Material

Mesh dynamic

Mesh dynamic

Mesh Slice Material

Mesh Slice Material

Toon Rendering 1

Toon Rendering 1

Toon Rendering 2

Toon Rendering 2

Facecap animation with morph targets

Facecap animation with morph targets

Morph Targets

Morph Targets

Multi-Object Selection

Multi-Object Selection

Volume and Mesh Slicing 1

Volume and Mesh Slicing 1

Mesh and Volume Slicing 2

Mesh and Volume Slicing 2

Panzoom Camera

Panzoom Camera

PBR Rendering 1

PBR Rendering 1

PBR Rendering 2

PBR Rendering 2

PBR Instanced Rendering

PBR Instanced Rendering

Color Picking

Color Picking

Mesh Picking

Mesh Picking

Mesh with quads

Mesh with quads

Nested Scenes

Nested Scenes

Scene Overlay

Scene Overlay

Subplots 1

Subplots 1

Sheen Chair

Sheen Chair

Glam Velvet Sofa

Glam Velvet Sofa

Use gfx.show to show a Scene

Use gfx.show to show a Scene

Skinned Mesh

Skinned Mesh

Detached Bind Mode

Detached Bind Mode

Use a Skybox

Use a Skybox

Sphere Geometry

Sphere Geometry

Text multiple grid

Text multiple grid

Text snake

Text snake

Text waterfall

Text waterfall

Transparency 1

Transparency 1

Transparency 2

Transparency 2

Volume Slice 1

Volume Slice 1

Volume Slice 2

Volume Slice 2

Wireframe 1

Wireframe 1

Wireframe 2

Wireframe 2

Wireframe Material

Wireframe Material

Clipping Planes

Clipping Planes

Hello World

Hello World

Hello text

Hello text

Render a Triangle

Render a Triangle

Lights

Lights

Boundary Boxes

Boundary Boxes

Offscreen Rendering

Offscreen Rendering

Orbit Camera

Orbit Camera

Use gfx.show

Use gfx.show

Simple Cube with Qt

Simple Cube with Qt

Simple Cube with WX

Simple Cube with WX

GPU selection

GPU selection

Pytorch Integration

Pytorch Integration

Light Effects

Light Effects

Load Open3D Mesh

Load Open3D Mesh

Boundary Boxes

Boundary Boxes

Full-Screen Post Processing 1

Full-Screen Post Processing 1

Fullscreen Postprocessing 2

Fullscreen Postprocessing 2

Reactive rendering loop

Reactive rendering loop

Showing CPU usage in the title bar

Showing CPU usage in the title bar

Two Canvases

Two Canvases

Additive Blending

Additive Blending

Validate transparency with and without bg

Validate transparency with and without bg

Validate dither

Validate dither

Validate transparency for the ordered2 blend mode

Validate transparency for the ordered2 blend mode

Validate weighted_plus

Validate weighted_plus

Box Geometry

Box Geometry

Reference Color

Reference Color

Culling

Culling

Depth Clipping

Depth Clipping

Depth Overlay 1

Depth Overlay 1

Depth Overlay 2

Depth Overlay 2

Validate the grid

Validate the grid

Image on Plane Geometry 1

Image on Plane Geometry 1

Light and Shadow

Light and Shadow

Mesh Colormaps

Mesh Colormaps

Mesh slice

Mesh slice

Normals on front and back

Normals on front and back

Validate Skybox

Validate Skybox

Validate transforms

Validate transforms

Validate view offset

Validate view offset

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering