Skip to content

[4.5 beta 1] Referencing NORMAL in the light function of any custom shader causes a huge shader compilation error #107746

Closed as duplicate of#107590
@antourenein

Description

@antourenein

Tested versions

-Reproducible in 4.5 beta 1
-Not reproducible in 4.5 dev 5

System information

Godot v4.5.beta1 - Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 32.0.15.7652) - 12th Gen Intel(R) Core(TM) i7-12700H (20 threads) - 63.74 GiB memory

Issue description

Creating any custom spatial shader that references the built-in NORMAL seems to cause a shader compilation error in the general shader that wraps up the custom shaders internally.

Something as simple as

shader_type spatial;
render_mode blend_mix;

void light() {
	DIFFUSE_LIGHT = NORMAL;
}

causes a huge 8k line shader compilation error in the output that even slows down the editor itself.

Here is a copy of the full error in the output:
normal-error-log.txt

Steps to reproduce

  • Open the MRP
  • Find the Material in the Surface Material Override of the main MeshInstance3D scene
  • Edit the shader and remove the comment from the //DIFFUSE_LIGHT = NORMAL; line
  • Watch the editor spam the compilation error.

Minimal reproduction project (MRP)

LightShaderErrorMRP.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions