fiji / 3D_Viewer

https://imagej.net/plugins/3d-viewer
GNU General Public License v3.0
19 stars 18 forks source link

Setting transparency for surfaces does not work #4

Closed ctrueden closed 8 years ago

ctrueden commented 10 years ago

From @tpietzsch:

When I set the transparency for a surface it has no effect. Surfaces are always rendered fully opaque.

Migrated-From: http://fiji.sc/bugzilla/show_bug.cgi?id=400

ctrueden commented 10 years ago

I tested today with the MRI Stack sample using "Display as: Surface" with a resampling factor of 1. Then "Change transparency" from the Edit menu (Cmd+T), and indeed it seems to have no effect.

arosh commented 9 years ago

I tried to use "Edit" -> "Change transparency" for WaveFront obj files (using "File" -> "Import surfaces" -> "WaveFront") with 3D_Viewer-3.0.1.jar. However, it seems to have no effects.

In 06.07.2011 ImageJ_3D_Viewer.jar (http://132.187.25.13/ij3d/?page=Download&category=Download), I could change transparency of WaveFront obj files.

ctrueden commented 9 years ago

@arosh Unfortunately, the author of 3D_Viewer does not actively maintain the plugin anymore. Perhaps you could look through the project's Git history (maybe limiting to src/main/java) and attempt to isolate when the problem was introduced? A great tool for this is git bisect.

acardona commented 9 years ago

I have seen this issue in the past and it was always related to graphics card drivers. Updating the driver addressed the error every time.

arosh commented 9 years ago

@ctrueden Thanks to your advice, I found the last good commit e606bf91e717d1f01495627d605aeaf4966be237 and the first bad commit 83f034ab3c527cea34b1c4fc0915481e74e63c56. My git bisect log is shown below.

# bad: [c2b85629d029495e1e496086c9cf5b10c79aa03e] Bump parent pom
# good: [e8931af162ed22f2f62e5e4ae7c9d9abdb2ab8e7] Move the 3D Viewer into its own package
git bisect start 'HEAD' 'e8931af162ed22f2f62e5e4ae7c9d9abdb2ab8e7'
# good: [19cf313db7a091e580315c775fae4a03f1bb1e78] 3D Viewer: Let Alt+Click remove landmarks instead of Shift+Click
git bisect good 19cf313db7a091e580315c775fae4a03f1bb1e78
# bad: [009ddf2c9570bdcf67d91c1e4c72cc44825ac79f] 3D Viewer: Implement shortcuts.
git bisect bad 009ddf2c9570bdcf67d91c1e4c72cc44825ac79f
# good: [7f0394e825eb2837a20a65c5e9b1eb10d14c0d4a] 3D Viewer: Fix slow drawing of 2D ROI.
git bisect good 7f0394e825eb2837a20a65c5e9b1eb10d14c0d4a
# good: [24617e378649a5b96bbdce8fe062ba1d1912b8dd] 3D Viewer (SurfacePlot): show color images in correct color
git bisect good 24617e378649a5b96bbdce8fe062ba1d1912b8dd
# good: [4ffd9016899f81d5e8d70905edce1e04c99b5091] 3D Viewer: some code formatting.
git bisect good 4ffd9016899f81d5e8d70905edce1e04c99b5091
# good: [59b93598c5471aaf8d76ec6a824e30c2644d3df3] 3D_Viewer: Designed a nice dialog for transforming objects.
git bisect good 59b93598c5471aaf8d76ec6a824e30c2644d3df3
# good: [e606bf91e717d1f01495627d605aeaf4966be237] 3D Viewer: Display text along with landmark points.
git bisect good e606bf91e717d1f01495627d605aeaf4966be237
# bad: [456aec52fee2f910c2eac45ef18ba395e14a5a02] 3D_Viewer: Some eclipse-suggested code style editing.
git bisect bad 456aec52fee2f910c2eac45ef18ba395e14a5a02
# bad: [83f034ab3c527cea34b1c4fc0915481e74e63c56] 3D Viewer: Make sure the annotation text of landmark points is on top of the content.
git bisect bad 83f034ab3c527cea34b1c4fc0915481e74e63c56
# first bad commit: [83f034ab3c527cea34b1c4fc0915481e74e63c56] 3D Viewer: Make sure the annotation text of landmark points is on top of the content.
# good: [e606bf91e717d1f01495627d605aeaf4966be237] 3D Viewer: Display text along with landmark points.
git bisect good e606bf91e717d1f01495627d605aeaf4966be237
# first bad commit: [83f034ab3c527cea34b1c4fc0915481e74e63c56] 3D Viewer: Make sure the annotation text of landmark points is on top of the content.
iarganda commented 8 years ago

I'm having a look at this problem because it is happening as well on my new machine with the latest drivers of my graphic card. Setting the transparency mode of the meshes to TransparencyAttributes.SCREEN_DOOR makes the transparency work, but it is not the idea solution.

ctrueden commented 8 years ago

@iarganda Are you testing with Java 3D 1.6?

Also, did you have a look at @arosh's helpful bisect info?

iarganda commented 8 years ago

@ctrueden No, I haven't tested yet with Java 3D 1.6. I tried using your branch (https://github.com/fiji/3D_Viewer/tree/jogl-java3d) but it seems I need to configure something else to use Java 1.7. I'll figure it out. Thanks!

iarganda commented 8 years ago

@ctrueden I just made a tiny modification that fixes the issue (601809d41cdbe55f27e4272207b325efc4994cf0). For some reason that I'm still trying to figure out, initializing a mesh transparency mode to TransparencyAttributes.NONE prevents the mesh to change its transparency later even if the mode is updated to any other mode except TransparencyAttributes.SCREEN_DOOR (which is not ideal). So I simply initialize all meshes with TransparencyAttributes.FASTEST transparency mode, even if the transparency value is 0, and it works as expected.

ctrueden commented 8 years ago

Awesome, thanks @iarganda. I cherry-picked it to master: 42cdbe4ddd263c67694d1cb1c69ee0f4581ffe15

@tpietzsch @arosh Please test (you can download the binary from our Maven repository if you like) and let us know if there are any problems.