[vtkusers] problems with transient unstructured volume rendering
David E DeMarle
dave.demarle at kitware.com
Wed Dec 16 10:50:08 EST 2009
wrote:
> I have set up an example here:
>
> http://www.cmake.org/Wiki/Unstructured_Transient_Volume_Rendering
>
> I do not believe the time source generates the right thing: the scalar
> ranges do not make any sense to me, neither does what I see on the screen.
> Please let me know if I do something wrong.
The label arrays are not very interesting in the source. Every
point/cell gets its own label and that doesn't change over time. The
X/Y/Z arrays are only interesting if the object is moving, as they are
just the coordinates of the point/(centroid of)cell. The Value arrays
vary over a sinusoid. Try this:
>>> for i in (0.1*s for s in xrange(0,10)):
print "AT TIME " + str(i)
ex.SetUpdateTimeStep(0,i)
tse.Update()
for j in range(0,tse.GetOutput().GetPointData().GetNumberOfArrays()):
print tse.GetOutput().GetPointData().GetArray(j).GetName()
tse.GetOutput().GetPointData().GetArray(j).GetRange()
Also, be careful about use of GetScalars. I don't think I mark any of
the arrays as the ActiveScalars, so you are better off coloring by a
specific array.
>
> As to the mapper, David, please note I am not re-creating the mapper but
> only the volume (actor).
Same effect, I think it is causing the lookup table range to be setup for you.
> Yes, indeed, it looks like color range is (not)
> reset, but I can not find any appropriate functions to influence the
> behavior - the transfer functions do not change. How would you force the
> desired behavior other than re-creating the volume?
>
I can't investigate the specifics of setting up the color controls at
the moment sorry. You have to coordinate the transfer function, mapper
and actor, and I don't keep the specific calls in my head. What you
are trying to do though is query the range every frame and make sure
it is used. A different alternative is to set the range ahead of time
such that it covers the total range over all time. You either have to
know that range apriori, or update to find it out.
Lastly, you generally want to set the time requested near the sink.
The setting you ask for on the source will be overridden if something
downstream asks for something different.
> Dominik
>
> David E DeMarle wrote:
>>
>> When you delete the mapper and make a new one each frame you are
>> rescaling the color lookup table on every frame. Color tables are not
>> automatically rescaled as time progresses and instead the ranges
>> correspond to that from the first available time step. Automatic
>> rescaling can be very misleading. A more intuitive approach would be
>> to get a global range over all time and use that to scale, but the
>> global range is prohibitively expensive to compute in general with
>> large data so we do not do that.
>>
>> Does this explain the effect you are seeing?
>>
>> About the vtkTimeSourceExample, how are you getting the time range?
>> Try this to exercise it:
>>
>> import vtk
>> tse = vtk.vtkTimeSourceExample()
>> ex = tse.GetExecutive()
>> tse.UpdateInformation()
>>
>> #inspect available time range and time steps
>> print ex.GetOutputInformation()
>>
>> #make it grow because bounds are easy to inspect
>> tse.SetGrowing(1)
>>
>> ex.SetUpdateTimeStep(0,0.0)
>> tse.Update()
>> print(tse.GetOutput().GetBounds())
>>
>> #pick some other time inside the time range
>> ex.SetUpdateTimeStep(0,0.5)
>> tse.Update()
>> print(tse.GetOutput().GetBounds())
>>
>>
>>
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>>
>>
>> On Tue, Dec 15, 2009 at 4:08 PM, Dominik Szczerba <dominik at itis.ethz.ch>
>> wrote:
>>>
>>> Hmmm all I am getting at the output is ONE cell (hexa 8 points) with
>>> several
>>> scalars but all of them constant in time.
>>>
>>> I think I will need something a little more realistic to demonstrate the
>>> problem.
>>>
>>> Or at least a small transient ImageData that can be triangulated.
>>>
>>> Dominik
>>>
>>> David E DeMarle wrote:
>>>>
>>>> That particular filter has only four parameters, produce data at
>>>> discrete locations or analytically across the temporal domain, grow
>>>> (vary number of cells or not), and x and y amplitude for it to move
>>>> across over time.
>>>>
>>>> It produces at most 5 cells I think, so you will have to write some
>>>> code if the bug is only exposed by higher resolution data. The point
>>>> was to make something small and predictable to test vtk's support for
>>>> time varying data.
>>>>
>>>> More details about time in VTK can be found here
>>>> http://www.vtk.org/Wiki/VTK/Time_Support
>>>>
>>>> David E DeMarle
>>>> Kitware, Inc.
>>>> R&D Engineer
>>>> 28 Corporate Drive
>>>> Clifton Park, NY 12065-8662
>>>> Phone: 518-371-3971 x109
>>>>
>>>>
>>>>
>>>> On Tue, Dec 15, 2009 at 3:33 PM, Dominik Szczerba <dominik at itis.ethz.ch>
>>>> wrote:
>>>>>
>>>>> I will be happy to.
>>>>>
>>>>> While I download and compile CVS, would you kindly post an example how
>>>>> to
>>>>> generate such a transient dataset (at a desired resolution for
>>>>> inaccurate
>>>>> but fast rendering)?
>>>>>
>>>>> Dominik
>>>>>
>>>>> David E DeMarle wrote:
>>>>>>
>>>>>> In CVS, time source produces an unstrucured grid that changes over
>>>>>> time. Can you reproduce the problem with that?
>>>>>>
>>>>>> David E DeMarle
>>>>>> Kitware, Inc.
>>>>>> R&D Engineer
>>>>>> 28 Corporate Drive
>>>>>> Clifton Park, NY 12065-8662
>>>>>> Phone: 518-371-3971 x109
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Dec 15, 2009 at 3:25 PM, Dominik Szczerba
>>>>>> <dominik at itis.ethz.ch>
>>>>>> wrote:
>>>>>>>
>>>>>>> I am quite happy with static unstructured volume rendering.
>>>>>>>
>>>>>>> The problems arise when I request subsequent timesteps:
>>>>>>>
>>>>>>> while time<=timeEnd:
>>>>>>> executive = reader.GetExecutive()
>>>>>>> executive.SetUpdateTimeStep(0,time)
>>>>>>> reader.Modified()
>>>>>>> window.Render()
>>>>>>>
>>>>>>>
>>>>>>> This results in changing but wrong colors in my volume. Don't know
>>>>>>> exactly
>>>>>>> what is rendered, but it is certainly different from rendering the
>>>>>>> subsequent timestep from scratch. The situation is remedied with the
>>>>>>> following code:
>>>>>>>
>>>>>>> while time<=timeEnd:
>>>>>>> executive = reader.GetExecutive()
>>>>>>> executive.SetUpdateTimeStep(0,time)
>>>>>>> reader.Modified()
>>>>>>> renderer.RemoveVolume(volume)
>>>>>>> volume = vtkVolume()
>>>>>>> volume.SetMapper(volumeMapper)
>>>>>>> volume.SetProperty(volumeProperty)
>>>>>>> renderer.AddVolume(volume)
>>>>>>> window.Render()
>>>>>>>
>>>>>>> Looks like something is not reset, but my color/transfer functions
>>>>>>> are
>>>>>>> static (not changing with the changing scalar ranges).
>>>>>>>
>>>>>>> I could just shrug and go on, but this does not look fine to me so I
>>>>>>> thought
>>>>>>> I'd better ask if it is not a problem somewhere in VTK that should be
>>>>>>> reported.
>>>>>>>
>>>>>>> Dominik
>>>>>>>
>>>>>>> PS. Following the great example of David D. I wanted to set up a wiki
>>>>>>> example, but unfortunately I was unable to find a small (transient
>>>>>>> unstructured) example dataset or an example code to generate one.
>>>>>>> _______________________________________________
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>>>
>>>
>>
>
>
More information about the vtkusers
mailing list