All skills
quodsoler avatar

/ue-materials-rendering

@f3742d7

Use when writing C++ for materials or rendering — dynamic material instances, material parameter collections, render targets, scene capture, post process, decals, Nanite, Lumen, MegaLights, Substrate. Also use when the user mentions 'MID', 'CreateDynamicMaterialInstance', 'SetScalarParameterValue', 'UMaterialInstanceDynamic', 'material parameter collection', 'UTextureRenderTarget2D', 'DrawMaterialToRenderTarget', 'scene capture', 'post process volume', 'FPostProcessSettings', 'bOverride_', 'blendable', 'decal', 'custom depth stencil', 'Nanite', 'Lumen' or 'global shader'. For Niagara materials, see ue-niagara-effects; for UMG materials, see ue-ui-umg-slate.

Use this Skill: https://skilld.dev/gh/quodsoler/unreal-engine-skills/ue-materials-rendering

This session only. Nothing lands on disk.

referencesglobal-shaders-rdg.md

≈498 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Global Shaders and the Render Dependency Graph

For a real HLSL pass, declare a FGlobalShader subclass and drive it with the Render Dependency Graph. Build.cs needs "RenderCore", "RHI" and "Projects".

#include "GlobalShader.h"
#include "ShaderParameterMacros.h"
#include "ShaderParameterStruct.h"

class FMyBlurCS : public FGlobalShader
{
public:
    DECLARE_GLOBAL_SHADER(FMyBlurCS);
    SHADER_USE_PARAMETER_STRUCT(FMyBlurCS, FGlobalShader);

    BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
        SHADER_PARAMETER(float, Radius)
        SHADER_PARAMETER_RDG_TEXTURE(Texture2D, InputTexture)
        SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float4>, OutputTexture)
    END_SHADER_PARAMETER_STRUCT()
};

IMPLEMENT_GLOBAL_SHADER(FMyBlurCS, "/MyGame/MyBlur.usf", "MainCS", SF_Compute);

Passes are added to an FRDGBuilder with GraphBuilder.AddPass(RDG_EVENT_NAME("MyBlur"), Parameters, ERDGPassFlags::Compute, [](FRHICommandList& RHICmdList) { ... }) and submitted with GraphBuilder.Execute(). Shader maps come from GetGlobalShaderMap(EShaderPlatform Platform).

The /MyGame/ virtual path must be registered before shaders compile — do it in the module's StartupModule, and give that module "LoadingPhase": "PostConfigInit" in the .uplugin/.uproject; a global shader type registered later hits the "Shader type was loaded too late" checkf (Shader.cpp:315). The usual Default phase is too late:

#include "Interfaces/IPluginManager.h"   // "Projects" module
#include "ShaderCore.h"                  // RenderCore; AddShaderSourceDirectoryMapping(const FString& VirtualShaderDirectory, const FString& RealShaderDirectory)

void FMyGameModule::StartupModule()
{
    const FString ShaderDir = FPaths::Combine(
        IPluginManager::Get().FindPlugin(TEXT("MyGame"))->GetBaseDir(), TEXT("Shaders"));   // plugin module; for a game module use FPaths::ProjectDir()
    AddShaderSourceDirectoryMapping(TEXT("/MyGame"), ShaderDir);
}

Source: SKILL.md on GitHub

No alerts2d5 checks · Risk SAFE
  • Gen Agent Trust Hub2d

    The skill provides C++ patterns and reference materials for Unreal Engine material and rendering systems. It includes instructions for the agent to read a project context file to tailor its advice. No security issues were detected.

  • Socket2d

    No alerts

  • Snyk2d

    Risk: LOW · No issues

  • Runlayer6mo

    3 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f3742d7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 3 days ago
metadata
{
  "version": "2.0.0",
  "engine": "5.8"
}

README badge

README badge for quodsoler/unreal-engine-skills/ue-materials-rendering