Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sky dds #42

Merged
merged 14 commits into from
Oct 11, 2022
Merged

Sky dds #42

merged 14 commits into from
Oct 11, 2022

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Oct 3, 2022

Adds support for reading cubemaps that are encoded as .dds files. This should support .dds files coming from Fuel, or from a local source.

Testing using Fuel

<?xml version='1.0' encoding='utf-8'?>
<sdf version="1.9">
  <world name="test">
    <scene>
      <sky>
<cubemap_uri>https://fuel.gazebosim.org/1.0/openrobotics/models/skybox/tip/files/materials/textures/skybox_grey.dds</cubemap_uri>
      </sky>
    </scene>
    <model name="ground_plane">
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
          <material>
            <ambient>0.8 0.8 0.8 1</ambient>
            <diffuse>0.8 0.8 0.8 1</diffuse>
            <specular>0.8 0.8 0.8 1</specular>
          </material>
        </visual>
      </link>
    </model>
  </world>
</sdf>

Testing using local file

<?xml version='1.0' encoding='utf-8'?>
<sdf version="1.9">
  <world name="test">
    <scene>
      <sky>
        <cubemap_uri>PATH_TO_LOCAL_DDS_FILE</cubemap_uri>
      </sky>
    </scene>
    <model name="ground_plane">
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
          <material>
            <ambient>0.8 0.8 0.8 1</ambient>
            <diffuse>0.8 0.8 0.8 1</diffuse>
            <specular>0.8 0.8 0.8 1</specular>
          </material>
        </visual>
      </link>
    </model>
  </world>
</sdf>

@nkoenig nkoenig requested a review from german-e-mas October 3, 2022 23:09
@nkoenig nkoenig mentioned this pull request Oct 3, 2022
@german-e-mas
Copy link
Collaborator

Just in case, I'm running the first test that uses the Fuel skybox, and I don't get a cubemap_uri. Could I be missing something?

I'm running ign gazebo -r -s test.sdf -v 4 and the websocket server.

This is the sky I get from the scene info topic.

Screenshot from 2022-10-05 15-55-52

@nkoenig
Copy link
Contributor Author

nkoenig commented Oct 5, 2022

Just in case, I'm running the first test that uses the Fuel skybox, and I don't get a cubemap_uri. Could I be missing something?

I'm running ign gazebo -r -s test.sdf -v 4 and the websocket server.

This is the sky I get from the scene info topic.

Screenshot from 2022-10-05 15-55-52

Do you have the lastest gz-sim code? You need the modifications from this PR: gazebosim/gz-sim#1739.

Nate Koenig added 2 commits October 5, 2022 12:45
@german-e-mas
Copy link
Collaborator

Do you have the lastest gz-sim code? You need the modifications from this PR: gazebosim/gz-sim#1739.

Thanks. I wasn't aware this required a gz-sim change. I'll get back to you.

Signed-off-by: Nate Koenig <[email protected]>
Copy link
Collaborator

@german-e-mas german-e-mas left a comment

Choose a reason for hiding this comment

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

Looks good. I tested it using Fuel's skyboxes and works as intended.

We need to cover the case where the skybox could come from the websocket, and have it taken into account by the websocket loading manager. This can be a follow up task though, as the skyboxes used are Fuel's.

Let me know what do you think @nkoenig

src/Scene.ts Outdated Show resolved Hide resolved
src/Scene.ts Outdated Show resolved Hide resolved
src/Scene.ts Outdated
'https://fuel.gazebosim.org/1.0/openrobotics/models/skybox/tip/files/materials/textures/skybox-posz.jpg',
]);
} else {
let ddsLoader = new DDSLoader();
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: const over let

Suggested change
let ddsLoader = new DDSLoader();
const ddsLoader = new DDSLoader();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we do check onError if the asset came from the websocket, pass the websocket loading manager into it.

You can check on other loaders how it was used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I did it in eab4493

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like it! Thanks! I'll test these changes and then re-approve it.

src/Scene.ts Outdated Show resolved Hide resolved
src/Scene.ts Outdated Show resolved Hide resolved
nkoenig and others added 4 commits October 7, 2022 11:03
Co-authored-by: Germán E. Más <[email protected]>
Co-authored-by: Germán E. Más <[email protected]>
Co-authored-by: Germán E. Más <[email protected]>
Co-authored-by: Germán E. Más <[email protected]>
@german-e-mas
Copy link
Collaborator

We can go ahead with this implementation, as we won't load dds files via websocket. LGTM.

Can you solve the conflicts @nkoenig ? If you bump the version in this PR, we can publish it.

german-e-mas
german-e-mas previously approved these changes Oct 7, 2022
Nate Koenig added 2 commits October 7, 2022 11:42
Signed-off-by: Nate Koenig <[email protected]>
Signed-off-by: Nate Koenig <[email protected]>
@german-e-mas german-e-mas self-requested a review October 7, 2022 18:46
@german-e-mas german-e-mas dismissed their stale review October 7, 2022 18:46

Testing new changes

@nkoenig
Copy link
Contributor Author

nkoenig commented Oct 7, 2022

@german-e-mas , let me know if you are okay with the changes.

Copy link
Collaborator

@german-e-mas german-e-mas left a comment

Choose a reason for hiding this comment

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

LGTM!

@nkoenig nkoenig merged commit 43c875a into gzweb2 Oct 11, 2022
@nkoenig nkoenig deleted the sky_dds branch May 31, 2023 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants