pygfx.objects.Mesh

class pygfx.objects.Mesh(geometry=None, material=None, *, visible=True, render_order=0, render_mask='auto')

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).

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

Transform Control without Matrix Updating

Transform Control without Matrix Updating

Gizmo to transform world objects

Gizmo to transform world objects

Volume Slice 1

Volume Slice 1

Geometry Plane

Geometry Plane

Wireframe 1

Wireframe 1

Klein Bottle Geometry

Klein Bottle Geometry

Stats helper (Manual)

Stats helper (Manual)

Wireframe 2

Wireframe 2

Volume Slice 2

Volume Slice 2

Panzoom Camera

Panzoom Camera

Instancing

Instancing

Color Picking

Color Picking

Sphere Geometry

Sphere Geometry

Directional Shadow 1

Directional Shadow 1

Mesh Slice Material

Mesh Slice Material

Colormap Channels

Colormap Channels

Scene Overlay

Scene Overlay

Look At

Look At

Text snake

Text snake

Subplots 1

Subplots 1

Use a Skybox

Use a Skybox

Transparency 1

Transparency 1

Nested Scenes

Nested Scenes

PBR Rendering 1

PBR Rendering 1

Look At (Instanced Mesh)

Look At (Instanced Mesh)

Mesh and Volume Slicing 2

Mesh and Volume Slicing 2

Transparency 2

Transparency 2

Types of Cylinders

Types of Cylinders

Mesh Picking

Mesh Picking

Volume and Mesh Slicing 1

Volume and Mesh Slicing 1

Lightmap

Lightmap

Dynamic Environment Map

Dynamic Environment Map

Ambient occlusion

Ambient occlusion

Directional Shadow 2

Directional Shadow 2

PBR Rendering 2

PBR Rendering 2

Environment Map Effects

Environment Map Effects

Text waterfall

Text waterfall

Mesh with quads

Mesh with quads

Colormap Mesh

Colormap Mesh

Multi-Object Selection

Multi-Object Selection

Depth Material

Depth Material

Spotlights

Spotlights

Spotlight Shadow

Spotlight Shadow

Wireframe Material

Wireframe Material

Box Geometry

Box Geometry

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

Light and Shadow

Light and Shadow

Validate Skybox

Validate Skybox

Depth Clipping

Depth Clipping

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering

Mesh Colormaps

Mesh Colormaps

Culling

Culling

Mesh slice

Mesh slice

Simple Cube with WX

Simple Cube with WX

Simple Cube with Qt

Simple Cube with Qt

GPU selection

GPU selection

Two Canvases

Two Canvases

Reactive rendering loop

Reactive rendering loop

Light Effects

Light Effects