InteriorSceneLighting

November 7, 2023 ยท View on GitHub

from tdw.add_ons.interior_scene_lighting import InteriorSceneLighting

Add an HDRI skybox to the scene from a curated list of skyboxes and set post-processing values.

The list of skyboxes is a subset of all of the skyboxes available in TDW. They are all exterior skyboxes, which means that they are suitable for interior scenes such as floorplan_1a or mm_craftroom_2b. Note that some interior scenes are not HDRI-compatible; see scene_record.hdri.


Class Variables

VariableTypeDescriptionValue
SKYBOX_NAMES_AND_POST_EXPOSURE_VALUESDict[str, float]A dictionary of all of the possible HDRI skyboxes. Key = The HDRI skybox name. Value = the post exposure value.loads(Path(resource_filename(__name__, "interior_scene_lighting_data/hdri_skyboxes.json")).read_text())

Fields

  • hdri_skybox The name of the current HDRI skybox.

  • commands These commands will be appended to the commands of the next communicate() call.

  • initialized If True, this module has been initialized.


Functions

__init__

InteriorSceneLighting()

InteriorSceneLighting(hdri_skybox=None, rng=None, aperture=8, focus_distance=2.5, ambient_occlusion_intensity=0.125, ambient_occlusion_thickness_modifier=3.5, shadow_strength=1)

ParameterTypeDefaultDescription
hdri_skyboxstrNoneThe name of the HDRI skybox. If None, a random skybox will be selected.
rngnp.random.RandomStateNoneThe random number generator for the purpose of selecting a random HDRI skybox. If None, a new random number generator will be created as needed.
aperturefloat8The depth-of-field aperture.
focus_distancefloat2.5The depth-of-field focus distance.
ambient_occlusion_intensityfloat0.125The intensity (darkness) of the Ambient Occlusion effect.
ambient_occlusion_thickness_modifierfloat3.5The thickness modifier for the Ambient Occlusion effect; controls "spread" of the effect out from corners.
shadow_strengthfloat1The shadow strength of all lights in the scene.

get_initialization_commands

self.get_initialization_commands()

This function gets called exactly once per add-on. To re-initialize, set self.initialized = False.

Returns: A list of commands that will initialize this add-on.

on_send

self.on_send(resp)

This is called within Controller.communicate(commands) after commands are sent to the build and a response is received.

Use this function to send commands to the build on the next Controller.communicate(commands) call, given the resp response. Any commands in the self.commands list will be sent on the next Controller.communicate(commands) call.

ParameterTypeDefaultDescription
respList[bytes]The response from the build.

before_send

self.before_send(commands)

This is called within Controller.communicate(commands) before sending commands to the build. By default, this function doesn't do anything.

ParameterTypeDefaultDescription
commandsList[dict]The commands that are about to be sent to the build.

get_early_initialization_commands

self.get_early_initialization_commands()

This function gets called exactly once per add-on. To re-initialize, set self.initialized = False.

These commands are added to the list being sent on communicate() before any other commands, including those added by the user and by other add-ons.

Usually, you shouldn't override this function. It is useful for a small number of add-ons, such as loading screens, which should initialize before anything else.

Returns: A list of commands that will initialize this add-on.

reset

self.reset()

self.reset(hdri_skybox=None, rng=None, aperture=8, focus_distance=2.5, ambient_occlusion_intensity=0.125, ambient_occlusion_thickness_modifier=3.5, shadow_strength=1)

Reset the HDRI skybox. Call this when resetting a scene.

ParameterTypeDefaultDescription
hdri_skyboxstrNoneThe name of the HDRI skybox. If None, a random skybox will be selected.
rngnp.random.RandomStateNoneThe random number generator for the purpose of selecting a random HDRI skybox. If None, a new random number generator will be created as needed.
aperturefloat8The depth-of-field aperture.
focus_distancefloat2.5The depth-of-field focus distance.
ambient_occlusion_intensityfloat0.125The intensity (darkness) of the Ambient Occlusion effect.
ambient_occlusion_thickness_modifierfloat3.5The thickness modifier for the Ambient Occlusion effect; controls "spread" of the effect out from corners.
shadow_strengthfloat1The shadow strength of all lights in the scene.