三.js:如何控制渲染顺序 [英] three.js: how to control rendering order

查看:44
本文介绍了三.js:如何控制渲染顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用three.js

如何控制渲染顺序?假设我有三个平面几何图形,并且想要以特定顺序渲染它们,而不管它们的空间位置如何.

谢谢

解决方案

可以设置

renderer.sortObjects = false;

并且对象将按照它们添加到场景中的顺序进行渲染.

或者,您可以将 sortObjects 保留为 true(默认值),并为每个对象指定 object.renderOrder 的值.

有关详细信息,请参阅 Threejs 中的透明对象

您可以做的另一件事是使用此处描述的方法:如何使用 Threejs 改变对象的 zOrder?

three.js r.71

Am using three.js

How can I control the rendering order? Let's say I have three plane geometries, and want to render them in a specific order regardless of their spatial position.

thanks

解决方案

You can set

renderer.sortObjects = false;

and the objects will be rendered in the order they were added to the scene.

Alternatively, you can leave sortObjects as true, the default, and specify for each object a value for object.renderOrder.

For more detail, see Transparent objects in Threejs

Another thing you can do is use the approach described here: How to change the zOrder of object with Threejs?

three.js r.71

这篇关于三.js:如何控制渲染顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆