UKismetRenderingLibrary::DrawMaterialToRenderTarget
#include "Kismet/KismetRenderingLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Renders a full-screen quad with the given material applied directly into the specified render target.
Caveats & Gotchas
- • This sets the render target even if it's already bound, which is an expensive state change — use BeginDrawCanvasToRenderTarget/EndDrawCanvasToRenderTarget instead if drawing multiple primitives to the same target in one frame.
- • Marked UnsafeDuringActorConstruction — do not call from a construction script.
- • The material's domain should generally be set to User Interface or it must otherwise be written to tolerate being drawn as a screen-space quad; a material authored for 3D surfaces may not sample correctly.
Signature
static void DrawMaterialToRenderTarget(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, UMaterialInterface* Material); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | UObject* | Object used to resolve the current world. | — |
| TextureRenderTarget | UTextureRenderTarget2D* | The render target to draw into. | — |
| Material | UMaterialInterface* | The material rendered as a full-screen quad into the target. | — |
Return Type
void Example
Bake a material into a texture C++
UKismetRenderingLibrary::DrawMaterialToRenderTarget(this, NoiseRenderTarget, NoiseMaterial); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?