# Model opacity change in single view

**URL:** <https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707>\
**Category:** Development\
**Created:** [November 9, 2018, 9:46pm UTC](https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707 "2018-11-09T21:46:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [November 9, 2018, 9:46pm UTC](https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707/1 "2018-11-09T21:46:21Z")

</div>

Hi

When the Slicer display is setup in the Triple 3D view, is it possible to change the opacity of a model only in 1 view while the model opacity remains the same in the other two views. I know it is possible to change whether the model is visible or not (using vtkMRMLViewNodes) but I wasn’t sure if you could change only the opacity of the model in a single view.

Thanks  
Priya

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 10, 2018, 5:37am UTC](https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707/2 "2018-11-10T05:37:03Z")

</div>

On the user interface, only the first display node is shown. However, you can add any number of display nodes using the Python console. Turn off visibility for one view on the GUI (e.g., View3) and add a new display node with the desired view ID and display properties:

```auto
modelDisplayNode=slicer.mrmlScene.AddNewNodeByClass("vtkMRMLModelDisplayNode")
modelDisplayNode.SetViewNodeIDs([slicer.mrmlScene.GetFirstNodeByName("View3").GetID()])
modelDisplayNode.SetOpacity(0.5)
modelNode.AddAndObserveDisplayNodeID(modelDisplayNode.GetID())

```

---

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [November 12, 2018, 8:08pm UTC](https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707/3 "2018-11-12T20:08:49Z")

</div>

Thanks Andras. With slight modifications, your suggestions worked well.

Thanks  
Priya

---

<div class="post-metadata">

**Author:** ![talmazov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/talmazov/32/3966_2.png) [@talmazov](https://discourse.slicer.org/u/talmazov)\
**Post date:** [July 30, 2020, 9:55pm UTC](https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707/4 "2020-07-30T21:55:38Z")

</div>

Hey,  
I am trying to change the opacity of a 3D model within vtkMRMLModelDisplayNode (the 3D object viewer) View1

> modelDisplayNode=slicer\_model.GetDisplayNode() #vtkMRMLModelDisplayNode  
> modelDisplayNode.SetViewNodeIDs([slicer.mrmlScene.GetFirstNodeByName(“View1”).GetID()])  
> modelDisplayNode.SetOpacity(float(mat\_color.find(‘a’).text))  
> slicer\_model.AddAndObserveDisplayNodeID(modelDisplayNode.GetID())

however i don’t see change in the opacity, rather the color changes. in fact if i set SetOpacity(0) that is when the true color appears.

im basically trying to set this value for the model  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/c/dc623d8a47e87ec7f808b8520917feffe369a4a1.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 30, 2020, 10:14pm UTC](https://discourse.slicer.org/t/model-opacity-change-in-single-view/4707/5 "2020-07-30T22:14:33Z")

</div>

If you need to display the same model differently in each view then you need to create a separate display node for each. Note that the models module GUI always shows/modifies the first display node only.
