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

Wrong shadows when use VIEW_MATRIX in VERTEX calculation #80814

Closed
BasilYes opened this issue Aug 20, 2023 · 1 comment
Closed

Wrong shadows when use VIEW_MATRIX in VERTEX calculation #80814

BasilYes opened this issue Aug 20, 2023 · 1 comment
Labels

Comments

@BasilYes
Copy link

Godot version

v4.1.1.stable.official [bd6af8e]

System information

Godot v4.1.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - integrated AMD Radeon(TM) Graphics (Advanced Micro Devices, Inc.; 31.0.12018.5) - AMD Ryzen 5 5500U with Radeon Graphics (12 Threads). Same on Fedora 38

Issue description

When I use VIEW_MATRIX to calculate VERTEX, shadows dont effected by this.
image
shader code

shader_type spatial;


void vertex(){
	VERTEX = (vec4(VERTEX, 1.0) * VIEW_MATRIX).xyz;
}

Steps to reproduce

Just apply this shader, to any mesh and it's will broke shadows

shader_type spatial;


void vertex(){
	VERTEX = (vec4(VERTEX, 1.0) * VIEW_MATRIX).xyz;
}

Minimal reproduction project

ShaderResearch.zip

@clayjohn
Copy link
Member

This is a duplicate of #41420

The issue comes from the fact that the VIEW_MATRIX used by the shadow calculations is the light's VIEW_MATRIX, not the camera's VIEW_MATRIX.

There is already a PR to fix this: #72638

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

No branches or pull requests

2 participants