说我有这个字符,我想允许用户选择它,所以当选择它时,我想要围绕它显示一个轮廓.
该角色是一个具有某些网格物体的对象3D.
我试图克隆和设置一个背面材料,但它没有工作,问题是每个立方体的形状是单独渲染背面,所以大纲是错误的.@H_502_4@
解决方法
@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@H_502_4@
您只需创建多个场景,并将它们与顺序渲染过程相结合:@H_502_4@
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实现:@H_502_4@
小提琴:http://jsfiddle.net/Tcb3z/@H_502_4@
three.js.r.66@H_502_4@