# DrawTexture3DVolume(Texture, float, float, FilterMode, bool, Gradient)

> Draws a 3D texture using Volume rendering mode in 3D space.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static void DrawTexture3DVolume(Texture texture, float opacity = 1, float qualityModifier = 1, FilterMode filterMode = FilterMode.Bilinear, bool useColorRamp = false, Gradient customColorRamp = null)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The volumetric texture to draw.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The non-linear volume opacity modifier. Use this to control the opacity of the visualization. Valid values are 0-1, inclusive. A value of 1 is fully opaque and a value of 0 is fully transparent. The default value is 1.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Sets the sample per texture pixel count. Higher values result in a higher quality render. The default value is 1.**** (\[FilterMode]\(/engine/6000.0/script-reference/unityengine/filtermode)): Sets the texture filtering mode to use.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Enables color ramp visualization.**** (\[Gradient]\(/engine/6000.0/script-reference/unityengine/gradient)): The custom gradient that Unity uses as a color ramp. If this is not specified, Unity uses [Google Turbo color ramp](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html).

### Remarks

![3DTextureHandleTeapotVolume (DrawTexture3DVolume(Texture, float, float, FilterMode, bool, Gradient))](/api/media?file=/engine/6000.0/media/images/3DTextureHandleTeapotVolume.png)

*Teapot volume rendered with a gradient that has a transparent black outline.*

![3DTextureHandleFireVolume (DrawTexture3DVolume(Texture, float, float, FilterMode, bool, Gradient))](/api/media?file=/engine/6000.0/media/images/3DTextureHandleFireVolume.png)

*Noise volume with fire gradient applied.*

```csharp
using UnityEditor;
using UnityEngine;

[ExecuteInEditMode]
public class Reference : MonoBehaviour
{
    public Texture3D texture;
    public float alpha = 1;
    public float quality = 1;
    public FilterMode filterMode;
    public bool useColorRamp;
    public bool useCustomColorRamp;

    // We should initialize this gradient before using it as a custom color ramp
    public Gradient customColorRampGradient;
}

[CanEditMultipleObjects]
[CustomEditor(typeof(Reference))]
public class Handle : Editor
{
    private void OnSceneViewGUI(SceneView sv)
    {
        Object[] objects = targets;
        foreach (var obj in objects)
        {
            Reference reference = obj as Reference;
            if (reference != null && reference.texture != null)
            {
                Handles.matrix = reference.transform.localToWorldMatrix;
                Handles.DrawTexture3DVolume(reference.texture, reference.alpha, reference.quality, reference.filterMode,
                    reference.useColorRamp, reference.useCustomColorRamp ? reference.customColorRampGradient : null);
            }
        }
    }

    void OnEnable()
    {
        SceneView.duringSceneGui += OnSceneViewGUI;
    }

    void OnDisable()
    {
        SceneView.duringSceneGui -= OnSceneViewGUI;
    }
}
```

Additional Resources: [Handles.DrawTexture3DSDF](/engine/6000.0/script-reference/unityeditor/handles/drawtexture3dsdf.md), [Handles.DrawTexture3DSlice](/engine/6000.0/script-reference/unityeditor/handles/drawtexture3dslice.md), [Texture3D](/engine/6000.0/script-reference/unityengine/texture3d.md), [Gradient](/engine/6000.0/script-reference/unityengine/gradient.md).
