Community Tutorial: Custom shading models directly in your material graphs

A guide to exposing lighting data to the material graph in UEs Forward Renderer, allowing for creation of arbitrary shading models without the need for further Engine modification nor GBuffer restrictions.

https://dev.epicgames.com/community/learning/tutorials/ow0x/unreal-engine-custom-shading-models-directly-in-your-material-graphs

2 Likes

Hi @AbidNaga, that’s a pretty interesting tutorial . Regarding the last part (Volumetric Lightmap and Reflection Capture sampling in the material) : you should ask this guy , he knows an answer .

1 Like

Hi. While following the tutorial, I came across this line in BasePassPixelShader.usf Light Smuggler Base Pass Function Implementation:

include “LightSmuggler/LightSmugglerPixelShader.ush”

However, the file LightSmugglerPixelShader.ush doesn’t seem to be included anywhere in the tutorial files. Am I overlooking something, or is this an error in the tutorial?

I’m asking because even after modifying the engine as shown in the tutorial, switching the shading model to LightSmuggler doesn’t give me access to FSmuggledLight or LightSmugglePack in the custom node.

Has anyone else run into this issue or found a workaround?

Any clarification would be greatly appreciated!

Thanks in advance!

Oh shoot thanks for pointing that out, it’s just an error on my part. What it actually should be is:

#include "LightSmuggler/LightSmugglerCalcMaterial.ush"

The file created in section 3.3.2. Just a mistake on my end sorry about that. Lemme know if everythings working well after that change

I’m getting some errors when trying to create a custom node in this shading model.

Any ideas on what could be causing this? I tried including the files in the custom node as well as in the include file paths within the details panel of the custom node.

I’m using Unreal 5.5, so I’m not sure if MegaLights or something else could have changed the setup slightly.

\Engine\Shaders\Private\MaterialTemplate.ush(3579,1): Shader TBasePassPSFNoLightMapPolicy, Permutation 0, VF FLocalVertexFactory:
/Engine/Generated/Material.ush:3579:1: error: unknown type name ‘FSmuggledLight’
FSmuggledLight DirLight = LightSmugglePack.DirectionalLight;

Depending on where you placed the LightSmugglerCommon.ush file, be sure to add it as an include in your custom node. I had it placed in “/Engine/Private/LightSmuggler/LightSmugglerCommon.ush”, so in my case I added that path to the include file paths of the HLSL node

Lemme know if that fixes it!