You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The concept is rather simple (but tricky to implement):
each object entity id is encoded into a unique RGB color
id colors are sent to a specific pipeline which renders them on a specific texture
after the texture is rendered, the host look at the color at the mouse cursor position
a table lookup is then used to know which object is currently hovered
I have implemented a small PoC of the method, where the object hovered by the mouse is highlighted in pink (the debug window shows id color pass result):
I have a specific IdColorPass and IdColorPipeline for my id color rendering
for each object I want to interact with, I attach a child with the same mesh, but with my IdColorPass and IdColorPipeline instead of the MainPass and default PBR pipeline. As far as I know it is not possible to have 2 different render pass, with 2 different pipelines to render the same object to 2 different textures from the same object.
It is quite hacky, but it works.
However it is kinda slow when I start to have a lot of objects (2 times slower than bevy_mod_picking with the same scene). After some testing/tracing, I suspect it is partly because I am duplicating all my meshes. I have no idea how I could simply have the same object go through 2 totally different rendering pipelines (is it possible?)
What solution would you like?
To be able to have the same object go through 2 totally different rendering pipelines.
For example, to be able to create from a scene:
a window with the PBR rendering,
another window with wireframe only,
another window with objects deformed by a custom shader
etc
(If it is already possible, I think it could be a great example!)
What alternative(s) have you considered?
I have looked at render_to_texture, wireframe and multiple_windows examples, but I think none of them demonstrate how it would be possible to achieve that.
What problem does this solve or what need does it fill?
I am trying to implement an object picking plugin based on this method: https://snoozetime.github.io/2019/05/02/object-picking.html
The concept is rather simple (but tricky to implement):
I have implemented a small PoC of the method, where the object hovered by the mouse is highlighted in pink (the debug window shows id color pass result):
I based my rendering pipeline on @rmsc render_to_file example and readout node implementation: https://github.com/rmsc/bevy/blob/render_to_file/crates/bevy_render/src/render_graph/nodes/texture_readout_node.rs
Currently my solution is:
It is quite hacky, but it works.
However it is kinda slow when I start to have a lot of objects (2 times slower than bevy_mod_picking with the same scene). After some testing/tracing, I suspect it is partly because I am duplicating all my meshes. I have no idea how I could simply have the same object go through 2 totally different rendering pipelines (is it possible?)
What solution would you like?
To be able to have the same object go through 2 totally different rendering pipelines.
For example, to be able to create from a scene:
(If it is already possible, I think it could be a great example!)
What alternative(s) have you considered?
I have looked at render_to_texture, wireframe and multiple_windows examples, but I think none of them demonstrate how it would be possible to achieve that.
Additional context
Related to #22
The text was updated successfully, but these errors were encountered: