I found two methods to create a camera.
Method 1:
from omni.isaac.core.utils.stage import get_current_stage
from pxr import UsdGeom
import omni.replicator.core as rep
camera_path = "/Camera"
camera = get_current_stage().DefinePrim(camera_path, "Camera")
camera.GetAttribute("clippingRange").Set(Gf.Vec2f(0.001, 100.0))
camera.GetAttribute("focalLength").Set(30)
UsdGeom.Xformable(camera).AddTranslateOp().Set((0.0, 0.0, 1.0))
UsdGeom.Xformable(camera).AddRotateXYZOp().Set((0.0, 0.0, 0.0))
render_product = rep.create.render_product(camera_path, (512, 512))
Method 2:
import omni.replicator.core as rep
camera = rep.create.camera(position=(0.0, 0.0, 1.0), rotation=(0, 0, 0))
render_product = rep.create.render_product(camera, (512, 512))
If I render an image with these two methods I obtain two different results. In fact if I place an object at (0.0, 0.0, 0.0)
it can be seen with the first method whereas with the second method I get a black image with no objects rendered.
Is this because these two methods use two different conventions for transformations (translation and rotation)?
Hi @federico.domeniconi. Method 1 is using the USD API directly, Method 2 is using the Replicator API which wraps the USD API. Both are valid.
Without more information about you Stage, my guess is that the clippingRange is a play here. Here is the clipping range for the camera created with the Replicator code:

The camera()
function does accept a keyword argument called clipping_range
that might get you what you want:
import omni.replicator.core as rep
camera = rep.create.camera(position=(0.0, 0.0, 1.0), rotation=(0, 0, 0), clipping_range=(0.001, 100.0))
Moving this to the SDG forum since this is good feedback for the Replicator team.
Is there a list of possible arguments for creating the camera?
Hopefully the Replicator team can jump in here and point to the documentation. I found it by looking at the implemention in the omni.replicator.core
extension. I show how to do that here: 6 Crucial Tips For New NVIDIA Omniverse Developers - YouTube
@federico.domeniconi thank you for the question. The discrepancy is due to the coordinate system in Isaac defaulting to Z-up. Because cameras in USD are always y-up regardless of coordinate system, an additional rotation is added with Replicator to provide intuitive camera orientation that is consistent with the rest of Kit - the same rotation is added when creating a camera using the menu system (Create->Camera). You can cancel out the additional rotation in a Z-up stage by creating a camera as so:
import omni.replicator.core as rep
camera = rep.create.camera(position=(0.0, 0.0, 1.0), rotation=(-90, -90, 0))