-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving Texture3D resource through script does not work in Godot 4 #72993
Comments
Beta 3, really? There's an RC already out, double check if the issue still exists. |
It's still not working on the latest snapshot beta 17. |
Do you mean PR #71394? |
Yes that's it. Edit: Also this one: #70212 |
Duplicate of #66558. |
I'm trying to understand the process of creating the data array for the image.
Could someone help me with this part? Before reading this, my code looked like this:
How do I create an array of type image? And is this the correct loop arrangement? |
A Texture3D is just an array of 2d images. The array should be used to store individual images. The outer most loop appends a new image to the image array. Then an inner loop iterates through each row of the current image and then the innermost loop iterates through each column of that current row setting each pixel of that image. Once done you can create a new Texture3D passing along the array of images to it. |
Thank you! This solved my problem, here is the new code:
|
I believe this issue deserves re-opening, as PR #71394 does not fix the problem for ImageTexture3D in 4.1.1 (a278c1b) The following code should produce a tres file containing the data. Instead, it produces an tres file without data:
The equivalent for Texture2DArray works fine:
I'm not sure if this is really how I'm meant to save as I am still fairly unfamiliar with godot, but it does feel like there is an issue there. |
Yeah, I agree. I'm thinking of contributing a fix if no one gets to it yet. |
Can confirm that ImageTexture3D instance generated from code can't be saved into tres file
Can confirm that ImageTexture3D generated from code can't be saved into valid tres/res file.
Using godot 4.1.1 bd6af8e |
This is a duplicate, please see: |
Godot version
4.0.beta.3
System information
Vulkan, Windows 10 GTX970m
Issue description
Saving Texture3Ds from script is does not work in Godot 4. Someone apparently already fixed it but there's no pr of it yet it seems: Game3DEE@68bb829
Edit: Turns out there's already a pr here: #66558 but it's not merged yet.
Steps to reproduce
First declare an array of type Image to hold each layer of the 3D Texture.
Initialize the Image array in a triple nested for loop where the outermost loop iterates through each each Image creating a new Image for the current layer, and the two inner loops iterate through each Image's x and y pixel coordinates setting the pixel at those coordinates.
Then, create an ImageTexture3D by first declaring ImageTexture3D.new() and then initializing it with ImageTexture3D.create() setting the format to Image.FORMAT_RGBA_8, its dimensions and passing in the image layer array to it.
Finally save the 3D texture using ResourceSaver.save(). Saving as tres outputs a 1x1x1 pink texture and saving as png or tga causes the saver to not write anything to the disk.
Minimal reproduction project
Create a new empty project and follow the steps to to reproduce.
The text was updated successfully, but these errors were encountered: