Skip to content

USD -> SDF: Added lights attached to the world#875

Merged
ahcorde merged 68 commits intosdf12from
ahcorde/usd_to_sdf_lights
Mar 31, 2022
Merged

USD -> SDF: Added lights attached to the world#875
ahcorde merged 68 commits intosdf12from
ahcorde/usd_to_sdf_lights

Conversation

@ahcorde
Copy link
Copy Markdown
Collaborator

@ahcorde ahcorde commented Mar 9, 2022

Signed-off-by: ahcorde ahcorde@gmail.com

🎉 New feature

Summary

USD -> SDF: Added lights attached to the world

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

ahcorde added 4 commits March 9, 2022 13:22
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde requested review from adlarkin and koonpeng March 9, 2022 18:43
@ahcorde ahcorde self-assigned this Mar 9, 2022
ahcorde added 3 commits March 9, 2022 19:50
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde force-pushed the ahcorde/usd_to_sdf_lights branch from ed473a5 to 4b09785 Compare March 9, 2022 22:48
adlarkin and others added 6 commits March 9, 2022 19:27
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde added the usd label Mar 10, 2022
ahcorde and others added 4 commits March 10, 2022 13:39
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Comment thread test/usd/upAxisZ.usda Outdated
Comment thread usd/src/usd_parser/USD2SDF.cc Outdated
Comment thread usd/src/usd_parser/USDLight_TEST.cc
Comment thread usd/src/usd_parser/USDWorld.cc Outdated
Comment thread usd/src/usd_parser/USDWorld.cc
ahcorde added 7 commits March 14, 2022 12:47
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde
Copy link
Copy Markdown
Collaborator Author

ahcorde commented Mar 23, 2022

code LGTM, but I got different results when converting sdf -> usd -> sdf

original:

    <light type="directional" name="sun">
      <cast_shadows>true</cast_shadows>
      <pose>0 0 10 0 0 0</pose>
      <diffuse>0.8 0.8 0.8 1</diffuse>
      <specular>0.8 0.8 0.8 1</specular>
      <attenuation>
        <range>1000</range>
        <constant>0.9</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <direction>-0.5 0.1 -0.9</direction>
    </light>

usda

    def DistantLight "sun"
    {
        float inputs:intensity = 100
        float intensity = 100
        float3 xformOp:rotateXYZ = (0, -0, 0)
        double3 xformOp:translate = (0, 0, 10)
        uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ"]
    }

converted

    <light name='sun' type='directional'>
      <pose>0 0 10 0 -0 0</pose>
      <cast_shadows>true</cast_shadows>
      <intensity>0.01</intensity>
      <direction>0 0 -1</direction>
      <diffuse>1 1 1 1</diffuse>
      <specular>1 1 1 1</specular>
      <attenuation>
        <range>10</range>
        <linear>1</linear>
        <constant>1</constant>
        <quadratic>0</quadratic>
      </attenuation>
      <spot>
        <inner_angle>0</inner_angle>
        <outer_angle>0</outer_angle>
        <falloff>0</falloff>
      </spot>
    </light>

There is some data that is not common between these two formats, I would say that some of the data might be "lost in translation"

@ahcorde ahcorde requested a review from koonpeng March 23, 2022 12:15
Copy link
Copy Markdown

@koonpeng koonpeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some data that is not common between these two formats, I would say that some of the data might be "lost in translation"

I assume that these differences are due to the different formats and can't be addressed easily?

@ahcorde ahcorde force-pushed the ahcorde/usd_to_sdf_lights branch from 1878882 to 7299701 Compare March 28, 2022 11:44
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@adlarkin adlarkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions before merging. Otherwise, I think this looks good.

Comment thread usd/src/usd_parser/USDLight_TEST.cc Outdated
Comment thread usd/src/usd_parser/USDLight_TEST.cc Outdated
Comment thread usd/src/usd_parser/USDLights.cc Outdated
Comment on lines +97 to +124
// In general USD models used in Issac Sim define the model path
// under a root path for example:
// -> /robot_name/robot_name_link0
// But sometimes for enviroments it uses just a simple path:
// -> /ground_plane
// -> /wall_0
// the shortName variable defines if this is the first case when it's
// False or when it's true then it's the second case.
// This conversion might only work with Issac Sim USDs
if (primPathTokens.size() >= 2)
{
bool shortName = false;
if (primPathTokens.size() == 2)
{
if (prim.IsA<pxr::UsdGeomGprim>() || (primType == "Plane"))
{
if (primName != "imu")
{
linkName = "/" + primPathTokens[0];
shortName = true;
}
}
}
if (!shortName)
{
linkName = "/" + primPathTokens[0] + "/" + primPathTokens[1];
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code mainly used for finding the parent prim of the light? I find it a little odd that we are manually parsing through the first 2 levels of the prim path to find the parent. I imagine this could be problematic if the light's parent isn't in the first two levels of the stage. Is there a better way to find the parent of a light that offers more flexibility/is less error prone?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a better way to do it, I'm open to suggestions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a better way at the moment - since we are pressed for time, I added a TODO note in 847271a and created an issue in #927.

ahcorde added 2 commits March 31, 2022 11:50
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Base automatically changed from ahcorde/usd_to_sdf_transforms to sdf12 March 31, 2022 18:16
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
@ahcorde ahcorde enabled auto-merge (squash) March 31, 2022 20:33
@ahcorde ahcorde merged commit 585c925 into sdf12 Mar 31, 2022
@ahcorde ahcorde deleted the ahcorde/usd_to_sdf_lights branch March 31, 2022 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants