Force field node material using Unity tutorial... Help needed to translate it to Babylon!

Hi everyone!

Been having a blast with the node material editor since I’ve finally started to understand some of the shader magic… Currently trying to recreate and understand this Brackeys tutorial for Unity: FORCE FIELD in Unity - SHADER GRAPH - YouTube

However, I’m having some difficulties undestanding some aspects of the tutorial and how to translate those into Babylon NME.

For example, I’m not sure how to translate these into NME nodes and what they are actually… Anyone has any ideas?

Here are my playground and nme so far, both look pretty awful :laughing:

Also I am wondering if I am missing some setting that would be critical on this shader? If anyone has any idea where to go from here, I would be super happy :pray: Mainly interested on the ‘intersection’ part of the tutorial, to achieve this kind of effect:


Thanks in advance :pray: :smiling_face:

Here’s how you can achieve the intersection effect:

The scene depth renderer does support generating depth in camera space, but the option is not available in the NME, that’s why I have created it “by hand” in the code (lines 35/36). I will make a PR tomorrow to better support it.

With the scene depth in camera space, it’s easy to implement the same thing than in Unity: the difference is that the camera space z coordinate of the current point is in 1/FragCoord.w instead of ScreenPosition.w like in Unity.


Thank you so much for help! :sunglasses: :pray:

So after the pr, this can be done in nme, right? Will the change be live before the 6.0. release?


It adds a property to the SceneDepth block:

This PG will work once the PR is merged:

I think yes as it’s only a small change.


Here is a more accomplished effect: