I have one custom node.
My .ush & .usf in here
.ush
#ifndef __CARDSHADER_USH__
#define __CARDSHADER_USH__
struct RenderFunc
{
float2 ParallaxMapping(float2 uv,float3 viewDir,float heightScale);
float4 FinalRender();
};
#endif
.usf
#include "CardShader.ush"
float2 RenderFunc::ParallaxMapping(float2 uv,float3 viewDir,float heightScale) {
float2 offset = viewDir.xy / viewDir.z;
offset = offset * heightScale;
return uv - offset;
}
float4 RenderFunc::Output() {
float4 BackColor = Texture2DSample(_Back,_BackSampler, ParallaxMapping(_uv, _ViewDirWs, 0.2));
float4 BackgroundColor = Texture2DSample(_Background, _BackgroundSampler, ParallaxMapping(_uv, _ViewDirWs, 0.4));
float4 FrontColor = Texture2DSample(_Front, _FrontSampler, ParallaxMapping(_uv, _ViewDirWs, 0.6));
float4 BorderColor = Texture2DSample(_Border, _BorderSampler, ParallaxMapping(_uv, _ViewDirWs, 0.7));
float4 finalCol = float4(0,0,0,1);
finalCol = BackgroundColor;
finalCol = lerp(finalCol, FrontColor, FrontColor.a);
finalCol += BorderColor;
return finalCol;
}
custom node
"/Shaders/CardShader.ush"
RenderFunc _func;
_func.FinalRender();
return 0;
Output:
[SM6] Shader debug info dumped to: “D:\qsw\GameWorkSpace\UE\RTR_Learning\Saved\ShaderDebugInfo\PCD3D_SM6\M_CardMat_61540b8bec78582b\Default\FLocalVertexFactory\FLumenCardPS\0”
D:\UE_5.8\Engine\Shaders\Private\MaterialTemplate.ush(3749,7): Shader FLumenCardPS, Permutation 0, VF FLocalVertexFactory:
/Engine/Generated/Material.ush:3749:7: note: used here
_func.FinalRender();
^
error: External function used in non-library profile: \01?FinalRender@RenderFunc@?1??CustomExpression0@@YA?AV?$vector@M$03@@UFMaterialPixelParameters@@V?$Texture2D@V?$vector@M$03@@@@USamplerState@@121212V?$vector@M$01@@V?$vector@M$02@@@Z@QAA?AV3@XZ
I don’t know how to resolve it really.
Please me!