-
-
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
Vulkan Mobile backend: LightmapGI baking does not take environment lighting into account #55868
Comments
I can take a look into it. At a first glance the issue appears to be caused by copy_cubemap_to_panorama function, which is not working in Vulkan Mobile backend. Maybe the fix is to create a fallback to CPU. |
Don't we have a fragment version of that shader for use with reflection probes and omni shadows? |
I started working on it. |
Personally, I would just remove the error check here:
There isn't much point in creating a raster version of this function as its not something that should be called at run time anyway. |
Doesn't work after removing error check. Still works fine on Forward+. |
That looks like the wrong error check. See the only I linked in my comment Edit: At any rate, just removing the error check isn't enough. Looks like you have to create a raster version anyway:
|
I've deleted the correct error check. I should've made it more clear what I meant. :( |
This deserves further discussion imho. The main rendering pipeline of the mobile renderer avoids using compute shaders because on most mobile phones compute is very limited, though I have often wondered if it was the right course of action to ignore them fully. In fact, I believe various systems still rely on compute such as particles (which is likely not a problem). Lightmapping however is a whole other story. The phone is the destination, hence using the mobile renderer, the phone is hampered in performance, hence using lightmapping to minimize overhead, but the host machine on which development happens, very likely can happily run compute shaders to create the lightmaps. We're only running the IDE using the mobile renderer to ensure accurate representation of the output of the game (unless the IDE is running on mobile hardware, which is now possible). There is thus an argument where we allow the compute variants of features in the IDE. |
I think that ordinary phone isn't a viable development platform especially for 3D, so I would prefer compute shader approach. Whatever path is least complex is the best in this case IMO. That said I can try to make a raster version. |
Owh flagship phones can do 3D just fine, but it was interesting that I was told the other day that the vast majority of successful phone games are all 2D games (not just Godot, but just in general). That all said, these decisions were made before we decided to use OpenGL (compatibility renderer) for lower end phones, so there is an argument for being less restrictive around compute for the mobile renderer. I definitely think there is no problem for the code that creates the lightmap data to use compute. We could do something like change the init code in |
Works after deleting 2 checks. I would just add some checks and use the compute version as it is the simplest way to fix the issue. Considering that the particles are using compute shaders and are going to be used as often as the Lightmap in mobile projects I think that it shouldn't really be a problem to not make a raster version. My suggestion is to just use |
I have no problem using a compute shader for this. But if we do, we should not limit it to the editor. The function can be called at run time, even though it will be slow if used at runtime (on a phone without good compute support), it should still succeed. |
Lightmaps can't be baked in exported project, so if there are no other use cases (currently) for it then there is no way to use it without running the editor anyway. |
@Lasuch69 For better or worse it is exposed directly through the RenderingServer API. Which means that it might be called at run time. |
I think if it's exposed like that, might as well make compute versions available. In the end it is up to us to make sure that the core of the rendering engine scarcely use the compute versions. |
I opened a draft PR. |
Godot version
4.0.dev (2a9dd65)
System information
Fedora 34, GeForce GTX 1080 (NVIDIA 470.74)
Issue description
Despite lightmap rendering not working correctly when using the Vulkan Mobile backend, LightmapGI baking does work. However, it ignores environment lighting from the sky when it's enabled in the node properties.
Note: You need to switch back to the Vulkan Clustered backend and restart the editor to see the lightmap baked in the Vulkan Mobile backend in the editor/project.
Lightmap baked in Vulkan Clustered
Lightmap baked in Vulkan Mobile (then displayed in Vulkan Clustered)
Steps to reproduce
back end
).Minimal reproduction project
test_vulkan_clustered_vs_mobile_lightmap_sampling.zipWith
.godot/
included to workaround importing issue: https://0x0.st/orQD.zip (link expires in September 2022)The text was updated successfully, but these errors were encountered: