How to select several indices

Hello, I’m testing this project and I don’t fully understand how to add a condition. I would like to have several red spheres and be able to select them using SelectStage. What tool can I use to do this? Thanks.

HowTo Select Indices.vl (60.1 KB)

This is an illustration of the concept
You may need to figure out how the “For” loop works in FUSE shader nodes

HowTo Select Indices.vl (72.0 KB)

Hello, thank you for your help. I’m trying to place several spheres and not just two; I need to figure out how to use SelectStage when working with spreads.

HowTo Select IndicesSeveral_sphre.vl (68.3 KB)

For loops in shaders are generally bad idea, specially if it has dynamic spread counts. To do this properly you likely need to create all of your spheres in advance and offset position depending on params…

1 Like

@visionnocturne I didn’t spot the answer straight away.

I realise you’re looking for more than just two elements. I’ve shown you the concept; you just need to develop it further using shader logic. The ‘for’ loop itself isn’t the problem, but you need to be aware that unrolling is highly likely to occur (though I’m now wondering how the SDSL compiler actually works).

There are various ways to solve your problem. You need a dynamic buffer containing a set of values, and you need to perform calculations on this buffer within a for loop. There is no ‘right’ way to do this task. But you need to understand how shaders work.

You need the ‘for’ from the FUSE itself, not the ‘ForEach’ region.

1 Like