help > object transparency
Showing 1-3 of 3 posts
Jun 29, 2022 09:06 AM | gaelj
object transparency
Hi,
I'm trying to change the transparency of an object I loaded:
gl.meshload('/Volumes/lh.white')
gl.azimuthelevation(-90, 0)
gl.shadername('Phong');
gl.overlayload('/Volumes/9_AICHAhr_v4.obj');
gl.overlaycolor(1, 250, 0, 250, 250, 0, 250)
gl.overlayopacity(1, 30)
the opacity ruler is indeed not at the value set by gl.overlayopacity but it does not seem to alter the way it is displayed
I've tried using this command too, but with no luck: gl.overlaytranslucent(1,1)
Do you have any idea of how to get this overlay not to be completely opaque ?
Thank you for your help,
Gaƫl.
I'm trying to change the transparency of an object I loaded:
gl.meshload('/Volumes/lh.white')
gl.azimuthelevation(-90, 0)
gl.shadername('Phong');
gl.overlayload('/Volumes/9_AICHAhr_v4.obj');
gl.overlaycolor(1, 250, 0, 250, 250, 0, 250)
gl.overlayopacity(1, 30)
the opacity ruler is indeed not at the value set by gl.overlayopacity but it does not seem to alter the way it is displayed
I've tried using this command too, but with no luck: gl.overlaytranslucent(1,1)
Do you have any idea of how to get this overlay not to be completely opaque ?
Thank you for your help,
Gaƫl.
Jun 29, 2022 12:06 PM | Chris Rorden
RE: object transparency
The overlay opacity influences the transparency of the vertex
colors, not the transparency of the mesh. To see how it works, try
adjusting the value in this script:
import gl
gl.resetdefaults()
gl.azimuthelevation(70, 15)
gl.meshload('BrainMesh_ICBM152.rh.mz3')
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayopacity(1, 30)
gl.overlayminmax(1,2,12)
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayminmax(2,-1,-2)
gl.colorbarvisible(1)
gl.overlaytransparencyonbackground(25)
gl.meshcurv()
Handling opacity of meshes is a bit more limited, and is handled by the Xray values, with one influencing the opacity of the background mesh and the other influencing how we a overlay buried below the surface of a background mesh bleeds through. Here is an example, but you can always use the Xray sliders in the graphical interface to get a better sense:
import gl
gl.resetdefaults()
gl.meshload('BrainMesh_ICBM152.lh.mz3')
gl.overlayload('~/19_AICHAhr_v4.obj')
gl.overlaycolorname(1, 'red')
gl.shaderxray(0.7, 0.3)
gl.azimuthelevation(270, 15)
gl.meshcurv()
import gl
gl.resetdefaults()
gl.azimuthelevation(70, 15)
gl.meshload('BrainMesh_ICBM152.rh.mz3')
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayopacity(1, 30)
gl.overlayminmax(1,2,12)
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayminmax(2,-1,-2)
gl.colorbarvisible(1)
gl.overlaytransparencyonbackground(25)
gl.meshcurv()
Handling opacity of meshes is a bit more limited, and is handled by the Xray values, with one influencing the opacity of the background mesh and the other influencing how we a overlay buried below the surface of a background mesh bleeds through. Here is an example, but you can always use the Xray sliders in the graphical interface to get a better sense:
import gl
gl.resetdefaults()
gl.meshload('BrainMesh_ICBM152.lh.mz3')
gl.overlayload('~/19_AICHAhr_v4.obj')
gl.overlaycolorname(1, 'red')
gl.shaderxray(0.7, 0.3)
gl.azimuthelevation(270, 15)
gl.meshcurv()