Problem with ambient and specular color in vtkLight using vtk 8.2.0 (2)

Hello,

I’ve some problems related to the methods vtkLight::setSpecularColor and vtkLight::seAmbientColor. I explained the issue in detail in here. I’m not sure if this is a bug, if someone can explain to me what is happening, it would be great.

Regards,
Santiago.

What are you trying to achieve? Do you want to reproduce the same result than VTK 6.3?

Yes, the result changed between OpenGL and OpenGL2 but the whole rendering engine has been reworked.
Specular color has no physical meaning for lights, the lights have only a radiance color that you can set using SetColor (specular and ambient colors are indeed ignored and deprecated now but it is not a bug).
Specular lobe and diffuse component are computed based on the material specification.
You need to specify diffuse, specular and shininess (specular power) on the vtkProperty class.

Note that starting from VTK 9.0, you can alternatively compute diffuse/specular/shininess automatically based on color/roughness/metallic properties with the new physically based shader.

The point raised by Santiago is that the red source has (0.5 0 0) as specular color while the blue source has (0 0 1.0) as specular color (both sources are at the same distance from the sphere actor). The OpenGL backend yielded the expected result with a smaller red specular blob as it is half the intensity of the blue source, whereas OpenGL2 beackend rendered specular blobs about the same size.

In his test, the red light is (1,0,0) not (0.5,0,0):

// Set up the lighting.
  // Light one is on the left and is blue.
  auto light1 = vtkSmartPointer<vtkLight>::New();
  light1->SetFocalPoint(0, 0, 0);
  light1->SetPosition(1, 0, 0);
  light1->SetColor(0, 0, 1);
  light1->SetSpecularColor(0, 0, 1.0);
  ren->AddLight(light1);
  // Light one is on the right and is red.
  auto light2 = vtkSmartPointer<vtkLight>::New();
  light2->SetFocalPoint(0, 0, 0);
  light2->SetPosition(-1, 0, 0);
  light2->SetColor(1, 0, 0);
  light2->SetSpecularColor(0.5, 0, 0);
  ren->AddLight(light2);

This is what I achieve when I set the light color to (0.5,0,0):
2020-05-06-090616_window

Please, reread the posts carefully. I said:

I didn’t say to change the red color to (0.5 0 0).

You can set the light specular color to green if you like, the specular lobe will still be red.

Good programming practice tells that a deprecated function should be documented as such. There is even a Doxygen tag for that:

/**
 * One-liner to describe this function.
 *
 * @deprecated since 1.0
 * @see backdrop_replacement_function()
 */

Paulo,

VTK is an open source project, please do not hesitate to contribute and create a merge request with this suggestion.

J.

Yeah right, I was expecting that kind of answer.