Repository: godot
Issue: Texture3D import not working when texture has fully opaque and (partly or fully) transparent slices
Labels: bug,topic:import

### Tested versions

Reproducible in: 4.2.2 (stable), 4.3 dev6, 4.0, (maybe?) 3.5.3 (stable)

### System information

Windows 10 - Godot Engine v4.3.dev6.official.89850d553 - https://godotengine.org OpenGL API 3.3.0 NVIDIA 551.76 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU (tested with Forward+, Compatibility and Mobile) - Also tested on a Surface Pro 10

### Issue description

Under certain conditions one cannot import Texture3Ds. One suspicion i have is, that on import Godot removes the alpha channel of textures that are fully opaque (which is quite annoying to begin with). Maybe it removes the alpha channel of the slices that are fully opaque and keeps them on the slices that have some transparency, leading to a mismatch in the format of the slices (RGB8 vs RGBA8). I made a few test textures attached to this with several different (but not all thinkable) cases. They are 512 * 512px with 8 * 8 slices. To be sure the files are not corrupted by the graphic software i made the same textures with different programs and the results were the same.

1.png: import as Texture3D working
2.png: import as Texture3D working
3.png: import as Texture3D NOT working
4.png: import as Texture3D working
5.png: import as Texture3D NOT working
6.png: import as Texture3D NOT working
7.png: import as Texture3D working

error message:
Image format mismatch
Attempting to use an uninitialized RID
servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1416 - Parameter "tex" is null.
Attempting to use an uninitialized RID
servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1416 - Parameter "tex" is null.
Attempting to use an uninitialized RID
servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:767 - Parameter "t" is null.

Godot 3.5.3 error message before forced restart:
ERROR: Condition "header[0] != 'G' || header[1] != 'D' || header[2] != 'S' || header[3] != 'T'" is true. Returned: ERR_FILE_CORRUPT
   at: _load_data (scene/resources/texture.cpp:476)
No error message after forced restart (but not sure if Texture3D was imported correctly.



### Steps to reproduce

Start a new project, drag and drop texture into it. Go to import tab, choose Texture3D with 8 by 8 tiles, hit import button.

### Minimal reproduction project (MRP)

No minimal reproduction project needed (can be done in new project). Here are the textures: 
![1](https://github.com/godotengine/godot/assets/64613417/309ca88a-5467-44d8-a7c6-5140a0c45dd9)
![2](https://github.com/godotengine/godot/assets/64613417/44ff202f-2842-4594-b612-e474763915aa)
![3](https://github.com/godotengine/godot/assets/64613417/7a93d087-d0b2-48be-b2ad-89425553d9f5)
![4](https://github.com/godotengine/godot/assets/64613417/ecd50e67-4e9a-44bc-9d20-6c38251ef651)
![5](https://github.com/godotengine/godot/assets/64613417/363733e8-b988-48c9-8ee1-0bdd0d2a85c0)
![6](https://github.com/godotengine/godot/assets/64613417/8e15a0c0-80d3-4dd3-a2b1-c67c7b46924e)
![7](https://github.com/godotengine/godot/assets/64613417/f1f9e5b1-aa0d-4280-a0e7-8b8884081022)