Set opacity based on distance from camera

I have a point source, and I want to set the opacity of the individual points based on the distance from the camera view. Is there a way for me to do this? Interactivity would be nice, but even something that allows me to get individual frames would be okay.

Nothing out of the box, I’m afraid.

One would need to implement a dedicated representation plugin for that.

Isn’t this same as depth-of-field that the ray-tracing (OSPray/Optix) support?

cc: @Dave_DeMarle

Close but not exactly. DOF makes things in general blurrier in the distance instead of more clear. @woodscn you might want to try it out and see if it can achieve a similar enough effect to what you are going for.

A glsl shader tweak (likely exposed within a dedicated representation plugin) that takes z into account when computing alpha could do what you want and should have a neglible render time cost. One constraint is that it has to interact nicely with depth peeling for correctness.

@Dave_DeMarle I’m looking at this, but I’m not seeing any options related to depth-of-field. I’m using Paraview 5.8.0 on Windows. The default settings aren’t doing quite what I want, so it looks like I may need to look into plugins instead.

More specifics.

thanks

And you probably don’t need to go the full plugin route for opacity with distance.

See instead the “Use Shader Replacements” checkbox on the (advanced) display section of the properties tab. In the resulting dialog you can fill in code that gets built into vtkOpenGLPolyDataMapper’s glsl. See https://lorensen.github.io/VTKExamples/site/Cxx/#shaders for some ideas.

I am thinking that this is most likely the best path forward for you.

1 Like

Sounds good. Thanks!