Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

CurveTexture

继承: Texture2D < Texture < Resource < RefCounted < Object

一维纹理,其中像素亮度对应于曲线上的点。

描述

1D 纹理,其中像素亮度对应于 Curve 资源上的点(以灰度或红色来表示)。这种视觉表示简化了将曲线保存为图像文件的任务。

如果需要在单个纹理中,存储最多 3 条曲线,请改用 CurveXYZTexture。另见 GradientTexture1DGradientTexture2D

属性

Curve

curve

bool

resource_local_to_scene

false (overrides Resource)

TextureMode

texture_mode

0

int

width

256


枚举

enum TextureMode:

TextureMode TEXTURE_MODE_RGB = 0

将曲线平均存储在红色、绿色和蓝色通道上。这会使用更多的显存,但与只读取绿色和蓝色值的着色器更兼容。

TextureMode TEXTURE_MODE_RED = 1

仅将曲线存储在红色通道中。这可以节省显存,但某些自定义着色器可能无法使用它。


属性说明

Curve curve

  • void set_curve ( Curve value )

  • Curve get_curve ( )

渲染到纹理上的 Curve


TextureMode texture_mode = 0

生成纹理时应使用的格式。当将 CurveTexture 作为输入传递给 Shader 时,可能需要调整。


int width = 256

  • void set_width ( int value )

  • int get_width ( )

纹理宽度(单位为像素)。较大的值能够更好地表示高频数据(例如方向的突变),但会增加生成时间和内存占用。