gazebosim / gazebosim/gz-rendering
Other Projector differences between Ogre1 and Ogre2
- Dominant language
- C++
- Stars
- 81
- Forks
- 90
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 10
Description
## Environment
* Ubuntu 22.04
* `gz-rendering8` build from source
## Description
Apart from the [frustum shape](https://github.com/gazebosim/gz-rendering/issues/848), I noticed two more differences between the Ogre1 and Ogre2 implementations of the projector:
1. **The Ogre2 projection requires a specular light** in the scene to show colors.
To test:
- Run the example demo world:
`gz sim projector.sdf`
`gz sim projector.sdf --render-engine ogre`
---> both show color in the projected pattern
- Change the 'sun' light in the sdf and set its `` to '0 0 0 1'
---> Ogre1 shows color, Ogre2 does not.
2. **The Ogre2 projection is not emissive**, in contrast to the Ogre1 projection.
To test:
- Set all ambient/diffuse and specular light values in the sdf to '0 0 0 1',
- Ogre1 still shows red colored pattern
- Ogre2 shows nothing
## Possible resolution
As a trial, I did a 'find-and-replace of all `Diffuse` into `Emissive` in `Ogre2Projector.cc`, e.g.
```c++
this->dataPtr->decalNode->getCreator()->setDecalsDiffuse(
this->dataPtr->decal->getDiffuseTexture());
```
becomes
```c++
this->dataPtr->decalNode->getCreator()->setDecalsEmissive(
this->dataPtr->decal->getEmissiveTexture());
```
except for `Ogre::CommonTextureTypes::Diffuse` which remains unaltered (as there is no `Ogre::CommonTextureTypes::Emissive`).
This seems to solve the issue for my projected texture png.
For my use case it seems perfect (I am simulating a laser line for laser triangulation).
However, there seems to be an issue with the png file of the example world: it shows white color in most of the transparent part:

I did not find out why, but simply opening the png in Gimp and exporting as png (without making any changes) solves the issue, so it must be some peculiarity of that specific file.

In attachment both files for comparison.
[pattern.zip](https://github.com/gazebosim/gz-rendering/files/13511390/pattern.zip)
Contributor guide
Assessment
This issue has not been assessed yet.