Volumetric Shader, fade to invisible toward edges

I’m wanting to play with making some nebulas for a space scene and I’m wanting to use an emission shader hooked up to the volume of a mesh with a voronoi texture to give it a smokey look. The problem is I don’t like it when the voronoi texture gets cut off by the edge of the object, making the mesh shape visible.

Is there a way to use a gradient or something to make it fade to invisible as it approaches the edges of the mesh? I’ve been playing with the gradient and voronoi nodes all day and haven’t had any luck except to create a spherical gradient in the center of the mesh, and I’d prefer that the shape not be spherical. I’d like to have a linear gradient extending in from the faces just a little ways.

I’d appreciate any help anyone can give me.

Moved from “General Forums > Blender and CG Discussions” to “Support > Materials and Textures”

I was playing with the mapping node, I just haven’t figured out all of how it works yet. Thanks though, at least I know I’m on the right track. Thanks for the link too, that should be a big help.

I found selected figure and Emission shader helps a lot to explore Mapping node…


Instead of the mapping node, it’s also possible to use math nodes in each axis of the coordinate system, by separating them with the separateRGB or separateXYZ, using Add as translation, and Multiply as scale. Rotation is also possible with sines and cosines.
This is the method I normally use, because i can connect other nodes to the desired transformations.

the mixRGB is also usefull for multiplying and adding vectors/coordinates.