How to: Audio spectrum cubes in Blender

audio visualization
In this tutorial you will learn about advanced audio visualization techniques.
Software : Blender
Difficulty : Intermediate
Scene file available for free

Get the download link by clicking and sharing one of the button below.

Nice, you found it!


This is the text version of the voice over.
Welcome to Fermi CG dot net. In this tutorial we are going to create awesome audio spectrum effect in Blender.
Remember we already covered the audio visualization effect in previous tutorial. This is the scene file we are going to create.
If I play the scene you can see what is happening inside.
If we jump to the rendered view, you can clearly see the shading effect.
Now the cubes get shaded with different colors and are affected with the audio spectrum.
Skip to the solid shading.
See we have a lot of element in this scene. We are just going to recreate it from scratch.
Remember this is going to be a long tutorial.

Create a new scene by going, File, New.
We don’t need the default cube now. Simply delete it by pressing delete or X key.
We need to set the scene.
Change the render resolution to HD 720 p.
Change the output tab to a custom folder.
Click on create new directory and rename the folder.
Open it and press accept.
Now save the scene by clicking file, save as.
Give a desired name.
We need to add the text first.
Click on add and chose text.
Jump to properties tab and find the text tab. It is denoted with an F symbol.
I am not going to change anything here except the alignment. Change it to center.
Change the characters by pressing tab and replace the letters as you wish.
Press tab again to get rid of the edit mode.

In the property tab double click on text and rename to text f. In the viewport, press shift d to duplicate.
Rename the duplicate to text m. In order to get the dynamics to work properly we need to change the text to a polygon.
Go to object, convert to, mesh from curve or text.
This will cause the text to become a polygon. Now we lost the ability to change the text but get ability to add real polygon options.
If you click on property tab you can see the vertices option and particle options are turned on.
Duplicate the converted text once again.
Select the text f and move it to the last scene layer by pressing m. Also move the text m.001 to the last layer.

Select text m and go to object property tab and turn on wire and show all edges under display. This allows us to visualize the scene properly in non edit mode.
Zoom to see the cuts. See we have odd cuts on the text. This will cause a lot of problem for our simulation. We need to create even cuts. Either we can manually cleanup the mesh or by using modifiers. Definitely we are going to use modifiers because it is the easiest.
Click on the modifier tab and chose solidify. This will add extra depth to the mesh. Increase the thickness and press apply.
Add a remesh modifier.
Turnoff remove disconnected mesh option.
Increase the octree depth to 7. Change the scale value to 0.4.

We need to get the cubes placed inside this mesh like this image. You can see the actual text inside these cubes. Also there are other cube elements present.
We need only the top faces of the text element.
Jump to front view and chose face selection. Select all the faces except the top area by pressing b. make sure that you selected the correct faces. Delete those faces by pressing delete and chose faces.
Duplicate the resulted mesh in object mode. Rename it by adding a copy. Move it to the second last render layer.
Jump to particle tab and click new.
Rename the particle settings to text cube.
Turn off the normal velocity to zero.
Under field weights tab turn off the gravity to zero. Play the scene to see the particles in action. Nothing happens!
We made a small mistake. We chose the wrong mesh.
Select the second last layer and see the particles. Also increase the particle per face to one.
To avoid confusion we can move this mesh back to the first layer. Press m and chose laye1.
Also move the text m to the second last layer.
Rename the text m copy to particle emitter.

Now we need something to instance copy.
Add a cube mesh to the scene.
Add a new material and change the color. Rename the material to cube.
Also rename the cube to cube text.
Move it to the side so we can see the particles.
Select text particle and chose object under render option.
Chose cube text as object.
See now our text is filled with cubes.
Change the size to 0.02.
We need to increase the upscale of the particles.
So select the cube and scale it in z axis. Now the problem is we have the particles with z scale in both directions. We don’t need that. So undo the scaling.
In orthographic view, place the pivot at the bottom of the cube.
Go to object, transform, origin to 3d cursor.
Scale in z axis to desired value.

Move the cube to the last layer.
Remember to save the scene periodically.
Change the renderer to Cycles.
Do a viewport rendering.
We need to add random colors to the cubes.
Select the cube and go to material tab.
Turn on use nodes.
This will add a diffuse material.
You can change the diffuse color and see the result.
But in order to get random colors we need to add some connections.
Make some room towards the right.
Change the properties tab to node editor.
Get rid of tool box by pressing n.

Click add, input, object info.
Connect the random output to the color input.
This will change the instance to change the color to random color in grayscale.
We need to add another node to get some colors.
So go to add, color, hue and saturation. Drag and drop it between object info and diffuse node.
Reconnect the random to hue node.
And change the color to red.
Also plug the random node to factor of hue node.
If you play the scene, there is no color change.
Jump back to properties menu.
Change the life time to 25.
Random to 1.
End to 250.
Change to solid mode.
Play the scene to see the effect.
Increase the number to 4000.
Change to render mode and see the result.
Play the scene to see the result.
 Do a particle cache.
Turn on disc cache.
Add a name to the cache.
Click bake.

Chose the second layer.
We need to add the musical cubes.
So go to add, object, grid.
Change the radius to 2.
X subdivisions to 20.
Turn on wire and draw all edges to see the cuts properly.
Change the x, y and z transformation to 0.
Scale the grid enough to cover the text.
Shift select the second layer to see the text.
Change to edit mode.
Do a subdivide.
Rename it to grid cube.
Skip the edit mode and duplicate it.
Move it to third last layer.
Go to the last layer and select cube.
Duplicate it.
Rename it to cube grid.
Duplicate the cube material by pressing the plus button.
Rename to cube grid.
Go back to second layer.
Select the grid and apply new particle settings.
Click on the particle settings and chose the first one. This is the text particle.
Play the scene and see the effect.
We can duplicate the particle settings by clicking the 2 icon in particle settings.
Rename to grid particles.
Delete the cube text under object selection.
Chose Cube grid as object selection.
Select cube grid in outliner and change to rendered view.
We need to assign different shading to these cubes.
Change to node editor.
Delete the object info node.
Add a particle info node.
Plug the location to the hue.
Back to properties.
Select the grid cube.
Change the end value to one.
Life time to 250.
Random to 0.
Change the number to 600.
We need to add the text mask for the grid.
So in second last layer, select the text m.
Add a solidify modifier.
Add some thickness and apply.
In the second layer select grid and add a Boolean modifier.
Move the Boolean to the top.
Change the operation to difference.
Chose text m as object
Press apply.
In edit mode delete the extruded faces.

Now change to blender render.
Chose texture.
Click new.
Change type to voroni.
Turn off time under influence.
Turn on density and size.
Rewind the scene to see the effect.

Add a single key frame for offset x and scale x.
Change to animation mode.
Select key, bake sound to F-curve.
Select the sound file and bake.
Play the scene to see the effect.
Change to default view.

Add a speaker object.
Select the same sound file used for baking.
Play the scene to see the sound visualization.

Select the grid cube and go to particle settings.
Change the emission number to 2000.
Change to cycles renderer and render.
Shift select the first layer.

Time to add musical lights.
Turn back to solid mode.
Select the grid cube.001 and also third last layer.
Move it to third layer.
Shift select second and third layer.
Select the first layer and delete the default light.
Select the grid cube and move it upwards.
Rename the grid cube.001 to grid light.
 Go to particles and add new.
Select the particle settings.002.
Duplicate the particle settings.
Rename to light grid.
Remove the dupli object.
Add a mesh plane.
Add new material.
Rename to light.
Change to emission.
Rename the plane to light plane.
Move the light plane to last layer.
Select the grid light.
Choose the light plane as dupli object.

Change to rendered view.
Under particle settings turn off the emitter rendering.

Change the end value to 250
Life time to 50.
Random to 1.
Number to 300
Turn off wire and draw all edges.
Also choose the bounding box.
Now increase the particle size to 0.19.
Change to rendered view.
Now select the light plane and under object properties, turn off camera ray visibility.

Change to node editor.
Add a particle info node.
Plug the size to strength.
The size value is not enough to produce the necessary lights.
So add, convert, math node and drop it between particle info and emission node.
Increase the value to 4.

Do a disk cache for all the particles.
Add a good camera angle, set the render settings like sampling to get a good renders.
If you want to know more about rendering watch my previous tutorials.

No comments: