gz-rendering
gz-rendering copied to clipboard
Support ImageBrownDistortionModel in ogre2
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.
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.
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:
-
ogre implementation
- The class loads a compositor script
- glsl vertex shader
- glsl fragment shader
-
ogre2 implementation
- the class creates the compositor by code (instead of loading it from a script)
- glsl vertex shader
- glsl fragment_shader