summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/renderer_rd/shaders')
-rw-r--r--servers/rendering/renderer_rd/shaders/canvas.glsl6
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl46
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl38
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl4
5 files changed, 49 insertions, 49 deletions
diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl
index 65a621b203..fbc641ee9e 100644
--- a/servers/rendering/renderer_rd/shaders/canvas.glsl
+++ b/servers/rendering/renderer_rd/shaders/canvas.glsl
@@ -82,7 +82,7 @@ void main() {
#endif
- mat4 world_matrix = mat4(vec4(draw_data.world_x, 0.0, 0.0), vec4(draw_data.world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data.world_ofs, 0.0, 1.0));
+ mat4 model_matrix = mat4(vec4(draw_data.world_x, 0.0, 0.0), vec4(draw_data.world_y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(draw_data.world_ofs, 0.0, 1.0));
#define FLAGS_INSTANCING_MASK 0x7F
#define FLAGS_INSTANCING_HAS_COLORS (1 << 7)
@@ -156,7 +156,7 @@ void main() {
}
matrix = transpose(matrix);
- world_matrix = world_matrix * matrix;
+ model_matrix = model_matrix * matrix;
}
}
@@ -179,7 +179,7 @@ void main() {
#endif
#if !defined(SKIP_TRANSFORM_USED)
- vertex = (world_matrix * vec4(vertex, 0.0, 1.0)).xy;
+ vertex = (model_matrix * vec4(vertex, 0.0, 1.0)).xy;
#endif
color_interp = color;
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
index f9cee011d2..c56ab5d7b2 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
@@ -130,13 +130,13 @@ void main() {
instance_index_interp = instance_index;
- mat4 world_matrix = instances.data[instance_index].transform;
+ mat4 model_matrix = instances.data[instance_index].transform;
- mat3 world_normal_matrix;
+ mat3 model_normal_matrix;
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) {
- world_normal_matrix = transpose(inverse(mat3(world_matrix)));
+ model_normal_matrix = transpose(inverse(mat3(model_matrix)));
} else {
- world_normal_matrix = mat3(world_matrix);
+ model_normal_matrix = mat3(model_matrix);
}
if (is_multimesh) {
@@ -229,8 +229,8 @@ void main() {
#endif
//transpose
matrix = transpose(matrix);
- world_matrix = world_matrix * matrix;
- world_normal_matrix = world_normal_matrix * mat3(matrix);
+ model_matrix = model_matrix * matrix;
+ model_normal_matrix = model_normal_matrix * mat3(matrix);
}
vec3 vertex = vertex_attrib;
@@ -267,24 +267,24 @@ void main() {
//using world coordinates
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
- vertex = (world_matrix * vec4(vertex, 1.0)).xyz;
+ vertex = (model_matrix * vec4(vertex, 1.0)).xyz;
#ifdef NORMAL_USED
- normal = world_normal_matrix * normal;
+ normal = model_normal_matrix * normal;
#endif
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
- tangent = world_normal_matrix * tangent;
- binormal = world_normal_matrix * binormal;
+ tangent = model_normal_matrix * tangent;
+ binormal = model_normal_matrix * binormal;
#endif
#endif
float roughness = 1.0;
- mat4 modelview = scene_data.inv_camera_matrix * world_matrix;
- mat3 modelview_normal = mat3(scene_data.inv_camera_matrix) * world_normal_matrix;
+ mat4 modelview = scene_data.view_matrix * model_matrix;
+ mat3 modelview_normal = mat3(scene_data.view_matrix) * model_normal_matrix;
{
#CODE : VERTEX
@@ -309,14 +309,14 @@ void main() {
//using world coordinates
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
- vertex = (scene_data.inv_camera_matrix * vec4(vertex, 1.0)).xyz;
+ vertex = (scene_data.view_matrix * vec4(vertex, 1.0)).xyz;
#ifdef NORMAL_USED
- normal = (scene_data.inv_camera_matrix * vec4(normal, 0.0)).xyz;
+ normal = (scene_data.view_matrix * vec4(normal, 0.0)).xyz;
#endif
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
- binormal = (scene_data.inv_camera_matrix * vec4(binormal, 0.0)).xyz;
- tangent = (scene_data.inv_camera_matrix * vec4(tangent, 0.0)).xyz;
+ binormal = (scene_data.view_matrix * vec4(binormal, 0.0)).xyz;
+ tangent = (scene_data.view_matrix * vec4(tangent, 0.0)).xyz;
#endif
#endif
@@ -453,7 +453,7 @@ layout(location = 9) in flat uint instance_index_interp;
//defines to keep compatibility with vertex
-#define world_matrix instances.data[instance_index].transform
+#define model_matrix instances.data[instance_index].transform
#ifdef USE_MULTIVIEW
#define projection_matrix scene_data.projection_matrix_view[ViewIndex]
#else
@@ -570,7 +570,7 @@ vec4 fog_process(vec3 vertex) {
float fog_amount = 1.0 - exp(min(0.0, -length(vertex) * scene_data.fog_density));
if (abs(scene_data.fog_height_density) >= 0.0001) {
- float y = (scene_data.camera_matrix * vec4(vertex, 1.0)).y;
+ float y = (scene_data.inv_view_matrix * vec4(vertex, 1.0)).y;
float y_dist = y - scene_data.fog_height;
@@ -1041,7 +1041,7 @@ void main() {
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE)) { //has lightmap capture
uint index = instances.data[instance_index].gi_offset;
- vec3 wnormal = mat3(scene_data.camera_matrix) * normal;
+ vec3 wnormal = mat3(scene_data.inv_view_matrix) * normal;
const float c1 = 0.429043;
const float c2 = 0.511664;
const float c3 = 0.743125;
@@ -1095,9 +1095,9 @@ void main() {
if (sc_use_forward_gi && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_SDFGI)) { //has lightmap capture
//make vertex orientation the world one, but still align to camera
- vec3 cam_pos = mat3(scene_data.camera_matrix) * vertex;
- vec3 cam_normal = mat3(scene_data.camera_matrix) * normal;
- vec3 cam_reflection = mat3(scene_data.camera_matrix) * reflect(-view, normal);
+ vec3 cam_pos = mat3(scene_data.inv_view_matrix) * vertex;
+ vec3 cam_normal = mat3(scene_data.inv_view_matrix) * normal;
+ vec3 cam_reflection = mat3(scene_data.inv_view_matrix) * reflect(-view, normal);
//apply y-mult
cam_pos.y *= sdfgi.y_mult;
@@ -1837,7 +1837,7 @@ void main() {
vec3(0, -1, 0),
vec3(0, 0, -1));
- vec3 cam_normal = mat3(scene_data.camera_matrix) * normalize(normal_interp);
+ vec3 cam_normal = mat3(scene_data.inv_view_matrix) * normalize(normal_interp);
float closest_dist = -1e20;
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl
index 2e31503669..f2672f10e7 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl
@@ -174,8 +174,8 @@ sdfgi;
layout(set = 1, binding = 0, std140) uniform SceneData {
mat4 projection_matrix;
mat4 inv_projection_matrix;
- mat4 camera_matrix;
- mat4 inv_camera_matrix;
+ mat4 inv_view_matrix;
+ mat4 view_matrix;
// only used for multiview
mat4 projection_matrix_view[MAX_VIEWS];
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
index 0fcf449659..6911cab27b 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
@@ -122,13 +122,13 @@ void main() {
bool is_multimesh = bool(draw_call.flags & INSTANCE_FLAGS_MULTIMESH);
- mat4 world_matrix = draw_call.transform;
+ mat4 model_matrix = draw_call.transform;
- mat3 world_normal_matrix;
+ mat3 model_normal_matrix;
if (bool(draw_call.flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) {
- world_normal_matrix = transpose(inverse(mat3(world_matrix)));
+ model_normal_matrix = transpose(inverse(mat3(model_matrix)));
} else {
- world_normal_matrix = mat3(world_matrix);
+ model_normal_matrix = mat3(model_matrix);
}
if (is_multimesh) {
@@ -221,8 +221,8 @@ void main() {
#endif
//transpose
matrix = transpose(matrix);
- world_matrix = world_matrix * matrix;
- world_normal_matrix = world_normal_matrix * mat3(matrix);
+ model_matrix = model_matrix * matrix;
+ model_normal_matrix = model_normal_matrix * mat3(matrix);
}
vec3 vertex = vertex_attrib;
@@ -259,24 +259,24 @@ void main() {
//using world coordinates
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
- vertex = (world_matrix * vec4(vertex, 1.0)).xyz;
+ vertex = (model_matrix * vec4(vertex, 1.0)).xyz;
#ifdef NORMAL_USED
- normal = world_normal_matrix * normal;
+ normal = model_normal_matrix * normal;
#endif
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
- tangent = world_normal_matrix * tangent;
- binormal = world_normal_matrix * binormal;
+ tangent = model_normal_matrix * tangent;
+ binormal = model_normal_matrix * binormal;
#endif
#endif
float roughness = 1.0;
- mat4 modelview = scene_data.inv_camera_matrix * world_matrix;
- mat3 modelview_normal = mat3(scene_data.inv_camera_matrix) * world_normal_matrix;
+ mat4 modelview = scene_data.view_matrix * model_matrix;
+ mat3 modelview_normal = mat3(scene_data.view_matrix) * model_normal_matrix;
{
#CODE : VERTEX
@@ -303,14 +303,14 @@ void main() {
//using world coordinates
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
- vertex = (scene_data.inv_camera_matrix * vec4(vertex, 1.0)).xyz;
+ vertex = (scene_data.view_matrix * vec4(vertex, 1.0)).xyz;
#ifdef NORMAL_USED
- normal = (scene_data.inv_camera_matrix * vec4(normal, 0.0)).xyz;
+ normal = (scene_data.view_matrix * vec4(normal, 0.0)).xyz;
#endif
#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
- binormal = (scene_data.inv_camera_matrix * vec4(binormal, 0.0)).xyz;
- tangent = (scene_data.inv_camera_matrix * vec4(tangent, 0.0)).xyz;
+ binormal = (scene_data.view_matrix * vec4(binormal, 0.0)).xyz;
+ tangent = (scene_data.view_matrix * vec4(tangent, 0.0)).xyz;
#endif
#endif
@@ -458,7 +458,7 @@ layout(location = 8) highp in float dp_clip;
//defines to keep compatibility with vertex
-#define world_matrix draw_call.transform
+#define model_matrix draw_call.transform
#ifdef USE_MULTIVIEW
#define projection_matrix scene_data.projection_matrix_view[ViewIndex]
#else
@@ -560,7 +560,7 @@ vec4 fog_process(vec3 vertex) {
float fog_amount = 1.0 - exp(min(0.0, -length(vertex) * scene_data.fog_density));
if (abs(scene_data.fog_height_density) >= 0.0001) {
- float y = (scene_data.camera_matrix * vec4(vertex, 1.0)).y;
+ float y = (scene_data.inv_view_matrix * vec4(vertex, 1.0)).y;
float y_dist = y - scene_data.fog_height;
@@ -967,7 +967,7 @@ void main() {
if (bool(draw_call.flags & INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE)) { //has lightmap capture
uint index = draw_call.gi_offset;
- vec3 wnormal = mat3(scene_data.camera_matrix) * normal;
+ vec3 wnormal = mat3(scene_data.inv_view_matrix) * normal;
const float c1 = 0.429043;
const float c2 = 0.511664;
const float c3 = 0.743125;
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
index 7a624c3b95..91ef19ab67 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile_inc.glsl
@@ -128,8 +128,8 @@ global_variables;
layout(set = 1, binding = 0, std140) uniform SceneData {
highp mat4 projection_matrix;
highp mat4 inv_projection_matrix;
- highp mat4 camera_matrix;
- highp mat4 inv_camera_matrix;
+ highp mat4 inv_view_matrix;
+ highp mat4 view_matrix;
// only used for multiview
highp mat4 projection_matrix_view[MAX_VIEWS];