forked from lightningpixel/modly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPKG-INFO
More file actions
33 lines (26 loc) · 1016 Bytes
/
Copy pathPKG-INFO
File metadata and controls
33 lines (26 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Metadata-Version: 2.1
Name: texture-baker
Version: 0.0.1
Summary: Small texture baker which rasterizes barycentric coordinates to a tensor.
Home-page: https://github.com/Stability-AI/texture_baker
Description-Content-Type: text/markdown
# Texture baker
Small texture baker which rasterizes barycentric coordinates to a tensor.
It also implements an interpolation module which can be used to bake attributes to textures then.
## Usage
The baker can quickly bake vertex attributes to the a texture atlas based on the UV coordinates.
It supports baking on the CPU and GPU.
```python
from texture_baker import TextureBaker
mesh = ...
uv = mesh.uv # num_vertex, 2
triangle_idx = mesh.faces # num_faces, 3
vertices = mesh.vertices # num_vertex, 3
tb = TextureBaker()
# First get the barycentric coordinates
rast = tb.rasterize(
uv=uv, face_indices=triangle_idx, bake_resolution=1024
)
# Then interpolate vertex attributes
position_bake = tb.interpolate(attr=vertices, rast=rast, face_indices=triangle_idx)
```