# Color space of RGB values in vtkProperty

**URL:** https://discourse.vtk.org/t/color-space-of-rgb-values-in-vtkproperty/16088
**Category:** Development
**Created:** [October 9, 2025, 3:47am UTC](https://discourse.vtk.org/t/color-space-of-rgb-values-in-vtkproperty/16088 "2025-10-09T03:47:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 9, 2025, 3:47am UTC](https://discourse.vtk.org/t/color-space-of-rgb-values-in-vtkproperty/16088/1 "2025-10-09T03:47:20Z")

</div>

We see incorrect, washed-out colors in the 3D rendering if we change `Interpolation` to `PBR` in `vtkProperty`. For example, the image below shows that if we use the same RGB values with Gouraud interpolation (first column) and PBR interpolation (second column) then with PBR the color looks faded. After converting the RGB values from sRGB to linear RGB (third column), the PBR rendering is no longer faded.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/3/332f3b606ad04067fed86a9d8631e6435d9bd3d1.jpeg)

It seems that color space of color values in `vtkProperty` depends on the chosen interpolation mode: RGB values are interpreted as sRGB; except if interpolation is PBR, then the color space is linear RGB.

**Is this just a bug? I would expect VTK to take care of converting between color spaces as needed.** (except where color is explicitly specified to be a different color space, e.g., for textures)

If for some reason VTK cannot do the necessary conversions under the hood then then at least there should be convenience methods in `vtkProperty` so that applications can still get/set colors in sRGB color space. For backward compatibility, it would make sense to call these methods `SetColor`, `GetColor`, etc. and add new methods (or optional additional method arguments) for specifying colors in other color spaces.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [October 14, 2025, 4:03pm UTC](https://discourse.vtk.org/t/color-space-of-rgb-values-in-vtkproperty/16088/2 "2025-10-14T16:03:19Z")

</div>

@lassoan, as far as I know, `vtkProperty` does not use sRGB color space by default unless you explicitly enable it using `vtkRenderWindow::SetUseSRGBColorSpace`.

However, when this option is enabled, the behavior you described appears to be a bug. Internally, the mapper converts the values to sRGB color space for PBR interpolation, regardless of the window setting. You can find the relevant code here: [https://gitlab.kitware.com/vtk/vtk/-/blob/33e80863c0c3499993ce422b372d82f0546fc2b1/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx#L1459](https://gitlab.kitware.com/vtk/vtk/-/blob/33e80863c0c3499993ce422b372d82f0546fc2b1/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx#L1459).

This behavior has been consistent since PBR was introduced in VTK, which you can review here: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/5584/diffs#119ad58b35cad6a89360ea74ac1db4ca126c5816\_900\_1129](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/5584/diffs#119ad58b35cad6a89360ea74ac1db4ca126c5816_900_1129).

To fix this, gamma correction should depend on whether the window utilizes sRGB color space.

@Michael FYI

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [October 14, 2025, 11:25pm UTC](https://discourse.vtk.org/t/color-space-of-rgb-values-in-vtkproperty/16088/3 "2025-10-14T23:25:56Z")

</div>

Thanks a lot @sankhesh for looking into this. Do you think @michael or other VTK develop will investigate this further or you would need further inputs or help from me?

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [October 15, 2025, 3:34pm UTC](https://discourse.vtk.org/t/color-space-of-rgb-values-in-vtkproperty/16088/4 "2025-10-15T15:34:30Z")

</div>

@lassoan Could you please confirm that the images generated in the screenshot you posted are from a vtkRenderWindow where `UseSRGBColorSpace` is enabled? Once you confirm, I can make the necessary changes in VTK’s PBR handling.
