How can I draw the outline of an object on top of any other object in Qt3D? For instance to highlight a selected object in a 3D editor?
相关问题
- QML: Cannot read property 'xxx' of undefin
- Is GLFW designed to use without LWJGL (in java)?
- QTextEdit.find() doesn't work in Python
- glDrawElements only draws half a quad
- QT Layouts, how to make widgets in horizontal layo
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- Qt槽函数自动执行多遍
- Converting glm::lookat matrix to quaternion and ba
- Is there a non-java, cross platform way to launch
- How to get a settings storage path in a cross-plat
- Why doesn't valgrind detect a memory leak in m
- Algorithm for partially filling a polygonal mesh
- Robust polygon normal calculation
If you want to draw the outline of an entity at all times, even if the entity is behind other entities, one solution is to do it in two steps:
When drawing the outline, you need to use an outline effect, which can be implemented in two render passes:
Here is a simple implementation of the above-mentioned shader:
Note: It might be a better idea to take the difference between the values instead of using an equality.
With this method, you don't have to worry about depth testing and the order in which the objects are drawn: The second time you draw, you will always draw on top of everything else.
You could do this by adding a single effect with two techniques with different filter keys. Alternatively, if you want to use materials from Qt3D.Extras, you can add another entity with the same transform and mesh and a material that uses the outline technique.
Here is an example that draws the outline on top of everything else using two render passes:
The result: