Hi NVIDIA Community,
i want to modify the position (position, rotation) of my asset including the projection material which is projected on the asset via a proxy cube.
The projection should always be on the exact same place on the asset.
To do so i created a xform as parent of the asset and the proxy cube and modified the position and rotation of that xform.
import os
from omni.isaac.kit import SimulationApp
config = {
'width': "1280",
'height': "720",
'headless': True,
'fast_shutdown': True
}
simulation_app = SimulationApp(config)
# isaac sim imprts
import omni.replicator.core as rep
from omni.replicator.core import AnnotatorRegistry, BackendDispatch, Writer
rep.settings.set_stage_meters_per_unit(1.0)
#create camera
camera = rep.create.camera(position=(2, 0, 0), rotation= (0,0,0))
render_product = rep.create.render_product(camera, (1024, 1024))
#create light
dome = rep.create.light(
light_type = "dome"
)
texture_path = os.path.join(rep.example.TEXTURES_DIR, "smiley_albedo.png")
projection_asset_xform = rep.create.xform(
semantics = [('class', 'projection_xform')],
name = "projection_xform"
)
# create projection material
projection_asset = rep.create.plane(
position=(0, 0, 0),
rotation=(0, 90, 0),
semantics = [('class', 'projection_asset')],
name = "projection_asset",
parent = projection_asset_xform
) # asset to project on
proxy_cube = rep.create.cube(
position=(1, 0, 0),
rotation=(0, 0, 0),
scale=(0.2, 0.2, 0.2),
visible = False,
semantics = [('class', 'proxy_cube')],
name = "proxy_cube",
parent = projection_asset_xform
)
with projection_asset:
rep.create.projection_material(proxy_prim = proxy_cube, semantics = [('class', 'projection_material')])
# modify projection material
projection = rep.get.prims(semantics = [('class', 'projection_material')])
with projection:
rep.modify.projection_material(diffuse=texture_path)
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(output_dir=os.path.join(os.path.dirname(os.path.realpath(__file__))), rgb=True)
writer.attach([render_product])
# first image without moving asset
rep.orchestrator.step(rt_subframes = 4)
# Move the projection asset
with projection_asset_xform:
rep.modify.pose(
position = (0, 0.2, 0),
rotation = (0, 0, 0)
)
# second image with modified position
rep.orchestrator.step(rt_subframes = 50)
quit()
simulation_app.close()
It seems like the asset and proxy cube modified the position correctly, but the projection stayes at the last position and does not update.
How can i fix this?