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.

  • 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

Use gfx.show

Use gfx.show

Hello World

Hello World

Render a Triangle

Render a Triangle

Boundary Boxes

Boundary Boxes

Lights

Lights

Offscreen Rendering

Offscreen Rendering

Clipping Planes

Clipping Planes

Hello text

Hello text

Orbit Camera

Orbit Camera

Möbius strip Geometry

Möbius strip Geometry

Subdivision

Subdivision

Use gfx.show to show a Scene

Use gfx.show to show a Scene

Geometry Cubes

Geometry Cubes

Rotating Polyhedra

Rotating Polyhedra

Torus knot

Torus knot

Mesh dynamic

Mesh dynamic

Flat Shading

Flat Shading

Volume Slice 1

Volume Slice 1

Transform Control without Matrix Updating

Transform Control without Matrix Updating

Gizmo to transform world objects

Gizmo to transform world objects

Geometry Plane

Geometry Plane

Toon Rendering 1

Toon Rendering 1

Wireframe 1

Wireframe 1

Klein Bottle Geometry

Klein Bottle Geometry

Volume Slice 2

Volume Slice 2

Stats helper (Manual)

Stats helper (Manual)

Wireframe 2

Wireframe 2

Panzoom Camera

Panzoom Camera

Instancing

Instancing

Color Picking

Color Picking

Directional Shadow 1

Directional Shadow 1

Mesh Slice Material

Mesh Slice Material

Colormap Channels

Colormap Channels

Displaying an image in a scene

Displaying an image in a scene

Scene Overlay

Scene Overlay

Look At

Look At

Text snake

Text snake

Sphere Geometry

Sphere Geometry

Subplots 1

Subplots 1

Use a Skybox

Use a Skybox

Measure distances in 3D

Measure distances in 3D

Nested Scenes

Nested Scenes

Look At (Instanced Mesh)

Look At (Instanced Mesh)

Mesh and Volume Slicing 2

Mesh and Volume Slicing 2

PBR Rendering 1

PBR Rendering 1

Lightmap

Lightmap

Types of Cylinders

Types of Cylinders

Transparency 1

Transparency 1

Volume and Mesh Slicing 1

Volume and Mesh Slicing 1

Mesh Picking

Mesh Picking

Ambient occlusion

Ambient occlusion

Dynamic Environment Map

Dynamic Environment Map

Morph Targets

Morph Targets

Directional Shadow 2

Directional Shadow 2

Transparency 2

Transparency 2

PBR Rendering 2

PBR Rendering 2

Text waterfall

Text waterfall

Environment Map Effects

Environment Map Effects

Mesh with quads

Mesh with quads

Toon Rendering 2

Toon Rendering 2

Skinned Mesh

Skinned Mesh

Earth

Earth

Depth Material

Depth Material

Colormap Mesh

Colormap Mesh

Multi-Object Selection

Multi-Object Selection

Detached Bind Mode

Detached Bind Mode

Spotlights

Spotlights

Facecap animation with morph targets

Facecap animation with morph targets

Spotlight Shadow

Spotlight Shadow

Wireframe Material

Wireframe Material

Validate transparency with and without bg

Validate transparency with and without bg

Box Geometry

Box Geometry

Additive Blending

Additive Blending

Image on Plane Geometry 1

Image on Plane Geometry 1

Normals on front and back

Normals on front and back

Depth Overlay 2

Depth Overlay 2

Depth Overlay 1

Depth Overlay 1

Reference Color

Reference Color

Transparency

Transparency

Validate transparency for the ordered2 blend mode

Validate transparency for the ordered2 blend mode

Light and Shadow

Light and Shadow

Validate Skybox

Validate Skybox

Depth Clipping

Depth Clipping

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering

Validate the grid

Validate the grid

Mesh Colormaps

Mesh Colormaps

Culling

Culling

Mesh slice

Mesh slice

Showing CPU usage in the title bar

Showing CPU usage in the title bar

Simple Cube with WX

Simple Cube with WX

Simple Cube with Qt

Simple Cube with Qt

GPU selection

GPU selection

Two Canvases

Two Canvases

Fullscreen Postprocessing 2

Fullscreen Postprocessing 2

Reactive rendering loop

Reactive rendering loop

Full-Screen Post Processing 1

Full-Screen Post Processing 1

Light Effects

Light Effects

Pytorch Integration

Pytorch Integration