Skip to main content

environment lighting toolkit

Project description

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

Project details


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 hashes)

Uploaded Source

Built Distribution

envlight-0.1.0-py3-none-any.whl (40.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page