unreal.RenderingLibrary

class unreal.RenderingLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Kismet Rendering Library

C++ Source:

  • Module: Engine

  • File: KismetRenderingLibrary.h

classmethod begin_draw_canvas_to_render_target(world_context_object, texture_render_target) -> (canvas=Canvas, size=Vector2D, context=DrawToRenderTargetContext)

Returns a Canvas object that can be used to draw to the specified render target. Canvas has functions like DrawMaterial with size parameters that can be used to draw to a specific area of a render target. Be sure to call EndDrawCanvasToRenderTarget to complete the rendering!

Parameters
Returns

canvas (Canvas):

size (Vector2D):

context (DrawToRenderTargetContext):

Return type

tuple

classmethod clear_render_target2d(world_context_object, texture_render_target, clear_color=[0.0, 0.0, 0.0, 0.0])None

Clears the specified render target with the given ClearColor.

Parameters
classmethod convert_render_target_to_texture2d_editor_only(world_context_object, render_target, texture)None

Copies the contents of a render target to a UTexture2D Only works in the editor

Parameters
classmethod create_render_target2d(world_context_object, width=256, height=256, format=TextureRenderTargetFormat.RTF_RGBA16F, clear_color=[0.0, 0.0, 0.0, 0.0], auto_generate_mip_maps=False)TextureRenderTarget2D

Creates a new render target and initializes it to the specified dimensions

Parameters
Returns

Return type

TextureRenderTarget2D

classmethod create_render_target2d_array(world_context_object, width=256, height=256, slices=1, format=TextureRenderTargetFormat.RTF_RGBA16F, clear_color=[0.0, 0.0, 0.0, 0.0], auto_generate_mip_maps=False)TextureRenderTarget2DArray

Creates a new render target array and initializes it to the specified dimensions

Parameters
Returns

Return type

TextureRenderTarget2DArray

classmethod create_render_target_volume(world_context_object, width=16, height=16, depth=16, format=TextureRenderTargetFormat.RTF_RGBA16F, clear_color=[0.0, 0.0, 0.0, 0.0], auto_generate_mip_maps=False)TextureRenderTargetVolume

Creates a new volume render target and initializes it to the specified dimensions

Parameters
Returns

Return type

TextureRenderTargetVolume

classmethod draw_material_to_render_target(world_context_object, texture_render_target, material)None

Renders a quad with the material applied to the specified render target. This sets the render target even if it is already set, which is an expensive operation. Use BeginDrawCanvasToRenderTarget / EndDrawCanvasToRenderTarget instead if rendering multiple primitives to the same render target.

Parameters
classmethod end_draw_canvas_to_render_target(world_context_object, context)None

Must be paired with a BeginDrawCanvasToRenderTarget to complete rendering to a render target.

Parameters
classmethod export_render_target(world_context_object, texture_render_target, file_path, file_name)None

Exports a render target as a HDR or PNG image onto the disk (depending on the format of the render target)

Parameters
classmethod export_texture2d(world_context_object, texture, file_path, file_name)None

Exports a Texture2D as a HDR image onto the disk.

Parameters
classmethod import_buffer_as_texture2d(world_context_object, buffer)Texture2D

Imports a texture from a buffer and creates Texture2D from it.

Parameters
  • world_context_object (Object) –

  • buffer (Array(uint8)) –

Returns

Return type

Texture2D

classmethod import_file_as_texture2d(world_context_object, filename)Texture2D

Imports a texture file from disk and creates Texture2D from it.

Parameters
  • world_context_object (Object) –

  • filename (str) –

Returns

Return type

Texture2D

classmethod read_render_target_pixel(world_context_object, texture_render_target, x, y)Color

Incredibly inefficient and slow operation! Read a value as sRGB color from a render target using integer pixel coordinates. LDR render targets are assumed to be in sRGB space. HDR ones are assumed to be in linear space. Result is 8-bit per channel [0,255] BGRA in sRGB space.

Parameters
Returns

Return type

Color

classmethod read_render_target_raw_pixel(world_context_object, texture_render_target, x, y)LinearColor

Incredibly inefficient and slow operation! Read a value as-is from a render target using integer pixel coordinates.

Parameters
Returns

Return type

LinearColor

classmethod read_render_target_raw_uv(world_context_object, texture_render_target, u, v)LinearColor

Incredibly inefficient and slow operation! Read a value as-is color from a render target using UV [0,1]x[0,1] coordinates.

Parameters
Returns

Return type

LinearColor

classmethod read_render_target_uv(world_context_object, texture_render_target, u, v)Color

Incredibly inefficient and slow operation! Read a value as sRGB color from a render target using UV [0,1]x[0,1] coordinates. LDR render targets are assumed to be in sRGB space. HDR ones are assumed to be in linear space. Result is 8-bit per channel [0,255] BGRA in sRGB space.

Parameters
Returns

Return type

Color

classmethod release_render_target2d(texture_render_target)None

Manually releases GPU resources of a render target. This is useful for blueprint creating a lot of render target that would normally be released too late by the garbage collector that can be problematic on platforms that have tight GPU memory constrains.

Parameters

texture_render_target (TextureRenderTarget2D) –

classmethod render_target_create_static_texture2d_editor_only(render_target, name='Texture', compression_settings=TextureCompressionSettings.TC_DEFAULT, mip_settings=TextureMipGenSettings.TMGS_FROM_TEXTURE_GROUP)Texture2D

Creates a new Static Texture from a Render Target 2D. Render Target Must be power of two and use four channels. Only works in the editor

Parameters
Returns

Return type

Texture2D

classmethod set_cast_inset_shadow_for_all_attachments(primitive_component, cast_inset_shadow, light_attachments_as_group)None
Set the inset shadow casting state of the given component and all its child attachments.

Also choose if all attachments should be grouped for the inset shadow rendering. If enabled, one depth target will be shared for all attachments.

Parameters