render#
This module contains the functions to render the agglomerates and
jellyroll in Blender. The module is called from the Data.render
method in the fasttomo package to run within Blender.
The script imports the STL files for each time instant for a specific
experiment and renders either the agglomerates or the jellyroll
(to show the sidewall rupture) in three different views: side, top
and perspective.
Module Contents#
Functions#
Returns the color palette used for the different labels. |
|
|
Modifies the properties of the rendering engine. |
|
Modifies the properties of the object associated to a |
|
Creates the materials for the different labels. A black |
|
Returns the path for the STL files. Creates and returns the |
|
Imports the STL file for a specific label, creates the associated |
Adds two point lights to the scene. |
|
|
Renders the top view of the scene in orthographic mode. |
|
Renders the side view of the scene in orthographic mode. |
|
Renders a perspective view of the scene. |
Attributes#
- render.color_palette()#
Returns the color palette used for the different labels.
- Returns:
palette – 10x3 array of RGB values for highly distinguishable colors.
- Return type:
np.array
- render.modify_engine(isJellyroll)#
Modifies the properties of the rendering engine.
- Parameters:
isJellyroll (bool) – Whether agglomerates or jellyroll are being rendered. Default is
False.
- render.modify_properties(obj, label, isJellyroll)#
Modifies the properties of the object associated to a specific label. A smoothing modifier is added to the object and the material is assigned based on the label.
- Parameters:
isJellyroll (bool) – Whether agglomerates or jellyroll are being rendered. Default is
False.
- render.create_materials(isJellyroll)#
Creates the materials for the different labels. A black material is assigned to the battery casing, a grey material to the jellyroll and different colors for the agglomerates.
- Parameters:
isJellyroll (bool) – Whether agglomerates or jellyroll are being rendered. Default is
False.
- render.create_folders(path, isJellyroll)#
Returns the path for the STL files. Creates and returns the folder to store the renders for the side, top and perspective views.
- Parameters:
path (str) – Path to the experiment folder.
isJellyroll (bool) – Whether agglomerates or jellyroll are being rendered. Default is
False.
- Returns:
stl_path (str) – Path to the STL files.
side_path (str) – Path to the side view renders.
top_path (str) – Path to the top view renders.
persp_path (str) – Path to the perspective view renders.
- render.import_object(obj_name, time_path, isJellyroll)#
Imports the STL file for a specific label, creates the associated
Blenderobject and modifies its properties.- Parameters:
obj_name (str) – Name of the STL file.
time_path (str) – Path to the folder containing the STL files for a specific time instant.
isJellyroll (bool) – Whether agglomerates or jellyroll are being rendered. Default is
False.
- render.add_lights()#
Adds two point lights to the scene.
- render.top_view_render(top_path, time)#
Renders the top view of the scene in orthographic mode.
- Parameters:
top_path (str) – Path to the folder containing the top view renders.
time (str) – Time instant for the render.
- render.side_view_render(side_path, time)#
Renders the side view of the scene in orthographic mode.
- Parameters:
side_path (str) – Path to the folder containing the side view renders.
time (str) – Time instant for the render.
- render.persp_view_render(persp_path, time, isJellyroll)#
Renders a perspective view of the scene.
- Parameters:
persp_path (str) – Path to the folder containing the perspective view renders.
time (str) – Time instant for the render.
isJellyroll (bool) – Whether agglomerates or jellyroll are being rendered. Default is
False.
- render.isJellyroll#