Skip to content
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: Shader that uses TIME does not force editor to continuously update #51957

Closed
t3nk3y opened this issue Aug 21, 2021 · 8 comments · Fixed by #53972
Closed

Vulkan: Shader that uses TIME does not force editor to continuously update #51957

t3nk3y opened this issue Aug 21, 2021 · 8 comments · Fixed by #53972

Comments

@t3nk3y
Copy link

t3nk3y commented Aug 21, 2021

Godot version

v4.0.dev.custom_build [e599f1b]

System information

Ubuntu 21.04

Issue description

When using a shader that uses TIME to provide animation, the editor should continuously update the viewport as it did Godot 3, however in Godot 4, it is not doing so.

Doing anything that refreshes the viewport, such as scrolling or zooming will update the shader.

This can be worked around by enabling "Update Continuously" in the Editor settings.

Here is how it should work:
Peek 2021-08-21 14-16

Here is how it DOES work:
Peek 2021-08-21 14-15

Steps to reproduce

Place any object in the 3D editor that has a ShaderMaterial that includes TIME to provide animation.

NOTE: Be sure "Update Continuously" is off in the Editor settings, as this will work around the issue.

Minimal reproduction project

This project has an example. Just load the project and the main scene should immediately fail to work right.(so long as update continuously is not checked in editor settings)
ShaderEditorIssueExample.zip

If anyone likes the little shader I put in here, feel free to use it, no credits needed.

@Zireael07
Copy link
Contributor

I believe this has been turned off for performance reasons?

@Calinou Calinou changed the title Shader that uses TIME does not force editor to continuously update in Godot4 Vulkan: Shader that uses TIME does not force editor to continuously update Aug 21, 2021
@Calinou Calinou changed the title Vulkan: Shader that uses TIME does not force editor to continuously update Vulkan: Shader that uses TIME does not force editor to continuously update Aug 21, 2021
@Calinou Calinou added this to the 4.0 milestone Aug 21, 2021
@Calinou
Copy link
Member

Calinou commented Aug 21, 2021

I believe this has been turned off for performance reasons?

This was likely not done intentionally, as this is not the behavior in 3.x. A proper way to fix this would be #43011, as this is something that needs to be consciously enabled by the user.

@t3nk3y
Copy link
Author

t3nk3y commented Sep 21, 2021

I agree that #43011 would be a sensible fix. Feel free to close this issue if you want.

@Calinou
Copy link
Member

Calinou commented Sep 21, 2021

I'll leave this issue open as the lack of updating by default still feels weird in practice.

@clayjohn
Copy link
Member

We need to make a redraw_request when a material has the uses_time property set to true. Here is how it is done in 2D

if (md->shader_data->uses_time) {
time_used = true;
}

if (time_used) {
RenderingServerDefault::redraw_request();
}

and in sky shaders:

if (shader_data->uses_time && p_scene_render->time - sky->prev_time > 0.00001) {
sky->prev_time = p_scene_render->time;
sky->reflection.dirty = true;
RenderingServerDefault::redraw_request();
}

@jinyoung-lim
Copy link

I'm new to open source and would love to take a stab at this issue.

@zedutch
Copy link
Contributor

zedutch commented Oct 18, 2021

@Calinou @clayjohn I think I've found a way to solve this. Should I wait for an update from @jinyoung-lim or can I go ahead and submit a pull request?

@jinyoung-lim
Copy link

Hey @zedutch - feel free to go ahead for a pull request. I got busy with other things and am not ready for a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants