Instancing from image with conditions

Hi there !

I am trying to use a texture to create instances of an object at certain positions.

Basically, i have a black and white texture like an image or a picture, and i would like to add 3D objects or points where the image is white, and nothing where it is black.

Now i am able to process the image and create objects from it at the desired UV positions. But as i am processing the image for all pixels, objects are instantiated at every pixel position.

How can i filter and prevent the instantiation to happen on the black parts of the image ?

Procedurally with code seems obvious, but i can’t find a way using TD logic. I probably need to create another texture array with black part filtered ? or convert it into a CHOP or DAT beforehand ?

Thanks a lot.

There’s a new attribute for instances called active that’s pulled from the translate Op. If you can pack your active / display data into your alpha channel of your position texture you should be able to make this work. Here’s a fast example:

base_active_as_alpha.tox (982 Bytes)

oh ! i didn’t noticed that !
Very nice feature !

What is the MathTOP purpose by the way ?

thanks a lot

Pixel values in the ramp TOP are typically expressed in a normalized range from 0 -1. Rather than editing the ramp keys, a Math TOP here changes the range of positions. If you bypass the math TOP you should see that all of the instances are only in the range of 0 - 1 and no longer centered in world space.

ok ! got it !

Any way widen the “black filter” ?
like drop everything black + grey-ish… i am currently using a thresholdTOP but find it a bit rough and not precise enough.

thanks

I think it really depends on how you want to work here - one approach would be to use the monochrome TOP to convert to gray scale, then use the chroma key TOP for some finer control in tuning your selection. The Reorder TOP is a pretty powerful way to move data around in channels, so the output of your chroma key should be easily rearrange to work with instancing.