Robotics StackExchange | Archived questions

Heightmap and texture size

Hi everyone !

I've been trying to create a landscape with a texture applied to it (for the fancy visual aspect) and I encountered two issues with three different ways of doing this.

First I tried to create a landscape and import the COLLADA dae file in gazebo. No problem there, but when I want to apply a texture creating a texture script (based on the brick box), I've noticed that the texture has a wrong scale with respect to the mesh (can't tell if too small or too big). I've been able to recreate this same issue in Blender, and by changing the size of the texture (making it to repeat over space) the issue was gone. So my first question is, how one can change the texture size in the material script ?

EDIT: I found that you can use a scale parameter in the material script, but in my case it makes no difference.

Second, because of the first issue, I tried to use a heightmap instead of the mesh. I created a jpg z-depth map of my mesh. If I try to import my landscape using the GUI I get the error: "Error [Visual.cc:2072] No mesh specified"

If I use a world file it imports something, which looks like a cube with yellow and black strips and make the rendering super slow (and has absolutely no related shape with my intended landscape of course). So what am I doing wrong with the heightmap usage ?

Third, I tried to export the collada file with a texture already applied to the model, specifying in Blender export to export the materials, but it doesn't work, the mesh has the good shape but no texture is visible, instead I have the default grey in Gazebo. What am I missing in this method ?

Thanks in advance for your response.

Best regards.

Asked by Frenetique on 2014-04-09 18:41:52 UTC

Comments

Answers

Hi,

maybe I can help with some of the problems...

the black/yellow stripes texture is displayed when your texture could not be found...

Including a heightmap with ui does not work for me, too. This seems to be a bug (maybe you can write an issue for that...)

Have you looked at the top of the cube that appears? A heightmap in gazebo produces this walls at the sides... ;)

Is it possible to provide screenshots and/or your projects source to see the actual problem...

Exporting collada with textures from blender works fine for me so it's hard to say what you are doing wrong there...

Asked by evilBiber on 2014-04-10 04:53:46 UTC

Comments

Thanks evilBiber for your answer.

Here are a few screenshots of the issues. I hope it's gonna help to understand the issue. This image is taken in Blender, as you can see a material (texture) is applied. image description

These are the exporting parameters in Blender (for Collada format):

image description

I am not using any UV layer, the texture coordinates are set on generated. I tried anyway to check the UV checkboxes, no change, the model in gazebo has the standard grey color.

This is the result of the heightmap method. I tried with two heigthmaps, one I created myself based on the Blender ground I created and another one given in the gazebo install. Both gave the same similar results. I also apply a material in the world description (material tag), which doesn't show up.

image description

Needless to say that it is supposed to be a plane with some curves and not a rectangle.

Here is the description of the material script:

material Sand/Diffuse
{
  receive_shadows on
  technique
  {
    pass
    {
      texture_unit
      {
        texture Sand_texture_modif.jpg

        filtering anistropic
        max_anisotropy 16
    scale 1 1

      }

    }
  }
}

And here is its implementation in the sdf file of the custom ground (only the visual block is printed here):

true

 <visual name="visual"> 
     <mesh>
        <uri>model://custom_ground/world_ground.dae</uri>
        <scale>10 10 10</scale>
          </mesh>

        </geometry>

      </visual>

I did a few new tests. First if I import my collada file into Blender, the texture doesn't show up. So it seems I have an issue with the export. Second, when trying to apply a material to the simple mesh (through the material tag), maybe there is an issue with zero thickness objects, I am going to try to give a thickness to my plane to see if there is any changes.

If any of these sound familiar (as an issue you encountered) I'll would be super happy to hear about it.

Thanks in advance.

Asked by Frenetique on 2014-04-10 13:00:05 UTC

Comments