Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Feb 17, 2025

Related issue: https://discourse.threejs.org/t/how-to-use-discard-in-tsl/78217/2

Description

The TSL Transpiler can now transpile the discard syntax in GLSL to TSL:

if ( finalColor.a <= 0.0 ) discard;

is converted to:

import { Discard, If } from 'three/tsl';

If( finalColor.a.lessThanEqual( 0.0 ), () => {

	Discard();

} );

That said, there is a more compact way in writing the above statement in TSL without the If:

 finalColor.a.lessThanEqual( 0.0 ).discard();

But I think the above should be okay for transpiled code.

@sunag sunag added this to the r174 milestone Feb 17, 2025
@sunag sunag merged commit 686b93f into mrdoob:dev Feb 17, 2025
11 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.

2 participants