Skip to content

Add GPU picking #264

Description

@Nicolas-Ferre

Problem
For GUI, we need a simple way to detect when the mouse hovers over a widget, even when the widget is rendered in a texture target that is rendered in the main window.

Feature
Add GPU picking functionality to the graphics module.

Dependencies

Additional context
Multiple parameters can be used to optimize the rendering (not all needs to be implemented for the moment):

  • Reduce the framerate (for example main rendering is done at 60FPS and picking rendering at 10FPS)
  • Reduce the resolution (for example, picking buffer is 4x smaller than window buffer)
  • Don't render if not necessary (e.g. when mouse is not moving)
  • It's important that the picking is done before the rendering, and the result retrieval from the GPU is done after the full rendering, so that it let some time to the GPU to render the picking texture.

To identify uniquely the objects, we can use the entity ID. There are few solutions that could be applied:

  • The entity ID is converted to a RGB color, and this color is used to render the object in the picking texture.
  • The picking texture have format R32Uint, which corresponds to the entity ID. This approach is probably more recommended as entity ID conversion is simpler and render might be quicker.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions