Class NoiseTexture2D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Uses the FastNoiseLite library or other noise generators to fill the texture data of your desired size. NoiseTexture2D can also generate normal map textures.
The class uses GodotThreads to generate the texture data internally, so GetImage() may return null
if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image and the generated byte data:
var texture = NoiseTexture2D.new()
texture.noise = FastNoiseLite.new()
await texture.changed
var image = texture.get_image()
var data = image.get_data()
public class NoiseTexture2D : Texture2D, IDisposable
- Inheritance
-
NoiseTexture2D
- Implements
- Inherited Members
Constructors
NoiseTexture2D()
public NoiseTexture2D()
Properties
AsNormalMap
If true
, the resulting texture contains a normal map created from the original noise interpreted as a bump map.
public bool AsNormalMap { get; set; }
Property Value
BumpStrength
Strength of the bump maps used in this texture. A higher value will make the bump maps appear larger while a lower value will make them appear softer.
public float BumpStrength { get; set; }
Property Value
ColorRamp
A Gradient which is used to map the luminance of each pixel to a color value.
public Gradient ColorRamp { get; set; }
Property Value
GenerateMipmaps
Determines whether mipmaps are generated for this texture. Enabling this results in less texture aliasing in the distance, at the cost of increasing memory usage by roughly 33% and making the noise texture generation take longer.
Note: GenerateMipmaps requires mipmap filtering to be enabled on the material using the NoiseTexture2D to have an effect.
public bool GenerateMipmaps { get; set; }
Property Value
Height
Height of the generated texture (in pixels).
public int Height { get; set; }
Property Value
In3DSpace
Determines whether the noise image is calculated in 3D space. May result in reduced contrast.
public bool In3DSpace { get; set; }
Property Value
Invert
If true
, inverts the noise texture. White becomes black, black becomes white.
public bool Invert { get; set; }
Property Value
Noise
The instance of the Noise object.
public Noise Noise { get; set; }
Property Value
Normalize
If true
, the noise image coming from the noise generator is normalized to the range 0.0
to 1.0
.
Turning normalization off can affect the contrast and allows you to generate non repeating tileable noise textures.
public bool Normalize { get; set; }
Property Value
Seamless
If true
, a seamless texture is requested from the Noise resource.
Note: Seamless noise textures may take longer to generate and/or can have a lower contrast compared to non-seamless noise depending on the used Noise resource. This is because some implementations use higher dimensions for generating seamless noise.
Note: The default FastNoiseLite implementation uses the fallback path for seamless generation. If using a Width or Height lower than the default, you may need to increase SeamlessBlendSkirt to make seamless blending more effective.
public bool Seamless { get; set; }
Property Value
SeamlessBlendSkirt
Used for the default/fallback implementation of the seamless texture generation. It determines the distance over which the seams are blended. High values may result in less details and contrast. See Noise for further details.
Note: If using a Width or Height lower than the default, you may need to increase SeamlessBlendSkirt to make seamless blending more effective.
public float SeamlessBlendSkirt { get; set; }
Property Value
Width
Width of the generated texture (in pixels).
public int Width { get; set; }
Property Value
Methods
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.