Skip to content

Commit

Permalink
[threejs] Explicitely discard fragments with alpha < 0.5, closes #1985
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Feb 2, 2022
1 parent b0de9cb commit 738217f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
### Three.js backend
* `SkeletonMesh` now takes an optional `SkeletonMeshMaterialParametersCustomizer` function that allows you to modify the `ShaderMaterialParameters` before the material is finalized. Use it to modify things like THREEJS' `Material.depthTest` etc. See #1590.
* **Breaking change:** the global object `spine.canvas` no longer exists. All classes and functions are now exposed on the global `spine` object directly. Simply replace any reference to `spine.threejs.` in your source code with `spine.`.
* **Breaking change:** the default fragment shader of `SkeletonMeshMaterial` now explicitely discards fragments with alpha < 0.5. See https://github.com/EsotericSoftware/spine-runtimes/issues/1985

### Player
* Added `SpinePlayerConfig.rawDataURIs`. Allows to embed data URIs for skeletons, atlases and atlas page images directly in the HTML/JS without needing to load it from a separate file. See the example for a demonstration.
Expand Down
1 change: 1 addition & 0 deletions spine-ts/spine-threejs/src/SkeletonMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class SkeletonMeshMaterial extends THREE.ShaderMaterial {
varying vec4 vColor;
void main(void) {
gl_FragColor = texture2D(map, vUv)*vColor;
if (gl_FragColor.a < 0.5) discard;
}
`;

Expand Down

0 comments on commit 738217f

Please sign in to comment.