-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Shader parameters specified in the inspector are not included when exporting a project in headless mode #66842
Comments
Git bisect indicates that this bug was introduced in commit ef17c46. |
It seems like shader parameters get lost when scene files are converted to binary during export. A workaround is to disable 'convert text resources to binary' in the project settings. |
I've had the same problem, I changed the default params of the shader to reflect what I wanted directly in the shader file.
For future reference, this option is under Editor -> Export, you need to activate the Advanced Settings switch. |
I spent a lot of time investigating this tonight It seems like this code is problematic in headless mode: godot/editor/export/editor_export_platform.cpp Lines 742 to 773 in 4dcf2c5
My working theory (as a total godot codebase noob) is that when we instantiate the node in headless mode, certain things (i.e. shader parameters) are ignored since they're unnecessary. This makes sense when we're running the game, but not when we're exporting. I plan to continue working on this issue, but I figured I'd leave some notes here for myself and anyone interested. |
I think I've narrowed down the problem, but I'm not really sure what a good impl for a fix looks like here. godot/scene/resources/shader.cpp Lines 117 to 121 in a7276f1
This function gets called in the path of exporting now, which, in headless mode, ends up calling this function:
Since the headless rendering server doesn't keep track of shader parameters, they get lost when we instantiate the tree. |
Can confirm that the issue is still present in 4.0.3 and the workaround still works. |
This issue is still present in 4.1 and the workaround still solves it 👍 This was affecting my |
Previously, requesting the shader parameter list from the rendering server would be a no-op when using the dummy rendering server. This would cause the params to be lost during a headless export. This change uses the param_cache of the ShaderMaterial instead of the rendering server to avoid this issue. Addresses godotengine#66842
I assume the RenderingDriverDummy needs to set per-instance parameters on the CPU, so that they can be retrieved later (even if they are never required for rendering). |
See godotengine/godot#66842 (comment) for details
FYI, I can confirm that this issue still exists with Godot 4.2, and the work-around still resolves the problem. |
This is a workaround to an existing issue with Godot not exporting shader parameters correctly when running in headless mode, breaking our starmap shaders when exported via CI/CD. godotengine/godot#66842
yup, 4.2 mono here, this is still an issue, and the workaround works as well |
When folks say "the workaround still works", do they mean giving the shader the default params equal to the desired ones? |
@QbieShay no I mean disabling "convert text resources to binary" in the project settings. |
For me in 4.2.1, this issue occurs both in headless exports and from-editor exports. Disabling convert text resources to binary solves the missing shader parameter, enabling convert text to binary causes the missing param in both headless and from-editor export. I am very happy to have found this issue and the workaround after some months of wondering if this was an undocumented compatibility renderer limitation. |
It was the same for me. Maybe it happens since I did an headless export for the first time. I had to go to each of my custom shaders to make them unique each time I really needed them for an export. Finding this issue and the fix was really helpful. |
We are building our game with (Linux) CI Pipeline in headless mode. After hours of frustration and wondering why it worked locally but not on the exported versions of iOS and web, we were also able to solve the issue with disabling the project setting "convert text resources to binary". According to #76121 (comment) there is no easy fix, maybe it would be helpful to mention the limitations and quirks of the headless export in the documentation? |
Fix shader parameters specified in the inspector are not included when exporting a project godotengine/godot#66842
I think it needs to be reopen. |
Godot version
4.0.beta2.official.f8745f2f7
System information
Void linux
Issue description
When exporting a project using
--headless --export-pack
, any shader parameters/uniforms specified in the inspector are not included in the exported project. All shader parameters are reverted to their default values (or null).Steps to reproduce
Project setup:
Export without
--headless
option:Export with
--headless
option:The behavior can be reproduced on Godot 4.0 alpha 16 through Godot 4.0 beta 2.
Minimal reproduction project
ShaderParameterHeadless.zip
The text was updated successfully, but these errors were encountered: