Skip to main content

Envlight

A toolkit to load *.hdr environment light map and sample lighting under the split-sum approximation.

This is basically a wrapped version of light.py from nvdiffrec.

Install

Assume torch and nvdiffrast already installed.

pip install envlight

# from github
pip install git+https://github.com/ashawkey/envlight

# or locally
git clone https://github.com/ashawkey/envlight
cd envlight
pip install .

Usage

import envlight

normal # [..., 3], assume normalized, in [-1, 1]
reflective # [..., 3], assume normalized, in [-1, 1]
roughness # [..., 1], in [0, 1]

light = envlight.EnvLight('assets/aerodynamics_workshop_2k.hdr', device='cuda')

diffuse = light(normal) # [..., 3]
specular = light(reflective, roughness) # [..., 3]

# to load another hdr file
light.load('assets/mud_road_puresky_1k.hdr')
light.build_mips()

An example renderer:

# requries extra dependencies: pip install trimesh dearpygui
python renderer.py

https://github.com/ashawkey/envlight/assets/25863658/505d57e6-6e8a-4492-ae02-586e28e038ad

Acknowledgement

Metadata

Release files for envlight 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for envlight 0.1.0
File Size Uploaded
envlight-0.1.0.tar.gz 30.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for envlight 0.1.0
File Interpreter ABI Platform
envlight-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.4 kB

Release files / envlight-0.1.0.tar.gz

Download URL envlight-0.1.0.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e1581c719f04d9643aba639783536a5523a435de8b57215f693c17647358a304
BLAKE2b-256 checksum
How to use checksums
0245303d98dd22be8d8eea202898d3172287d9d26d7d80079ddb638ad23e84ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / envlight-0.1.0-py3-none-any.whl

Download URL envlight-0.1.0-py3-none-any.whl
Size 40.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62673c540cf599d3215e6ac8c641e73c71122ff255e776e6a25620735d2352e3
BLAKE2b-256 checksum
How to use checksums
73406450954238a1a767ea10b9ad4af55de98d66e413769321c7370543dccbec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page