[vtkusers] Lighting coefficients "SetSpecular", "SetAmbient" and "SetDiffuse"
Bryn Lloyd
lloyd at itis.ethz.ch
Tue Jun 7 10:45:14 EDT 2011
Hi
I would like to get the same effect using a vtkActor as with following
OpenGL code:
float light_ambient[] = {0.3f,0.3f,0.3f,1.0f};
float mat_spec[] = {0.8f,0.8f,0.8f,1.0f};
float mat_diff[] = {0.3f,0.2f,0.8f,1.0f};
float mat_shininess[] = { 32.0f };
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_spec);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diff);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_AMBIENT ,light_ambient);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
I have tried following VTK code (the light is at the same position):
actor->GetProperty()->SetInterpolationToFlat();
actor->GetProperty()->SetAmbient(0.3);
actor->GetProperty()->SetDiffuse(1.0);
actor->GetProperty()->SetSpecular(0.5);
actor->GetProperty()->SetAmbientColor(0.3, 0.3, 0.3);
actor->GetProperty()->SetDiffuseColor(1.0, 0.0, 0.0);
actor->GetProperty()->SetSpecularColor(0.8, 0.8, 0.8);
actor->GetProperty()->SetSpecularPower(32.0);
The effect is different though. I am unclear about the light coefficients
set using "SetSpecular", "SetAmbient" and "SetDiffuse".
What does this correspond to? If I set all to 1.0, then it seems I get only
the specular effect.
Thanks
Bryn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110607/cbd24dfa/attachment.htm>
More information about the vtkusers
mailing list