artifacts when rendering both sides of a transparent object with three.js

前端 未结 4 1148
梦谈多话
梦谈多话 2020-11-27 19:27

I try to render both sides of a transparent object with three.js. Other objects located within the transparent object should show too. Sadly I get artifacts I don\'t know to

4条回答
  •  误落风尘
    2020-11-27 20:29

    Self-transparency is particularly difficult in WebGL and three.js. You just have to really understand the issues, and then adapt your code to achieve the effect you want.

    You can achieve the look of a double-sided, transparent sphere in three.js, with a trick: You need to render two transparent spheres -- one with material.side = THREE.BackSide, and one with material.side = THREE.FrontSide.

    Using such methods is generally required if you want self-transparency without artifacts -- especially if you allow the camera or object to move.

    Here is a fiddle: http://jsfiddle.net/x5bm0qLf/

    EDIT: Updated fiddle to three.js r.105

提交回复
热议问题