Godot: Shader Error "Unknown identifier in expression: TIME"

Created on 21 Jun 2018  ·  1Comment  ·  Source: godotengine/godot

Godot version:

3.0.3

OS/device including version:

Fedora 26

Issue description:

I created a fragment shader and a function where I use the built-in variable TIME. I get the error "Unknown identifier in expression: TIME". However I can use TIME in the fragment()-function but not in my own functions.

Working example:

shader_type spatial;
render_mode unshaded;

void fragment()
{
    vec3 col = 0.5 + 0.5*cos(vec3(0.0, TIME, 0.0));
    ALBEDO = col;
}

Not working example:

shader_type spatial;
render_mode unshaded;

vec3 getColor()
{
    vec3 col = 0.5 + 0.5*cos(vec3(0.0, TIME, 0.0));
    return col;
}

void fragment()
{
    vec3 col = getColor();
    ALBEDO = col;
}

Steps to reproduce:
Create a fragment shader and write a function that uses TIME.

Minimal reproduction project:

shader_TIME.zip

archived bug core rendering

Most helpful comment

Duplicate of #18315 , which covers all built-in variables but is not labeled as bug, for some reason.

>All comments

Duplicate of #18315 , which covers all built-in variables but is not labeled as bug, for some reason.

Was this page helpful?
0 / 5 - 0 ratings