# Is it possible to make the 3d black area transparent in code?

**URL:** <https://discourse.slicer.org/t/is-it-possible-to-make-the-3d-black-area-transparent-in-code/25140>\
**Category:** Development\
**Created:** [September 7, 2022, 12:14pm UTC](https://discourse.slicer.org/t/is-it-possible-to-make-the-3d-black-area-transparent-in-code/25140 "2022-09-07T12:14:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [September 7, 2022, 12:14pm UTC](https://discourse.slicer.org/t/is-it-possible-to-make-the-3d-black-area-transparent-in-code/25140/1 "2022-09-07T12:14:25Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/9/c9582a8e3936cee0e4accb22da653d7b7b5af818.jpeg)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [September 7, 2022, 8:14pm UTC](https://discourse.slicer.org/t/is-it-possible-to-make-the-3d-black-area-transparent-in-code/25140/3 "2022-09-07T20:14:21Z")

</div>

You can set the transparency threshold for the slice rendering in the Volumes module. If that’s what you are looking for you can access the corresponding functionality with `vtkMRMLScalarVolumeDisplayNode::SetThreshold`.

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [September 8, 2022, 1:39am UTC](https://discourse.slicer.org/t/is-it-possible-to-make-the-3d-black-area-transparent-in-code/25140/4 "2022-09-08T01:39:52Z")

</div>

thanks pieper .  
i find the code to render slice in 3d view , it looks like to convert slice volume into a texture then combine the texture into a vtkPlaneSource,render the 3d plane source use ModelDisplayNode

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/6/e6bd55473b34ce9141b8e2b103faa361a28ba1f5.png)  
i try to add the follow code to make the 3d rendering black area transparent,but it make no sense  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/2/f24906da6b27d71d0311fc32494ff21d04c7adf5.png)
