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

Error casting user data: Unexpected index #394

Closed
darksylinc opened this issue Sep 5, 2021 · 1 comment
Closed

Error casting user data: Unexpected index #394

darksylinc opened this issue Sep 5, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@darksylinc
Copy link
Contributor

darksylinc commented Sep 5, 2021

Chasing this bug where INTEGRATION_lidar_visual prints:

[Err] [Ogre2GpuRays.cc:262] Error casting user data: Unexpected index

in stderr which aren't happening in Edifice which ended up not being a rendering bug, I noticed that if I force retroValue = -1 the items from INTEGRATION_lidar_visual still do get rendered using standard PBS shaders in both Edifice (2.1) and Fortress (2.2).

These reveals two possible bugs:

  1. laser_retro is not set anywhere. except ign-gazebo/src/rendering/SceneManager.cc and ign-rendering/test/integration/gpu_rays.cc but neither of them are set during INTEGRATION_lidar_visual test. Due to this change, it appears that previously by default Variant would return int 0, whereas now a default Variant will throw when trying to cast to any type because none is set.

  2. If I force retroValue = -1 the items from INTEGRATION_lidar_visual still do get rendered using standard PBS shaders even though the code later messes with visibility flags:

if (retroValue >= 0)
{
  // set visibility flag so the camera can see it
  item->addVisibilityFlags(0x01000000);
  // ...
}

which suggests that the intended path is that items whose retroValue is not set should not be rendered; however they are being rendered.

Environment

  • OS Version: Ubuntu 18.04 LTS
  • Source or binary build?
    Source. main branch

Description

  • Expected behavior: No errors printed on stderr. Likely appropriate objects should switch to use the custom low level material while the rest is not rendered (instead of being rendered using standard PBS).
  • Actual behavior in main: Errors are printed on stderr and objects are being rendered using PBS shaders
  • Behavior in Edifice: No stderr. All objects are switched to low level material because laser_retro defaults to 0 when unset. However if an object explicitly sets laser_retro to a negative value, objects will still be rendered using PBS, which is likely a bug.

Steps to reproduce

  1. Run INTEGRATION_lidar_visual in main

Output

Lots of:

[Err] [Ogre2GpuRays.cc:262] Error casting user data: Unexpected index

Test still passes anyway but looks like random chance. Inspecting the RenderTarget shows results are quite different

Reference result (uses custom low level material shader):
reference

Reference wireframe:
reference_wireframe

Failure result (uses PBS shaders. I don't think this element should be getting rendered at all!):
failure

Failure wireframe:
failure_wireframe

@darksylinc darksylinc added the bug Something isn't working label Sep 5, 2021
@darksylinc
Copy link
Contributor Author

darksylinc commented Oct 4, 2021

I noticed the error got fixed and closed but the behavior is still different.

If this new behavior is desired then ignore my comment

Update: ahhh nevermind, I missed that visibility flags were updated too

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

No branches or pull requests

2 participants