# Adding Light to the volume I am rendering

**URL:** https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270
**Category:** Web
**Created:** [September 21, 2020, 5:00pm UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270 "2020-09-21T17:00:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![samm-vs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/samm-vs/32/2173_2.png) [@samm-vs](https://discourse.vtk.org/u/samm-vs)
#### Post date: [September 21, 2020, 5:00pm UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270/1 "2020-09-21T17:00:13Z")

</div>

I was able to get my volume rendered and it looks very nice but I would like to add a light from like an angle so the shadows will give the user a better view of the volume. I saw that I can use vtkLight, is there any example on how to use it. Or is there a different way to create what I want. My issue is that this is a vti object so I want to make sure that after irrelevant values (opacity set to 0) are taken out, what is still visible can still have shadows.

---

<div class="post-metadata">

### Author: ![Aron\_Helser](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aron_helser/32/14_2.png) [@Aron\_Helser](https://discourse.vtk.org/u/Aron_Helser)
#### Post date: [September 21, 2020, 6:11pm UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270/2 "2020-09-21T18:11:37Z")

</div>

Try starting here: [https://lorensen.github.io/VTKExamples/site/Cxx/Lighting/Light/](https://lorensen.github.io/VTKExamples/site/Cxx/Lighting/Light/)

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dave_demarle/32/6_2.png) [@Dave\_DeMarle](https://discourse.vtk.org/u/Dave_DeMarle)
#### Post date: [September 22, 2020, 10:37am UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270/3 "2020-09-22T10:37:29Z")

</div>

You might also want to try VTK’s OSPRay interface.

As far as I know GL rendered volumes in VTK can not cast or receive volumes. However OSPRay rendered volumes in VTK can cast them and in master with OSPRay 2 at least they can also receive them with either path tracing or ray casting and vtkVolumeProperty::ShadeOn().

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dave_demarle/32/6_2.png) [@Dave\_DeMarle](https://discourse.vtk.org/u/Dave_DeMarle)
#### Post date: [September 22, 2020, 10:38am UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270/4 "2020-09-22T10:38:59Z")

</div>

Apologies, I see now that this is in the Web area. OSPRay is not applicable in the vtk-js space.

---

<div class="post-metadata">

### Author: ![samm-vs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/samm-vs/32/2173_2.png) [@samm-vs](https://discourse.vtk.org/u/samm-vs)
#### Post date: [September 22, 2020, 5:47pm UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270/5 "2020-09-22T17:47:44Z")

</div>

I will check it out

---

<div class="post-metadata">

### Author: ![samm-vs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/samm-vs/32/2173_2.png) [@samm-vs](https://discourse.vtk.org/u/samm-vs)
#### Post date: [September 22, 2020, 5:48pm UTC](https://discourse.vtk.org/t/adding-light-to-the-volume-i-am-rendering/4270/6 "2020-09-22T17:48:42Z")

</div>

Well in volume property there is a way to set shade to 1. However, I couldn’t see a change in my volume after I changed it but thank you!
