Two mesh with Muti-Materials set same renderOrder value, the z-order is not correct?
See original GitHub issueDescription of the problem
I create two mesh with same renderOrder.
var circleGeometry = new THREE.CircleBufferGeometry(radius, segements);
var ringGeometry = new THREE.RingBufferGeometry(radius, radius + ringWidth, segements);
var cellGeometry = null;
//...
var circleMaterial = new THREE.MeshBasicMaterial({
map: texture,
// wireframe: true
});
var ringMaterial = new THREE.MeshBasicMaterial({
color: 0x000000,
vertexColors: THREE.VertexColors,
// wireframe: true
});
cellGeometry = THREE.BufferGeometryUtils.mergeBufferGeometries([circleGeometry, ringGeometry], true);
var mesh1 = new THREE.Mesh(cellGeometry, [circleMaterial, ringMaterial]);
scene.add(mesh1);
mesh1.renderOrder = radius;
var mesh2 = new THREE.Mesh(cellGeometry, [circleMaterial, ringMaterial]);
mesh2.position.x += 2;
mesh2.renderOrder = radius;
scene.add(mesh2);
The result was not correct, see screenshot! 
Three.js version
- r94
Browser
- Chrome
OS
- macOS
Hardware Requirements (graphics card, VR Device, …)
Issue Analytics
- State:
- Created 5 years ago
- Comments:27 (4 by maintainers)
Top Results From Across the Web
three.js - How to use Object3d.renderOrder to control the z-index
Setting renderOrder in three.js does not cause a renderable object to be "on top". It just controls the rendering order. It can be...
Read more >Object3D#renderOrder – three.js docs
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together. Sorting is from lowest...
Read more >Z order issue when using custom meshes - Babylon.js Forum
I am using 2 custom meshes with 2 triangles each under certain angles the ordering is fine. image. But when I rotate the...
Read more >Cannot find correct rendering order value, it just breaks.
To fix that I set its Rendering Order to +2. Now exterior parts fade out completely and reveal parts underneath.
Read more >About same Z-Order on ordering - GoJS - Northwoods Software
I found all nodes have the same zOrder and increase or decrease the zOrder same time the nodes do not stack correctly. stack...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi! I definitely need material specific renderOrder feature, instead of
mesh.renderOrder
.I’m currently working on Unity familiar stuff ( https://hub.vroid.com ), and it has
material.renderQueue
to deal with multiple material meshes. Since Three.js has no ability to sort its render order per material, We made our ownWebGLRenderList
to achieve correct rendering order:https://gist.github.com/FMS-Cat/8e86dad4293516c5f2eeed1eedd88843#file-webglvrmrenderlists-ts-L39-L53
Our current way is too hacky and very vulnerable to future Three.js updates so I want a feature that can tweak its render order by material property.
Michael,
The bad practice is still there. This “SortingGroup” workaround comes with wasted processing power (performances hit). Feel free to take it as ‘feature request’ if you like.