Skip to content

A collection of Python tools for dealing with mesh related data.

License

Notifications You must be signed in to change notification settings

readyplayerme/meshops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

88fc57f · May 15, 2024

History

36 Commits
May 14, 2024
Oct 31, 2023
May 8, 2024
May 8, 2024
Oct 29, 2023
May 8, 2024
Nov 14, 2023
May 13, 2024
May 14, 2024
Oct 29, 2023
May 13, 2024
Jan 5, 2024
May 15, 2024
May 14, 2024

Repository files navigation

MeshOps · GitHub license

A collection of tools for dealing with mesh related data.

Installation

To install a specific version of readyplayerme-meshops directly from github:

pip install "ReadyPlayerMe-MeshOps@https://github.com/readyplayerme/meshops/releases/download/0.1.0/readyplayerme_meshops-0.1.0-py3-none-any.whl"

You need to change the tag (0.1.0 in this example) to the version you want to install.

Alternatively, you can also download the latest wheel file from the Releases and install it using pip:

  1. Navigate to the Releases page of the meshops GitHub repository.
  2. Download the latest .whl file.
  3. Install the wheel file using pip, e.g.:
pip install <path-to-download>/readyplayerme_meshops-0.1.0-py3-none-any.whl

Development Setup

You'll find setup instruction of this project in the CONTRIBUTING.md file.

Features

Position Map

from readyplayerme.meshops.draw.image import get_position_map

Position maps encode locations on the surface of a mesh as color values in an image using the UV layout. Since 8-bit colors are positive values only and capped at 255, the linear transformation of the positions into the color space is lossy and not invertible, meaning that the original positions cannot be recovered from the color values. However, these maps can be utilized as control signals for various tasks such as texture synthesis and for shader effects.

Object Space Normal Maps

from readyplayerme.meshops.draw.image import get_obj_space_normal_map

Object space normal maps encode the surface normals of a mesh as color values in an image using the UV layout. Similar to position maps, the conversion from normals to colors is lossy. They also can be used as control signals for various tasks such as texture synthesis.

Any Vertex Attribute to Image

from readyplayerme.meshops.draw.image import get_vertex_attribute_image

This function allows you to convert any vertex attribute of a mesh that can be represented as a color to an image.

UV Island Mask

from readyplayerme.meshops.draw.image import create_mask

This function creates a black and white mask image from the mesh's UV layout.

UV Seams Transitioning

from readyplayerme.meshops.draw.image import blend_uv_seams

UV seams are splits in a triangle mesh that, however, is supposed to represent a continuous surface across these splits. These splits are necessary to allow the mesh to flatten out cleanly in UV space and have as little distortion in the texture projection as possible. The UV seams are splits between UV islands for which the projection onto the mesh should appear as seamless as possible.

Goal

  • identify UV splits in a mesh
  • mitigate the mismatch between image content when transitioning over a UV split