I do not understand how to specify what scalar to use when getting the scalar range, or how to get the information of a specified scalar in general.
Convenience method to get the range of the first component (and only the first component) of any scalars in the data set.
If the data has both point data and cell data, it returns the (min/max) range of combined point and cell data
Does the above mean that I cannot specify which scalar to use?
You can try unGridReader->GetOutput()->[ GetPointData() or GetCellData() ]->GetScalars()->GetRange( integer ). See doc here: https://vtk.org/doc/nightly/html/classvtkDataArray.html#a825000e3c1a9d8c1177ec1df549f347f . vtkAbstractArray::GetNumberOfComponents() can return the number of scalars per data/cell. The number you pass to GetRange() should be between 0 and vtkAbstractArray::GetNumberOfComponents()-1.
The first render is slow mostly because of this range computation. Successive calls to compute range use the cached range in the data. You could speed up the first call by caching the range separately. The most straightforward way is to call compute range when loading data before the first render.
Thanks!
what if use fixed values for ScalarRange, eg. use short_min and short_max instead of the computed values? decrease the precision while store and sample the transFunc as texture?