Skip to content

Conversation

@mrxz
Copy link
Collaborator

@mrxz mrxz commented Jul 24, 2025

With #134 the default blending now uses premultipliedAlpha. The material system of Three.js has built-in support for this, which takes care of setting the right blending function as well as providing a define in the fragment shader.

This PR replaces the custom blending function and instead uses the premultipliedAlpha setup. Additionally the uniform has been replaced with the define. This does mean that changing the flag requires a shader recompilation, though these variants are cached by Three.js. In the unlikely situation that a user repeatedly switches this flag, it should only incur a recompilation once.

@mrxz mrxz force-pushed the three-normal-blending branch from 0632611 to 0f45622 Compare July 24, 2025 11:17
Copy link
Contributor

@asundqui asundqui left a comment

Choose a reason for hiding this comment

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

Nice! Very helpful with in-depth Three.js knowledge, the trade-off sounds good to me, unlikely the user will be changing that flag I agree, but even so seems fine.

@dmarcos dmarcos merged commit 30f50aa into sparkjsdev:main Jul 25, 2025
2 checks passed
kali-shade pushed a commit to kali-shade/spark-kali that referenced this pull request Sep 16, 2025
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.

3 participants