In the same way, godot3 can display textures, godot4 can't.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GiantArtisan

Scene:
-Node2D
–TextureRect

godot3:

extends Node2D
export var height_map:NoiseTexture
onready var texture_rect: TextureRect = $TextureRect

func _ready() -> void:
	var h_map:ImageTexture = domain_warp(height_map,10,0.15)
	texture_rect.texture = h_map

func domain_warp(nt:NoiseTexture,strength:float,size:float)->ImageTexture:
	var out:ImageTexture = ImageTexture.new()
	strength = max(0,strength)
	size = max(0,size)
	
	var data:Array = []
	var minmax:Vector2 = Vector2(INF,-INF)
	for x in range(nt.width):
		for y in range(nt.height):
			var value: = strength * nt.noise.get_noise_2d(size * x,size * y)
			value = nt.noise.get_noise_3d(x,y,value)
			minmax.x = min(minmax.x,value)
			minmax.y = max(minmax.y,value)
			data.push_back(value)

	var bytes:StreamPeerBuffer =  StreamPeerBuffer.new()
	for d in data:
		bytes.put_float(range_lerp(d,minmax.x,minmax.y,0,1))
	
	var  image:Image = Image.new()
	image.create_from_data(nt.width,nt.height,false,Image.FORMAT_RF,bytes.data_array)
	out.create_from_image(image)
	return out

godot4_beta4:

extends Node2D

@export var height_map:NoiseTexture2D

@onready var texture_rect: TextureRect = $TextureRect


func _ready() -> void:
	var h_map:ImageTexture = domain_warp(height_map,10,0.15)
	texture_rect.texture = h_map

func domain_warp(nt:NoiseTexture2D,strength:float,size:float)->ImageTexture:
	var out:ImageTexture = ImageTexture.new()
	strength = max(0,strength)
	size = max(0,size)
	
	var data:Array = []
	var minmax:Vector2 = Vector2(INF,-INF)
	for x in range(nt.width):
		for y in range(nt.height):
			var value: = strength * nt.noise.get_noise_2d(size * x,size * y)
			value = nt.noise.get_noise_3d(x,y,value)
			minmax.x = min(minmax.x,value)
			minmax.y = max(minmax.y,value)
			data.push_back(value)
	
	
	var bytes:StreamPeerBuffer =  StreamPeerBuffer.new()
	for d in data:
		bytes.put_float(remap(d,minmax.x,minmax.y,0,1))
	
	var  image:Image
	image = Image.create_from_data(nt.width,nt.height,false,Image.FORMAT_RF,bytes.data_array)
	out.create_from_image(image)
	return out