Skip to content

R3F: an opacity outside [0, 1] is clamped, as three draws it, instead of throwing - #117

Merged
shinyobjectz merged 1 commit into
shinyobjectz:mainfrom
Ragulsundaram:fix-r3f-opacity-overshoot
Nov 12, 2026
Merged

shinyobjectz merged 1 commit into
shinyobjectz:mainfrom
Ragulsundaram:fix-r3f-opacity-overshoot

Conversation

@Ragulsundaram

Copy link
Copy Markdown
Contributor

Fixes #115.

A three.js material opacity outside [0, 1] (an overshooting easing gives 1.03) is clamped by three when it draws; the R3F bridge handed it straight to raea's MeshBasicMaterial, whose check threw RangeError. The bridge now clamps opacity (in drawn() and the shadow-catcher's ShadowMaterial) before converting.

Test: sdk/r3f/test/input.test.tsx "an opacity past 1 or below 0 ... is clamped" fails without the change and passes with it.

… of throwing

An easing that overshoots (bezier(0.34, 1.4, 0.64, 1)) gives a material opacity of 1.03; three clamps it when it
draws, but the bridge handed it straight to raea's MeshBasicMaterial, whose check threw RangeError. The bridge now
clamps opacity before converting.
@shinyobjectz
shinyobjectz merged commit 163f0b9 into shinyobjectz:main Nov 12, 2026
4 checks passed
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.

<R3F>: a material opacity just over 1 (an overshooting easing) throws RangeError; three.js clamps it

2 participants