微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – 复杂的形状字符轮廓

我有这个字符,我想允许用户选择它,所以当选择它时,我想要围绕它显示一个轮廓.

该角色是一个具有某些网格物体的对象3D.
我试图克隆和设置一个背面材料,但它没有工作,问题是每个立方体的形状是单独渲染背面,所以大纲是错误的.

我需要为轮廓创建另一个网格,是否有更简单的方法

解决方法

@spassvolgel写的是正确的

What I SUSPECT needs to be done is something like this: 1. First the background needs to be rendered 2. Then,on a separate transparent layer,the character model with a flat color,slightly bigger than the original,3. On another transparent layer the character with its normal material / texture 4. Finally,the character layer needs to go on top of the outline layer and them combined need to be placed in the bg

您只需创建多个场景,并将它们与顺序渲染过程相结合:

renderer.autoClear = false;
. . . 

renderer.render(scene,camera); // the entire scene
renderer.clearDepth();
renderer.render(scene2,camera); // just the selected item,larger,in a flat color
renderer.render(scene3,camera); // the selected item again

这是一个使用GPU采摘实现的小提琴,但它可以很容易地与更熟悉的Raycaster实现:

小提琴:http://jsfiddle.net/Tcb3z/

three.js.r.66

原文地址:https://www.jb51.cc/js/150782.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐