Texture3D not working in Unity Plus

Hi,

Is Texture3D supported in Unity plus or just Unity pro? I couldn’t find that specific info anywhere.

I’m currently running Unity plus and trying to create a voxel based vector field texture for some DirectCompute fluid sim/ particle system work I’m doing.

If it is supported, can someone tell me what I am doing wrong? The texture seems to be created fine (i.e. it has colors when I open it in the inspector.)

Here’s my code for creating the texture:

void CreateVectorFieldTexture()
    {
        int idx = 0;

        int res = (int)_vectorField._fieldInfo[0].Resolution.x;
        var data = new Color[res * res * res];

        _vectorFieldTexture = new Texture3D(res, res, res, TextureFormat.RGBAFloat, true);
        _vectorFieldTexture.name = "VectorField";
        _vectorFieldTexture.filterMode = FilterMode.Trilinear;
        _vectorFieldTexture.wrapMode = TextureWrapMode.Repeat;

        for (int x = 0; x < res; x++)
            for (int y = 0; y < res; y++)
                for (int z = 0; z < res; z++)
                {
                    Color c = new Color();
                    var dir = _vectorField._vectorInfo[x + res * y + res * (x + y)].Direction;
                    c.r = dir.x;
                    c.g = dir.y;
                    c.b = dir.z;

                    data[idx] = c;

                    idx++;
                }
        _vectorFieldTexture.SetPixels(data);
        _vectorFieldTexture.Apply();
    }

Binding the texture…

        ComputeKernels.SetTexture(0, "_vectorField", _vectorFieldTexture);

And the shader code…

Texture3D<float4> _vectorField : register(t0);
SamplerState sampler_vectorField : register(s0)
{
    Filter = MIN_MAG_MIP_POINT;
    AddressU = Clamp;
    AddressV = Clamp;
};



[numthreads(NumThreads, 1, 1)]
void UpdateParticles(uint3 id : SV_DispatchThreadID)
{
   Particle p = Particles[id.x];
// should sample the texture at mip level 0
   p.velocity = _vectorField.SampleLevel(sampler_vectorField, float3(.2,.3, .1), 0);
   Particles[id.x] = p;
}

The sampler is returning 0,0,0 no matter where I sample from. Not sure what I’m doing wrong…

Any ideas greatly appreciated!

Oops I meant to put this in the regular Graphics section. Mods plz delete this one…