File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
- import { Fn , float } from '../tsl/TSLBase.js' ;
1
+ import { Fn , float , select } from '../tsl/TSLBase.js' ;
2
2
import { lengthSq , smoothstep } from '../math/MathNode.js' ;
3
3
import { uv } from '../accessors/UV.js' ;
4
4
@@ -12,18 +12,19 @@ import { uv } from '../accessors/UV.js';
12
12
*/
13
13
export const shapeCircle = Fn ( ( [ coord = uv ( ) ] , { renderer, material } ) => {
14
14
15
- const alpha = float ( 1 ) . toVar ( ) ;
16
15
const len2 = lengthSq ( coord . mul ( 2 ) . sub ( 1 ) ) ;
17
16
17
+ let alpha ;
18
+
18
19
if ( material . alphaToCoverage && renderer . samples > 1 ) {
19
20
20
21
const dlen = float ( len2 . fwidth ( ) ) . toVar ( ) ;
21
22
22
- alpha . assign ( smoothstep ( dlen . oneMinus ( ) , dlen . add ( 1 ) , len2 ) . oneMinus ( ) ) ;
23
+ alpha = smoothstep ( dlen . oneMinus ( ) , dlen . add ( 1 ) , len2 ) . oneMinus ( ) ;
23
24
24
25
} else {
25
26
26
- len2 . greaterThan ( 1.0 ) . discard ( ) ;
27
+ alpha = select ( len2 . greaterThan ( 1.0 ) , 0 , 1 ) ;
27
28
28
29
}
29
30
You can’t perform that action at this time.
0 commit comments