Many CAD packages have an option to add an outline to models, where the edges are dark lines.
I currently have the model, but no outlined edges.
I’ve seen mention of an outline filter here, but I don’t know if that’s the right tool or even where to find an example of that. How should I go about achieving this outline effect?
There are a few potential techniques, I think. One might be to write a post-process shader that achieves this effect, perhaps by comparing a given pixel’s depth-value with nearby depth-values.
In addition, I think that the toon shader (see the samples for more on this) has an option to outline models rendered using it.
[edit]
Looking at that CAD screenshot, I wonder whether they’re not generating a wireframe and rendering that over the model, with a slight depth-offset. Note that the back-facing corner-verticals appear over the “top” of the model for a short distance, perhaps due to the depth-offset causing them to be treated as being “in front of” the technically-closer “top”-faces of the model.
1 Like
There is another option:
from panda3d.core import Vec4
from direct.directtools.DirectGeometry import LineNodePath
from direct.showbase.ShowBase import ShowBase
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
vertical = LineNodePath(render, colorVec = Vec4(0, 1, 0, 1))
vertical.setThickness(2)
vertical.drawLines([((0, 0, -0.25),(0, 0, 0.25))])
vertical.create()
vertical.reparentTo(render)
app = MyApp()
app.run()
If you are using shaders, you will still need to create an algorithm to draw the desired edges. Therefore, you can immediately mark the desired edges with a line.
There are still LineSegs, but I don’t know what
2 Likes
@Thaumaturge @serega-kkz Thank you both for your replies. I’m still very new to Panda3D and 3D rendering, so I’m learning as I go. I may give the toon shader a look, but eventually I would like to highlight faces, edges and vertices when the mouse cursor hovers over them, so maybe drawing the lines manually makes the most sense. That way I have more control over how they’re displayed.
1 Like