<div dir="ltr">It sounds like something is stuck in a bad state. You could try marking the property modified after you turn the scalar visibility back off. ala <div><br></div><div>actor.GetProperty().Modified();</div><div><br></div><div>if that doesn't fix it then you could also try forcing the mapper to rebuild by doing something like</div><div><br></div><div>mapper->GetInput()->Modified();</div><div><br></div><div>last resort also turn off InterpolateScalarsBeforeMapping and call actor->ReleaseGraphicsResources(renderWindow);</div><div><br></div><div>Hope one of those works for you.</div><div><br></div><div>Thanks</div><div>Ken</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 14, 2016 at 4:11 AM, CARD Student <span dir="ltr"><<a href="mailto:cardstudent@balgrist.ch" target="_blank">cardstudent@balgrist.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Ken</p>
<p><br>
</p>
<p>My issue is the following: I have an OpenGl Actor, created like this:</p>
<p><br>
</p>
<p></p>
<div> var mapper = vtkPolyDataMapper.New();</div>
<div> mapper.SetInput(polyData);</div>
<div> mapper.<wbr>ImmediateModeRenderingOn();</div>
<div><br>
</div>
<div></div>
<div> var actor = vtkActor.New();</div>
<div> actor.SetProperty(vtkProperty.<wbr>New());</div>
<div> actor.GetProperty().SetColor(<wbr>0.5, 0.5, 0.5);</div>
<div> actor.GetProperty().<wbr>SetInterpolationToFlat();</div>
<div>
<div> actor.GetProperty().<wbr>SetAmbient(0.45);</div>
<div> actor.GetProperty().<wbr>SetDiffuse(0.55);</div>
<br>
</div>
<br>
<p></p>
<p>At this point, the model looks like this:</p>
<p><br>
</p>
<p><img size="17654" id="m_-7398932826669697772img227839" height="180" width="165" src="cid:d9f17763-1db4-4acb-8505-51aa685ba65c"><br>
</p>
<p><br>
</p>
<p>Then scalars get added:</p>
<p><br>
</p>
<span> </span><span> <span> </span></span>polyData.<wbr>GetPointData().AddArray(data);</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<span> </span><span> <span> </span>polyData.GetPointData().<wbr>SetActiveScalars("name");</span></div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<span></span><span>
<div> actor.GetMapper().<wbr>SetScalarMode(1); // this is <span style="color:rgb(128,96,32);font-family:monospace,fixed;font-size:13px;white-space:pre-wrap;background-color:rgb(251,252,253)">VTK_SCALAR_MODE_USE_POINT_<wbr>DATA</span></div>
<div> actor.GetMapper().<wbr>SetInterpolateScalarsBeforeMap<wbr>ping(1);</div>
<div><span> </span><span> </span><span> </span>actor.GetMapper().<wbr>SetScalarVisibility(1);<br>
</div>
</span><span></span>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
Then it looks like this (which is fine):</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<img size="59898" id="m_-7398932826669697772img207348" height="180" width="153" src="cid:b5c1ab6c-6c84-40df-8cb2-cfbf056fd6f0"><br>
<br>
To disable the scalars again, we do the following:</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<span> </span><span> <span> </span></span>actor.GetMapper().<wbr>SetScalarVisibility(0);</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
But now, the orignial color is rendered brighter, like this:</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<img size="14515" id="m_-7398932826669697772img606863" height="180" width="153" src="cid:585b5372-dfe7-48fa-ac12-f38bbab10bea"></div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
So my question is, how can I get back to the original state (with the darker grey)? I'm stuck using VTK 5.8 since we use the free Kitware <span>ActiViz C# wrapper. After some googling I suspected that my problem is related to the thread I answered to, but any
help is appreciated.</span></div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<span></span>I tried messing with the scalars material mode, resetting the scalars using 'polyData.GetPointData().<wbr>GetScalars().Reset();' and resetting the diffuse lighting to 0.55. None of which helped. The current workaround is to have separate PolyDataMappers,
one with the original state, and another where scalars are never set to active. And instead of showing and hiding scalars, we swap the mapper. But this seems like a hack...</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
Best regards,</div>
<div id="m_-7398932826669697772divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
Frederik<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-7398932826669697772divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Ken Martin <<a href="mailto:ken.martin@kitware.com" target="_blank">ken.martin@kitware.com</a>><br>
<b>Gesendet:</b> Donnerstag, 13. Oktober 2016 17:22<br>
<b>An:</b> CARD Student<br>
<b>Cc:</b> vtk<br>
<b>Betreff:</b> Re: [vtkusers] Scalars and diffuse lighting</font>
<div> </div>
</div>
<div>
<div dir="ltr">I am not completely following your issue. But .. if you are using VTK with the OpenGL2 back end then the diffuse is based the actor's property when scalars are not visible. Note that colors and intensity in the actor's property cover a range
of 0.0 to 1.0 not 0.0 to 255.0. If you can explain your problem a bit more specifically, including what version of VTK you are using and what rendering backend, the I might be able to help more.
<div><br>
</div>
<div>Thanks</div>
<div>Ken</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Oct 13, 2016 at 9:28 AM, Zivi, Der <span dir="ltr">
<<a href="mailto:cardstudent@balgrist.ch" title="mailto:cardstudent@balgrist.ch
Ctrl+Klicken oder tippen Sie, um dem Link zu folgen." target="_blank">cardstudent@balgrist.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi David<br>
<br>
Sorry for digging out this ancient post, but I'm now having the same<br>
problem.<br>
<br>
More specifically, I don't mind that the diffuse coefficient is 1 when<br>
scalars are shown. But at some point the scalar visibility is reset to 0,<br>
but the diffues coefficient stays at 1. How can I switch back to using the<br>
diffuse coefficient set in the actor properties?<br>
<br>
Because the diffuse coefficient is only set to 1 once the active scalar is<br>
set, and there is no reset method...<br>
<br>
Frederik<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Scalars-and-diffuse-lighting-tp4298628p5740758.html" rel="noreferrer" target="_blank">
http://vtk.1045678.n5.nabble.c<wbr>om/Scalars-and-diffuse-lightin<wbr>g-tp4298628p5740758.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" title="http://www.kitware.com/opensource/opensource.html
Ctrl+Klicken oder tippen Sie, um dem Link zu folgen." target="_blank">
http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">
http://www.vtk.org/Wiki/VTK_FA<wbr>Q</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">
http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/vtkusers</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="m_-7398932826669697772gmail_signature">Ken Martin PhD
<div>Chairman & CFO<br>
Kitware Inc.<br>
28 Corporate Drive<br>
Clifton Park NY 12065<br>
<a href="tel:518%20371%203971" value="+15183713971" target="_blank">518 371 3971</a>
<div><br>
</div>
<div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the
original message. Thank you.</span></div>
</div>
</div>
</font></span></div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Ken Martin PhD<div>Chairman & CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY 12065<br>518 371 3971<div><br></div><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message.
Thank you.</span></div></div></div>
</div>