Training Livestream - How to use the Custom Material node and create Metaballs


In this week’s live stream and will cover the various uses of the Custom Material node. also explains how he used Custom Material nodes to achieve the liquid “metaball” from the beginning of the ProtoStar demo.


Tuesday, March 29th @ 2:00PM-3:00PM ET - Countdown



  • Sr Training Content Creator @SamDeiter]()
  • Sr. Artist, Technical
1 Like

Very excited about this one

This is amazing. I am interested in what editor you guys use to author the custom code as typing in the small box is a pain.

I use Notepadd ++ for a lot of this.

You bring the Metaballs, i’ll bring the spaghetti! A great group of guys today, exciting!

Any of making some custom noise such as voronois or any other type of noise?

Where’s best to ask questions? Here, twitter or twitch?

Oooo! Definitely going to be a good one, I’ll be tuning in :slight_smile:

[QUESTION] - Can someone persuade to Twitter so we can follow all the super-rad stuff he does?

Am I the only one that read Meatballs there? Bring on the Spaghetti, and Sam! :smiley:


lol always laugh at that name! :cool:

What is the reason for you not supporting texture arrays? I’m doing procedural geometry and it would be really usefull for me(and I presume many others)

“The ideal way to write this is actually in C++…”

What’s all this talk about C++ materials? ‘Ask your engineer to turn the custom HLSL into C++, it’s more efficient’ etc etc. I can’t find anything on google for ‘C++ materials’ in UE4.

What are you talking about here? Can you write materials without HLSL, just C++? Is it more efficient then HLSL??? And if so why was the metaballs phone demo written in Custom Expressions material nodes?

(PS: That was really interesting, I’m glad to see some walkthroughs on the custom GPU stuff.)

The Custom node can not use any of the behind the scenes optimizations that the UE4 Material Editor performs to make Materials run faster or more efficiently. Because of this, you run the risk of the HLSL code you wrote not running as performant as it could. To get around this and make sure that your Material Expression nodes run as fast as possible, you should have an engineer turn what you created with the Custom Expression node into a Material Expression node that can then be placed in your Material Graph. To do this you will need to have an engineer write the framework of the new Material Expression in C++ and then use HLSL as the code to power it. This way your new Material Expression can make sure of all the behind the scenes optimizations that it can.

The reason that this was not done to the Metaballs was due to time constraints and performance. After doing a lot of performance testing on the Metaballs, it turned out that they were running fast enough so in this case there would be no immediate advantage to taking the time to write them as a new Expression as the manner in which they were done with the Custom node worked and did not take that much performance away from the project.

As we stated in the stream this is not something that you need to do all the time but rather should be something that you do if you find that you are having performance issues. You can by all means use the Custom Expression to do things like ATAN without seeing any performance spikes. But if you do you need to make sure that you are constantly checking performace to make sure that your FPS will not suffer because of this.

Could you share your material for all??, I have so many problems trying to reproduce the results by myself.

Yes can we get the material please?

Hey Sam- Is there any documentation on creating custom material expressions from custom nodes as you encourage doing for specific cases?

I’m getting an error “error X3004: undeclared identifier View_ViewOrigin” for the simple metaballs custom node. Has this changed in 4.17?

I found the reason … View.ViewOrigin has been changed to View.WorldViewOrigin. Everything is rosey now!

How did you make the geometry for the metaballs in your demo?

But why didn’t they upload those files? It’s so difficult to get all those correct parameter values and handwriting the code down…