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

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...