Skip to content

Configurable lighting: multiple lights with color + direction #189

Description

@markwpearce

Background

Today's `isShaded` shading model (`SceneObjectBillboard.applyShading()`, `SceneObjectModel.updateCanvasPosition()`) is a single, fixed, camera-facing dot-product brightness with no concept of light color or direction - effectively "brightness = how much this surface faces the camera," floored at `Drawable.ambientBrightness` (added to prevent a face rotating into view from briefly rendering pure black - see #128's investigation).

Proposal

A real lighting model: one or more light sources, each with its own direction (or position, for a point light) and color, combined with each face/surface's normal to compute a properly colored, multi-light-aware brightness - instead of every shaded surface being tied to the camera's own facing direction.

Worth designing deliberately rather than bolting on incrementally - open questions include: directional vs. point lights (or both), how many simultaneous lights are practical given this is a 2D-renderer-based engine doing real per-triangle/per-frame shading math (not a GPU shader), how this interacts with `ambientBrightness`'s existing floor, and whether this belongs on `Game`/`Room` (a scene-wide light list) or per-entity.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions