Lightning effect based on proximity?

Hi, guys.
Currently, I see no way to make something like this in Notch: https://youtu.be/rR6aztrOe2s?t=18.
Any ideas?

-Andy

1 Like

Maybe with a bunch of extruded, deformed Spline nodes hooked up to a bunch of Parent To Vertex nodes and switching between groups of them with the Select Child node?

It would be absolutely killer to have a Lighting Renderer for particles in Notch that was able to listen for collisions with geometry to produce effects like that.

Hi, Spencer.

Thanks for the good idea, but it won’t work this way. Since ver. 0.9.19 the Parent To Vertex node works differently with mesh geometry.
It allows to iterate over only 2 vertices instead of all which is frustrating and IMO should be fixed.

[blockquote]It would be absolutely killer to have a Lighting Renderer for particles in Notch that was able to listen for collisions with geometry to produce effects like that.[/blockquote]

Yes. This would allow Notch to ultimately leave most game engines behind to bite the dust. :wink:

Andy

[blockquote]It allows to iterate over only 2 vertices instead of all which is frustrating and IMO should be fixed.[/blockquote]

That’s not the case, it iterates over all of the vertices in the mesh. If you have an example to the contrary please upload it.
The new addition in 0.9.19 is that the Parent To Vertex node now supports deforming geometry.

Hi
this is my proposition, it’s not ideal but with some tweak could be achievement.

https://wetransfer.com/downloads/fadd49b3e09eb662739edef7ddf1925620171023141103/4e75fc1f266bb0664896c3b709ae528720171023141103/c55cf3
and
https://we.tl/xorCSSW2xT

If You want some blink and flash effects use shading node particles, also for visibility of particles.

K.

Hi, All.

@ K.
Thanks for the input. Looks OK, but that’s a different look (plasma?). Not a lightning. :wink:

@ Matt
Yep. You were right. The Parent to Vertex IS working, but not by pulling the index slider manually.
I admit I was wrong saying that it didn’t work after fiddling with it manually (i.e. without using modifiers).
The node shows some insane vertex index numbers in the input box and, if played with manually, visually parents the child
object to just 2 positions - the one belonging to either first or last index number. It would be better if it showed the real
input vertex count, don’t you think so?

Now for the attached project: I managed to get a working prototype (Spencer, thanks again for the tip),
but there are still some issues I can’t get around:

  1. How to make the deformers work only on the middle section of the beam? I tamed the deformers at the source object
    but since there are no deformer falloffs controlled by UVs or deformer falloff mixing nodes, I can’t constrain the other
    end of the beam to the contact vertex and place the light directly at that position (a slight offset from the surface wouldn’t hurt though).

  2. The Affected Objects input of the Glow post-effect makes no difference - the entire scene is affected. Am I missing something?

  3. How to select the vertices that face the beam source for the contact group?

  4. How to make the beam branch? It looks like the Parent to Vertex doesn’t work for the Lines geometry (see Line branch test1.dfx).

Well… The conclusion is that after addressing the above issues Notch should be capable of achieving this effect without using particles,
but the setup can be a bit complex. IMO particles might do the job way better. What do think, Matt?

Andy

I was able to get the beam to split by using Splines instead of Lines. This way, you can use Spline follower to parent things to the center of the spline, so you can parent lights and more splines to parts of the spline to build up the lightning.

There is still the problem of selecting the right vertices in close proximity, but you could get around this by selecting all the vertices you want it to attach to in your 3D package of choice and export them as a separate object.

Hey, Spencer.
I’ll be able to look at your file (as well as run Notch) only this evening. Till then my comments may seem a little off. So, please, bear with me :wink: .

[blockquote]This way, you can use Spline follower to parent things to the center of the spline, so you can parent lights and more splines to parts of the spline to build up the lightning.[/blockquote]
Cool, but how do you approach controlling the resolution of the spline? The Spline node has no such attribute, as far as I know.

[blockquote]There is still the problem of selecting the right vertices in close proximity, but you could get around this by selecting all the vertices you want it to attach to in your 3D package of choice and export them as a separate object.[/blockquote]
Good idea. I wish we could use weightmaps (or textures) for point group selection though. :wink:

The Extruded Spline node is where the resolution is controlled. There you can set the number of segments. I’m pretty sure the spline itself is a nurbs curve so it is a vector.

So, this means that you apply the deformers to the Extruded Spline node then, right?

Yup.

[attachment file=22026]

Good job, Spencer! Looks nice. But the setup is getting heavier… :wink:
Do you see any way to shade the bolt other than by using a post-effect? A real lightning bolt gently fades out from its core to edges. Fresnel? Gradient?

Hey, Spencer.
Having had a closer look at your test file I see that the solution with splines is really good but not yet the ticket.
And here is why: deformers applied to the Extruded Spline object affect the surface geometry. Not the spline itself. That’s why the bolt looks jagged and hardly usable up-close.
Look at the files attached.

Andy

Ah, yes. Some deformers don’t play as nicely with extruded splines as other ones. The Distortion deformer is what was making it look bad up close. Replacing them with Turbulence deformers seemed to do the trick but I totally agree, we should be able to deform splines directly before they get extruded.

Hey, Spencer.
Frankly speaking, I’m not sure if splines are the way to go as far as deformation is concerned. Splines are computationally harder to deform than Lines as they contain additional interpolation
data which is bad for scene performance. Anyway, I’d like to see our devs’ opinion on the subject. Notch Team, do you copy? :wink:

Andy

Sure, Extruded Splines have some more vertices than lines, but in my experience, deforming meshes in Notch is extremely well optimized. If you you just turn down the segments to the appropriate amount, the effect it has on a full scene is negligible. It not until you start to crank the segments to ridiculous numbers that it can actually affect the performance of a scene. Splines also have way better features for this. (the ability to use materials, parent to a specific point in the spline, clone to the spline, shape them the way you want, etc…)

The only thing with splines right now is that they don’t work with cloners yet and there are some issues importing them from Cinema 4D.

The attached scene is loaded up with stuff including the lightning effect. Try cranking up the subdivisions on the Extrude Spline nodes and see how it affects performance. For me it runs around 55 with Volumetric Lighting on and around 60 with it off at 1080p. There seems plenty of headroom for many other extruded splines. If you have a scene you are having trouble with optimizing, you could try setting up an LOD using a proximity modifier hooked up to your camera to drive the number of segments so the closer it gets to the bolt, the more subdivisions there are.

Hey, Spencer.

It’s all true, but splines in Notch are very much dependant on c4d so far. Irrespective of their use for lightning-like effects the following spline node issues still remain (at least for me):

  • Adding nulls to the source socket of the spline node could be better organized (i.e. there’s no way to select all the nulls and pipe their outputs into the source socket by a single drag of the mouse). Each time you absolutely have to connect each null manually, which is rather annoying.
  • Inability to change spline interpolation type from within Notch, the only way of rounding off the spline being increasing the scale of the respective null object. All well and good, but the Scale of the null affects the spline mesh width attribute if connected to the Extruded Spline node. Correct me if I’m wrong, but man… It’s a vicious circle :wink:

Currently, to get the full advantage of splines in Notch one needs a copy of c4d which means extra investment; SVG import support is not planned for the nearest future which leaves misers like me with this rather modest Spline + Nulls solution. At least for now :wink:

Regarding the scene file. It runs just fine on my Nvidia GTX 1060 - no problem at all. That’s all because the splines themselves are not being deformed. It’s the geometry that is. :wink:
Anyway, IMO this approach is better applied to something like tentacles or some weird displaced plants, but not lightning and other electricity. I’m sure there should be a dedicated tool for electrical/energy effects: a special geometry or particle node and a proper beam renderer including contact lighting. Currently a setup involving just 2 beams and a simple piece of geometry takes up too much working space. With each lightning branch needing another spline and a Parent to Vertex combo the lightning system soon becomes too complex to control.

-Andy