Open Lestropie opened 9 years ago
Sounds good. Just one question: I'm not sure I see how you'd use a geometry shader to achieve your 2D slice. I was assuming you'd simply use the crop-to-slice trick used in the tractography tool, which is trivial to achieve in the fragment shader...
Crop-to-slice relies on a slice thickness, which may look weird with a mesh. In the connectome tool I use the geometry shader to detect precisely where the polygon intersects the focus plane, and generate a line covering the width of the intersection.
OK, I see. Personally, I reckon it would be more useful in general to use the crop to slab - it would make it easier to visualise alongside tracts for instance. And it would reduce to more or less to what you're suggesting with a thin enough slab. Have you tried doing that for you connectome tool? I'm always in favour of keeping things as simple as they can be, having two separate code paths means twice as much maintenance and debugging...
No I haven't tried it. My logic was that you want a finite slab thickness for the tractography tool in order to 'fill in' the slice: having a dot at each point where a streamline crosses the slice would look very sparse, and wouldn't give important directionality information. With a mesh, you're really looking for the outline of the structure within the current slice; adding depth thickness to it may just hide slice features when the surface is parallel to the viewing plane, and the fragment shader rejection approach may behave strangely in cases where the camera direction is parallel to the surface (the depth provided by rasterization may be outside the slice thickness, even though the polygon crosses the plane). But I can try it.
Currently in the connectome tool it's pretty simple: compile the geometry shader if in 2D mode, don't if in 3D mode.
OK, I guess if the geometry shader remains simple, why not.
That said, I reckon the advantage of using a crop to slab approach is that it would disambiguate cases where users expect their tracks to end on the surface boundary, or to have been selected as included/excluded in a mesh region - displaying the mesh as only its outline in the slice plane opens the possibility of streamlines appearing to enter the region when they're not, or vice versa.
Anyway, worth a try, it's a simple change.
Yeah fair point; will make more sense once that's in there.
Allow import and display of arbitrary meshes