What Should I Build?

A directory of what people actually want. Classified, clustered, ranked and updated daily

Unreal Engine shader-injection toolkit/plugin

ContentCreation · 1 mentions

#1993042843762602145

Employer got you stuck using UE5? Frustrated by Unreal’s shaders not letting you do what you want? Want to make your employer love you for your hacking skills? Look no further than shader injection! Like SQL injection, you’re going to leverage Unreal’s shader code generation to hack around the official publicly exposed interface to do whatever you want with Unreal’s shader variables in your Custom HLSL nodes, all without making any engine changes. Step 1: Access the full shader codegen You need to update the DefaultEngine.ini config file to have the following: [ShaderCompiler] r.Shaders.Symbols=1 You then need to build and cook your project with “by the book” set. This will give you an exe that you can then run in Nsight Graphics. Find your draw/dispatch and the shader source will be visible if done correctly. The config change above makes that possible. Step 2: Analyze the code Now that you can see the code, you can see where your own code is being injected and where Unreal is screwing with you. Sometimes there are settings that can be modified to change their codegen for the better; sometimes there aren’t. The engine source can help. If not, proceed to step 3. Step 3: Write your hacks Using defines and your custom functions/variables that match Unreal’s naming, inject your own code changes into it. You have access to nearly every private function and variable if you position your injection correctly. If you need to be positioned higher in the shader, use the include file paths feature. You may also exit an existing function from within a Material Custom HLSL node and define your own by just starting with return 1; } and defining further ones from there. If you need to bypass the Editor’s compile-time restrictions, use defines only available locally there and different ones that are imported elsewhere. UE will codegen your injected shader into multiple different variants, but only the versions that are actually running are the ones that matter. Step 4: Brag to your boss You just solved what all your colleagues thought was an unsolvable problem without Epic’s intervention. Make sure you get that well deserved bonus.

For any inquiries, contact info@quantumedge.sk