Unreal Engine Livestream - Shaders in UE4 - Dec 14 - Live from Epic HQ

WHAT
Curious on how to create shaders and materials in UE4? Then don’t miss Thursday’s stream. Alan Willard returns to the Unreal Engine studio to demonstrate the creation of a sample shader, reminiscent of a Palantir. He’s also ready for some serious Q&A, so if you’ve got questions for him, drop them in the comments below and we’ll try to answer them on the stream!

Project file available for download here.

WHEN
Thursday, December 14th @ 2:00PM ET Countdown]

WHERE
Twitch
Youtube
Facebook

WHO
Alan Willard - Sr. Developer Relations Technical Artist
Amanda Bott - Community Manager - @amandambott](http://twitter.com/amandambott)

ARCHIVE
Shaders in UE4 | Live Training | Unreal Engine Livestream - YouTube

Woah, am I right in assuming this means shaders in code? Or is it a material shader livestream?

Don’t get me wrong every video Alan makes on Materials is solid gold and has taught me a bunch, but linking to the shader development page has got my hopes up that the stream is about writing custom shaders using C++ and HLSL.

If so, I’m SUPER looking forwards to this. If not, still will be great, but hope that one video about using custom shaders and getting them to link with the Material system is made soon (especially considering that the engine now lets you define Global Shaders even in the binary build/plugins apparently?)

Sorry - that’s probably a bit misleading, so I removed the link. Make sure to toss any questions you have here and I’ll see about getting someone on to do shaders with C++ for a future stream!

You guys are killing it with these, thanks!

Awesome! Have been eager to see a new stream on materials and shaders! Now we’re talking =)

When I was working on my own engine, I used to write my shaders in raw HLSL. Here’s my top resource/reference:
Writing HLSL Shaders in Direct3D 9 - Win32 apps | Microsoft Learn

Granted, that’s DirectX 9, which is pretty old and doesn’t come with the fragment shaders and other new features. But, it’s enough to get your feet wet with raw HLSL. Raw HLSL is really challenging to debug properly though. You have to use a scene debugger which lets you sample an individual pixel, view the draw calls on the GPU, and figure out what is happening to make the pixel the color it is. There may be multiple shaders which play a role in that, so it can be very much like searching for a needle in a hay stack. After using the UE4 material shaders, I never looked back or want to touch HLSL again, directly. Only in the very most dire of circumstances, will I create a custom node in a material to inject HLSL code (which has only happened once!).

The key thing to note (and this is in the documentation for the custom node), is that injecting your own HLSL into the material node graph can limit the amount of optimization UE4 can do. Large blocks of HLSL code can make a shader really hard to optimize, and thus, it may run slower.

Would love to learn more about dynamic materail shaders!

Was there a stream on global shaders in plugins? I know there was one planned, but I thought it got cancelled. For materials I would love to hear about any new nodes added in the last couple releases of the engine. Also, maybe a bit about some of the functions that are in the engine content that are available but maybe we might not know about them or not as visible.

  1. How to create a material that supports tension maps? (clothes folds, eye wrinkles, muscle flex)

  2. How to create a material that “fills in” camera-clipped geometry? (If the camera clips through a mesh, fill/overlay that space with some solid color?)

  3. How to make materials/textures affect AO color, how to dictate AO color per material?

  4. Mesh distance fields:https://youtube.com/watch?v=shmJIbCayhc^ How to remake this in 4.18, and can we make it “self-collide” for more complex meshes, like characters, or some work around that would make it appear function that way?

Is there a lowcost (for performance) solution to imitate flickering light with prebaked lightmaps and static lights?

I would love some tutorial on multiple Custom Depth effects working together without overlapping…

Or is this impossible in the current engine without modifying it?

Looking forward a lot for this one!

Would really appreciate to hear some thoughts on implementing clipping planes (e.g. making a section cut through multiple objects).
Especially with datasmith coming on would really be a big improvement…

That red thing is a decal.

The post-process zoom blur effect is a reasonable request though. It’s something you can work out on your own step by step if you’re familiar with post-process domain shaders too, it’ll be one of the easier effects to start with.

The maths is pretty straight-forward: sample the same material several times and blend the results. Use UV coordinates and a bit of maths to offset the sampling.

Once you’ve figured out how to do it, try converting it into HLSL in a custom expression node, as repetition lends itself to this.

Dear Epic: please add a loop node into the material graph.

Oh man.

BEVEL SHADER!

Images aren’t from UE4:

But there was thread a long time ago here on the UE4 forums where someone made a bevel shader, they called it something else though, but I haven’t found that thread again, idk where it was, but it was somewhere here.

Looks great. I second that!

Alan Wizard Shader Show - ya kiddin’ me - will be there! :slight_smile:

Here’s some OSL code that does bevel shading. Maybe some super-clever person can understand it well enough to get something like that running in real-time.

yay :frowning: not on youtube yet?(

btw Alan is great!

I couldn’t reach for the stream.
How could I find the recorded video???

Hi and thanks for the nice stream session. Asking the same thing as i did in a live chat: would you please share the practice material and functions so we could play and practice with them now?