user: Show practical ways to work with Bpy.Types.Renderengine in a Blender add-on or script – include code.

assistant: ata = pixels ) # Note: This is just a didactic example. # In this case it would be more convenient to fill the texture with: # self.texture.clear(&#39;FLOAT&#39;, value=[0.1, 0.2, 0.1, 1.0]) def __del__ ( self ): del self . texture def draw ( self ): from gpu_extras.presets import draw_texture_2d draw_texture_2d ( self . texture , ( 0 , 0 ), self . texture . width , self . texture . height ) # RenderEngines also need to tell UI Panels that they are compatible with. # We recommend to enable all panels marked as BLENDER_RENDER, and then # exclude any panels that are replaced by custom panels registered by the # render engine, or that are not supported. def get_panels (): exclude_panels = { &#39;VIEWLAYER_PT_filter&#39; , &#39;VIEWLAYER_PT_layer_passes&#39; , } panels = [] for panel in bpy . types . Panel . __subclasses__ (): if hasattr ( panel , &#39;COMPAT_ENGINES&#39; ) and &#39;BLENDER_RENDER&#39; in panel . COMPAT_ENGINES : if panel . __name__ not in exclude_panels : panels . append ( panel ) return panels def register (): # Register the RenderEngine. bpy . utils . register_class ( CustomRenderEngine ) for panel in get_panels (): panel . COMPAT_ENGINES . add ( &#39;CUSTOM&#39; ) def unregister (): bpy . utils . unregister_class ( CustomRenderEngine ) for panel in get_panels (): if &#39;CUSTOM&#39; in panel . COMPAT_ENGINES : panel . COMPAT_ENGINES . remove ( &#39;CUSTOM&#39; ) if __name__ == "__main__" : register () GPU Render Engine ¶ import bpy class CustomGPURenderEngine ( bpy . types . RenderEngine ): bl_idname = "CUSTOM_GPU" bl_label = "Custom GPU" # Request a GPU context to be created and activated for the render method. # This may be used either to perform the rendering itself, or to allocate # and fill a texture for more efficient drawing. bl_use_gpu_context = True def render ( self , depsgraph ): # Lazily import GPU module, since GPU context is only created on demand # for rendering and does not exist on register. import gpu # Perform rendering task. pass def register (): bpy . utils . register_class ( CustomGPURenderEngine ) def unregister (): bpy . utils . unregister_class ( CustomGPURenderEngine ) if __name__ == "__main__" : register () base class — bpy_struct subclasses — HydraRenderEngine class bpy.types. RenderEngine ( bpy_struct ) ¶ Render engine bl_idname ¶ Type : string, default “”, (never None) bl_label ¶ Type : string, default “”, (never None) bl_use_custom_freestyle ¶ Handles freestyle rendering on its own, instead of delegating it to EEVEE Type : boolean, default False bl_use_eevee_viewport ¶ Uses EEVEE for viewport shading in Material Preview shading mode Type : boolean, default False bl_use_gpu_context ¶ Enable OpenGL context for the render method, for engines that render using OpenGL Type : boolean, default False bl_use_image_save ¶ Save images/movie to disk while rendering an animation. Disabling image saving is only supported when bl_use_postprocess is also disabled. Type : boolean, default True bl_use_materialx ¶ Use MaterialX for exporting materials to Hydra Type : boolean, default False bl_use_postprocess ¶ Apply compositing on render results Type : boolean, default False bl_use_preview ¶ Render engine supports being used for rendering previews of materials, lights and worlds Type : boolean, default False bl_use_shading_nodes_custom ¶ Don’t expose Cycles and EEVEE shading nodes in the node editor user interface, so separate nodes can be used instead Type : boolean, default True bl_use_spherical_stereo ¶ Support spherical stereo camera models Type : boolean, default False bl_use_stereo_viewport ¶ Support rendering stereo 3D viewport Type : boolean, default False camera_override ¶ Type : Object , (readonly) is_animation ¶ Type : boolean, default False is_preview ¶ Type : boolean, default False layer_override ¶ Type : boolean array of 20 items, default (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False) render Type : RenderSettings , (readonly) resolution_x ¶ Type : int in [-inf, inf], default 0, (readonly) resolution_y ¶ Type : int in [-inf, inf], default 0, (readonly) temporary_directory ¶ Type : string, default “”, (readonly, never None) use_highlight_tiles ¶ Type : boolean, default False update ( * , data = None , depsgraph = None ) ¶ Export scene data for render render ( depsgraph ) ¶ Render scene into an image render_frame_finish ( ) ¶ Perform finishing operations after all view layers in a frame were rendered draw ( context , depsgraph ) ¶ Draw render image bake ( depsgraph , object , pass_type , pass_filter , width , height ) ¶ Bake passes Parameters : pass_type (enum in Bake Pass Type Items ) – Pass, Pass to bake pass_filter ( int in [ 0 , inf ] ) – Pass Filter, Filter to combined, diffuse, glossy and transmission passes width ( int in [ 0 , inf ] ) – Width, Image width height ( int in [ 0 , inf ] ) – Height, Image height view_update ( context , depsgraph ) ¶ Update on data changes for viewport render view_draw ( context , depsgraph ) ¶ Draw viewport render update_script_node ( * , node = None ) ¶ Compile shader script node update_render_passes ( * , scene = None , renderlayer = None ) ¶ Update the render passes that will be generated update_custom_camera ( * , cam = None ) ¶ Compile custom camera tag_redraw ( ) ¶ Request redraw for viewport rendering tag_update ( ) ¶ Request update call for viewport rendering begin_result ( x , y , w , h , * , layer = '' , view = '' ) ¶ Create render result to write linear floating-point render layers and passes Parameters : x ( int in [ 0 , inf ] ) – X y ( int in [ 0 , inf ] ) – Y w ( int in [ 0 , inf ] ) – Width h ( int in [ 0 , inf ] ) – Height layer ( string , ( optional , never None ) ) – Layer, Single layer to get render result for view ( string , ( optional , never None ) ) – View, Single view to get render result for Returns : Result Return type : RenderResult update_result ( result ) ¶ Signal that pixels have been updated and can be redrawn in the user interface Parameters : result ( RenderResult ) – Result end_result ( result , * , cancel = False , highlight = False , do_merge_results = False ) ¶ All pixels in the render result have been set and are final Parameters : result ( RenderResult ) – Result cancel ( boolean , ( optional ) ) – Cancel, Don’t mark tile as done, don’t merge results unless forced highlight ( boolean , ( optional ) ) – Highlight, Don’t mark tile as done yet do_merge_results ( boolean , ( optional ) ) – Merge Results, Merge results even if cancel=true add_pass ( name , channels , chan_id , * , layer = '' ) ¶ Add a pass to the render layer Parameters : name ( string , ( never None ) ) – Name, Name of the Pass, without view or channel tag channels ( int in [ 0 , inf ] ) – Channels chan_id ( string , ( never None ) ) – Channel IDs, Channel names, one character per channel layer ( string , ( optional , never None ) ) – Layer, Single layer to add render pass to get_result ( ) ¶ Get final result for non-pixel operations Returns : Result Return type : RenderResult test_break ( ) ¶ Test if the render operation should been canceled, this is a fast call that should be used regularly for responsiveness Returns : Break Return type : boolean pass_by_index_get ( layer , index ) ¶ pass_by_index_get Parameters : layer ( string , ( never None ) ) – Layer, Name of render layer to get pass for index ( int in [ 0 , inf ] ) – Index, Index of pass to get Returns : Index, Index of pass to get Return type : RenderPass active_view_get ( ) ¶ active_view_get Returns : View, Single view active Return type : string, (never None) active_view_set ( view ) ¶ active_view_set Parameters : view ( string , ( never None ) ) – View, Single view to set as active camera_shift_x ( camera , * , use_spherical_stereo = False ) ¶ camera_shift_x Parameters : use_spherical_stereo ( boolean , ( optional ) ) – Spherical Stereo Returns : Shift X Return type : float in [0, inf] camera_model_matrix ( camera , * , use_spherical_stereo = False ) ¶ camera_model_matrix Parameters : use_spherical_stereo ( boolean , ( optional ) ) – Spherical Stereo Returns : Model Matrix, Normalized camera model matrix Return type : mathutils.Matrix of 4 * 4 items in [-inf, inf] use_spherical_stereo ( camera ) ¶ use_spherical_stereo Returns : Spherical Stereo Return type : boolean update_stats ( stats , info ) ¶ Update and signal to redraw render status text Parameters : stats ( string , ( never None ) ) – Stats info ( string , ( never None ) ) – Info frame_set ( frame , subframe ) ¶ Evaluate scene at a different frame (for motion blur) Parameters : frame ( int in [ -inf , inf ] ) – Frame subframe ( float in [ 0 , 1 ] ) – Subframe update_progress ( progress ) ¶ Update progress percentage of render Parameters : progress ( float in [ 0 , 1 ] ) – Percentage of render that’s done update_memory_stats ( * , memory_used = 0.0 , memory_peak = 0.0 ) ¶ Update memory usage statistics Parameters : memory_used ( float in [ 0 , inf ] , ( optional ) ) – Current memory usage in megabytes memory_peak ( float in [ 0 , inf ] , ( optional ) ) – Peak memory usage in megabytes report ( type , message ) ¶ Report info, warning or error messages Parameters : type (enum set in Wm Report Items ) – Type message ( string , ( never None ) ) – Report Message error_set ( message ) ¶ Set error message displaying after the render is finished Parameters : message ( string , ( never None ) ) – Report Message bind_display_space_shader ( scene ) ¶ Bind GLSL fragment shader that converts linear colors to display space colors using scene color management settings unbind_display_space_shader ( ) ¶ Unbind GLSL display space shader, must always be called after binding the shader support_display_space_shader ( scene ) ¶ Test if GLSL display space shader is supported for the combination of graphics card and scene settings Returns : Supported Return type : boolean get_preview_pixel_size ( scene ) ¶ Get the pixel size that should be used for preview rendering Returns : Pixel Size Return type : int in [1, 8] free_blender_memory ( ) ¶ Free Blender side memory of render engine tile_highlight_set ( x , y , width , height , highlight ) ¶ Set highlighted state of the given tile Parameters : x ( int in [ 0 , inf ] ) – X y ( int in [ 0 , inf ] ) – Y width ( int in [ 0 , inf ] ) – Width height ( int in [ 0 , inf ] ) – Height highlight ( boolean ) – Highlight tile_highlight_clear_all ( ) ¶ The temp directory used by Blender register_pass ( scene , view_layer , name , channels , chanid , type ) ¶ Register a render pass that will be part of the render with the current settings Parameters : name ( string , ( never None ) ) – Name channels ( int in [ 1 , 8 ] ) – Channels chanid ( string , ( never None ) ) – Channel IDs type (enum in [ 'VALUE' , 'VECTOR' , 'COLOR' ]) – Type classmethod bl_rna_get_subclass ( id , default = None , / ) ¶ Parameters : id ( str ) – The RNA type identifier. Returns : The RNA type or default when not found. Return type : bpy.types.Struct subclass classmethod bl_rna_get_subclass_py ( id , default = None , / ) ¶ Parameters : id ( str ) – The RNA type identifier. Returns : The class or default when not found. Return type : type Inherited Properties ¶ bpy_struct.id_data Inherited Functions ¶ bpy_struct.as_pointer bpy_struct.driver_add bpy_struct.driver_remove bpy_struct.get bpy_struct.id_properties_clear bpy_struct.id_properties_ensure bpy_struct.id_properties_ui bpy_struct.is_property_hidden bpy_struct.is_property_overridable_library bpy_struct.is_property_readonly bpy_struct.is_property_set bpy_struct.items bpy_struct.keyframe_delete bpy_struct.keyframe_insert bpy_struct.keys bpy_struct.path_from_id bpy_struct.path_from_module bpy_struct.path_resolve bpy_struct.pop bpy_struct.property_overridable_library_set bpy_struct.property_unset bpy_struct.rna_ancestors bpy_struct.type_recast bpy_struct.values Next RenderLayer(bpy_struct) Previous RemeshModifier(Modifier) Copyright &#169; Blender Authors Made with Furo Report issue on this page On this page RenderEngine(bpy_struct) Simple Render Engine GPU Render Engine RenderEngine RenderEngine.bl_idname RenderEngine.bl_label RenderEngine.bl_use_custom_freestyle RenderEngine.bl_use_eevee_viewport RenderEngine.bl_use_gpu_context RenderEngine.bl_use_image_save RenderEngine.bl_use_materialx RenderEngine.bl_use_postprocess RenderEngine.bl_use_preview RenderEngine.bl_use_shading_nodes_custom RenderEngine.bl_use_spherical_stereo RenderEngine.bl_use_stereo_viewport RenderEngine.camera_override RenderEngine.is_animation RenderEngine.is_preview RenderEngine.layer_override RenderEngine.resolution_x RenderEngine.resolution_y RenderEngine.temporary_directory RenderEngine.use_highlight_tiles RenderEngine.update() RenderEngine.render() RenderEngine.render_frame_finish() RenderEngine.draw() RenderEngine.bake() RenderEngine.view_update() RenderEngine.view_draw() RenderEngine.update_script_node() RenderEngine.update_render_passes() RenderEngine.update_custom_camera() RenderEngine.tag_redraw() RenderEngine.tag_update() RenderEngine.begin_result() RenderEngine.update_result() RenderEngine.end_result() RenderEngine.add_pass() RenderEngine.get_result() RenderEngine.test_break() RenderEngine.pass_by_index_get() RenderEngine.active_view_get() RenderEngine.active_view_set() RenderEngine.camera_shift_x() RenderEngine.camera_model_matrix() RenderEngine.use_spherical_stereo() RenderEngine.update_stats() RenderEngine.frame_set() RenderEngine.update_progress() RenderEngine.update_memory_stats() RenderEngine.report() RenderEngine.error_set() RenderEngine.bind_display_space_shader() RenderEngine.unbind_display_space_shader() RenderEngine.support_display_space_shader() RenderEngine.get_preview_pixel_size() RenderEngine.free_blender_memory() RenderEngine.tile_highlight_set() RenderEngine.tile_highlight_clear_all() RenderEngine.register_pass() RenderEngine.bl_rna_get_subclass() RenderEngine.bl_rna_get_subclass_py() Inherited Properties Inherited Functions