# Make further objects blurry?

I have the following function:

normalSpheres =
Table[Sphere[RandomVariate[NormalDistribution[0, 10], 3], .2], {500}];

Manipulate[
Graphics3D[normalSpheres, Background -> Black, ViewAngle -> 1,
ViewVector -> {{50 Sin[t], 50 Cos[t], 0}, {0, 0, 0}},
ImageSize -> Large], {t, 0, 2 Pi}]


I want to imbue this with a feeling of depth though. The best way I can think of is by creating a blur effect for each Sphere that increases the further away the object is from the ViewPoint (or ViewVector[[1]] in this case).

Does anybody have any tips on how I could achieve this?

P.S. sorry if the GIF makes anyone dizzy...

Keyword: depth of field

• It's hard to do blurring of any sort — depth of field, motion blur, etc. — in the traditional hardware rendering pipeline, which is what I believe Mathematica uses for its 3D graphics. To depict fuzzy, blurry things (like smoke and fire) in games one typically uses sprites, i.e. predefined 2D images with transparency that are inserted into the 3D scene. One could try the same thing here by precomputing images of 3D spheres with varying amounts of blur. But that's more work than I'm willing to attempt right now :)
– user484
Commented May 16, 2014 at 4:03
• What's your main goal? 1. If it's just creating a sense of depth, I think ybeltukov's solution is great and better than blurring. 2. If you want blurring, export the scene from Mathematica and use tools which are designed for the purpose, such as Blender. 3. If you simply want to push the boundaries of what's possible with Mathematica, and doing it with Mathematica is more important than getting the best possible result, then perhaps indicate this in the question. Commented Mar 1, 2015 at 19:01
• Related: (6242) Commented Oct 28, 2016 at 16:41

In spirit of djp's answer: one can put a point lighting source at the camera position to distinguish distances to spheres.

With the option

Lighting -> {{"Point", White, ImageScaled@{0, 0, 0}, {0, 0, 5}}}


I obtain

Show the spheres together with a black semi-opaque bitmap. It gives "fog", but not blur.

spheres =
Table[Sphere[
RandomVariate[UniformDistribution[{0.2, 0.8}], 3], .01], {100}];
cube = {{{RGBColor[0, 0, 0, 0.07]}}};
c = Image3D[cube];
s = Graphics3D[spheres, Background -> Black, ImageSize -> Large];
Show[s, c]


It gives distance, but not depth of field. I tried to achieve depth of field by using a series of slabs where I applied "Blur" to each slab, but it didn't work --- the documentation claims that Blur works with 3D images but IMHO it doesn't.