-
-
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
TextureLayered subclasses don't serialize properly when created from a tool script #34312
Comments
I wrote a simple wrapper class to work around the problem for the use-case of TextureLayered-powered ShaderMaterials on MeshInstance nodes: It's no fix, but it might help anyone having the same issue in the meantime. |
All TextureLayered classes fail to save properly with ResourceSaver, so save_texarr was added as a temp workaround. see: godotengine/godot#34312
I couldn't get importing of TextureArrays to do anything useful at all in 3.2.2 |
@vwood a bug was introduced in the LayeredTexture importer in 3.2.2, fixed in 3.2.3 |
Working on Cartographer I ran into a lot of bugginess in TextureArray in Godot 3.2. You can't save a TextureArray in the scene, or in a It looks like they're getting some attention in 4, but for now the importer is the only stable way to create TextureArrays natively, but its usefulness is limited. So, long story short; I ended up creating a custom ResourceSaver for TextureArrays that saves them in the same format that the importer does, as a I also created a custom EditorImportPlugin for TextureArrays that builds them from simple JSON files. Just describe the TextureArray as a JSON structure of other images or textures, and the importer bungs them all in the TextureArray. If they're useful to you, or others, I can extract them as a standalone plugin. |
@arccoza Have you seen the TextureLayeredMesh add-on? If so, what did it miss? |
Hey @Calinou, sorry for the very slow response, I've had no time for Godot recently. While fishing through Godots importer code for hints, I realized you only need a custom Unfortunately the importer doesn't expose its |
So, I've ran into this issue recently while trying to use precomputed/procedurally generated 3D textures to accelerate a raymarching shader which renders all sorts of nebulae in a space sim game. I'd like to thank @Shfty for his workaround Thank you. |
As far as I know, nobody has looked at fixing this in the |
I've extracted the tools and UI from Cartographer for working around this as a stand-alone plugin; BetterTextureArray, get it here: https://github.com/awkwardpolygons/better-texture-array |
Godot 3.3.2.stable.official on windows 10 After struggling with creating a Texture3D from a tool script, which seems to work, and being unable to save and restore the resulting resource, I ran into a few interesting error messages.
In either case the output file appears but with suspiciously low file size. As expected, these resources won't load and give
If you try to use ResourceSaver to save the Texture3D during runtime, not in a tool script, you get a similar message in the debugger (this one is for target file = .res)
and the resulting file will similarly not load in the editor. Epilogue: I installed arccoza's plugin mentioned above and now I can save my generated Texture3Ds as .tex3d files and it works very well! Cheers and I hope this is incorporated into Godot at some point! |
Apologies for bumping this thread without any significant new information. I wanted to drop in to say that I was also tearing my hair out at Godot's default behaviour when attempting to save a 3D texture from a tool script. In my case I was generating a Texture3D with various noises in different channels, for some shader effects at runtime (to avoid a very expensive cost to generate the noise in the shader). I don't think this is a particularly rare or obscure use-case but I appreciate it might not be a high priority to resolve. But thank god I managed to find this conversation. @arccoza's addon works flawlessly to solve the import issue, while also adding some incredibly useful functionatlity to view the texture in editor (per channel even!). It would be great if this was added to Godot at some point, at least a fix for the saving/importing issue. |
Fixed by #71394. |
Godot version:
3.1.2 / 3.2 beta 3
OS/device including version:
Windows 10 Pro 10.0.18362 Build 18362
Issue description:
TextureLayered resources (as well as their Texture3D and TextureArray subclasses) can be created without issue via the import process by selecting the appropriate Import As option, but creating them from a tool script results in instances that can't be serialized.
I've been trying to use a TextureArray to implement a mipmap-friendly texture atlas for the Qodot project, which works well, but can't be saved into a scene due to this issue.
Steps to reproduce:
ERROR: Resource was not pre cached for the resource section, bug? At: scene/resources/resource_format_text.cpp:1372
-
ERROR: _set_data: Condition ' !img.is_valid() ' is true. Continuing..: At: **scene/resources/texture.cpp:2093**
Minimal reproduction project:
TextureArrayBug.zip
The text was updated successfully, but these errors were encountered: