gz-rendering icon indicating copy to clipboard operation
gz-rendering copied to clipboard

Support ImageBrownDistortionModel in ogre2

Open mahiuchun opened this issue 2 years ago • 2 comments

Desired behavior

ImageBrownDistortionModel is supported in "ogre2".

Alternatives considered

N/A

Implementation suggestion

I'm not very familiar.

Additional context

It appears that whenever there is <distortion> in a camera sensor, gz-sensors would attempt to create an ImageBrownDistortionModel from the rendering engine. "ogre2" does not support ImageBrownDistortionModel right now while "ogre" supports it.

mahiuchun avatar Aug 02 '22 22:08 mahiuchun

I would also be interested by this feature, could one of the gazebo devs provide some tips on how this could work? I'd be happy to try to implement and test this.

ghost avatar Aug 14 '23 15:08 ghost

The work is probably a little more involved and requires some shader knowledge.

Here's the original PR for adding distortion effect to ogre: in https://github.com/gazebosim/gz-rendering/pull/502. Now we need to port the changes that are in the ogre/src directory to ogre2/src. The problem is that ogre2 uses a different material system so there are a few more changes need to be done

  • port glsl shaders to version 330
  • port ogre 1.x compositor to 2.x compositor

At a high level, distortion is implemented as a "RenderPass" in gz-rendering. Once you create the render pass, you can assign it to a camera to give it a specific effect. Gaussian Noise is another example of render pass which you can look as as an example:

iche033 avatar Aug 14 '23 20:08 iche033