How to make a shader lighting aware
Asked Answered
V

2

0

I followed a tutorial on adding water in Godot 4, which is a fragment/vertex shader - it works but shown on the picture is an example of how 'evenly lit' it is everywhere.

At the end of the tunnel it is dark (lighting wise) - but the water is still bright. How can I make the shader 'aware' of lighting?

Any tips to push me into the right direction?

!

Vocoid answered 26/1, 2023 at 7:23 Comment(0)
V
0

I changed the shader mode to Mul and now it picks up on the lighting 😉 no idea how it works but sure 😃

Vocoid answered 26/1, 2023 at 7:44 Comment(0)
L
0

There is a light function, similar to the vertex and fragment. You can write it yourself, but it's kind of involved.

It might be a better idea to customize the standard material instead. You can use the drop down arrow to convert a standard material to a shader material, then add your code.

Louielouis answered 26/1, 2023 at 8:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.