[vtkusers] Effect of the light to shaded volume rendering.

Takahashi takahashi_tak at inet.co.jp
Wed May 12 21:03:45 EDT 2010

Hi, everyone.

My question is that do the light parameters reflect to the shaded volume
rendering ?

I use the vtkFixedPointVolumeRayCastMapper for volume rendering.

If I turn on the shading mode, I can get the shaded result.

I want to change the light effect ( ambient, diffuse, specular ), so I
changed the parameter of the light.

But, ambient and specular parameter setting seems to be not effect to the

How I can get the correct result ?
Or, these light parameters can't work correctory in shaded volume rendering

My code is as follows...

 // "renderer" is vtkRenderer's pointer.
 if( renderer ) {

  vtkLightCollection* lights = renderer->GetLights();
  if( lights ) {

   const int num_lights( lights->GetNumberOfItems() );
   for( int idx = 0; idx < num_lights; ++idx ) {

    vtkLight* light = dynamic_cast< vtkLight* >( lights->GetItemAsObject(
idx ) );
    if( light ) {
     light->SetIntensity( intensity );
     light->SetAmbientColor( amb.r, amb.g, amb.b );
     light->SetDiffuseColor( diff.r, diff.g, diff.b );
     light->SetSpecularColor( spec.r, spec.g, spec.b );

Best regards

More information about the vtkusers mailing list