Image color bleeds - error and workaround

Report crashes, strange behaviour, or apparent bugs
Post Reply
richardh
Posts: 28
Joined: 16 Jan 2017, 12:39

Image color bleeds - error and workaround

Post by richardh » 07 Feb 2017, 04:42

Please refer to two screen shots png with error and with out colour error.

In the first image, you can see the SPTD logo (on the right hand side of the scene) has colour bleeds from the extreme positions to the edge (at left towards the bottom in red, but also in red at the bottom right middle, but also slightly at the top in yellow).

The simulation was created (for each of the three logos in the scene) by adding a plane, then adding a texture of the logo png. The texture was then adjusted to remove repeating uv mapping and colour interpolation. Also some scaling is needed since the dimensions of the plane do not always match the proportions of the image. The options 'mapping mode' -> 'projection' and 'apply mode' -> decal were chosen. The 'decal' option is the only one that works with transparent pixels (from trying different options).

The workaround below is already applied to the HKSTP and VREP logos in the scene in the first image. Here the STPD logo is used as an example to show the colour bleed problem. If the logo has a border with a solid color, then the problem is not visible. The SPTD logo has a problem because the image is cropped to the first meaningful pixel on each edge, and that pixel is part of a line.

I am using Ubuntu.

The workaround can be seen in the next image. It was achieved for each of the logos in this scene by editing the image in GIMP and increasing the 'canvas' size by 2 pixels in the x and y directions and centering the image (thus creating a border 1 pixel wide around the image). The border is created so that it is filled with transparent pixels. Then the new image is saved as a png file. In this way any extra expansion in V-REP is filled with transparent pixels and there is no visible colour bleed.

I do not know how textures are applied to planes in VREP, so I do not know whether colour bleeding is an artefact of the rendering software (eg, in Ubuntu), or whether there is something that can be changed in VREP. It seems to me that if an image is to be expanded beyond the bounding box of the image, then the pixel values should be transparent and not copies of the outermost border, especially if the box 'Interpolate colors' is not ticked.

coppelia
Site Admin
Posts: 6185
Joined: 14 Dec 2012, 00:25

Re: Image color bleeds - error and workaround

Post by coppelia » 07 Feb 2017, 09:22

Thanks for the explanation. This is actually the way you would do it, since this effect is directly linked to the way the texture is provided to openGl.

Cheers

Post Reply