Handles.DrawTexture3DSDF

Cambiar al Manual
public static void DrawTexture3DSDF (Texture texture, float stepScale= 1.0f, float surfaceOffset= 0.0f, Gradient customColorRamp= null);

Parámetros

textureThe volumetric texture to draw.
stepScaleThe number by which to multiply the ray step size. The ray step size is the distance between 2 neighboring pixels. The default value is 1.
surfaceOffsetThe intensity of the pixels at which the surface is rendered. When this value is positive, Unity will expand the rendered surface. When this value is negative, Unity will render empty space as a surface, and a surface as empty space. The default value is 0.
customColorRampThe custom gradient that Unity uses as a color ramp. If this is not specified, Unity uses Google Turbo color ramp.

Descripción

Draws a 3D texture using Signed Distance Field rendering mode in 3D space.

This visualization mode supports only non-directional Signed Distance Fields.


Corridor SDF visualized using Google Turbo color ramp.

using UnityEditor;
using UnityEngine;

[ExecuteInEditMode] public class Reference : MonoBehaviour { public Texture3D texture; public float stepScale = 1; public float surfaceOffset; 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.DrawTexture3DSDF(reference.texture, reference.stepScale, reference.surfaceOffset, reference.useCustomColorRamp ? reference.customColorRampGradient : null); } } }

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

void OnDisable() { SceneView.duringSceneGui -= OnSceneViewGUI; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961