Why do edges of the surface model appear jagged?

This is a needle model I created using Slicer, but when I rotate the model, I can see a lot of jaggies at certain angles. how to avoid this?


This is due to the resolution of your monitor and the fact that one pixel is always assigned to one object (the model or the background) and the appearance of the edge of the model is very different.

Possible solutions:

  1. Use higher-resolution screen

On a higher-resolution screen, size of a voxel is much smaller, so individual voxels are much less visible.

  1. Reduce the contrast between the object boundary and background. If you use shading, edges of models are dark, so a dark background will make jagged model edges disappear. Alternatively, you can edit model lighting settings to make make the edges of the model appear brighter.

  2. Use anti-aliasing - make one pixel rendered from multiple 3D positions. Multi-sampling causes problems with hardware-accelerated point picking and occlusion detection and screen-space methods, such as FXAA can cause rendering artifacts (may suppress some lines and corners).

If rendering artifacts do not cause problem in your application then you can enable FXAA anti-aliasing like this:

view = slicer.app.layoutManager().threeDWidget(0).threeDView()
# for slice view: view = slicer.app.layoutManager().sliceWidget('Red').sliceView()
renderWindow = view.renderWindow()
renderers = renderWindow.GetRenderers()
for renderer in renderers: