forge-basic-lighting

Implement Blinn-Phong lighting with ambient, diffuse, and specular terms in SDL3 GPU scenes.

36|6|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Nebulavenus/forge-gpu --skill forge-basic-lighting-nebulavenus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: forge-basic-lighting
Source: https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-basic-lighting
Command: npx skills add https://github.com/Nebulavenus/forge-gpu --skill forge-basic-lighting-nebulavenus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables real-time lighting for 3D scenes by implementing Blinn-Phong shading with ambient, diffuse, and specular components, using world-space normals and camera-aware uniforms.

Core Features & Use Cases

  • World-space normal transformation using adjugate-transpose of the model matrix to ensure correct shading under non-uniform scales.
  • Per-pixel lighting with ambient, diffuse, and specular terms driven by shader uniforms for base color, light direction, and eye position.
  • Integration with SDL3 GPU pipelines, including MVP/model uniforms and fragment uniforms for lighting parameters.
  • Use cases include lighting a mesh in a game scene, adding basic real-time shading to a model, and experimenting with material properties (shininess, ambient, specular strength).

Quick Start

Load a sample mesh, attach a Blinn-Phong shader, and render with ambient, diffuse, and specular lighting using world-space lighting calculations.

Frequently Asked Questions about forge-basic-lighting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add real-time Blinn-Phong lighting to a 3D scene using SDL3 GPU?

Real-time Blinn-Phong lighting in SDL3 GPU is added by implementing ambient, diffuse, and specular terms with world-space normals. You achieve this by pushing MVP, model matrices, and lighting parameters as vertex and fragment uniforms to the GPU.

How do I calculate world-space normals for shaders under non-uniform scaling?

World-space normal transformation under non-uniform scaling requires the adjugate-transpose of the model matrix. This ensures correct per-pixel shading by properly transforming normals before applying Blinn-Phong lighting calculations.

What uniforms are needed for Blinn-Phong shading in a real-time rendering pipeline?

Blinn-Phong shading requires vertex uniforms for MVP and model matrices, plus fragment uniforms for base color, light direction, and eye position. These lighting parameters drive the ambient, diffuse, and specular calculations per-pixel.

Can I use Blinn-Phong lighting with meshes and textures in SDL3?

Yes, Blinn-Phong lighting integrates with SDL3 GPU pipelines to shade meshes and textures. It uses camera-aware uniforms and per-pixel lighting to render interactive 3D scenes with adjustable material properties like shininess and specular strength.

Why do my 3D scene normals look wrong when using non-uniform scaling?

Normals appear wrong under non-uniform scales because standard transformation matrices distort them. Correct shading requires using the adjugate-transpose of the model matrix to transform world-space normals accurately for Blinn-Phong lighting.