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
- Credits to Nvidia's nvdiffrec.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
envlight-0.1.0.tar.gz
(30.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
envlight-0.1.0-py3-none-any.whl
(40.4 kB
view details)
File details
Details for the file envlight-0.1.0.tar.gz.
File metadata
- Download URL: envlight-0.1.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1581c719f04d9643aba639783536a5523a435de8b57215f693c17647358a304
|
|
| MD5 |
c9fd54e39273cc1ec30e5d64e7a6fb68
|
|
| BLAKE2b-256 |
0245303d98dd22be8d8eea202898d3172287d9d26d7d80079ddb638ad23e84ad
|
File details
Details for the file envlight-0.1.0-py3-none-any.whl.
File metadata
- Download URL: envlight-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62673c540cf599d3215e6ac8c641e73c71122ff255e776e6a25620735d2352e3
|
|
| MD5 |
cf4f61e735682a476af347c5b397d602
|
|
| BLAKE2b-256 |
73406450954238a1a767ea10b9ad4af55de98d66e413769321c7370543dccbec
|