Replies: 2 comments 1 reply
-
The VSG doesn't have a shader/effect to do outlines and none of the examples do it. Would be a nice to feature to have, at least in a example. The OpenSceneGraph (VulkanSceneGraph's predecessor) has and osgFX::Outline class for rendering the outline of subgraph, the implementation is very old, probably over 20 years old now. The technique did two passes over the subgraph, one renders the subgraph without any changes, the second turns the polygon mode to wireframes, sets the line width to the outline width, pushes the depth of the fragments so they a rejected by z test, but the outer outline passes this test as it's outside the mesh. It doesn't use any clever shader tricks. I have seen articles on modern techniques for rendering outlines, but off the top of my head I don't recall the websites to point you in the direction off. I'd need to do searches to see what comes out, but it's evening and the weekend so that ain't something I going to do right now. Perhaps others can make suggestions. |
Beta Was this translation helpful? Give feedback.
-
Blender's outline shader is done by binding two buffers when drawing objects, one which is the regular colour buffer, and another that contains the ID of the object being drawn, or zero if it's not currently selected. It then does a second fullscreen pass that colours any pixel that doesn't have the same ID as its neighbours, using a different colour if the ID matches the ID of the most recently selected object. If you want a thicker outline, you can check for differences with any of the pixels in a larger radius, but that doesn't scale well and you'll want to use a technique called jump fill for thicker outlines. If you go for the wireframe approach that osgFX used, then it can work, but will have problems with alpha testing and blending. |
Beta Was this translation helpful? Give feedback.
-
In Blender, a selected model is drawn with an additional stroked rim (in orange). How would I get the same effect in vsg? I realize that I could draw it based on the the 2D distance transform of the 2D-projected shape. But 1) I have no idea how to calculate the distance transform in a (computation?) shader and 2) I'm hoping there is a simpler way.
Beta Was this translation helpful? Give feedback.
All reactions