Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other Projector differences between Ogre1 and Ogre2 #944

Open
jrutgeer opened this issue Nov 30, 2023 · 1 comment · Fixed by #946
Open

Other Projector differences between Ogre1 and Ogre2 #944

jrutgeer opened this issue Nov 30, 2023 · 1 comment · Fixed by #946
Labels
bug Something isn't working

Comments

@jrutgeer
Copy link

jrutgeer commented Nov 30, 2023

Environment

  • Ubuntu 22.04
  • gz-rendering8 build from source

Description

Apart from the frustum shape, 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 <specular> to '0 0 0 1'
      ---> Ogre1 shows color, Ogre2 does not.


  1. 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.

this->dataPtr->decalNode->getCreator()->setDecalsDiffuse(
        this->dataPtr->decal->getDiffuseTexture());

becomes

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:
image

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.

image

In attachment both files for comparison.

pattern.zip

@jrutgeer jrutgeer added the bug Something isn't working label Nov 30, 2023
@iche033
Copy link
Contributor

iche033 commented Nov 30, 2023

thanks for the proposed solution! I created #946 for the emissive texture changes.

I couldn't reproduce the transparency issue with the png file in the example world though so I didn't touch that file.

@azeey azeey removed the status in Core development Jan 8, 2024
@azeey azeey removed this from Core development Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants