Thanks for your explanation David. This is a shame as I would expect it is a fairly common requirement for a user to toggle scalars on/off, which perhaps only affect part of an actor, therefore the other parts of the actor logically should stay looking exactly the same as before. I am assuming there is no way to only assign scalars to a portion of an actors cells.<br>
<br>Regards,<br><br><br>Andrew<br><br><br><br><div class="gmail_quote">On 12 April 2011 18:59, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Okay, here is my best explanation of what is going on. Someone<br>
please correct me if there are mistakes.<br>
<br>
The use of lighting coefficients is limited when using scalars.<br>
Generally, VTK uses the scalars as the diffuse color while ignoring<br>
the diffuse coefficient (i.e. assuming it is 1.0). The ambient and<br>
specular colors and coefficients are used as specified in the<br>
property, i.e. they are not taken from the scalars.<br>
<br>
This behavior can be slightly modified via the mapper<br>
SetScalarMaterialMode method, by making it so that the ambient<br>
color tracks the scalars, or so that both ambient and diffuse color<br>
tracks the scalars.<br>
<br>
Long story short: diffuse coefficient is ignored when using scalars.<br>
This does not appear to be a bug, I think this was done intentionally<br>
to keep the mapper implementation from becoming too complex.<br>
Kind of surprising that it isn't better documented, though.<br>
<br>
- David<br>
<br>
<br>
On Tue, Apr 12, 2011 at 10:49 AM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
> Hi Andrew,<br>
><br>
> I'm not 100% sure on this, but I think it has to do with the<br>
> ScalarMaterialMode in the mapper. Try doing this, for instance, to<br>
> see if it helps:<br>
><br>
> mapper->SetScalarMaterialModeToAmbientAndDiffuse();<br>
><br>
> The PolyDataMapper seems to use glColor() for color scalars, but it<br>
> uses glMaterial() for the property color, and I think that this is<br>
> responsible for the different behavior.<br>
><br>
> - David<br>
><br>
><br>
> On Tue, Apr 12, 2011 at 10:23 AM, andrew.derek.ward<br>
> <<a href="mailto:andrew.derek.ward@gmail.com">andrew.derek.ward@gmail.com</a>> wrote:<br>
>> Hello,<br>
>><br>
>> I am trying to determine how lighting works in colour scalar mode.<br>
>><br>
>> I have an actor of colour (255,0,0) with ambient lighting set to 0.1 and<br>
>> diffuse lighting set to 0.7<br>
>><br>
>> Without scalars, this actor looks fine, but if I enable scalars giving every<br>
>> cell the same colour (255,0,0) the<br>
>> diffuse lighting coefficient does not seem to have any affect.<br>
>><br>
>> It is as though VTK locks the diffuse lighting coefficient to 1.0 when<br>
>> scalars are enabled, giving me a brighter<br>
>> looking actor than my original non-scalar coloured one.<br>
>><br>
>> This appears to be similar to these unanswered questions:<br>
>> <a href="http://www.vtk.org/pipermail/vtkusers/1999-July/050896.html" target="_blank">http://www.vtk.org/pipermail/vtkusers/1999-July/050896.html</a><br>
>> <a href="http://www.vtk.org/pipermail/vtkusers/2002-October/063444.html" target="_blank">http://www.vtk.org/pipermail/vtkusers/2002-October/063444.html</a><br>
>><br>
>> Any help/explanation greatly appreciated.<br>
>><br>
>> Regards,<br>
>><br>
>> Andrew<br>
><br>
</blockquote></div><br>