Transparency with complex shapes in three.js -


i'm trying render complex lamp using three.js: https://sayduck.com/3d/xhcn

render preview

the product split in multiple meshes similar one: mesh preview

the main issue need use transparent png textures (in order achieve complex shape while keeping polygon counts low) this: texture preview

as can see live demo, gives weird results, when rotating camera around lamp - believe due z-ordering of meshes.

i've been reading answers similar questions on so, https://stackoverflow.com/a/15995475/5974754 or https://stackoverflow.com/a/37651610/5974754 understanding of underlying mechanism of how transparency handled in three.js , webgl.

i think in theory, need is, each frame, explicitly define renderorder each mesh transparent texture (because order based on distance camera changes when moving around), three.js knows pixel closest camera.

however, ignoring moment explicitly setting order each frame seems far trivial, not sure understand how set order theoretically. meshes have complex shapes , quite intertwined, means given camera angle, part of mesh can closer camera part of mesh b, while somewhere else, part of mesh b closer. in situation, seems impossible define closer mesh, , proper renderorder.

have understood correctly, , reaching limits of webgl can handle?

otherwise, if doable, approach 2 render scenes (one opaque meshes first, 1 transparent ones ordered front) right one? how should go defining front renderorder way three.js expects?

thanks lot help!


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

Why does math.random(999999999999) returns 1 in Lua? -