Monthly Archives: April 2014

Procedural BarChart Substance Material


today we submitted a new asset for the Unity asset store. We’ve been using Substance Designer for quite a while now and are happy to announce the publication of a nice material we’ve been using internally for some project.

You can check out the video on YouTube or Vimeo!

Basically, we wanted to display a bar chart inside the 3D world without building the chart elements out of game objects. This is where the procedural materials are very useful. We created a substance that does allow for lots of tweaking.

Here are some screenshots of the game window:

Screenshot 1

Screenshot 2

For example you can display up to 8 bars, change the width and some other visual settings. You can edit the texture inside the editor to generate just what you need, or you can change the texture via script to adjust values, colors, and any other property. You can even use a GUI texture to display charts on your HUD and update it, e.g. for a simple health bar.

Here is a screenshot to show you the tweaks:


To make it actually useful, we added some example scenes to get you started, in case you are not already fully familiar with using substances inside Unity. Here is an example script that does change all values randomly:

/// Sample script to set the bar values randomly
/// ----------------------
using UnityEngine;
using System.Collections;

public class RandomBars : MonoBehaviour
public ProceduralMaterial bar; // reference to the bar chart substance

void OnMouseDown() // this is called when the object is clicked (here the display)
for (int i = 1; i < 9; i++)
bar.SetProceduralFloat("Val" + i, Random.Range(0.1f, 0.9f)); // set all values to some random value

bar.RebuildTextures(); // update the procedural material

Happy charting!