Ball Transform Provider
In this section you will learn how to use BallTransformProvider in SkyRenderer.
Agenda:
- Ball Transform Provider basics
- Ball Transform Provider usage
Scene setup
Let's use custom scene composer to set up the scene.
from skyrenderer.cases.utils.PROVIDER_scene import SeagullTransformProviderSceneComposer
scene_composer = SeagullTransformProviderSceneComposer(antialiasing_level=64)
scene_composer.setup_scene(render_width=1400, render_height=800)
scene_composer.visualize()
2025-04-15 09:49:54,882 | skyrenderer.scene.renderer_context | INFO: Root paths: - root path: /home/skyengine/anaconda/lib/python3.6/site-packages/skyrenderer - assets path: /dli/mount/assets - config path: /home/skyengine/anaconda/lib/python3.6/site-packages/skyrenderer/config - gpu sources path: /home/skyengine/anaconda/lib/python3.6/site-packages/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-04-15 09:49:55,092 | skyalembic.archive_manager | WARNING: Loading not adapted alembic file 2025-04-15 09:49:55,096 | skyrenderer.basic_types.provider.unit_providers.hdr_texture_provider | WARNING: Parameter light_adapt provided in HDR json is not supported 2025-04-15 09:49:55,096 | skyrenderer.basic_types.provider.unit_providers.hdr_texture_provider | WARNING: Parameter color_adapt provided in HDR json is not supported 2025-04-15 09:49:57,221 | skyrenderer.utils.time_measurement | INFO: Setup time: 2.12 seconds 2025-04-15 09:49:59,486 | skyrenderer.utils.time_measurement | INFO: Context update time: 2.26 seconds 2025-04-15 09:50:02,171 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-04-15 09:50:02,172 | skyrenderer.utils.time_measurement | INFO: Render time: 2.69 seconds
Ball Transform Provider basics
Ball Transform Provider is a class responsible for distribution of transformations of the object within a
ball-shaped volume. It is connected with the SkyRenderer's randomization machine, hence assigning this particular
transform provider will make instances of the object randomized over frames.
Ball Transform Provider usage
To use BallTransformProvider, we need to set it up and modify locus definition via layout node's methodmodify_locus_definition
of the desired node. To visualize better how transformations are passed, we will
increase number of instances of the objects. BallTransformProvider will take care of randomization for each
instance.
NOTE: For detailed information about Scene Layout and Transformations check INTRO_SceneLayout,
INTRO_TransformProvider and TRANSFORMATIONS_Transform tutorials.
from skyrenderer.basic_types.provider.transform_providers.ball_transform_provider import BallTransformProvider
seagull_locator = scene_composer.renderer_context.layout().get_node("seagull_GEO_NUL")
seagull_locator.n_instances = 10
transform_provider = BallTransformProvider(scene_composer.renderer_context, radius=7)
seagull_locator.modify_locus_definition(transform_provider=transform_provider)
scene_composer.randomize_bird_animations()
scene_composer.visualize(frame=0)
2025-04-15 09:50:02,679 | skyrenderer.utils.time_measurement | INFO: Setup time: 205 ms 2025-04-15 09:50:05,307 | skyrenderer.utils.time_measurement | INFO: Context update time: 2.63 seconds 2025-04-15 09:50:07,425 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-04-15 09:50:07,426 | skyrenderer.utils.time_measurement | INFO: Render time: 2.12 seconds
We will render second frame, to see how randomization machine causes change of transformations of the seagulls.
It is possible to adjust strategy of randomization for the Transform Provider.
NOTE: For detailed information how randomization in SkyRenderer works, check INTRO_Randomization tutorials.
scene_composer.visualize(frame=1)
2025-04-15 09:50:07,855 | skyrenderer.utils.time_measurement | INFO: Setup time: 129 ms 2025-04-15 09:50:10,534 | skyrenderer.utils.time_measurement | INFO: Context update time: 2.68 seconds 2025-04-15 09:50:12,445 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-04-15 09:50:12,446 | skyrenderer.utils.time_measurement | INFO: Render time: 1.91 seconds
To make the ball-shaped cloud of objects more apparent, we will scale the objects down and create many more
instances of them, to fill the ball volume better.
seagull_geometry = scene_composer.renderer_context.layout().get_node("seagull_GEO")
seagull_geometry.apply_scale((0.2, 0.2, 0.2))
seagull_locator.n_instances = 100
transform_provider = BallTransformProvider(scene_composer.renderer_context, radius=10)
seagull_locator.modify_locus_definition(transform_provider=transform_provider)
scene_composer.visualize(frame=2)
scene_composer.visualize(frame=3)
scene_composer.visualize(frame=4)
2025-04-15 09:50:13,040 | skyrenderer.utils.time_measurement | INFO: Setup time: 310 ms 2025-04-15 09:50:18,156 | skyrenderer.utils.time_measurement | INFO: Context update time: 5.12 seconds 2025-04-15 09:50:20,051 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-04-15 09:50:20,053 | skyrenderer.utils.time_measurement | INFO: Render time: 1.90 seconds 2025-04-15 09:50:20,852 | skyrenderer.utils.time_measurement | INFO: Setup time: 523 ms 2025-04-15 09:50:26,561 | skyrenderer.utils.time_measurement | INFO: Context update time: 5.71 seconds 2025-04-15 09:50:28,414 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-04-15 09:50:28,414 | skyrenderer.utils.time_measurement | INFO: Render time: 1.85 seconds 2025-04-15 09:50:29,010 | skyrenderer.utils.time_measurement | INFO: Setup time: 331 ms 2025-04-15 09:50:34,632 | skyrenderer.utils.time_measurement | INFO: Context update time: 5.62 seconds 2025-04-15 09:50:39,915 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-04-15 09:50:39,916 | skyrenderer.utils.time_measurement | INFO: Render time: 5.28 seconds
Summary
In this section you have learnt:
- BallTransformProvider distributes instances of the object within a ball-shaped volume.
- BallTransformProvider needs to be assigned via SceneLayoutNode's
modify_locus_definition
method. - BallTransformProvider is connected with SkyRenderer's randomization machine enabling randomization of each
instance transformations.