Substance Dynamic Texture Size

One of the key benefits of Substances or Procedural Materials as Unity refers to them, is to be resolution independent. Now I would really appreciate if I could set the target texture size at runtime. This would let me do some math based on client CPU, GPU and Screen Size do determine how big the textures need to be.

I can’t find the property in the procedural material class.
Does it mean it cannot be set at runtime ? Am I missing something ?

You can modify the resolution at runtime using “MySubstance.SetProceduralVector(”$outputsize" ,new Vector4(9,9,9,9));"

9 being actually 2^9 = 512, so 10 will be 1024, etc.

It’s not documented but it’s there :slight_smile:

Hi,

You should try this:

if (GUI.Button(new Rect(10,10,60,20), "256x256"))
{
    ProceduralMaterial substance = renderer.sharedMaterial as ProceduralMaterial;
    if (substance)
    {
        substance.SetProceduralVector("$outputsize", new Vector4(8.0f, 8.0f, 0.0f, 0.0f));
        substance.RebuildTextures();
    }
}