Skip to content

Conversation

@HifiExperiments
Copy link
Member

closes #1131

this adds support for basic additive local lights on mtoon. like UniVRM and Lyuma, this doesn't affect the lighting direction used for MToon shading, because we don't have access to the necessary information in the deferred pass.

this ended up being quite a bit simpler than I originally thought once I realized I could store which surfaces were MToon in the deferred buffer using existing mechanisms and use that to skip directional lighting and only apply local lights. I've also added a framebuffer debugging option to luci to visualize just MToon surfaces

Test plan

You can run this script to create a bunch of MToon spheres and confirm that they are now affected by light entities. Note again that this lighting is additive, so a full bright MToon surface (1, 1, 1) will still appear white when lit - although if you have bloom enabled the surface will still glow with the light color since bloom uses the unclamped color.

Funding

This project is funded through NGI0 Entrust, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.

NLnet foundation logo
NGI Zero Logo

@HifiExperiments HifiExperiments added needs CR This pull request needs to be code reviewed needs QA This pull request needs to be tested NLnet labels Dec 3, 2025
@ada-tv
Copy link
Collaborator

ada-tv commented Dec 3, 2025

This looks relatively simple. I wonder if #1793 could be adapted to use this too after this PR is merged and I rebase the forward lights branch

@HifiExperiments
Copy link
Member Author

This looks relatively simple. I wonder if #1793 could be adapted to use this too after this PR is merged and I rebase the forward lights branch

yeah we’d just calculate the local lighting as you do elsewhere and add it to the color in the mtoon block, should be pretty simple!

@JulianGro
Copy link
Member

This is certainly a lot better than before.
One thing that is a bit weird is how little effect local lights have without key light versus with key light:
overte-snap-by--on-2025-12-30_22-08-46
overte-snap-by--on-2025-12-30_22-10-45
The pinkish tint comes from the ambient light.
Turning off both ambient light and key light…:
overte-snap-by--on-2025-12-30_22-13-31
(Still a lot better than the perfect black on master.)

Copy link
Member

@ksuprynowicz ksuprynowicz left a comment

Choose a reason for hiding this comment

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

Everything looks good :)

@ksuprynowicz ksuprynowicz added CR approved This pull request has been successfully code reviewed and removed needs CR This pull request needs to be code reviewed labels Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CR approved This pull request has been successfully code reviewed needs QA This pull request needs to be tested NLnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Take local lights into account for MToon

4 participants