-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add iOS Support #218
Comments
I tried removing all textures but one, painting that and white color everywhere, same result. I also tried When I try to set it as an Albedo Texture I get this log (error and message):
Similarly for Normal Texture:
I see the log line here, which sure enough requires FORMAT_DXT5, but shouldn't it also support FORMAT_RGBA8? I see these values in the path I have tried exporting from GIMP with and without the Channel Pack approach, and all the same checkboxes marked in the PNG instructions. I selected the same Godot import options as in the instructions, but there are many other settings I may have wrong: So, I tweaked the check to allow FORMAT_RGBA8 and error to output the format:
This finally revealed it was FORMAT_DXT1.
I'm not sure if I'm exporting or importing the PNG incorrectly, or if that would help the iOS issue (and I'm probably misunderstanding a couple other things too). |
Oh I also tried the demo ground_037 texture. The editor sets it fine, but on export to iOS the same chess board no texture pattern appears. |
I can work with PNG just fine with the instructions in the wiki.
DDSs exported as we describe are RGBA compressed with DXT5. When you import PNGs into Godot they are not sent directly to the video card typically. Godot converts them to another specified format, such as DXT1 or 5. So no it shouldn't accept plain RGB8. You should tell Godot to import the PNG as VRAM Compressed as stated in the docs. Then it will be converted to DXT5 and be usable. Do you want us to convert up to 64 4096x4096 textures every time you open a scene in the editor, or run the game or a scene? No, we want to avoid all this extra processing on start. So you do the easy preparation once to convert the textures into the format they will be used in vram. Godot normally does that with every texture.
You are looking in the godot-cpp repository which is only a set of binding classes for the engine. You need to look at the engine code repository to see how it actually works.
This isn't the way to go. However having the code tell you the format its in is a good way to go. We need format 19 specifically, which is RGBA compressed as DXT5. 17 is RGB compressed as DXT1. The settings you showed are correct. If the computer says its 17, I believe it. That means you added an RGB image. You need height on the alpha channel.
The checkboard texture is a 1024x1024 RGBA as DXT5 texture. As is the ground texture. So we know these textures can be read by the shader on ios. If not, then you'd see a completely white or black terrain as the shader is failing, or the texture is. I suspect that the problem lies in the exporting. Either in the settings you have chosen, your process, or a bug in the project exporting portion of the engine is causing the ground dds file to not be included in the export. When Terrain3D loads, if there is no attached texture it is supposed to generate the checkerboard images to fill in. I can export the demo to windows just fine. Have you tried exporting the demo to mac, both debug and release builds? Make sure the libraries are in the export directory (which should be automatic) or it will crash instantly. If you can get a console mode on ios, you can enable debug logging and get a lot more information about what is and is not happening. |
Update: ETC2 ASTC?Would Terrain3D/project iOSImport ETC2 ASTCLogs
Steps:
|
Is it an issue on desktop? I don't know. So far we've only been using DXT5, which is S3TC. The demo textures and generated checkered textures are in this format, 19. It looks like godot's etc format would be FORMAT_ETC2_RGBA8 = 31 I don't know how to make that format. If you have a png with vram compression, while etc is enabled, that might make that format. The checkerbox is automatically generated, so it's probably using that format. But ground textures are not. You'll need to modify our verification check to accept format 31. You should also print out the format to see if the checkers are indeed 31 instead of 19.
This means Godot will not convert 19 to 31. We have to uncompress then recompress in the new format. However, the compression/decompression libraries do not exist in the exported versions of Godot. So the textures must be setup for ios from the beginning (probably with png). Looking through the Godot source for this format it looks like there is a ktx texture format that can hold etc2. This tool can write that format https://developer.imaginationtech.com/pvrtextool/ and a plugin for gimp https://github.com/chriku/gimp-ktx |
Solved?I re-added the change to output the texture format and continue regardless, showing the on-device format is 5 (FORMAT_RGBA8) and it runs fine (no texture issue). There may have been some extra loading time (just a feeling, I have not done any profiling - I also saw a lot of warnings). I'm a bit out of my depth with these texture options, but I'm happy to use this approach. That is:
PRI went ahead and forked so I could send a PR with these little changes. After something like that (I'm happy to talk more about the better fix or let anyone else, I can just work off this for now) you still need Step 1 (Building iOS libraries -- I am not sure how to contribute those): ScreenshotLog
Change, Solving Step 3(PR is cleaner and more limited)
|
Overview
I am new to Godot and Terrain3D, but have been experimenting. I managed to mostly get iOS working without much trouble, maybe solving 2 of 3 issues/steps, after some setup from building from source instructions.
Steps
Note: there are some deprecation warnings.
With the first two changes and the normal iOS export templates from the Godot editor, I am seeing a "chess squares" shader issue (as if it had no textures?) actually on device. I have a separate C++ GDExtension moving the character and camera slightly to confirm code is running. Also note shadows and occlusion look to be working.
Other Thoughts
Rendering: This is with Godot Project Settings->General->Renderering->Renderer->Rendering Method options: forward_plus or mobile. gl_compatibility shows an all grey plane, no height at all or squares, which is a different issue.
Exporting: I am not an artist, but one suggestion from that other issue was to investigate the texture exports themselves. I followed Texturing the Terrain, using the highly recommended DDS settings using GIMP-2.10. It renders fine in editor, export to mac and windows.
Architectures: I did this on an M1 Mac and updated to the latest XCode. But I am not sure that matters as it builds universal. arm64 seems to build fine:
Though the resulting libraries are exactly the same size as the universal libraries. I haven't tried with the App Store either. The mac libraries look to not use architecture, though now I wonder if that would help arm macs.
The text was updated successfully, but these errors were encountered: