Skip to main content

Light volume calculation and rendering with OpenGL

Project description

This package provides the module lightvolume, which offers a CFFI binding to trylock/visibility. This, in turn, is a C++ implementation of the visibility algorithm documented in detail (with awesome interactive demos) on the Red Blob Games website.

API

First, import lightvolume:

import lightvolume

Then, we can create a number of shadow-casting bodies:

objects = [
    lightvolume.rect(0, 0, 500, 500),  # outer bounds - this is needed
    lightvolume.rect(20, 30, 10, 20),
    lightvolume.rect(290, 300, 100, 300),
]

Finally, we can render the lit area cast by a light in this scene (an OpenGL context must already have been created and appropriate GL state set):

light = 90, 200
lightvolume.draw_light(light, objects)

This module is intended to be used with appropriate shaders to provide attenuation, surface interactions such as bump mapping, and so on.

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

lightvolume-0.1.2.tar.gz (85.5 kB view details)

Uploaded Source

File details

Details for the file lightvolume-0.1.2.tar.gz.

File metadata

  • Download URL: lightvolume-0.1.2.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lightvolume-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a089cb78a8110052c03d1f70805e827784c96bd732a81abb3b705b6be7104e2d
MD5 148c4cf314c8d4c03ea61be599afa3be
BLAKE2b-256 d5c7649f1caa96e6b10a7cd59f63b5e31e0c9b7f5485f86af4bbb761ce344d07

See more details on using hashes here.

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