8
$\begingroup$

How can I control the volume density values at different locations in a mesh with volume shaders?

I know that noise textures can be plugged in to the density factor slot of a volume shader (producing a sponge-like effect as in the example below) for instance, but what other ways are there to control the density pattern inside a mesh? Are there ways to achieve more controlled/less random patterns?

noise volume texture example

$\endgroup$
1
  • $\begingroup$ You can use any texture you want.. What kind of pattern do you have in mind? $\endgroup$
    – gandalf3
    Commented Mar 29, 2014 at 1:14

1 Answer 1

16
$\begingroup$

Yes, you can use any set of 3D values (e.g. procedural texture) you want (note that this means you can't use image textures. This is because you need the texture to be defined in 3D, and of course a image texture is 2D.
See the wiki for a list of cycles textures with descriptions.

The density is controlled by the value (brightness) of the texture.
Consider this node setup:

enter image description here

Where the texture is white (1), the density will be 1. Where it is black (0), the density will be 0.

Because a density of 1 is still very faint, I have added a multiply node to scale the white portions of the texture to 20 instead of 1:

enter image description here

As an example for non-procedural texture information, this setup will make the density based on the global X location of the object (with some math nodes to avoid volumes with negative density):

enter image description here

enter image description here

$\endgroup$
4
  • $\begingroup$ I have used the other procedural textures with volume shaders as well. What I mean to ask is, are we 'limited' to the current selection of procedural textures, or are there other ways to define the volume density at different points inside a mesh? Is there a way to make the density at a point a function of its local or global coordinates, for instance (set the density equal to the tangent of the local x coordinate at that point)? Are there ways to switch to different volume shader subtrees if the z coordinate is between 1 and 3 blender units away from the local object origin? And how... $\endgroup$
    – Qutorial
    Commented Mar 29, 2014 at 13:21
  • $\begingroup$ @Qutorial You don't have to use procidural textures, anything that returns a value will work. $\endgroup$
    – gandalf3
    Commented Mar 29, 2014 at 21:54
  • $\begingroup$ Is there a rule of thumb or list of what's compatible with the density input (what sockets will output a density field/values in 3 dimensions)? $\endgroup$
    – Qutorial
    Commented Oct 3, 2015 at 3:55
  • $\begingroup$ @Qutorial In general everything works, but things which are inherently 2D don't give you very obviously useful results (no doubt you could find some creative use for them). Experiment and see what happens :) $\endgroup$
    – gandalf3
    Commented Oct 3, 2015 at 6:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .