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

Compatibility Renderer: LIGHT_VERTEX does not affect shadows #101119

Open
hilloftheking opened this issue Jan 4, 2025 · 1 comment
Open

Compatibility Renderer: LIGHT_VERTEX does not affect shadows #101119

hilloftheking opened this issue Jan 4, 2025 · 1 comment

Comments

@hilloftheking
Copy link

Tested versions

  • Reproducible in: v4.3.stable.official [77dcf97], v4.4.dev.mono.gh [bdf625b]

System information

Godot v4.3.stable - Fedora Linux 41 (Workstation Edition) - Wayland - GLES3 (Compatibility) - NVIDIA GeForce RTX 3060 Ti (nvidia; 565.77) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 Threads)

Issue description

Shadows seem to ignore LIGHT_VERTEX in the Compatibility renderer.

These screenshots and the MRP change LIGHT_VERTEX to create a 4x4 grid on a plane.

Compatibility
Image
Forward+
Image

Shader code:

shader_type spatial;

uniform vec3 albedo_color : source_color;

#define SURFACE_SIZE 2.0
#define TEXEL_SIZE 4.0

void fragment() {
	ALBEDO = albedo_color;

	vec2 snapped_uv = (floor(UV * TEXEL_SIZE) / TEXEL_SIZE) + vec2(0.5 / TEXEL_SIZE);
	vec2 uv_diff = snapped_uv - UV;

	LIGHT_VERTEX += TANGENT * uv_diff.x * SURFACE_SIZE;
	LIGHT_VERTEX += -BINORMAL * uv_diff.y * SURFACE_SIZE;
}

Steps to reproduce

  1. Open MRP
  2. View shadows in Compatibility
  3. Switch to Forward+
  4. View shadows in Forward+

Minimal reproduction project (MRP)

light_vertex_mrp.zip

@clayjohn
Copy link
Member

clayjohn commented Jan 4, 2025

For performance reasons the compatibility renderer does shadow calculations in the vertex shader. Therefore the LIGHT_VERTEX value isn't available when they are being calculated.

I guess to support LIGHT_VERTEX in the compatibility renderer, we need to have a slow fallback for when LIGHT_VERTEX is used

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

No branches or pull requests

3 participants