Home | Tutorials | Wiki | Issues
Ask Your Question
0

Ground plane texture image

asked 2015-02-02 14:59:22 -0500

SailAvid gravatar image

I want to get a ground plane with a dimension of 11.03x5.66m. For this I have a texture image with the size of 1103x566px (same size but 1px = 1cm)

I followed the instructions posted in here: http://answers.gazebosim.org/question/4761/how-to-build-a-world-with-real-image-as-ground/

So I have the following files:

./materials/scripts/floor_walls_1.material
./materials/textures/floor.png
./model.config
./model.sdf

model.sdf

<?xml version="1.0"?>
<sdf version="1.4">
<model name="floor_walls_1">
  <static>true</static>
    <link name="link">
      <collision name="collision">
        <geometry>
          <plane>
            <normal>0 0 1</normal>
            <size>11.03 5.66</size>
          </plane>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>100</mu>
              <mu2>50</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <visual name="visual">
        <cast_shadows>false</cast_shadows>
        <geometry>
          <plane>
            <normal>0 0 1</normal>
            <size>11.03 5.66</size>
          </plane>
        </geometry>
        <material>
          <script>
            <uri>model://floor_walls_1/materials/scripts/floor_walls_1.material</uri>
            <name>FloorWalls1/Image</name>
          </script>
        </material>
      </visual>
    </link>
  </model>
</sdf>

model.config

<model>
  <name>Floor Walls 1</name>
  <version>1.0</version>
  <sdf version="1.5">model.sdf</sdf>

  <description>
    A simple ground plane with texture.
  </description>
</model>

floor_walls_1.material

material FloorWalls1/Image
{
  technique
  {
    pass
    {
      ambient 1 1 1 1.000000
      diffuse 1 1 1 1.000000
      specular 0.03 0.03 0.03 1.000000 
      emissive 0.900000 0.900000 0.900000 1.000000

      texture_unit
      {
        texture floor.png
        scale 0.01 0.01
      }
    }
  }
}

floor.png

floor.png

THE PROBLEM:

Unfortunately this only produces a very weird image (yellow with some anti-aliasing black stripes).

How can I fix the ground plane so that it shows the image at full size?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-02-02 17:14:29 -0500

It showed up for me after these changes:

model.sdf

      <script>
        <uri>model://floor_walls_1/materials/scripts</uri>
        <uri>model://floor_walls_1/materials/textures</uri>
        <name>FloorWalls1/Image</name>
      </script>

floor_walls_1.material

  texture_unit
  {
    texture floor.png
  }

You might also want to adjust the colors in the material to get the circles to show, for me just leaving that information out did the trick.

If your floor comes up blinking grey when you insert it, it's because it's z-fighting with the default ground_plane, just delete the ground plane and that should be fine.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2015-02-02 14:59:22 -0500

Seen: 10,775 times

Last updated: Feb 02 '15