Skip to content

Improve explanations around shader language's TIME variable (3.2) #4283

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

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 17, 2020

Note: Opened against the 3.2 branch as VisualServer.set_shader_time_scale() is only available in 3.2.x, not 4.0. This is because global uniforms provide a way for users to replace this feature in 4.0.

This closes #4282.

@Calinou Calinou changed the title Improve explanations around shader language's TIME variable Improve explanations around shader language's TIME variable (3.2) Oct 17, 2020
@@ -51,8 +51,12 @@ Global built-ins are available everywhere, including custom functions.
+-------------------+-----------------------------------------------------------------------------+
| Built-in | Description |
+===================+=============================================================================+
| in float **TIME** | Global time, in seconds. |
| | It's subject to the rollover setting (which is 3,600 -1 hour- by default). |
| in float **TIME** | Global time since the shader was compiled, in seconds (always positive). |
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this time actually reset when the shader was compiled outside the editor? I'm not sure.

Copy link
Contributor

@NathanLovato NathanLovato Oct 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clayjohn would you know about this? Also, is compiling shaders outside Godot officially supported? If not, it's fine to merge as-is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think it resets when the shader is recompiled. TIME comes from frame.time which is incremented in the rasterizer.

https://github.com/godotengine/godot/blob/84e17881cd19218d32430d03613497405ad51696/drivers/gles3/rasterizer_gles3.cpp#L197-L210

@NathanLovato NathanLovato merged commit 444f5c5 into godotengine:3.2 Oct 23, 2020
@NathanLovato
Copy link
Contributor

Thanks much and sorry for the delay!

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

Successfully merging this pull request may close these issues.

3 participants