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.

[Feature request] Add per-instance visibility support to InstanceMesh

See original GitHub issue

Is your feature request related to a problem? Please describe.

In the project I’m working on (a 3d editor) we have objects in the form of AABB boxes. We have all objects invisible by default and show them when highlighted or selected. The problem arises when selecting a group with many children, which should become visible. Instancing is a perfect solution for this, but we would need a way to show/hide them individually. I’m not sure how possible this request is, or if there’s a way to do this that I missed.

Describe the solution you’d like

A way to set visibility of each instance, like currently exists for color. setVisibilityAt() and getVisibilityAt(), for example.

Describe alternatives you’ve considered

I’ve tried setting the scale to zero, but I need to use the raycast on those invisible objects (in the editor objects are highlighted on hover and selected on click).

Additional context

This is what I want to achieve https://gfycat.com/QuestionableOilyLeech

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Mugen87commented, Jul 9, 2021

A way to set visibility of each instance, like currently exists for color. setVisibilityAt() and getVisibilityAt(), for example.

Notice that an additional instanced attribute that controls visibility will not improve the performance. It might be preferable to organize your instances in a way such that the visible instances are defined first and after that the invisible ones. In this way, you can use the count property to decrease the effective draw range.

This will produce the same result and you will have better performance. Of course you have to do more work at app level to get things going.

2reactions
aminickcommented, Apr 14, 2022

This is my solution:

// emptyMatrix = [0, 0, 0]
meshRef.current.setMatrixAt(id, emptyMatrix)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to show and hide an instance in instance mesh - Questions
If you want to show/hide instances, it's explained here: [Feature request] Add per-instance visibility support to InstanceMesh · Issue #22102 ...
Read more >
GPU instancing - Unity - Manual
To add GPU instancing support to any other shader, see Creating shaders that support GPU instancing. The mesh must come from one of...
Read more >
Canon Man Tutorial: Hierarchical Instanced Static Meshes
Announcement: https://forums.unrealengine.com/showthread.php?118229In this learning stream Ian has prepared a mini-game, Canon Man, ...
Read more >
Efficient instancing in a streaming scenario - Game Developer
Run a compute shader over the tile-set in view to determine which meshes to render. Just count instances per mesh in the instance-count...
Read more >
DrawMeshInstancedIndirect Example Comments and Questions
In order to correctly render shadows you need to add additional pragma defines, ... and add each visible instance to an Append Buffer....
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