Jump to content

Planting points


Recommended Posts

I have a lightning bolt with a start and end point, where the end point snaps to a ground point, triggers, plays out and disappears. I'd like to procedurally add an effect to where the lightning contacts the ground.

My thinking is that when the end point of the lightning snaps to the ground point, to somehow spawn a new point or capture the ptnum of said ground point. From there a new effect triggers... ?? Problem is that I don't have a clue how to capture a single ptnum or reassign it somehow to begin the last effect.

Is my logic flawed? If there's a simpler way... or even a more difficult way, I'm all ears either way. I have a sneaking suspicion this is probably an elementary thing to do, but haven't figured it out. My apologies if that is the case.

Link to comment
Share on other sites

this can be approached numerous ways. but i imagine something along these lines could work: (the result should be a detail attribute on lightning geometry, storing the last ground point number that's been hit by the lightning)

- on your ground points, create integer point id attribute (@id=@ptnum)

- on lightning geometry create an integer detail attribute with the same name, with a value -1

- wire both geometries into Solver SOP - solver SOP will help you to preserve the hit point number over time

- use attribute transfer SOP (inside the Solver) with some small radius to transfer @id from ground points onto your lightning geometry

- promote @id point attribute to detail (attribute promote SOP), with the method set to Maximum (so you'll end up having a constant attribute value equal to the hit point number, or -1 if no point has been hit at the current frame)

- still inside Solver SOP, drop down Attribute VOP running over Detail, and wire in the previous frame result and the current frame result

- inside that VOP read the transferred id number. if it is greater than -1, use that value. if it's equal to -1, it means that the lighting geometry is not touching the ground at the current frame, and you want to use the result of the previous frame (which may be also -1 if the lightning never hit the ground yet, or it may be the last point number it hit)

unfortunately I can't post a hip file with the setup but hopefully it'll help as a guideline. cheers.

  • Like 1
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...