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.

OutlinePass does not support InstancedMesh

See original GitHub issue
Description of the problem

OutlinePass does not appear to properly support InstancedMesh. I’ve created an example here that uses the same setup of OutlinePass in the example in the docs. The sphere is a regular Mesh and the squares are the instances of InstancedMesh. https://jsfiddle.net/anthonysimone/dL8s2qmv/

It seems like there’s a couple things going on here.

  1. If you hover over the regular mesh first (sphere), then one of the instanced mesh instances, the base position of the InstancedMesh is outlined any time you’re hovering over any of the instances. In the above example all of the instances have been moved from the default position to demonstrate this clearly.
  2. If you first hover over any of the box instances, the entire collection of instances (though not the base position) of the InstancedMesh are outlined, but then hovering over a regular mesh (the sphere) causes an error.

I dug into OutlinePass a bit and it seems like it might just not be taking into account handling instanced meshes separately from regular meshes. I’m still pretty new to Three.js, so I don’t have a potential fix to suggest at this point.

Three.js version
  • r113
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
Mugen87commented, Mar 25, 2021

Fixed via #20135, see https://jsfiddle.net/quf0p415/1/.

No runtime errors occur anymore. Point 1 of the original post is solved. Also the artifact mentioned in https://github.com/mrdoob/three.js/issues/18533#issuecomment-581782781. Point 2 is partially solved since all instanced meshes are highlighted when one is selected. But that is an acceptable behavior for now since some use cases require it anyway. A solution for individual highlighting is explained here: https://github.com/mrdoob/three.js/issues/18533#issuecomment-581782781

@mrdoob I guess this is a good example of what you mean in https://github.com/mrdoob/three.js/pull/20975#issuecomment-805349659. By removing skinning, the same effect would be achieved and a single overrideMaterial can be used for normal, instanced and skinned meshes 🎉 .

1reaction
mrdoobcommented, Mar 25, 2021

@mrdoob I guess this is a good example of what you mean in https://github.com/mrdoob/three.js/pull/20975#issuecomment-805349659. By removing skinning, the same effect would be achieved and a single overrideMaterial can be used for normal, instanced and skinned meshes 🎉 .

Yes 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

three.js - ThreeJS: native Antialias not working with Outline ...
I'm working on a project that uses a lot of lines and marks with the camera at a very low angle (almost at...
Read more >
OutlinePass does not show correctly - Questions - three.js forum
Dear All, This is my code below, but the outline didn't show correctly~~~~ The outline only show if the no overlapping part between...
Read more >
import LOCAL .obj to load with Three.js OBJLoader using ...
I figured it out. In the webpack config I changed the .obj loader, from 'file-loader' to 'url-loader' const rules = [ { test:...
Read more >
[Tutorial] Adding outline detailing to meshes in Three.js with ...
Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, try restarting your device. Your browser can't play this video.
Read more >
mrdoob/three.js r144 on GitHub - NewReleases.io
Support HSL(A) with decimal percentage values. #24461 (@Mugen87) ... Add support for InstancedMesh . ... Editor. Do not call .update() for skeleton helpers....
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