-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Description
Description
The chaining of step
and smoothstep
are inconsistent with each other. smoothstep
chains the last parameter, which is OK, but steps
chains the first parameter - this is inconsistent with smoothstep
, but consistent with most other chaining, where the first parameter got chained.
smoothstep( e0, e1, x )
→x.smoothstep( e0, e1 )
-- this is OKstep( edge, x )
→edge.step( x )
-- this is inconsistent
Two suggestions:
- Making
step
consistent withsmoothstep
and chain its last parameterx.step( edge )
- Adding documentation about what parameter is chained, e.g. always the fisrt, except for
step
,smoothstep
...
Issues:
- Such change will break already existing TSL-based code
Reproduction steps
- Place the code form [Code] section in the TSL Editor
- Uncomment one of the lines 5..9 to see the effect
- Lines 5, 6 and 7 work fine
- Line 8 should result as 7, but it is not
- Line 9 just tests that
step
chains the first parameter
Code
const { float, vec4, uv, step, smoothstep } = await import( 'three/tsl' );
const x = uv().x;
//const r = smoothstep( 0.25, 0.75, x );
//const r = x.smoothstep( 0.25, 0.75 );
//const r = step( 0.5, x );
const r = x.step( 0.5 );
//const r = float( 0.5 ).step( x );
output = vec4( r, 0, 0, 1 );
Live example
(not provided)
Screenshots
Left two snapshots show that smoothstep
chains the last parameter.
Right three snapshots show that step
chains the first parameter.
Version
r176
Device
Desktop
Browser
Chrome
OS
Windows
sunag
Metadata
Metadata
Assignees
Labels
TSLThree.js Shading LanguageThree.js Shading Language