Car Commercial – 3 – Procedural Lightning
October 31, 2017
So it’s been a while since I have last posted, I have been taking a ton of time developing my lightning system. I prefer to develop my work a bit closer to completion because I tend to sporadically attempt various techniques to accomplish a goal and can end up in a bit of a jumbled mess that I can’t explain in an organized manner. I like to gather my system rather than show random snippets of code that can change on the minute. I’ll try my hardest to explain my train of thought as I go as I understand that is being lost here. Again as in my past posts I will be going into more detail in other posts so that general ideas and process can be explained here while more detail is available if necessary. I’ll try to do better in the future with updating my work! And with that, lets make some lightning.
So this lightning system is nearly completely procedural, which is great because I have implemented more than enough parameters to play with. The system is broken into 2 main parts, the primitive sourcing and the actual lightning creation. There are various methods of connecting the primitives, and I started with just two points and a single primitive to move along lookdev-ing the lightning shape. The main controls have kept the same from this previous post.
This initial set of nodes are used to apply the main shape of the lightning, running a few levels of noise through the points to achieve that jagged lightning look, along with a local noise falloff of the points and a normal offset. Again, all of this is explained here. One of the main important changes however is the foreach loop at the top. This loop resamples each primitive and stores the total amount of points as a primitive attribute, This way this attribute can be called upon later in the node tree to re-sample each primitive regardless of how much it has been distorted. This way each primitive is re-sampled relative to its original point density.
All of the primitives now have the lightning shape, however they are completely solid and consistent. These loops correct a few attributes so that a range from the middle of the prim is taken and deleted. This range is widened or shortened to determine its current animation. Thanks to Professor Deborah and Sasha for their help developing this idea! This method is great because all I have to do now is take these few attributes, the animRange and the midPoint Location and set them procedurally and let the system drive itself.
Finally we have particle sourcing and polywire. The pscale is remapped on either side of the animation so that it tapers towards the middle and is thicker on the outsides. This is changeable by a ramp. The output of the animation is checked in a point wrangle, if the tips of the lightning are within a certain definable range (something very small) then particles are emitted from those points. At this moment the particles are some light debris and floaty sparks.
Now that I have the lightning looking good and completely proceduralized, I can throw any amount of primitives at it and its able to source the lightning with no problem. Of course, cooking times can get a bit heavy, mainly because of the polywire and the density of the lines, but all of this can be changed of course. So lets start making some interesting ways of connecting some points together. Check out that post here!