<div dir="ltr">+1 to what other Dave said. I'd also point out that you can simply add all of the potential scalars you'd like to use to the point/cell/field data as named arrays, and then use the vtkMapper::SelectColorArray method to select the property to use for visualization.<div><br></div><div>This way, the threshold/DSSF pipeline would only execute once and will produce a dataset with all of the property arrays filtered to just the active set. Changing the visible scalars at the mapper level will not cause the pipeline to re-execute.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 28, 2016 at 7:35 AM, Andrea Gavana <span dir="ltr"><<a href="mailto:andrea.gavana@gmail.com" target="_blank">andrea.gavana@gmail.com</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"><font face="monospace, monospace">Dear All,</font><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">     I am working with some stuff coming out of CFD simulations, and in the current work the simulator produces a 3D grid (unstructured grid made of hexahedrons). The full grid is about 4 million cells, but due to other settings in the simulator the number of "active" cells in the simulation ends up being "only" 270,000. In order to visualize all this, I create a vtkUnstructuredGrid to hold the full grid, use a vtkThreshold to remove the "inactive" cells and then use a vtkDataSetMapper to visualize the resulting active grid:</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">vtkUnstructuredGrid --> vtkThreshold --> vtkDataSetMapper --> vtkActor<br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">However, the rendering speed for the 270,000 cells grid is quite low - it takes about one second to display a new property by using SetScalars on the output of vtkThreshold. So I thought of using a vtkDataSetSurfaceFilter on the output of vtkThreshold to try and speed up the rendering. So, the current visualization strategy I have implemented is the following:</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">vtkUnstructuredGrid --> vtkThreshold --> vtkDataSetSurfaceFilter --> vtkPolyDataMapper --> vtkActor</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">This is still as slow as my first approach, and I also have a couple of questions - which stems from my ignorance in VTK things:</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">1. When I load (from the simulator outputs) a new property (cell-based) and I assign its values to the original vtkUnstructuredGrid (by using SetScalars on it), do all the filters (vtkThreshold and vtkDataSetSurfaceFilter) need to be re-run? If yes, why? I am not changing the active/inactive cells nor the geometry of the grid, only assigning different scalars. And, if yes, is there any way to tell the pipeline: "look, I've only changed the scalars, there's no need to re-run all the thresholds and surface filters *again*"?</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">2. Is there any other pipeline style or visualization technique in VTK or any settings whatsoever that could bring down the rendering time (memory is not that much of a concern)? Basically, what I have a the moment - in terms of timing - is as follows:</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">Reading data from simulator: 0.042 seconds</font></div><div><font face="monospace, monospace">Create VTK array with data : 0.002 seconds</font></div><div><font face="monospace, monospace">Call to SetScalars         : 0.000 seconds</font></div><div><font face="monospace, monospace">Create Lookup Table        : 0.001 seconds</font></div><div><font face="monospace, monospace">Render on screen           : about 1 second</font></div><div><br></div></div><div><br></div><div><font face="monospace, monospace">Thank you in advance for any suggestion, my apologies for the long message.</font></div><span class="HOEnZb"><font color="#888888"><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Andrea.</font></div></font></span></div>
<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" target="_blank">http://www.kitware.com/<wbr>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_<wbr>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=<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/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>