Jump to content

For Each on edges?


Recommended Posts

Trying to make my network for the light string apply to an input curve, but I am having a little bit of trouble figuring out how to get it to process through each section of my curve. I read in another thread that there is no edge attribute in Houdini, which makes it a little iffy. I also need to figure out how, once I get the edge set in the ForEach node, how to detect the individual end points for that line.

Link to comment
Share on other sites

what is your input (linear poly curve?)

what do you expect to get in each loop (just the segment?)

here is a simple example of such thing

there are many other methods you can use even for branched curves or poly meshes but it depends on what you want

as for end points of the segment you can add custom attribute before foreach storing $PT then each point (of 2) inside foreach will contain correct number inside that attribute

instead of foreach you can use VOPs and Neighbour VOP to get each segment and do something on the end points, again it depends on what you want

lin_curve_for_each_segment.hip

Link to comment
Share on other sites

Thanks anim, that gave me exactly what I needed to be able to do it (I will definitely be giving you credit in the intro of my tutorial I am going to write. If you have a website and would like me to link your name to it, let me know.). Now if only I understood what all of it does. I understand the start value on the delete, but the end value... I'm not sure of. I haven't learned about the stamp() function yet, so I have no idea what it is actually doing.

The other problem I am having with the forEach is how to get a group out or how to target my spheres to light them with the geoLight, but not target my lines. I have included my current attempt. I still get some of the quirky lighting problem where parts of the geometry don't render properly as lights with whole sections of single spheres being dark. It is a most frustrating problem. In the file I attached you can see the problem if you change the geoLight target to the forEach rather than the copy node inside of it.

light_string1.hipnc

Edited by Adam Ferestad
Link to comment
Share on other sites

forEach in this mode will iterate npoints-1 times

starting from 1 ending npoints-1

so for curve with 3 points (0,1,2) it is executing 2 times and since it is set to start at 1 and end on npoints-1 it will have following values on each iteration

1st iteration : value 1

2nd iteration : value 2

this value is stored in FORVALUE variable (you can change it's name) or in FORIDXVALUE (for other modes like Each Group)

stamp("..","FORVALUE",1) will get the value of FORVALUE variable at the current iteration it's like copy stamping

so at 1st iteration you will keep 0-1 segment in Delete SOP, at 2nd iteration segment 1-2 and so on

you cannot reference something in ForEach the way you do because it doesn't exist in memory when ForEach is finished, only final computed geometry exists

you need to group your spheres then recall that group after for each

see the example

(i have also changed render settings and attenuation on your lights so change it back if you want, I was just playing)

on the other hand for what you are doing you can completely avoid ForEach

and instead of copied spheres you can use instanced area lights if you just want simple shape like sphere

see the second example file

light_string_fix.hipnc

light_string_instances.hipnc

Link to comment
Share on other sites

Thaks for the explanation, though I don't understand what stamping does on copy sops either. I looked at your fix file for the geoLight method and i really like the way that you handled it with the blasts. I had came to the realization that I actually didn't need the copy and Wireframe branches inside of the forEach node. Once I took those branches out and did them in my geometry sop it became a very simple problem to solve. I also figured out how to do a randomized slack value for each section so an artist could give some variance to the string since that would be more realistic.

Now I have to decide how I want to handle the tutorial for it. I am considering doing a roof model and having the lights use the edges of the roof to iterate through. I am slightly worried about doing a long tutorial since my other ones tend to be pretty short. Would I be better off doing the two as separate tutorials, a long one or serialized tutorials?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...