# OSPRay features supported in vtkOSPRayRenderNode

**URL:** https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489
**Category:** Support
**Created:** [August 5, 2019, 8:53pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489 "2019-08-05T20:53:37Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Sean\_Curtis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sean_curtis/32/718_2.png) [@Sean\_Curtis](https://discourse.vtk.org/u/Sean_Curtis)
#### Post date: [August 5, 2019, 8:53pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/1 "2019-08-05T20:53:37Z")

</div>

I’m having difficulty reasoning about documented OSPRay functionality and how to access it via VTK. Is there some definitive document somewhere that articulates that mapping that I’ve missed? Or is there some philosophical assumption I haven’t internalized (I admit to be a naive VTK user at best). For example, tasks that I’ve been unable to do/figure out:

- After setting the render node to be “raytracer”, I’m unsure how to set the renderer-specific parameters: e.g., `aoSamples`, `shadowsEnabled`, etc. The same applies for `pathtracer`-specific parameters.
- Defining OSPRay materials via any method _other_ than writing an appropriate json file and parsing via `vtkOSPRayMaterialLibrary::ReadFile`.

I’ll probably find more as I go. Thanks in advance.

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [August 6, 2019, 11:40am UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/2 "2019-08-06T11:40:17Z")

</div>

Hi,  
Agreed, the documentation regarding OSPRay could be improved.  
Regarding the parameters you are looking for:

- `aoSamples`: `vtkOSPRayRendererNode::SetAmbientSamples`
- `shadowsEnabled`: `vtkRenderer::UseShadowsOn`

It is possible to create materials of type `OBJMaterial` (available in 8.2) or `Principled` (on master only) directly without the JSON file.  
The type of material is set using `vtkProperty::SetInterpolation` (Phong for OBJMaterial, PBR for Principled).  
All materials parameters are set using the same class `vtkProperty`.

---

<div class="post-metadata">

### Author: ![Sean\_Curtis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sean_curtis/32/718_2.png) [@Sean\_Curtis](https://discourse.vtk.org/u/Sean_Curtis)
#### Post date: [August 8, 2019, 2:21pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/3 "2019-08-08T14:21:36Z")

</div>

I appreciate the pointers. The take away lesson here is to recognize that any parameter that naturally overlaps the basic interface is going to be serviced there.

And the guidance for creating materials on the fly was _particularly_ helpful.

One last question: if I set the background color in an OpenGL2 renderer, it is the clear color for the color buffer and any pixel not covered by geometry is rendered that color. However, in the OSPRay render, such is not the case (for either “scivis” or “pathtracer”). However, the background color _does_ contribute to the overall lighting (for “pathtracer”). Is the only way to change the “empty pixel” color from black to some alternate to provide a background texture?

---

<div class="post-metadata">

### Author: ![Sean\_Curtis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sean_curtis/32/718_2.png) [@Sean\_Curtis](https://discourse.vtk.org/u/Sean_Curtis)
#### Post date: [August 8, 2019, 2:34pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/4 "2019-08-08T14:34:54Z")

</div>

Correction on background colors:

- for “scivis” renderer, I find as long as I set the background alpha to 1, the set color does render in the empty pixels.
- that does _not_ appear to affect the _pathtracer_ (although, again, it contributes a fair amount of energy into the lighting).

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [August 8, 2019, 2:47pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/5 "2019-08-08T14:47:04Z")

</div>

Are you using remote rendering?

---

<div class="post-metadata">

### Author: ![Sean\_Curtis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sean_curtis/32/718_2.png) [@Sean\_Curtis](https://discourse.vtk.org/u/Sean_Curtis)
#### Post date: [August 8, 2019, 3:03pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/6 "2019-08-08T15:03:06Z")

</div>

I don’t know. “Remote rendering” suggests distributed to me – or possibly in a situation in which I don’t have a proper GL context? Could you elaborate?

As I’ve done further research I’ve found:

1. OSPRay supports a backplate defined as “texture image used as background, replacing visible lights in infinity”. That suggests two things:
2. It’s definitely a texture and not a color.
3. It _must_ contribute to illumination. That in itself is a bit disappointing…particularly as I can’t twiddle its intensity.

Your question implies that I _should_ be getting a background color (as if it were a backplate texture). It contributes to the lighting as such, but isn’t rendering.

That said, I also found [this discussion](https://discourse.paraview.org/t/setting-backplate-while-using-ospray/2078).

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [August 12, 2019, 8:57am UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/7 "2019-08-12T08:57:51Z")

</div>

Forget “Remote rendering”, this is a feature we use in ParaView but it is not related to VTK.  
Yes, at the moment you cannot add a background that do not contribute to illumination. That should change though.  
Thanks for the feedback.

---

<div class="post-metadata">

### Author: ![Sean\_Curtis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sean_curtis/32/718_2.png) [@Sean\_Curtis](https://discourse.vtk.org/u/Sean_Curtis)
#### Post date: [August 12, 2019, 1:41pm UTC](https://discourse.vtk.org/t/ospray-features-supported-in-vtkosprayrendernode/1489/8 "2019-08-12T13:41:16Z")

</div>

Thanks for the answers. I’ve found my own work around for a simple background color (the magic of compositing).
