You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +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:
@@ -1022,6 +1022,11 @@ void fragment_shader(in SceneData scene_data) {
|
||||
inv_view_matrix[1][3] = 0.0;
|
||||
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;
|
||||
{
|
||||
@@ -1032,6 +1037,15 @@ void fragment_shader(in SceneData scene_data) {
|
||||
transmittance_color.a *= sss_strength;
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#ifndef USE_SHADOW_TO_OPACITY
|
||||
|
||||
#ifdef ALPHA_SCISSOR_USED
|
||||
|
||||
Reference in New Issue
Block a user