<div dir="ltr">Hi, thank you for your response Simon.<div>I tried your suggestions. Adding <span style="font-size:12.8px">SetScalarModeToUseCellData didn't solve the problem :( (still I'm seeing all the model in white)</span><div><span style="font-size:12.8px">I saved my results to load them in ParaView and indeed I can see a new Cell Data named "TEMP" with the values of the Point Data as I wish. </span></div><div><span style="font-size:12.8px">Thus, I think that the point2celldata is working properly, and I have only a problem of configuring something to see it, but where?</span></div><div><br></div><div><span style="font-size:12.8px">Any thoughs?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thank you.</span><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-22 14:28 GMT+01:00 Simon ESNEAULT <span dir="ltr"><<a href="mailto:simon.esneault@gmail.com" target="_blank">simon.esneault@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<br><br>Not sure, but maybe a call to <br>SetScalarModeToUseCellData()<br>is needed on the mapper ?<br>You should try to save/load the dataset in paraview after it is processed to see what's going on with the cell/point data :)<br><br>Good luck<br>Simon<br><br><br></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">2016-02-22 13:23 GMT+01:00 Fernando Nellmeldin <span dir="ltr"><<a href="mailto:f.nellmeldin@open-engineering.com" target="_blank">f.nellmeldin@open-engineering.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello again.<div>Yes, you understood the issue perfectly. And I understand the reason as of why is not working anymore, thank you for the great explanation.</div><div><br></div><div>After your advise, I tried using vtkPointDataToCellData, but without success.</div><div>Here is one small example I wrote. If I activate the line #define USE_P2C, I can't see any color (everything is light gray). If that line is commented, everything works as expected.</div><div>Do you know what I am missing?</div><div><br></div><div><div><br></div><div>#include <vtkSmartPointer.h></div><div>#include <vtkDataSetMapper.h></div><div>#include <vtkActor.h></div><div>#include <vtkPointDataToCellData.h></div><div>#include <vtkUnstructuredGrid.h></div><div>#include <vtkUnstructuredGridGeometryFilter.h></div><div>#include <vtkGeometryFilter.h></div><div>#include <vtkXMLUnstructuredGridReader.h></div><div>#include <vtkRenderer.h></div><div>#include <vtkRenderWindow.h></div><div>#include <vtkPointData.h></div><div>#include <vtkCellData.h></div><div>#include <vtkRenderWindowInteractor.h></div><div>int main()</div><div>{</div><div><span style="white-space:pre-wrap"> </span>// Read the grid</div><div><span style="white-space:pre-wrap"> </span>std::string filename = "D:/model.vtu";</div><div><span style="white-space:pre-wrap"> </span>std::string fieldname = "TEMP";</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkXMLUnstructuredGridReader> reader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();</div><div><span style="white-space:pre-wrap"> </span>reader->SetFileName(filename.c_str());</div><div><span style="white-space:pre-wrap"> </span>reader->Update();</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkUnstructuredGrid> model = reader->GetOutput();</div><div><br></div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkDataSetMapper> colorMapper = vtkSmartPointer<vtkDataSetMapper>::New();</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkActor> colorActor = vtkSmartPointer<vtkActor>::New();</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();</div><div><br></div><div>//============ BEGIN OF SECTION OF INTEREST</div><div><span style="white-space:pre-wrap"> </span>// Convert point to cell data</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkPointDataToCellData> point2CellData = vtkSmartPointer<vtkPointDataToCellData>::New();</div><div><span style="white-space:pre-wrap"> </span>point2CellData->PassPointDataOn();</div><div><span style="white-space:pre-wrap"> </span>point2CellData->SetInputData(model);</div><div><span style="white-space:pre-wrap"> </span>point2CellData->Update();</div><div><br></div><div>#define USE_P2C</div><div>#ifdef USE_P2C</div><div><span style="white-space:pre-wrap"> </span>// Neither of these "setActiveScalars" makes any difference</div><div><span style="white-space:pre-wrap"> //</span>model->GetCellData()->SetActiveScalars(fieldname.c_str());</div><div><span style="white-space:pre-wrap"> </span>//model->GetPointData()->SetActiveScalars(fieldname.c_str());</div><div><span style="white-space:pre-wrap"> </span>geometryFilter->SetInputData(point2CellData->GetOutput());</div><div><span style="white-space:pre-wrap"> </span>geometryFilter->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, fieldname.c_str()); // cells because I transfered the data</div><div>#else</div><div><span style="white-space:pre-wrap"> </span>model->GetPointData()->SetActiveScalars(fieldname.c_str());</div><div><span style="white-space:pre-wrap"> </span>geometryFilter->SetInputData(model);</div><div><span style="white-space:pre-wrap"> </span>geometryFilter->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, fieldname.c_str());</div><div>#endif</div><div><br></div><div><span style="white-space:pre-wrap"> </span>colorMapper->SetInputConnection(geometryFilter->GetOutputPort());</div><div><br></div><div>//============ END OF SECTION OF INTEREST<br></div><div><br></div><div><span style="white-space:pre-wrap"> </span>colorMapper->SetScalarRange(297, 637); //hardcoded to reduce code length</div><div><span style="white-space:pre-wrap"> </span>colorActor->SetMapper(colorMapper);</div><div><span style="white-space:pre-wrap"> </span>colorMapper->ScalarVisibilityOn();</div><div><br></div><div><span style="white-space:pre-wrap"> </span>// Usual rendering stuff, nothing of interest from here onwards</div><div><span style="white-space:pre-wrap"> </span>//Create a renderer, render window, and interactor</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();</div><div><span style="white-space:pre-wrap"> </span>renderWindow->AddRenderer(renderer);</div><div><span style="white-space:pre-wrap"> </span>vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div><span style="white-space:pre-wrap"> </span>renderWindowInteractor->SetRenderWindow(renderWindow);</div><div><span style="white-space:pre-wrap"> </span>//Add the actor to the scene</div><div><span style="white-space:pre-wrap"> </span>renderer->AddActor(colorActor);</div><div><span style="white-space:pre-wrap"> </span>renderer->SetBackground(.3, .6, .3); // Background color green</div><div><span style="white-space:pre-wrap"> </span>//Render and interact</div><div><span style="white-space:pre-wrap"> </span>renderWindow->Render();</div><div><span style="white-space:pre-wrap"> </span>renderWindowInteractor->Start();</div><div><span style="white-space:pre-wrap"> </span>return EXIT_SUCCESS;</div><div>}</div></div><div><br></div><div><br></div><div>Thank you!.</div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">2016-02-18 17:05 GMT+01:00 Ken Martin <span dir="ltr"><<a href="mailto:ken.martin@kitware.com" target="_blank">ken.martin@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Fernando,<div><br></div><div>Making sure that I understand the issue. Essentially you have defined scalars/colors on the points of a triangle. With phong shading the colors interpolate across the triangle. With flat shading on the old backend, the system takes the color of the first point and uses that for the entire triangle. On the new backend the colors are still interpolated across the triangle. Is that the issue you see?</div><div><br></div><div>If so, then the issue is that on the new backend I am interpreting shading to only mean lighting and normal calculations while in the old backend it seems to include vertex color properties (but not other properties such as tcoords, hmm wonder what happens with flat shading and texture based coloring) In modern OpenGL (version 3.2 ) you can specify flat versus smooth interpolation by attribute. So normals could be flat while colors are smooth. Without requiring OpenGL 3.2 we would need to rebuild the VBO each time you switch between flat and smooth, basically treating flat shading as if you had cell colors instead of point colors.</div><div><br></div><div>If backward compatibility was not an issue :-) I would suggest moving to require OpenGL 3.2 and then modifying vtkProperty so that people can independently specify if they want normals/colors/etc to be flat/smooth/perspective.</div><div><br></div><div>One stopgap, you could use vtkPointDataToCellData to essentially accomplish what you want in either back end. </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"><div><div>On Thu, Feb 18, 2016 at 10:14 AM, Fernando Nellmeldin <span dir="ltr"><<a href="mailto:f.nellmeldin@open-engineering.com" target="_blank">f.nellmeldin@open-engineering.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello friends.<div><br><div>In our application, we want to allow the user to alternate between a flat and a smooth shading of the colors in an actor. To do this, we have a option that allows the user to call setInterpolationToFlat() or setInterpolationToPhong() in the property of the vtkactor. </div><div><br></div><div>The problem is that the call to set flat is not working, there is no change and the actor is always rendered smooth.</div><div><br></div><div>I've tried with VTK 6.3.0 and VTK 7.0.0 under OpenGL2 backend. In VTK 5.10 (using the old opengl), this works as expected. </div><div><br></div><div>And please note that in the three cases, the code is exactly the same. Well, except the connection between the ugrid and the geometry filter that I have the usual if:</div><div><div><span style="white-space:pre-wrap"> </span>#if VTK_MAJOR_VERSION <= 5</div><div><span style="white-space:pre-wrap"> </span>geometryFilter->SetInputConnection(m_model->GetProducerPort());</div><div><span style="white-space:pre-wrap"> </span>#else</div><div><span style="white-space:pre-wrap"> </span>geometryFilter->SetInputData(m_model);</div><div><span style="white-space:pre-wrap"> </span>#endif</div></div><div><br></div><div>Therefore, is the support of flat interpolation dropped, or I have to add something to make it work under OpenGL2 backend?</div><div><div><br></div><div>Thank you!</div><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div style="font-size:12.8px"><b><font color="#cc0000"><span style="font-family:'arial black',sans-serif;font-size:12.8px"><br></span></font></b></div></div></div></div></div></div></div>
</div></div></div>
<br></div></div>_______________________________________________<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" target="_blank">http://www.kitware.com/opensource/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_FAQ</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=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/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>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>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><b>Fernando NELLMELDIN</b><br>Software Engineer<div style="font-size:12.8px"><b style="font-size:12.8px"><font color="#cc0000">_______________________________________________________________</font></b><br></div><div><div style="font-size:12.8px"><b style="font-size:12.8px"><font color="#000000"><br></font></b></div><div style="font-size:12.8px"><b style="font-size:12.8px"><font color="#000000">O</font><font color="#cc0000">pen E</font><font color="#000000">ngineering s.a.</font></b><br></div><div style="font-size:12.8px"><font color="#000000"><br></font></div><div style="font-size:12.8px"><font color="#000000">Rue Bois Saint-Jean 15/1</font></div><div style="font-size:12.8px"><font color="#000000">B-4102 Seraing (Belgium)</font></div><div><font color="#000000" style="font-size:12.8px">Tel: </font>+32.4.353.30.34 </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><a href="http://www.open-engineering.com/" style="color:rgb(17,85,204)" target="_blank">http://www.open-engineering.com</a></div><div style="font-size:12.8px"><a href="https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym" style="color:rgb(17,85,204)" target="_blank">https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym</a><br></div><div style="font-size:12.8px"><b><font color="#cc0000"><span style="font-family:'arial black',sans-serif;font-size:12.8px">_________________________________________________________________________<br></span></font></b></div></div></div></div></div></div></div>
</div>
<br>_______________________________________________<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" target="_blank">http://www.kitware.com/opensource/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_FAQ</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=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/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br></div></div><div><div dir="ltr"><div>------------------------------------------------------------------<br>Simon Esneault<div>Rennes, France<br>------------------------------------------------------------------</div></div></div></div></div></blockquote></div>
</div></div>