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

Vulkan: Projector textures on SpotLight3D and OmniLight3D needs adjustment to scaling #50445

Closed
Tracked by #57284
pracedru opened this issue Jul 14, 2021 · 4 comments · Fixed by #57888
Closed
Tracked by #57284

Comments

@pracedru
Copy link

Godot version

4.0.dev

System information

PopOS, Vulkan, Nvidia GTX 1060

Issue description

The current build of Godot only show a small section of the center of the texture on spotlight.
Maybe a texture scale feature could be added to the light projector texture.

Steps to reproduce

Make 3D scene.
Add Spotlight.
enable shadows.
Add texture to Projector.
Place a surface on which the light can be seen.
image
Here a 11x11 tiled texture is added to the projector and only 4-5 partial segments of the texture is shown in the light.

Minimal reproduction project

No response

@jcostello
Copy link
Contributor

Can you show what happens if you move the light away to almost hit the mesh with the edge of the cone? Also can you set up the default attenuation?

@pracedru
Copy link
Author

Attenuation, Angle, Angle Atenuation and the position of the light has no impact on the scaling of the texture. The same small subsection is always projected.

@dusakus
Copy link
Contributor

dusakus commented Jan 7, 2022

So I hit that problem recently, which prompted me to look into the engine to check how the projector calculates the texture UV, and I found this:

vec2 proj_uv = normal_to_panorama(splane.xyz) * spot_lights.data[idx].projector_rect.zw;
link to this exact line in scene_forward_lights_inc.glsl

Since we are talking about SpotLights, I tried removing the "normal_to_panorama()" part, as I'm pretty sure SpotLights are not supposed to use panoramic textures.
The resulting line is

vec2 proj_uv = splane.xy * spot_lights.data[idx].projector_rect.zw;

And the result?
image

While I'm sure this isn't a proper fix, it might at least point someone much more knowledgeable to possibly implement one.

Edit to clarify:
I'm running Arch, with GTX 1060 using Nvidia binary driver and Vulkan renderer.
Testing using a fresh build of master branch, with the only difference being the above mentioned line.
With a clean build (without the change mentioned above) I get a "random" tiny piece of the texture instead of the whole thing, as shown in the screenshot below
image

@Calinou Calinou added this to the 4.0 milestone Jan 7, 2022
@Calinou Calinou changed the title Textures on Spotlight and Omnilight needs adjustment to scaling. Vulkan: Projector textures on Spotlight and Omnilight needs adjustment to scaling Jan 7, 2022
@Calinou Calinou changed the title Vulkan: Projector textures on Spotlight and Omnilight needs adjustment to scaling Vulkan: Projector textures on SpotLight3D and OmniLight3D needs adjustment to scaling Jan 7, 2022
@akien-mga
Copy link
Member

Fixed by #57888.

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

Successfully merging a pull request may close this issue.

5 participants