Adding in a VOP For Loop

   3710   1   1
User Avatar
Member
2 posts
Joined: July 2005
Offline
Hi,

I want to use a For Loop VOP to add the output of a single Noise VOP who's parameters are changing each interation. This sort of thing is easy in VEX…

For example…

float nval = 0;
for ( i <= 5; i += 1 )
{
nval += snoise(P * i);
}

But its the += part that is ellusive in VOPs. I can find a way to add the output of the first interation to the output of the second. I tried with the switch VOP and copy VOP to no avail.

This must be possible?

Thx

Jarrett
User Avatar
Member
276 posts
Joined: July 2005
Offline
Hi Jarrett,

This is possible with VOPs. I'm not a VOPs expert, but I will try to help in case someone more knowledgeable doesn't

The thing to realize I think is that when you put down a For Loop VOP you get a white input labelled “next”. Whatever you wire into that, you will have available inside your For Loop and thus can add to it. Try piping a Constant into the “next” and then go inside the For Loop and grab your constant and add some noise to it and output the sum back into the “next” of the suboutput node. Now go back up one level, and the output of the for loop should be available to you and as you expect. Also, viewing the code (by Right clicking on a VOP node and choosing “View Code from Vop Network…”) always helps figure out what's going on

Hope that helps.
George.
  • Quick Links