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

Godot 4 lighting issue when using shader material #91626

Closed
Foyezes opened this issue May 6, 2024 · 7 comments
Closed

Godot 4 lighting issue when using shader material #91626

Foyezes opened this issue May 6, 2024 · 7 comments

Comments

@Foyezes
Copy link

Foyezes commented May 6, 2024

Tested versions

4.3 dev5 and 3.4 dev4.

System information

Godot v4.3.dev5 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 580 2048SP (Advanced Micro Devices, Inc.; 31.0.21910.5) - Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz (4 Threads)

Issue description

when using visual shader to create some grass and using omnilight to light the grass, from most angles it looks very white, but the trees near the grass look fine, those are standard materials. from certain angles the grasses look ok but from other angles they appear very white. like I mentioned this happens only when using shader material and not standard material.

MAIN ISSUE: In the last picture I'm using spotlight and shadermaterial for the grass. There's a clear split between light and darkness. It happens when using directional, omni or spotlight.

2
3
1
4

FIXED (Issue with the alpha map):

image

image

image

Steps to reproduce

creating a shape with shader mat and a directional light will recreate the issue

Minimal reproduction project (MRP)

screenshots of the MRP can be found in screenshots folder. if the camera is in the center of plane and rotated around the lighting goes from dark to light and when looking at the plane from top down a line can be seen running through the mesh.

lightingbug.zip

@Zireael07
Copy link
Contributor

Please upload an MRP

@Foyezes
Copy link
Author

Foyezes commented May 6, 2024

Please upload an MRP

uploaded

@Foyezes
Copy link
Author

Foyezes commented May 10, 2024

Update: It turns out the whiteness of the grass blades is caused by alpha issues, the edges were white so it made it seem the whole blades were white. But there issue when with directional light and shader material still persists. I've updated the screenshots.

@Foyezes
Copy link
Author

Foyezes commented May 10, 2024

Please upload an MRP

#91626 (comment)

@clayjohn
Copy link
Member

Thank you for adding an MRP. I took a look and quickly found the issue.

You are writing the normal map into the "normal" property" instead of the "normal map" property.

Screenshot from 2024-05-15 12-39-25

Properly using the "normal map" property fixes the issue
Screenshot from 2024-05-15 12-39-28

@Foyezes
Copy link
Author

Foyezes commented May 15, 2024

Thank you for adding an MRP. I took a look and quickly found the issue.

You are writing the normal map into the "normal" property" instead of the "normal map" property.

Screenshot from 2024-05-15 12-39-25

Properly using the "normal map" property fixes the issue Screenshot from 2024-05-15 12-39-28

Thank you! I didn't think to change the options even though I noticed it before. What is the difference between the Normal and Normal Map?

@clayjohn
Copy link
Member

Thank you! I didn't think to change the options even though I noticed it before. What is the difference between the Normal and Normal Map?

Normal overwrites the per-fragment normal value and is specified in view space.

Normal_map applies a normal map on top of the per-fragment normal and is specified in tangent space (the same space as your normal map texture)

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

4 participants