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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
clear_color (LinearColor) –
- 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
world_context_object (Object) –
render_target (TextureRenderTarget2D) –
texture (Texture2D) –
- 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
world_context_object (Object) –
width (int32) –
height (int32) –
format (TextureRenderTargetFormat) –
clear_color (LinearColor) –
auto_generate_mip_maps (bool) –
- Returns
- Return type
- 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
world_context_object (Object) –
width (int32) –
height (int32) –
slices (int32) –
format (TextureRenderTargetFormat) –
clear_color (LinearColor) –
auto_generate_mip_maps (bool) –
- Returns
- Return type
- 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
world_context_object (Object) –
width (int32) –
height (int32) –
depth (int32) –
format (TextureRenderTargetFormat) –
clear_color (LinearColor) –
auto_generate_mip_maps (bool) –
- Returns
- Return type
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
material (MaterialInterface) –
- 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
world_context_object (Object) –
context (DrawToRenderTargetContext) –
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
file_path (str) –
file_name (str) –
- classmethod export_texture2d(world_context_object, texture, file_path, file_name) → None¶
Exports a Texture2D as a HDR image onto the disk.
- classmethod import_buffer_as_texture2d(world_context_object, buffer) → Texture2D¶
Imports a texture from a buffer and creates Texture2D from it.
- classmethod import_file_as_texture2d(world_context_object, filename) → Texture2D¶
Imports a texture file from disk and creates Texture2D from it.
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
x (int32) –
y (int32) –
- Returns
- Return type
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
x (int32) –
y (int32) –
- Returns
- Return type
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
u (float) –
v (float) –
- Returns
- Return type
- 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
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
u (float) –
v (float) –
- Returns
- Return type
- 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
render_target (TextureRenderTarget2D) –
name (str) –
compression_settings (TextureCompressionSettings) –
mip_settings (TextureMipGenSettings) –
- Returns
- Return type
- 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
primitive_component (PrimitiveComponent) –
cast_inset_shadow (bool) –
light_attachments_as_group (bool) –