unreal.RenderingLibrary
¶
- class unreal.RenderingLibrary(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
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 calculate_projection_matrix(minimal_view_info) Matrix ¶
Calculates the projection matrix using this view info’s aspect ratio (regardless of bConstrainAspectRatio)
- Parameters:
minimal_view_info (MinimalViewInfo) –
- Return type:
- classmethod clear_render_target2d(world_context_object, texture_render_target, clear_color=[0.000000, 0.000000, 0.000000, 1.000000]) 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_array_editor_only(world_context_object, render_target, texture) None ¶
Copies the contents of a UTextureRenderTarget2DArray to a UTexture2DArray Only works in the editor
- Parameters:
world_context_object (Object) –
render_target (TextureRenderTarget2DArray) –
texture (Texture2DArray) –
- classmethod convert_render_target_to_texture2d_editor_only(world_context_object, render_target, texture) None ¶
Copies the contents of a UTextureRenderTarget2D to a UTexture2D Only works in the editor
- Parameters:
world_context_object (Object) –
render_target (TextureRenderTarget2D) –
texture (Texture2D) –
- classmethod convert_render_target_to_texture_cube_editor_only(world_context_object, render_target, texture) None ¶
Copies the contents of a UTextureRenderTargetCube to a UTextureCube Only works in the editor
- Parameters:
world_context_object (Object) –
render_target (TextureRenderTargetCube) –
texture (TextureCube) –
- classmethod convert_render_target_to_texture_volume_editor_only(world_context_object, render_target, texture) None ¶
Copies the contents of a UTextureRenderTargetVolume to a UVolumeTexture Only works in the editor
- Parameters:
world_context_object (Object) –
render_target (TextureRenderTargetVolume) –
texture (VolumeTexture) –
- classmethod create_render_target2d(world_context_object, width=256, height=256, format=TextureRenderTargetFormat.RTF_RGBA16F, clear_color=[0.000000, 0.000000, 0.000000, 1.000000], auto_generate_mip_maps=False, support_ua_vs=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) –
support_ua_vs (bool) –
- Return type:
- classmethod create_render_target2d_array(world_context_object, width=256, height=256, slices=1, format=TextureRenderTargetFormat.RTF_RGBA16F, clear_color=[0.000000, 0.000000, 0.000000, 1.000000], auto_generate_mip_maps=False, support_ua_vs=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) –
support_ua_vs (bool) –
- Return type:
- classmethod create_render_target_volume(world_context_object, width=16, height=16, depth=16, format=TextureRenderTargetFormat.RTF_RGBA16F, clear_color=[0.000000, 0.000000, 0.000000, 1.000000], auto_generate_mip_maps=False, support_ua_vs=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) –
support_ua_vs (bool) –
- 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 enable_path_tracing(enable_path_tracer) None ¶
Enables or disables the path tracer for the current Game Viewport. This command is equivalent to setting ShowFlag.PathTracing, but is accessible even from shipping builds.
- Parameters:
enable_path_tracer (bool) –
- 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(world_context_object, texture_render_target, normalize=True) Array[Color] or None ¶
Incredibly inefficient and slow operation! Reads entire render target as sRGB color and returns a linear array of sRGB colors. LDR render targets are assumed to be in sRGB space. HDR ones are assumed to be in linear space. Result whether the operation succeeded. If successful, OutSamples will an entry per pixel, where each is 8-bit per channel [0,255] BGRA in sRGB space.
- Parameters:
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
normalize (bool) –
- Returns:
out_samples (Array[Color]):
- Return type:
- 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) –
- Return type:
- classmethod read_render_target_raw(world_context_object, texture_render_target, normalize=True) Array[LinearColor] or None ¶
Incredibly inefficient and slow operation! Read entire texture as-is from a render target.
- Parameters:
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
normalize (bool) –
- Returns:
out_linear_samples (Array[LinearColor]):
- Return type:
Array[LinearColor] or None
- classmethod read_render_target_raw_pixel(world_context_object, texture_render_target, x, y, normalize=True) 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) –
normalize (bool) –
- Return type:
- classmethod read_render_target_raw_pixel_area(world_context_object, texture_render_target, min_x, min_y, max_x, max_y, normalize=True) Array[LinearColor] ¶
Incredibly inefficient and slow operation! Read an area of values as-is from a render target using a rectangle defined by integer pixel coordinates.
- Parameters:
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
min_x (int32) –
min_y (int32) –
max_x (int32) –
max_y (int32) –
normalize (bool) –
- Return type:
- classmethod read_render_target_raw_uv(world_context_object, texture_render_target, u, v, normalize=True) LinearColor ¶
Incredibly inefficient and slow operation! Read a value as-is 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) –
normalize (bool) –
- Return type:
- classmethod read_render_target_raw_uv_area(world_context_object, texture_render_target, area, normalize=True) Array[LinearColor] ¶
Incredibly inefficient and slow operation! Read an area of values as-is from a render target using a rectangle defined by UV [0,1]x[0,1] coordinates.
- Parameters:
world_context_object (Object) –
texture_render_target (TextureRenderTarget2D) –
area (Box2D) –
normalize (bool) –
- 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) –
- Return type:
- classmethod refresh_path_tracing_output() None ¶
Forces the path tracer to restart sample accumulation. This can be used to force the path tracer to compute a new frame in situations where it can not detect a change in the scene automatically.
- 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_array_editor_only(render_target, name='Texture', compression_settings=TextureCompressionSettings.TC_DEFAULT, mip_settings=TextureMipGenSettings.TMGS_FROM_TEXTURE_GROUP) Texture2DArray ¶
Creates a new Static Texture 2D Array from a Render Target 2D Array. Only works in the editor
- Parameters:
render_target (TextureRenderTarget2DArray) –
name (str) –
compression_settings (TextureCompressionSettings) –
mip_settings (TextureMipGenSettings) –
- Return type:
- 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. Only works in the editor
- Parameters:
render_target (TextureRenderTarget2D) –
name (str) –
compression_settings (TextureCompressionSettings) –
mip_settings (TextureMipGenSettings) –
- Return type:
- classmethod render_target_create_static_texture_cube_editor_only(render_target, name='Texture', compression_settings=TextureCompressionSettings.TC_DEFAULT, mip_settings=TextureMipGenSettings.TMGS_FROM_TEXTURE_GROUP) TextureCube ¶
Creates a new Static Texture Cube from a Render Target Cube. Only works in the editor
- Parameters:
render_target (TextureRenderTargetCube) –
name (str) –
compression_settings (TextureCompressionSettings) –
mip_settings (TextureMipGenSettings) –
- Return type:
- classmethod render_target_create_static_volume_texture_editor_only(render_target, name='Texture', compression_settings=TextureCompressionSettings.TC_DEFAULT, mip_settings=TextureMipGenSettings.TMGS_FROM_TEXTURE_GROUP) VolumeTexture ¶
Creates a new Static Volume Texture from a Render Target Volume. Only works in the editor
- Parameters:
render_target (TextureRenderTargetVolume) –
name (str) –
compression_settings (TextureCompressionSettings) –
mip_settings (TextureMipGenSettings) –
- Return type:
- classmethod resize_render_target2d(texture_render_target, width=256, height=256) None ¶
Changes the resolution of a render target. This is useful for when you need to resize the game viewport or change the in-game resolution during runtime and thus need to update the sizes of all the render targets in the game accordingly.
- Parameters:
texture_render_target (TextureRenderTarget2D) –
width (int32) –
height (int32) –
- 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) –