Part scale based on Image Pixel density

   4701   5   1
User Avatar
Member
9 posts
Joined: Jan. 2008
Offline
Hi there ! Frist time posting here.

Im learning a lot from you guys. Here we have some great houdini magicians.

The thing is…. i was trying to selective separate in diferent points groups coming from a scattered image., based on how much neighboors they have, so. For example i ant to have in a group point with one neighboor, in another points wih two and so son.

I was tryning with a scatter fuse copy cookie pipeline but… not happy with the results…

I start a week ago working seriously on houdini, cause i start a proyect on maya mel - nuke where we need to put sprites based on the density of the source image to recreate the image with particle Sprites of different sizes. This was very important cause actually only the size makes de diffence betwen each one.

This is an example…. done in maya mel approach

http://youtube.com/watch?v=DKZw6gDi5Xo [youtube.com]

http://youtube.com/watch?v=DKZw6gDi5Xo
[youtube.com]

Of couse i think this can be done pretty much better in houdini to have a lees sprite saturated but with best reading result…

What do you think masters ?
please check out my blog

http://hassanvfx.blogspot.com [hassanvfx.blogspot.com]
User Avatar
Staff
5285 posts
Joined: July 2005
Offline
There is the pic() expression which you can use to grab a pixel value from an image in COPs (use a File COP to load it and reference that):

pic(“copnet1/file”, x, y, 0) // 0=R, 1=G, 2=B, 3=A

You can probably work that into the expression for the sprites scale parameter.
User Avatar
Member
1145 posts
Joined: July 2005
Offline
You could possibly call in the image using the pic function in the point sop,
something like this, in the Add colour fields, changing the last character for the appropriate colour.

pic(“/obj/butterfly/cop2net1/image”,$BBX,$BBY,D_CR)

Then use a series of Group sop to separate out the colours, based on whatever threshold you are after, using the Group by Expression option.

$CB<0.8

or

$CB<0.4-$CG<0.2

And using the boolean operations in the Combine folder to further refine you choices.
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
9 posts
Joined: Jan. 2008
Offline
thanks for your reply guys !

Actually im using in my approach the pic function to create an alpha property inside a point node and then using it inside the scatter custom attribute. (“As i see in The magc of houdini book”)

My issue here is that rather than making a selection of the scale based on the luminance or the intensity inside one RGB channel i want to have a criteria like this:

scanning square area of 10x10 pixels inside channel X, calculate how much of the pixels are white (defining white as any value > .9 )

if white pixels are > 60% of the total area: use only 1 sprite with size 10 x 10.

if white pixels are > 30% use 4 sprites with size 2x2

any other case use 10 sprites with size 1 x 1.

so, if anyone can point me about a good technique to meseaure how much pixels are white inside a determinated area, i think i can go on the rest of the tree, and post the final result here.

(PD, i feel a little scary about to use a loop function to scan using pic… this should be very slowly…. Anyway if somebody can point about how to code this i will do it )

Thanks again ! hassan.
please check out my blog

http://hassanvfx.blogspot.com [hassanvfx.blogspot.com]
User Avatar
Staff
5285 posts
Joined: July 2005
Offline
If you do a box blur of 10x10 using a blur COP, it'll give you average value of the surrounding pixels. While it won't give you totally accurate results with a grayscale map, it will for black & white maps. 60% of pixels white would yield a value of .6, for example. You can then use the pic() function on the blur node instead.

Perhaps this approximation will work for your case.
User Avatar
Member
9 posts
Joined: Jan. 2008
Offline
8)


Oki i solve this using a proximity node in the pop network… here is an example.

thanks guys !

Attachments:
proximitytests.hip (358.5 KB)

please check out my blog

http://hassanvfx.blogspot.com [hassanvfx.blogspot.com]
  • Quick Links