• International日本語
  • Three.js において SkeletonMesh に光と影を適用したい

  • تم التحرير

お世話になっております!いつも楽しく Spine を使っております!

さて、Three.js ランタイムについて質問です。
Three.js で表示している Spine データ(SkeletonMesh)に対して下記 3 点を適用したいと考えています。

  1. SkeletonMesh に光を当てたい
  2. SkeletonMesh の影を落としたい
  3. 他の 3D オブジェクトの影を SkeletonMesh に落としたい

実験的にサンプルプロジェクトを用意していますので、併せて確認していただければと存じます。
コントロールパネルを用意していますので、ご確認に活用していただければと存じます。

また、サンプルプロジェクトのバージョン情報は下記の通りです。

  • ランタイム
    • Three.js: 0.167.1
    • @esotericsoftware/spine-threejs: 4.2.58
    • Typescript: 5.5.4
  • Spine アプリケーション: v4.2

1.SkeletonMesh に光を当てたい
SkeletonMesh に対して、Three.js の Light の光を当てても影響がない状況です。
どのようすれば、SkeletonMesh に対して Three.js の Light の影響を与えられるのかご教授をお願いいたします。

サンプルページでは SpotLight で SkeletonMesh を照らしており、SkeletonMesh に spineSkeletonMesh.castShadow = true を適用していますが、光が適用されない状況でした。
(下記の画面キャプチャのように SpotLight の色味を変更しても、SkeletonMesh に適用されない状況です。)

2.SkeletonMesh の影を落としたい
SkeletonMesh の形状に沿って、影を落とせるようにしたいと考えています。
理想としては下記の画面キャプチャのようなカタチで影を落とせるようにしたいです。
現状では光と同じく、そもそも影が表示されない状況でした。どのようすれば、SkeletonMesh の影を落とせるのかご教授をお願いいたします。

3.他の 3D オブジェクトの影を SkeletonMesh に落としたい
下記の画面キャプチャのように SkeletonMesh を、他の 3D オブジェクトの影に入れても、影響がない状況です。
どのようすれば、SkeletonMesh に対して、他の 3D オブジェクトの影を適用できるのかご教授をお願いいたします。

確認したい点は以上になります。
お手数をおかけしますが、よろしくお願いいたします!

    Related Discussions
    ...

    tonyo-maru

    You area right, currently the custom shader we use just renders the textures ignoring lights.
    I saw that we can extend the current shader rather than creating a new one. We'll se what we can do.

    I created an issue on our GitHub. You can follow update on there. However, it will take a while before we'll be able to work on that.

    @Davide
    Thank you for your prompt answer and creating the issue!
    I understand.

    To be honestly, I can't write shader code at all …, but I'll try to read three.js code and write code.

      4 أشهر لاحقا

      tonyo-maru

      We've finally implemented this. It required rewriting some of the internals of spine-threejs.
      We also upgraded to a more modern version of threejs because it removed some API we used.
      You can read more in this blog post.