gazebosim / gazebosim/gz-rendering
Update ogre2 implementation of Projector to project texture based on a frustum
- Dominant language
- C++
- Stars
- 81
- Forks
- 90
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 10
Description
## Environment
* OS Version: Ubuntu 22.04
* Source or binary build? Source build 91f5fe954197a61a3c520c7b92a4f64f7bb2403e
The projected texture in the ogre2 implementation of Projector differs from ogre1.x's and we need to update the ogre2 implementation to match ogre1.x's.
Related PR: https://github.com/gazebosim/gz-rendering/pull/845
From the PR description:
* The ogre 1.x implementation is ported from gazebo-classic's [Projector](https://github.com/gazebosim/gazebo-classic/blob/gazebo11/gazebo/rendering/Projector.hh) class. It uses ogre material projective texturing feature.
* in addition, I extended the implementation to support visibility flags so that we can toggle the visibility of the projected texture based on the camera's visibility mask.
* The ogre 2.x implementation uses screen space decals (instead of projective texturing) and has a different behavior.
Also added support for setting visibility flags.
* Note: There is one major caveat with this implementation. The projection is not in the form of a "frustum" (i.e. projection becomes larger at longer distance). It uses ogre 2.x screen space decals. Think of a as a rectangular volume and any surface that intersects with the volume will have the texture mapped onto it.
* We will need to investigate whether it's possible to change the implementation to match the ogre 1.x behavior in the future. Here is a related [ogre forum post](https://forums.ogre3d.org/viewtopic.php?t=95298) asking the same question. I will create an issue to track this limitation once the PR is merged.
## Description
* Expected behavior: The projected texture should be based on a frustum
* Actual behavior: Projection is done based on a rectangular volume (bounding box)
## Steps to reproduce
1. Build and the [projector](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/projector) example.
2. Run with `ogre2`: `./projector ogre2` and see that the projection is a rectangular volume
3. Run with `ogre`: `./projector ogre` and see that the projector has a proper frustum, i.e. the further surface the larger the projection.
## Output
See screenshots in https://github.com/gazebosim/gz-rendering/pull/845
Contributor guide
Research direction
Start with the projector example linked in the issue and run it with both ogre2 and ogre to reproduce the difference. Read the implementation and discussion in related PR #845, then investigate how the ogre2 screen-space decal path could provide frustum-based projection. Done means ogre2 matches ogre's perspective behavior while retaining the described visibility-mask support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100