-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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 & reloading precedurally generated textures #16678
Comments
What are the functions you use? Image.load(path) and ImageTexture.create_from_image(Image)? |
Ref< StreamTexture > n; |
IIRC, Edit: might be related to #14879 Also just saw that you use StreamTexture. Try using ResourceSaver::save("... .tres") to save it instead of png. |
The technique you suggested works |
This is now causing me another problem, The Image and ImageTexture I create is being saved into my scene making it bloat out to like 200mb! Seems I need to emulate what EditorFileSystem::get_singleton()->reimport_files(reimports); is doing but i can only do this in the editor doing it this way stops some image being saved into my scene. |
But if it's generated, why are you adding it to the scene? You can create an ImageTexture, save it with ResourceSaver somewhere (so it's not part of your scene), then load it when needed, |
I generate a normal map from a height map then save it. Then I load it and apply it to the terrain material so there map maker can see the normals. |
Right after a good sleep I have this almost working using the following steps:
1a. if in the editor, I tell the editor to re-import the texture so I can load it ASAP:
There is a 'gotcha' here in that because I am applying the procedural texture in the editor, it is being saved into the scene. So If I want to ship the map without this texture (as it is generated procedurally) then I would need to work around this last issue. The map won't load with a missing texture. Is there a way I can force the level to load with missing dependencies as the editor somehow does? |
What's the status on this issue? If there's still a problem, could you provide a minimal reproduction project? |
Sorry I have no idea if this is possible yet. I have just changed things so the texture is generated each time I load onto a level which is slow but works for me. Which is a better solution in my case. The ideal solution is to be able to cache the generated texture on the end users machine by the game but at this stage editor code is compiled out AFAIK (ie ability to save out assets). |
In theory you can bypass this by implementing your own custom What Godot could do at the core is possibly exposing some |
I think this issue should be closed. It had no activity for years and to me looks unactionable / better fit for a proposal. |
Godot 3.0
commit 187c40d
Linux Manjaro
I have a height map, which my game will then take and generate a normal map from. This normal map is then saved to disk so that next time the user plays the map, the normal map does not need to be generated again.
I can save out the normal map as a png just fine, but when it tries to load the png the next time I hit the error:
ERROR: _load_data: Condition ' header[0] != 'G' || header[1] != 'D' || header[2] != 'S' || header[3] != 'T' ' is true. returned: ERR_FILE_CORRUPT
At: scene/resources/texture.cpp:430.
I suspect this has to do with godot using its own intermediate texture format.
The text was updated successfully, but these errors were encountered: