HDR files
In this section you will get to know how to use and store HDR files.
Agenda:
- HDR - Environmental mapping files with wide bit range
HDR - Environmental mapping files with wide bit range.
In SkyRenderer one can use HDR as in every other rendering engine, but you have to organize them in a proper
way. HDR files are stored in 'background_hdrs' subdirectory. You may access full path using renderer context's
get_abs_path functionality
renderer_context.get_abs_path("", AssetsTypes.BACKGROUND_HDRS)
Inside a directory there are always at least two files: HDR and .json config. In some cases, when there is
a batch used, there would be n json-hdr file pairs accompanied by additional, proxy json in which there is a
mapping of mentioned n* json-hdr pairs.
You can learn more about parametrizing HDRs in HDRTextureProvider tutorial.
import json
from pathlib import Path
from skyrenderer.cases.utils import MaterialsSceneComposer
from skyrenderer.core.asset_manager.asset_manager import AssetsTypes
scene_composer = MaterialsSceneComposer(antialiasing_level=32)
hdr_directory = scene_composer.renderer_context.get_abs_path("", AssetsTypes.BACKGROUND_HDRS)
scene_composer.log_info(hdr_directory)
pink_sunrise_dir = scene_composer.renderer_context.get_abs_path("pink_sunrise", AssetsTypes.BACKGROUND_HDRS)
for entry in pink_sunrise_dir.iterdir():
scene_composer.log_info(entry.name)
with open(pink_sunrise_dir.joinpath("pink_sunrise.json"), "r") as file:
config_content = json.load(file)
scene_composer.log_info("Single HDR:")
scene_composer.log_info(config_content)
batch_hdr_dir = scene_composer.renderer_context.get_abs_path("batch_hdr", AssetsTypes.BACKGROUND_HDRS)
with open(Path(batch_hdr_dir).joinpath("batch_hdr.json"), "r") as file:
config_content = json.load(file)
scene_composer.log_info("Batch HDR:")
scene_composer.log_info(config_content)
2025-01-29 13:51:17,697 | skyrenderer.scene.renderer_context | INFO: Root paths:
- root path: /dli/skyenvironment/skyrenderer/skyrenderer
- assets path: /dli/mount/assets
- config path: /dli/skyenvironment/skyrenderer/skyrenderer/config
- gpu sources path: /dli/skyenvironment/skyrenderer/skyrenderer/optix_sources/sources
- cache path: /dli/mount/cache
- ptx cache path: compiled_ptx/ptx
- ocio path: ocio_configs/aces_1.2/config.ocio
2025-01-29 13:51:17,727 | skyrenderer | INFO: /dli/mount/assets/renderer/background_hdrs
2025-01-29 13:51:17,728 | skyrenderer | INFO: pink_sunrise_8k.hdr
2025-01-29 13:51:17,729 | skyrenderer | INFO: pink_sunrise.json
2025-01-29 13:51:17,731 | skyrenderer | INFO: Single HDR:
2025-01-29 13:51:17,732 | skyrenderer | INFO: {'map_path': 'pink_sunrise_8k.hdr', 'parameters': {'gamma': 1.5, 'intensity': 3}}
2025-01-29 13:51:17,733 | skyrenderer | INFO: Batch HDR:
2025-01-29 13:51:17,733 | skyrenderer | INFO: {'map_path': '{}', 'config_proxy': ['blaubeuren_church_square_8k.json', 'leadenhall_market_8k.json', 'flower_road_4k.json'], 'internal_lights_count': 10}
Summary
In this section you have learnt:
- HDR files are stored in 'background_hdrs' subdirectory.
- In HDR's directories HDR files are accompanied by .json files.