MaiaVictor
MaiaVictor

Reputation: 52987

How to use an extra parameter as the z-index on Three.js?

I am using a personalized ortographic projection matrix to position my objects, which are all flat sprites. The problem is there is no way to derive the depth of the projection linearly from their positions: it is, instead, the result of a topological sort of them. How can I set the depth of them independently from their positions?

Upvotes: 0

Views: 2175

Answers (1)

WestLangley
WestLangley

Reputation: 104793

For meshes, you can assign a value to object.renderDepth, and make sure renderer.sortObjects = true.

This does not work for sprites, however. Sprites are always sorted by their z-coord in camera space, when sprite.material.useScreenCoordinates = false.

three.js r.60

Upvotes: 2

Related Questions