shadewire
Compile MaterialX materials and Blender material graphs to shader code from Python: WGSL, GLSL (desktop and ES), HLSL and Metal, each with the reflection a renderer needs to bind them. The compiler is Rust (Shadewire); one wheel per platform serves every CPython from 3.8.
pip install shadewire
from shadewire import mtlx, glsl
text = open("material.mtlx", encoding="utf-8").read()
ir = mtlx.to_ir(text, location="material.mtlx") # the material in Shadewire's IR
compiled = glsl.compile(ir, version=420) # or shadewire.wgsl / .hlsl / .msl
print(compiled.code) # the model's struct, shadewire_eval_surface(), ...
print(compiled.reflection["uniforms"]) # offsets and defaults of the uniform block
print(compiled.reflection["textures"]) # files, colorspaces, bindings
-
shadewire.mtlx:to_ir(text, location=None, material=None, models=None, ...)andmaterial_names(text, location=None).modelslists the shading models the renderer accepts:standard_surface,open_pbr_surface,gltf_pbr,surface_unlit, andsurface, the material as a closure tree of MaterialX's lobes (raw BSDF graphs included).resolver=readsxi:includes your way: a callable(base, href) -> (location, text)that raises to fail (None reads the file system relative tolocation).list_dependencies(text, location=None)returns a document's{"includes": [...], "files": [...]}, so a host with its own I/O can fetch everything first:def resolve(base, href): # locations are opaque strings: paths, URLs, archive members location = base.rsplit("/", 1)[0] + "/" + href return location, fetched[location] # a KeyError fails the compile with its message ir = mtlx.to_ir(text, location="https://example.com/m.mtlx", resolver=resolve)
-
shadewire.blender:to_ir(text, material=None, models=None, ...)andmaterial_names(text)read a Blender material graph (the JSON the Blender extension's File > Export > Material Graph writes): a Principled BSDF becomesopen_pbr_surface, other BSDFs a closure tree (acceptsurfaceinmodels). What the front end dropped or approximated, one line per node, is inIr.warnings:ir = blender.to_ir(open("material.json", encoding="utf-8").read(), models=["open_pbr_surface", "surface"]) for warning in ir.warnings: # 'ShaderNodeBevel "Bevel": not lowered, output Normal ...' print(warning)
-
shadewire.Ir:optimize(),dump(),to_dict()(the IR as a JSON-like document),model,structure_hash,warnings. -
shadewire.wgsl,shadewire.glsl,shadewire.hlsl,shadewire.msl:compile(ir, ...)returns ashadewire.Compiledwithcode,language,reflectionandmodel_struct.
The generated code calls host functions (shadewire_host_normal_world(), shadewire_host_texcoord_0()...) that the
renderer defines next to its lights; for a material with lobes it also evaluates them as MaterialX defines
(shadewire_eval_bsdf, shadewire_eval_albedo, shadewire_eval_emission, and shadewire_eval_ambient, the albedo
split into diffuse and specular for a host with its own environment lighting). The repository's
crates/shadewire-py/examples has complete renderers: OpenGL with pygame (a host lighting MaterialX's lobes, and one
with its own PBR over the named models) and wgpu-py.
Licensed MIT; parts port MaterialX (Apache-2.0) and Open Shading Language (BSD-3-Clause): see NOTICE.
Metadata
Release files for shadewire 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shadewire-0.2.0.tar.gz | 686.5 kB | Without provenance | Details for shadewire-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 9.6 MB
Release files / shadewire-0.2.0.tar.gz
| Download URL | shadewire-0.2.0.tar.gz |
|---|---|
| Size | 686.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dd65a094c7c5aad75f224a73a1b3c62a6ed59c2de9fb9791eda24783fdd3a1d
|
|
BLAKE2b-256 checksum How to use checksums |
ea98b938cc79872e142473be9b4dbfc0047f8ca6c1dc4a77a32f63085c176c2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / shadewire-0.2.0-cp38-abi3-win_arm64.whl
| Download URL | shadewire-0.2.0-cp38-abi3-win_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4e12e39d95ce62bf7078e1b475ad64ed4ad309d2cb6711d7df4f5018aeda4ea2
|
|
BLAKE2b-256 checksum How to use checksums |
ed2310ec3e8af518cc6873a83e52c50671559594e02e131c63396243f645e416
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / shadewire-0.2.0-cp38-abi3-win_amd64.whl
| Download URL | shadewire-0.2.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
68feae93662451423710513f704037027937cb0c1ca985defdf81b11d48ddabf
|
|
BLAKE2b-256 checksum How to use checksums |
4f8ddf7aff3459162e10ad5e24a9530f5e88884ce91763c84dba83b8613ef934
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / shadewire-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | shadewire-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9751a4e97817cba5ea668917c77c67577100717715cd4e879e9cb05f487e0e34
|
|
BLAKE2b-256 checksum How to use checksums |
46a17d83a858ad204818ce619168211dcc0e0e10e690258c0fc077e1d4c52acf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / shadewire-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | shadewire-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
da397cf61e341a54131b73b9e4de6535f378ba8a6fb8199908138cb1c435ee05
|
|
BLAKE2b-256 checksum How to use checksums |
1c7dca08ecfcf3e35bddaa8bbf19c4175fad725e50b231183cecec136f3aa996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / shadewire-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | shadewire-0.2.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7bf206e1146efe34e8bba43fdf6cbd21781643e5a37518ad6197560962837552
|
|
BLAKE2b-256 checksum How to use checksums |
e02dc9639fa8a0941f0b8089823d5b3cfc1c4d7b2cf2c148b8b6ee5145425cc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / shadewire-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | shadewire-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
329297bfd00734410f4b37e3d400cb5307ffd4d087c4e6fa285ece54e0948264
|
|
BLAKE2b-256 checksum How to use checksums |
85d73b39b32875e9618e22eb87f7e5e0b8f86233717658bf5482ac0babd3bdd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for shadewire 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.