Jump to content
TanjaW

Procedural growth of lightning with branches in Houdini 16.5

Recommended Posts

lightning_test.hipnc

Hello everybody,

I am new to Houdini and am eager to learn more every day. I started with some lightning effects and got stuck where I wanted to create a slider for its growth. If the lighting develops it should start with the main branch. As soon as it reaches the first secondary branch, the secondary branch should start developing as well as the main branch should continue with its develpoment and so on.

In my file you will see a rudimentary version - (I needed to take out a lot of nodes to get a proper overview again) - of the lightning so far.

My idea about how to procede was as following: Have a carve sop for the main branching, the secondary branching as well as the third branching. Paste the relative parameters of the "second u" channel of the main branching into the channel of the secondary and third branching and subtract an offset, which would be the distance of the basepoints from one branching to the basepoints of the following branching. For that I merged the basepoint groups, added a sort sop to bring the point numbers in order, then added an add sop to connect the points. If this had worked, I would have created a distance attribute for me to know the offset. But what I probably need is a wrangle sop in order to specify that I only want to connect the points from the same branches in order to measure the distance between for example basepoints2 and basepoints3. The animated seed of the scattered basepoints will probably make it more complicated since it changes the oder of the point number as well from the sort sop.

Maybe I am completely on the wrong track and there is another - maybe even less complicated - way of doing this, so I would be happy about all responses.

If you've got any ideas on how I could do this, especially how I can write it out in a wrangle node, I would appreciate all help I can get.

Share this post


Link to post
Share on other sites

Hello Tanya,

Welcome to the forum. Sounds like you dove in pretty deep.

While making your lightning system is great for a lot of productions and learning. Have you tried to use the Lightning preset on the L-system sop? A bit old school but it should have most of the functionality you seek, with plenty of seeds. If you place down a geometry node at object level, and then drop a Lsystem sop, you can then hit the gear icon an pick from the presets lightning or any other of the branching patterns. Then you can play with the Generations tab to control the growth. The Lightning preset has Random Seed set to $F which means you can scrub the timeline to quickly test different cases. Otherwise you can break that channel and use the ladder bracket to quickly change up seeds so you can animate the generation over time. 

I'll let others go into some of the other methods you can use like in vexpressions, too. There a few other post out there too you can look into on the forum, especially in regards to different growth systems. 

Have fun and enjoy the journey.

Share this post


Link to post
Share on other sites

Hi Ben,

thank you very much for the warm welcome and for your reply. Indeed, I did try out the Lsystem and while I think it is a great tool, I thought I wasn't that felxible concerning the handling of the branches in the Lsystem. It is definitely a very good start for lightning and I took some ideas from it (e.g. the angle slider) and applied them to my lightning scene, which worked great. My goal in my lightning test was to try as many procedures out as possible. Fading of the width, angle of the branches, length of branches, seed, individual noise for three levels of branching etc. (Don't worry, you didn't miss those in that uploaded scene, I just had to throw it all out again for me to actually get a proper overview again about what I have been doing.) So far everything worked out like I thought it would, however I didn't think the procedural growth would be the milestone, which totally confuses me. Unfortunately I can't even look inside the Lsystem how it is done in there. 

There are so many brilliant tutorials and great discussions out there, but I seem to be too narrowminded to actually apply them to my scene. I bet it is always a minor user mistake (like it always seems to be in my case) but I haven't figured it out yet. Of course, I will keep trying and if I come up with a solution I will post it here. If anyone has an idea, I would still be very grateful for each input.

Edited by TanjaW

Share this post


Link to post
Share on other sites

Hi Alvaro,

thank you very much for your response! I did try the Find Shortest Path sop, and outside of my setup it worked fine but as soon as I implemented it into the lightning setup, I got an error about there not being a path to follow.

Share this post


Link to post
Share on other sites

Got it, i had this problem already. All the edges in your base mesh must be connected.

Are you tetrahedralizing a mesh to generate the edges?

Share this post


Link to post
Share on other sites

No unfortunately not. What I am basically doing is just copying some lines as sub branches onto scattered points onto my main line/ branch. I noticed that the different levels of lines are treated as separate meshes, but neither the fuse sop nor the join sop could connect the branches with each other. There is nothing in there that's tetrahedralized. But since you were asking about it, I guess it needs to be?

Share this post


Link to post
Share on other sites

It doesn't need to be tetrahedralized, it just have to be connected. If you apply it on a plane or a box it will work between the connected points. 

Can you generate a new base mesh to tetrahedralize?

I did a small example of how it would work

Cheers,
Alvaro

Lightning.hiplc

Share this post


Link to post
Share on other sites

Hi Alvaro,

sorry for not responding sooner. I have been fighting a cold for a week and lost miserably xD
 

Thank you for your solution! Works like a charm. :)

What I have been working on is using the curveu for the carving of the branches by transferring said attribute from the main branch to the subbranches. Only works if the subbranches run kind of parallel to the main branch of course, but if they do then it works as well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×