Skip to content

✨ feat: lighting - #25

Merged
AhmedSobhy01 merged 23 commits into
mainfrom
feat/lighting
Apr 18, 2026
Merged

✨ feat: lighting#25
AhmedSobhy01 merged 23 commits into
mainfrom
feat/lighting

Conversation

@AhmedAmrNabil

@AhmedAmrNabil AhmedAmrNabil commented Apr 13, 2026

Copy link
Copy Markdown
Owner

you can play around with adding lighting components in the config.jsonc and use it with a lit material

note that this pr doesn't have gltf/glb model loading yet

Comment thread assets/shaders/lit.frag

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial forward-rendered lighting support by introducing a Light component, a new lit material/shader pair, and tangent generation to support normal mapping.

Changes:

  • Introduce Light component + forward renderer light collection and uniform upload for lit materials.
  • Add LitMaterial with support for multiple PBR-ish texture inputs (albedo/metallic/roughness/normal/AO/emissive).
  • Extend mesh vertices with tangents and compute tangents when loading OBJ meshes; add new lit.vert/lit.frag shaders.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/common/texture/texture2d.hpp Adds TextureUnits enum for binding multiple material textures.
src/common/systems/forward-renderer.hpp Stores scene light render data collected per-frame.
src/common/systems/forward-renderer.cpp Collects Light components, sets camera/model/light uniforms for LitMaterial.
src/common/mesh/vertex.hpp Adds tangent attribute and includes it in equality/hash.
src/common/mesh/mesh.hpp Enables vertex attribute location for tangents.
src/common/mesh/mesh-utils.cpp Computes tangents from UVs after OBJ load.
src/common/material/material.hpp Adds LitMaterial and factory support for "lit".
src/common/material/material.cpp Implements LitMaterial setup, deserialization, and light uniform upload.
src/common/components/light.hpp Introduces Light component and LightRenderData.
src/common/components/light.cpp Implements JSON deserialization for lights.
src/common/components/component-deserializer.hpp Registers Light in the component registry.
src/common/asset-loader.cpp Adds AssetLoader<Light>::clear() call.
assets/shaders/lit.vert Vertex shader with TBN output for normal mapping.
assets/shaders/lit.frag Fragment shader implementing multi-light shading + spot/point/directional support.
config/app.jsonc Adds lit shader and example usage of Light + lit monkey material.
CMakeLists.txt Adds light component source to build.
flake.nix Adds gdb to dev environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/common/material/material.cpp
Comment thread src/common/mesh/mesh-utils.cpp
Comment thread src/common/mesh/mesh-utils.cpp
Comment thread assets/shaders/lit.frag Outdated
Comment thread src/common/asset-loader.cpp Outdated
Comment thread src/common/material/material.cpp
Comment thread assets/shaders/lit.frag Outdated
Comment thread src/common/components/light.hpp
Comment thread src/common/components/light.cpp
Comment thread src/common/material/material.hpp Outdated
Comment thread src/common/material/material.cpp
Comment thread src/common/systems/forward-renderer.cpp
OmarGamal10
OmarGamal10 previously approved these changes Apr 17, 2026
@AhmedAmrNabil AhmedAmrNabil changed the title feat: lighting ✨ feat: lighting Apr 18, 2026

@LoayAhmed304 LoayAhmed304 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it and it looks fine for me for now. We'll dive deeper when we have the map and real lighting source.

@AhmedSobhy01
AhmedSobhy01 merged commit 5c693a1 into main Apr 18, 2026
10 checks passed
@AhmedAmrNabil AhmedAmrNabil mentioned this pull request Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants