question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't sorting the objects based on Material.Transparency contradicts with onBeforeRender of Object3D?

See original GitHub issue

I have 100 meshes and only one material for all the meshes. I have to make the objects transparent based on user interaction. What i have done is, i changed the material transparency in onBeforeRender of the mesh and changed it again in onAfterRender. But since objects gets sorted based on the Material.Transparent, it does not work properly.

So if we can change the transparency in onBeforeRender, shouldn’t we sort the object based on something other than Material.Transparent?

Three.js version
  • Dev
  • r82
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • Linux
  • Android
  • IOS
Hardware Requirements (graphics card, VR Device, …)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
WestLangleycommented, Nov 20, 2016

Hehe. You beat me by 8 sec…

0reactions
WestLangleycommented, Nov 20, 2016

Why not set material.transparent = true and material.opacity = 1 to begin with?

Read more comments on GitHub >

github_iconTop Results From Across the Web

three.js transparent material: object not always transparent
As far as I know, this happens in 2 occasions: 1) When you have more than 1 facet set on the same position...
Read more >
ThreeJS and the transparent problem - Questions
I create some mesh objects with a simple transparent material. ... sorting issues it to explicitly define the rendering order via Object3D.
Read more >
Transparency Sorting - OpenGL Wiki
This process involves disabling writes to the depth buffer and sorting transparent objects and/or polygons based on distance to the camera.
Read more >
Sorting out Problems with Transparency - Mozilla Hubs
This is often referred to as an 'alpha sorting problem'. The renderer doesn't know what order to sort each surface so it can't...
Read more >
Three.js, transparency bug or limitation or what? - 3D
In a game I am developing there is an odd issue where rotating the player character the water plane looses it's transparent state...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found