Hey so I am trying to create a ImageTexture3D through Godot so I can make a LUT file and sample it in my shader. Using .new() doesn’t work at all, seems like I am using unitialized rids. How can I initialize them?
func make_lut():
var imageArray:Array[Image] = [];
var sizea:Array = range(size + 1);
var fsize:float = float(size);
for r in sizea:
for g in sizea:
var img:Image = Image.new();
img.create_empty(size + 1, size + 1, false, Image.FORMAT_RGB8);
print("img made %s" % img);
for b in sizea:
var color_in:Color = Color(r/fsize, g/fsize, b/fsize);
img.set_pixel(r, g, transform_color(color_in));
imageArray.push_back(img);
image3D = ImageTexture3D.new();
image3D.create(Image.FORMAT_RGB8, size + 1, size + 1, size + 1, false, imageArray);
func transform_color(color:Color)->Color:
print("%s -> %s" % [color, color]);
return color;
These errors show up:
hi making lut
img made <Image#-9223352691650909176>
(0, 0, 0, 1) -> (0, 0, 0, 1)
Attempting to use an uninitialized RID
servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:767 - Parameter "t" is null.
Attempting to use an uninitialized RID
Attempting to use an uninitialized RID
I checked out the Rendering Server class, but all the create()s need an image, and every place I check in the internet is using Image.new(). What am I doing wrong?