-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
GLES2 3D editor and game: meshes and viewports are rendered black (no light?) #31019
Comments
Can't reproduce on Ubuntu. |
It also happens on old games I made (project, not binary) and with new projects with default cubes so it should be a bug in Godot or some missing driver. GLES3 displays everything correctly. |
Do you updated your graphics drivers recently? |
I installed dxvk today for playing games on wine, not sure if it could cause something like this. |
Strange thing is that this also happens for me on Windows wine Godot. |
I can't reproduce either. Ubuntu 16.04 with Intel integrated drivers |
it might be a problem with your project this doesn't happen to me either |
this seems to happen when the sky contribution is 0 and you don't have any lights and the ambient light is black, but it doesn't affect the editor like in your screenshot so that's weird |
I tried a build a few hours ago and this happened to me as well. Another build from a few days ago didn't. Windows 7 |
This happens to me too, on both windows and linux across 3 different machines. I haven't had the time to look into it yet. I'll do a regression test later when I'll have some time on my hands, because it only started happening with my most recent build. |
(I just realized this is because all the objects are rendered black, so they can't be seen against the black background) |
Any errors in the terminal? @clayjohn Sounds like redefining |
No errors for me. |
edit: false positive |
CC @raphael10241024 |
Unable to see it both in my mac and windows pc, I'm still trying to fingure out how this happens, it looks confusing. |
Yeah, this has also been happening to me. All the 3D meshes in my old GLES2 projects are rendered solid black. Godot version: 3.2-dev 77e8947 Everything seems to work in 47df673... Not sure that's the culprit. I'll try bisecting in a moment. |
I just figured it out, that this only happens in release_debug, in debug it is not an issue, even on the current master. On my linux machine reverting to one before the commit I linked fixed the issue, building on that commit, the issue appeared. I'll clean rebuild everything, to double check in a few minutes. |
Finished bisecting. 8b4c538 is the culprit! During my bisecting I discovered that 507e41e renders only ImmediateGeometry lines as black: @Relintai Oh uhh that's really weird. I should probably note that I was building release_debug builds while bisecting, but I don't know what that says. |
@Relintai @Homer666 Doing a clean build may fix the problem! @LinuxUserGD Can you try a full recompile and see if that solves the issue? edit: Alternatively, if you want to avoid a full recompile, just add a comment in |
@clayjohn Which commit should I choose for the full recompile? I would do |
@LinuxUserGD Build from master. Instead of doing a full recompile just force gles_builder to rebuild shaders. You can do that by adding a comment to |
Got some error because I was compiling with lto. Will try a full compile tomorrow (sorry!). |
@clayjohn I tried building after using They were |
The black immediate geometry stuff will require more testing. I'll continue tomorrow, with git cleans and scons cache cleans to find the proper culprit. It was 47df673 for me on linux, but without clearing caches, so this might not be the right one. If I find it, I'll open an another issue for that (or pr if I can fix it). However for the black spatial meshes 8743da9 seems to be the culprit consistently, on both windows and linux. A few more screenshots, because the original one really doesn't do this justice, it even confused me a little bit first: Both are windows, release_debug, 64bit builds. Opening the same project. They are built with vs2017 community, and I cleaned the project and removed scons cache before building them. This is at 3256fbf: This is at 8743da9: The same happens on linux, I've also tried adding lights, and textures, I get the same black box. And on GLES3 everything works perfectly. And no error logs in the console. Also ImmediateGeometries created ingame are black too. (Haven't tested in-editor) |
Okay, I can now confirm 3f25dde breaks rendering initially, but only for the lines and grid and then 8743da9 breaks everything else. However, debug builds are fine. I do not understand why these commits have broken rendering in that way. There are no errors, so the shaders must be compiling fine. @akien-mga We may need to just revert for now and figure something else out... |
I managed to figure out how to get a shader compile error. The key to it is having a WorldEnvironment in the Scene with fog enabled. Minimal example project: Open the project, click on the MeshInstance Node in the scene, and in the mesh property create a new mesh, something that's not an empty ArrayMesh. I've tried it with multiple builds, it errors every time. Also, these are the errors I get: |
@Relintai I get some more errors when trying your minimal example project: drivers/gles2/shader_gles2.cpp:129 - SceneShaderGLES2: Fragment shader compilation failed:
0:1831(120): error: `light_direction' undeclared
0:1831(102): error: no matching function for call to `dot(vec3, error)'; candidates are:
0:1831(102): error: float dot(float, float)
0:1831(102): error: float dot(vec2, vec2)
0:1831(102): error: float dot(vec3, vec3)
0:1831(102): error: float dot(vec4, vec4)
0:1831(98): error: no matching function for call to `max(error, float)'; candidates are:
0:1831(98): error: float max(float, float)
0:1831(98): error: vec2 max(vec2, float)
0:1831(98): error: vec3 max(vec3, float)
0:1831(98): error: vec4 max(vec4, float)
0:1831(98): error: vec2 max(vec2, vec2)
0:1831(98): error: vec3 max(vec3, vec3)
0:1831(98): error: vec4 max(vec4, vec4)
0:1831(98): error: int max(int, int)
0:1831(98): error: ivec2 max(ivec2, int)
0:1831(98): error: ivec3 max(ivec3, int)
0:1831(98): error: ivec4 max(ivec4, int)
0:1831(98): error: ivec2 max(ivec2, ivec2)
0:1831(98): error: ivec3 max(ivec3, ivec3)
0:1831(98): error: ivec4 max(ivec4, ivec4)
0:1831(94): error: no matching function for call to `pow(error, float)'; candidates are:
0:1831(94): error: float pow(float, float)
0:1831(94): error: vec2 pow(vec2, vec2)
0:1831(94): error: vec3 pow(vec3, vec3)
0:1831(94): error: vec4 pow(vec4, vec4)
0:1831(69): error: operands to arithmetic operators must be numeric
0:1831(19): error: no matching function for call to `mix(vec3, vec3, error)'; candidates are:
0:1831(19): error: float mix(float, float, float)
0:1831(19): error: vec2 mix(vec2, vec2, float)
0:1831(19): error: vec3 mix(vec3, vec3, float)
0:1831(19): error: vec4 mix(vec4, vec4, float)
0:1831(19): error: vec2 mix(vec2, vec2, vec2)
0:1831(19): error: vec3 mix(vec3, vec3, vec3)
0:1831(19): error: vec4 mix(vec4, vec4, vec4)
0:1847(35): warning: `fog_color' used uninitialized
0:1847(47): warning: `fog_color' used uninitialized
drivers/gles2/shader_gles2.cpp:360 - Method/Function Failed, returning: __null
drivers/gles2/shader_gles2.cpp:88 - Condition ' !version ' is true. returned: false
drivers/gles2/shader_gles2.h:254 - Condition ' !version ' is true. returned: -1 |
After seeing @LinuxUserGD 's error, out of curiosity I put a "#define USE_LIGHTING" into scene.glsl both under the [vertex], and under the [fragment] shader mark, and now it seems to work. Even without a WorldEnvironment. |
I think I found it, in shader_gles2.h the conditionals like USE_LIGHTNING is stored in conditional_version.version as bits. Before those 2 commits the Conditionals array for the scene shader contained exactly 32 entries. conditional_version.version is a uint32_t. And now USE_LIGHTNING's index is 33rd in the array, so it just won't get set anymore. edit: I've tested it since, by reordering the conditional arrays in the generated scene shader file (I moved the new stuff to the end by hand), doing it fixed both the ImmediateGeometry, and the spatial material issues, so this is the actual problem. Also I've been trying to change the shader version code to uint64_t since then. It doesn't work yet. |
@Relintai Great work! Keep us updated! |
@Relintai I asked Reduz what to do, he explained that we can avoid creating extra code_versions if we use |
Really cool! This solution is soo much simpler and better! Thanks! |
Thanks! After deleting all the *glsl.gen.h files, everything is working again 👍 |
Godot version:
master (77e8947 )
OS/device including version:
Arch Linux (Antergos Deepin)
Issue description:
Minimal reproduction project:
Any 3D game
The text was updated successfully, but these errors were encountered: