Glyph with Custom Source orientation


(David Doria) #1

With the Glyph with Custom Source filter, there is an “orient” option that requires Vectors to be set (presumably interpreting 3 values (v_x, v_y, v_z) at each point). If the Custom Source is something like an arrow, then this makes some sense (though which axis of the Custom Source would it align with the Vectors data?). But if the Custom Source is something for which you want to show a “full” orientation, you’d need to provide something like a rotation matrix or quaternion at every point. Is it possible to do this?

Thanks,

David


(Utkarsh Ayachit) #2

The filter merely generates a rotation matrix per point assuming a default orientation (if I am not mistaken, the default orientation is assumed to be along X-axis, it’s one of the 3 coordinate axes for sure). If you go to the advanced properties of the glyph filter (not the custom source one), it should allow you to set a transformation matrix to pre-transform the glyph source being used. For the Custom source version of the glyph filter, you can apply the Transform filter to pretransform the source geometry (you may need to apply Extract Surface after transform just to convert it back to polydata)


(joe insley) #3

While this is a somewhat old thread, I have a similar question. Utkarsh, your suggestion works great for applying the same transformation to all glyphs. What if instead I want to apply a different transform to each individual glyph? More specifically, I want to rotate each glyph a different amount around a given axis (in this case the same axis for every glyph, just at different angles)? Is there a way to do this? I’ve tried orienting the glyphs based on a vector, but I can’t seem to get the glyph to rotate around a single axis using this method. Perhaps I’m just not setting the vector appropriately.

Along these same lines, is there a way, using the custom source version of the glyph filter with a programmable filter as the glyph for instance, to customize each glyph? For example, I want to apply a texture to my custom glyph. And for each glyph I’d like to randomly select the texture that gets used from a list of textures. I suspect I could easily have the programmable filter randomly pick the texture, but does the filter get executed for each glyph? Or would I end up with all of the glyphs using the same texture, but randomly selected each time the pipeline is updated?

Thanks for any help on this.
joe


(Cory Quammen (Kitware)) #4

ParaView does not have an orientation mode that does this in either the Glyph filter or Glyph with Custom Source filter. With the exception of the Box glyph and the 2D glyphs, there is an assumption that the glyph is radially symmetric about the x-axis, so the transformation that rotates the glyphs to line up with a vector may induce a rotation about the glyph’s axis that is assumed not to matter.

However, the 3D Glyphs representation may let you rotate about a specific axis if you set the Orientation Mode property to Rotation. In that mode, the vector array will specify a rotation about each of the X, Y, or Z axes.

Thinking about this, it should be possible, but it is a bit involved. Only one texture can be applied to a polygonal data set in ParaView at a time. You could do a trick where you pack different textures into a single texture and then adjust the texture coordinates applied to each glyph to get the effect you are looking for You’ll need to have some 2d texture coordinates defined in a custom glyph, and then transform the texture coordinates for each glyph so that they map into the different textures you’ve packed into one.

Now, how do you transform the texture coordinates randomly for each glyph? The Programmable Filter will be run once for the entire output of the Glyph with Custom Source filter, so you’ll need to process all glyphs in one execution of the filter. To assign texture coordinates randomly, the filter will need to know something like a “glyph ID” and then map that ID to a texture coordinate transform. You could generate a random mapping ahead of time from “glyph ID” to texture transform and then use that map while processing each point in the glyphed data. The Glyph with Custom Source filter does not produce a “glyph ID” field, but you could apply the Connectivity filter to obtain effectively an ID for each glyph in an array called RegionId, and then apply the Programmable Filter to that (so your pipeline would be Glyph with Custom Source :arrow_right: Connectivity :arrow_right: Programmable Filter).

So, it’s likely possible, but not necessarily straightforward.