4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Three.jsの透過処理でつまずいた点

Last updated at Posted at 2016-09-21

半透明な板で挟んだのに中身が見えない

スクリーンショット 2016-09-21 12.51.17.png

外側のモデル(壁)はtransparent=true
内側のモデル(蝶)はtransparent=false
レンダリングのQueueでtransparent=falseが先に描画されるので、蝶だけは透けずに表示される。

位置がかぶるとうまくレンダリングされない

上の例で全てのモデルをposition.set(0,0,0)としていたところ、片方の壁が透過されない状態に。
https://mo49.github.io/qiita/20160908/opacity.html

これを解決するために片方の壁の位置を0.1ずらしてあげることで、両方の壁が透過されるようになった。
https://mo49.github.io/qiita/20160908/opacity.html

参考
JSONモデルを透過させた際に表示に差異がある

奥にあるモデルが手前のモデルを上書きしてしまう

depthTest = false;

depthTestにfalseを設定すると、奥の物体が手前の物体を上書きするのを防ぐ「陰面処理」が無効になる

参考
多彩な表現力のWebGLを扱いやすくする「Three.js」 (3/5)

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?