2
$\begingroup$

I have a set up where there's a box with holes (dice) with a point light inside it, with volumetric settings, so that the rays coming out of the cube are visible.

The problem is, you can't barely see the cube itself.

Is there a way to add another light that faces the cube which is not affected by the volumetric settings?

I thought of doing it in [two different passes][1], but I was curious if this is achievable, by say, setting that new light to ignore any volumetric effects.

Similar question: Lighting specific objects in cycles with volumetric atmosphere

$\endgroup$
  • $\begingroup$ Check this out and see if it's helpful. Make a Grassy Meadow in Blender. Andrew Price makes a grassy meadow. The link should go directly to the point in the video where he goes through the volumetric mist. $\endgroup$ – Duane Dibbley Sep 4 '16 at 20:41
2
$\begingroup$

I'm not using a volumetric world here, so in essence this doesn't answer your specific question, but it does make the light rays coming out of the die visible, while preventing the volumetrics from affecting any other objects. I hope it does solve your problem.
I won't go into modelling the die, because I assume from your question that you already figured that out. However, once you've placed your holes, don't delete the faces. Instead make sure the faces of all the holes are selected, then press AltE to bring up the Extrude options followed by V to extrude along vertex normals. Then drag your mouse or type in how far you want to extrude, confirm with Enter or LMB, and hit CtrlNumpad+ once to expand the selection, to get something like this.

enter image description here

Create two materials, and assign one of them to the now selected faces. This will be the volumetric material. Here's the node setup.

enter image description here

The Position socket of the Geometry node gives the coordinates of the shading point.
The mapping node here really does nothing, but I included it for completeness. Use its location values if the die is not located at the world origin (0,0,0) and its scale values if you want the falloff to be different along the X, Y and Z axes.
The Separate XYZ separates the location vector into three values.
The following math nodes upto and including the last Power node, calculates the distance from the centre of the die, by use of the The Distance Formula in 3 Dimensions.
The Divide node set the outher threshold. Enable Clamp on this one.
The ColorRamp lets you finetune the falloff. Make sure you flip it, by clicking the double arrow, to get the black at the right end and white at the left end. By adding more control points in the ramp and changing each point and/or changing from linear to something else, you can get very precise control over the falloff.
The Multiply node following the ramp sets the maximum density. I've input it into a Volume Scatter, but you can use Volume Absorption or emission, or any combination of two of them or even all three, by use of Mix and/or Add shaders.

Here is the result.

enter image description here

I've used a cube and square holes. The cube is placed at the world origin, where there is also a point lamp with default settings. Environment light is turned off, and the external light comes from a sun lamp.

$\endgroup$
  • $\begingroup$ Hey, really sorry for the late reply, even though it's not strictly what I was hoping to find, it works perfect for what I needed! $\endgroup$ – Minkiu Oct 18 '16 at 21:55
  • $\begingroup$ @Minkiu Glad I could help. :) $\endgroup$ – Duane Dibbley Oct 18 '16 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.