Object with custom opacity gradient
I expect you want more than this.. but it's a start ..

In principle, you can just make the color or density of a volume absorption shader a function of your chosen texture space. Here, Object Space is used. Its origin is at the object's origin, and is measured in Blender units along the object's local axes. So this default cube has 0 a its center and runs from -1 to 1 in all directions.



The function here is e^ -(x^2 + y^2 + z^2)..



Instead of mapping to a gradient, you could put in a threshold, map to Alpha instead.. all sorts, it depends exactly what you want..