1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Add LIGHT_VERTEX to fragment shader

Adds a new variable to the fragment shader to specify
the vertex position used when calculating lighting.
This commit is contained in:
Rob Blanckaert
2024-04-24 21:41:18 -07:00
parent 780e1a5040
commit ffe0b869f5
7 changed files with 48 additions and 0 deletions

View File

@@ -830,6 +830,10 @@ void main() {
inv_view_matrix[2][3] = 0.0;
#endif
#ifdef LIGHT_VERTEX_USED
vec3 light_vertex = vertex;
#endif //LIGHT_VERTEX_USED
mat4 read_view_matrix = scene_data.view_matrix;
vec2 read_viewport_size = scene_data.viewport_size;
@@ -837,6 +841,15 @@ void main() {
#CODE : FRAGMENT
}
#ifdef LIGHT_VERTEX_USED
vertex = light_vertex;
#ifdef USE_MULTIVIEW
view = -normalize(vertex - eye_offset);
#else
view = -normalize(vertex);
#endif //USE_MULTIVIEW
#endif //LIGHT_VERTEX_USED
#ifdef LIGHT_TRANSMITTANCE_USED
#ifdef SSS_MODE_SKIN
transmittance_color.a = sss_strength;