Skip to content

Commit 8a475a6

Browse files
authored
SpriteNodeMaterial: Set transparent=true as default (#30435)
1 parent 422684a commit 8a475a6

9 files changed

+13
-9
lines changed

examples/webgpu_instance_sprites.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
// material
7272

73-
material = new THREE.SpriteNodeMaterial( { sizeAttenuation: true, map, alphaMap: map, alphaTest: 0.1, transparent: true } );
73+
material = new THREE.SpriteNodeMaterial( { sizeAttenuation: true, map, alphaMap: map, alphaTest: 0.1 } );
7474
material.color.setHSL( 1.0, 0.3, 0.7, THREE.SRGBColorSpace );
7575
material.positionNode = instancedBufferAttribute( positionAttribute );
7676
material.rotationNode = time.add( instanceIndex ).sin();

examples/webgpu_particles.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
smokeNodeMaterial.positionNode = offsetRange.mul( lifeTime );
9090
smokeNodeMaterial.scaleNode = scaleRange.mul( lifeTime.max( 0.3 ) );
9191
smokeNodeMaterial.depthWrite = false;
92-
smokeNodeMaterial.transparent = true;
9392

9493
const smokeInstancedSprite = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), smokeNodeMaterial );
9594
smokeInstancedSprite.scale.setScalar( 400 );

examples/webgpu_postprocessing_afterimage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090

9191
// material and TSL
9292

93-
const material = new THREE.SpriteNodeMaterial( { blending: THREE.AdditiveBlending, depthWrite: false, transparent: true } );
93+
const material = new THREE.SpriteNodeMaterial( { blending: THREE.AdditiveBlending, depthWrite: false } );
9494

9595
const localTime = instancedBufferAttribute( timeAttribute ).add( time.mul( 0.1 ) );
9696
const modTime = mod( localTime, 1.0 );

examples/webgpu_sprites.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
material.colorNode = textureNode.mul( uv() ).mul( 2 ).saturate();
7171
material.opacityNode = textureNode.a;
7272
material.rotationNode = userData( 'rotation', 'float' ); // get value of: sprite.userData.rotation
73-
material.transparent = true;
7473

7574
for ( let a = 0; a < amount; a ++ ) {
7675

examples/webgpu_tsl_compute_attractors_particles.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
// particles
142142

143143
const count = Math.pow( 2, 18 );
144-
const material = new THREE.SpriteNodeMaterial( { transparent: true, blending: THREE.AdditiveBlending, depthWrite: false } );
144+
const material = new THREE.SpriteNodeMaterial( { blending: THREE.AdditiveBlending, depthWrite: false } );
145145

146146
const attractorMass = uniform( Number( `1e${7}` ) );
147147
const particleGlobalMass = uniform( Number( `1e${4}` ) );

examples/webgpu_tsl_galaxy.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
// galaxy
4949

5050
const material = new THREE.SpriteNodeMaterial( {
51-
transparent: true,
5251
depthWrite: false,
5352
blending: THREE.AdditiveBlending
5453
} );

examples/webgpu_tsl_vfx_flames.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
// flame 1 material
9595

96-
const flame1Material = new THREE.SpriteNodeMaterial( { transparent: true, side: THREE.DoubleSide } );
96+
const flame1Material = new THREE.SpriteNodeMaterial( { side: THREE.DoubleSide } );
9797

9898
flame1Material.colorNode = Fn( () => {
9999

@@ -129,7 +129,7 @@
129129

130130
// flame 2 material
131131

132-
const flame2Material = new THREE.SpriteNodeMaterial( { transparent: true, side: THREE.DoubleSide } );
132+
const flame2Material = new THREE.SpriteNodeMaterial( { side: THREE.DoubleSide } );
133133

134134
flame2Material.colorNode = Fn( () => {
135135

examples/webgpu_tsl_vfx_linkedparticles.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
const particleGeom = new THREE.PlaneGeometry( particleQuadSize, particleQuadSize );
124124

125125
const particleMaterial = new THREE.SpriteNodeMaterial();
126-
particleMaterial.transparent = true;
127126
particleMaterial.blending = THREE.AdditiveBlending;
128127
particleMaterial.depthWrite = false;
129128
particleMaterial.positionNode = particlePositions.toAttribute();

src/materials/nodes/SpriteNodeMaterial.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ class SpriteNodeMaterial extends NodeMaterial {
8686
*/
8787
this.scaleNode = null;
8888

89+
/**
90+
* In Sprites, the transparent property is enabled by default.
91+
*
92+
* @type {Boolean}
93+
* @default true
94+
*/
95+
this.transparent = true;
96+
8997
this.setDefaultValues( _defaultValues );
9098

9199
this.setValues( parameters );

0 commit comments

Comments
 (0)