Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds a 'cast-shadow' attribute to m-light to toggle shadow casting #167

Merged
merged 1 commit into from
May 9, 2024

Conversation

TheCodeTherapy
Copy link
Contributor

This PR implements a cast-shadow boolean attribute to the <m-light> tag to allow the user to enable (default) or disable shadow casting for the m-lights in an MML document.

MML uses ThreeJS on mml-web, and ThreeJS uses shadow maps by default. That means having more than 15 lights casting shadows on a scene will likely exceed the number of texture units available for the WebGL context. Even when not exceeding the limit, a high number of shadow-casting lights with shadow maps impose a brutal performance impact (as every light casting shadows must draw every object in the scene from its own perspective to draw the shadows, and finally the renderer needs an extra draw call to blend all the shadow maps).


What kind of changes does your PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Refactor
  • Tests
  • Other, please describe:

Does your PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe its impact and migration path for existing applications:

Does your PR fulfill the following requirements?

  • All tests are passing
  • The title references the corresponding issue # (if relevant)

@MarcusLongmuir MarcusLongmuir merged commit 3b89fd7 into main May 9, 2024
8 checks passed
@MarcusLongmuir MarcusLongmuir deleted the feature/light-shadows-toggle branch May 9, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants