#5 closed enhancement (fixed)
Show green outline for selection
Reported by: | Tom Goddard | Owned by: | Tom Goddard |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Retired | Version: | |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | chimera |
Description
Want to indicated selected objects by drawing a green outline around them like Chimera 1. Currently selection is show as diagonal stripes which look much worse than the green outline.
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
To get borders only around the visible selected parts we need to draw the selected items using the depth buffer that includes the unselected items. So maybe we draw the original scene first to a texture with a depth attachment, then reuse the depth attachment for subsequent draws to the 2 extra textures used to compute the border.
comment:3 by , 12 years ago
Drawing selected items will of course need to use depth test allowing equal depth.
As in Chimera 1 this is not going to show the green outlines under a transparent surface. Could allow that to work by drawing the selection with just the depth from the opaque draw pass of all models. Would like those selection outlines to be dimmed by the transparent overlying surface though -- so those would also need to have outlines rendered before transparent draw pass of all models.
Drawing the outline will not write depth values, and will not filter using the depth buffer.
comment:4 by , 12 years ago
Use glBlitFramebuffer() to copy pixels between FBO and default framebuffer. Could draw scene without selection to fbo to get depth, then blit that to the default frame buffer, then use the depth and a texture to do the border calculation.
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Done.
The outline is not exactly the same as Chimera 1. It shows an outline around all visible parts of selected objects, while Chimera 1 omits the outline when it borders an unselected object in front of the selected object. I think the Chimera 1 style is better, but harder to implement. If a surface is selected with an unselected atom (e.g. water) in front of it, the Hydra selection outline will be shown bordering the atom which will make the atom look selected. Maybe this confusion is rare, and I'm going to wait and see if this simpler style outline suffices.
comment:6 by , 4 years ago
Blocking: | → 5279 |
---|
comment:7 by , 4 years ago
Blocking: | 5279 |
---|
This requires some new OpenGL code in Hydra. I think the way to do it will be to render just the selected objects to a texture using a single color (no lighting) fragment shader. Then draw for shifted versions of that texture to a new texture, shifted by one pixel in x and y. Then draw the original unshifted version black with alpha 0. So after drawing the 5 shifted versions of the texture to a new texture, that new texture has a border drawn, (say green with alpha 1) and alpha 0 everywhere except the border. Draw that texture on top of the original rendered scene in the frame buffer with blend mode src 1, dest 1-alpha. This rendering technique should be much faster than Chimera 1 since it draws the original selected objects just one time, then does 6 texture draws.
For wider borders in the future we could use more than 4 shifts of the texture to produce the border.