Davide Hello Davide, thanks for your reply, we created this sandbox to shared the project to you, versions are write in the package.json
https://codesandbox.io/p/devbox/pass-through-portals-forked-7l3ql9?file=%2Fsrc%2FApp.js
ThreeJS alpha issue when moving asset
The issue seems to be more complicated than I expected.
The problems seems to be caused by the need of more than a batch due to the high number of vertices.
In your skeleton there is a high number of vertices due to the clipping attachment.
As a workaround you could temporarely remove the clipping attachment until I find a suitable solution for the issue.
I've created an github issue for this: EsotericSoftware/spine-runtimes2754
Hey Davide, thanks for your response to our issue.
I also noticed that we had quite a few black lines in the hair area that we managed to remove with alphaTest (but this also reduces the lines on the mouth and other effects).
Also, the color is completely different from when we use spine-player (which gives us the true colors). What could be causing this?
I'll write more about the finding of the main issue you reported here tomorrow.
But regarding the colors and black lines, since you have exported premultiplied textures, you have to enable premultiply alpha in the asset manager:
const assetManager = new spine.AssetManager(baseUrl, undefined, true)
- Modificato
I updated the sandbox with const assetManager = new spine.AssetManager(baseUrl, undefined, true)
which improved the line issue significantly (though they're still slightly visible), but the colors still don't match what I saw in my previous video (using spine player)
https://codesandbox.io/p/devbox/pass-through-portals-forked-7l3ql9
Djauron
https://codesandbox.io/p/sandbox/spine-threejs-forked-6vrj76
wrong sandbox updated
There's actually a bug in spine-threejs
that might lead to the darker color you are seeing.
Since you are not using tint black, you can avoid the issue setting twoColorTint:false
.
const skeletonMesh = new spine.SkeletonMesh({
skeletonData: SkeletonData,
twoColorTint: false,
materialFactory: (parameters) => new THREE.MeshBasicMaterial(parameters),
});
Then, I've notice the @react-three/fiber
use different defaults for the webgl renderer: see here.
The default toneMapping = THREE.ACESFilmicToneMapping
is the reason why you still see lines around mesh borders. To put the default value for tome mapping (THREE.NoToneMapping
), set flat={true}
as canvas property.
<Canvas flat={true} ... >
Let me know if it is rendered as expected.
The result
If you are interested on what was causing the issue you reported initially, here you can find the analysis.
Regarding the wrong colors you had with default parameters (twoColorTint: true
), I've just commited a fix.
However, since you are not using tint black in your skeleton, I would recommend to keep twoColorTint: false
since it uses less vertices to send to the GPU.