VOPs Flocking

   18616   20   2
User Avatar
Member
132 posts
Joined: July 2005
Offline
I haven't really gotten into the thick of this experiment but I'd like to describe a theoretical solution to flocking which I plan on setting up in VOPs. This is my second particle operator I've built through VOPs so I'm really new to the pipeline.

I would like to replicate the “boids” model seen here:

http://www.red3d.com/cwr/boids/ [red3d.com]

By casting a cone of rays out in the direction of my particles velocity and letting those rays bounce off other particles I'd like to determine the location of other particles and adjust my velocity based on what my particle “see's.”

Any help or links you could offer would help. I'll be working on this today as an excersize and will update when I make some progress or run into any walls…

I could use any VOPs/VEX tips out there and have been finding a lot online already, any more links you could offer will probably help.
User Avatar
Member
15 posts
Joined: July 2005
Offline
http://www.kolve.com/mp_brainbugz/brainbugz.htm [kolve.com] - open source plug-in for Maya doing some nice behavioural animation applied to Maya's particles. It is easy to use and works as expected.
Will not be that hard to catch-up some ideas and to extract the math from there.

EDIT: Forgot to mention - take a look at the Thesis page - it is based on CraigRaynolds papers.
User Avatar
Staff
2592 posts
Joined: July 2005
Offline
http://odforce.net/forum/index.php?showtopic=2131&hl= [odforce.net]

Probably not exactly what you're looking for, but fun none the less.
User Avatar
Member
132 posts
Joined: July 2005
Offline
Thanks guys these responses have been really helpful. The bugbrainz plugin by Carsten Kolve is pretty slick! Now I just have to replicate the same kind of thing in Houdini… thanks again for the input so far!
User Avatar
Member
132 posts
Joined: July 2005
Offline
Update:

Okay, it is becoming clear to me that in order to do this correctly I have to familiarize myself more with the way a VOP_particle network should work.

I've decided to ditch my “boids” idea for a much more simple excersize to get me on the right path. My goal now is to create a nice 3D noise field (which will act somewhat like turbulence) for my particles to fly through.

Simple enough, right?

So far I have my VOP network setup like this:

I bring in my pop info from a “global variable” pop. I pipe EVERYTHING out through the output variables pop and make sure the newly created pop is working correctly (i.e. not doing anything.) After I do this I lay down 3 turbulence VOPs so I can add noise in X, Y, and Z seperately. I attach parameters to the frequency, offset, and amplitude inputs on my noise so I have control over them in pops (I control amplitude for X, Y, and Z seperately but my offsets and frequency work on all turbulence VOPs at once.)

After I do this I take my particle velocity information and strip it out into x,y,z values using a vector_to_float VOP.

Here's where I go wrong…. (unless I've already gone wrong which is highly likely). In order to add the noise to my particles I'm using an “add” VOP and adding the turbulence values to my stripped out X, Y, and Z values. So I have three turbulences, one for each axis, being added to my velocity in x, y, and z seperately.

This may work if the only value returned from my noise was -1 to 1 but I assume it's not (by the way, is there a way to visualize numeric outputs from VOPs?) The result I get is interesting but not what I want. My particles are clearly biased in one direction from my having added the turbulence to each axis instead of introducing it in some other way.

I'm certain there's a better way for doing something like this properly. I know the way I'm approaching this isn't very elegant so any input to steer me in the right direction woud be appreciated.
User Avatar
Member
132 posts
Joined: July 2005
Offline
“(by the way, is there a way to visualize numeric outputs from VOPs?)”

This is kind of a stupid question since everything done in Houdini can be seen…. I could look at my velocity values from my source pops, then look at the new values from my noise VOP, and get the difference from there. However it may be cool to have a spreadsheet type view available within the VOP editor. I'm curious how other artists are looking at the math behind the curtains…
User Avatar
Member
31 posts
Joined: July 2005
Offline
(by the way, is there a way to visualize numeric outputs from VOPs?)

Hi Squid

what I usually do is use a print vop (make sure you have “print to console” turned on in the vop)

What this will do is print the values from your shader into the shell that you started
from. I use this to debug my vex ops all the time. If you're working on windows you will
need to start houdini from a shell(a unix emulator like cygwin is nice) in order to see the values.
User Avatar
Member
1631 posts
Joined: July 2005
Offline
Hey the_squid,

To print out values, use the Print VOP.

Cheers!
steven
User Avatar
Member
132 posts
Joined: July 2005
Offline
The “print VOP”…. OF COURSE!!!

Well that certainly helps. By the way, in Windows if you dont start from a console but toggle on “Output Text to Console” it creates a new window and prints your values there. Very cool! Thanks for the responses. I now have some better noise but it's still clearly biased in one direction. I hooked color into the noise as well so I can see what it's doing a bit better.

Using the print VOP will help me get to the bottom of this a lot faster
User Avatar
Member
132 posts
Joined: July 2005
Offline
When I do my conversions from vector to float value's I'm getting strange results.

I'm using a “vector to float” VOP and piping the “v” from “Global Variables” into it. The vector values I get before the conversion are:

v: {0.404275,1.624916,0.659920}

Converted through a vector to float VOP they become:

fval1: 0.008625 fval2: 1.215465 fval3: 0.444304

I assume this may be normal but it's not what I want. I thought by using “vector to float” I'd be able to easily seperate out my X, Y and Z values. There are other ways to seperate these values, but now I'm wondering what the vector to float is usually used for.
User Avatar
Member
7725 posts
Joined: July 2005
Offline
The print VOP gets executed for all points. Are you sure you're just not seeing results from different points?
User Avatar
Member
132 posts
Joined: July 2005
Offline
Yes, I'm only emitting one point.
User Avatar
Member
7725 posts
Joined: July 2005
Offline
This works for me. My guess is that you're modifying the values and they're not getting printed where you think. Check the VEX code.
User Avatar
Member
132 posts
Joined: July 2005
Offline
// Code produced by: print1
text = sprintf(“v: %f\tfval1: %f\tfval2: %f\tfval3: %f”, v, fval1, fval2, fval3);
printf(“v: %f\tfval1: %f\tfval2: %f\tfval3: %f\n”, v, fval1, fval2, fval3);

================

I was able to view the correct values finally after setting all of my new pop parameters to 0.

I have two pops. One is a source and one is the new pop I'm making in VOPS. I have my pops in view, my new VOP pop is displayed and I'm able to see the changes I make at the VOP level affect my pops. Life is good.

I have my print hooked up to my original velocity (first value) and hooked into my vector to float conversion (second value). If I set all of my noise values to 0 the values I get back in the “print” are correct. However, the second I introduce noise this all changes and I see different results. I'm wondering now if the noise VOP I'm creating is actually reading from the noise VOP I'm using in pops…

Sound familiar? Anybody else ever have this issue? Again, I'm new to VOPs and it's very possible I'm doing something I shouldn't be. See anything wrong with my setup from what I've written?
User Avatar
Member
252 posts
Joined: July 2005
Offline
Have you checked out the WISP POP on odforce? It does a great job of simulating a random bug-like flying motion that seems somewhat intelligent. that you could layer in with a flocking/interact POP setup I would think.

It basically creates a 3D noise field and the particles fly around the “gradient” of the noise. Anyway, the VEX code is there and you can check it out.

-Craig
User Avatar
Member
132 posts
Joined: July 2005
Offline
Thanks I'll have to check that out!
User Avatar
Member
132 posts
Joined: July 2005
Offline
I downloaded the wisp VOP. The readme says:

this contains vex code for a POP and a sample .hip utilizing this POP.
the POP rotates the motion of the particles around the transverse
to the gradient of a noise function. This gives you cool vortexes
and wispy swirling motion.

-Ivan

==========

I've never loaded in VEX code. How do I do it? The compressed folder I downloaded contains these files:

wisp.vfl
README
wisp.hip
VEXpop

Some hand holding will be required here…
User Avatar
Member
7725 posts
Joined: July 2005
Offline
the_squid
// Code produced by: print1
text = sprintf(“v: %f\tfval1: %f\tfval2: %f\tfval3: %f”, v, fval1, fval2, fval3);
printf(“v: %f\tfval1: %f\tfval2: %f\tfval3: %f\n”, v, fval1, fval2, fval3);

I meant the position of where the print statement is relative your other operations. esp. the ones which might modify fval1, fval2, fval2, or val after they have been created.
User Avatar
Member
412 posts
Joined: July 2005
Offline
hey the_squid,

it's actually much easier than you're thinking..

here's a link:
http://www.sidefx.com/forum/viewtopic.php?t=2863 [sidefx.com]
Dave Quirus
User Avatar
Member
132 posts
Joined: July 2005
Offline
Thanks, that worked perfectly! Much easier than I thought. I LOVE VEX!!!
  • Quick Links