Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-05-09 17:16:12 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-10 13:14:41 +0300
commita298dde5d799bd41dd571cda9c91b62a6b78562a (patch)
tree75dc46e668c58915e0a2f1a8369f2a029e42072c /source/blender/draw/engines/eevee/shaders
parentfdddea676d4fa40668ca82f8ccc5106437d113f2 (diff)
Eevee: Update matrices operations to not use combined matrices
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders')
-rw-r--r--source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl16
-rw-r--r--source/blender/draw/engines/eevee/shaders/prepass_vert.glsl12
-rw-r--r--source/blender/draw/engines/eevee/shaders/shadow_vert.glsl13
3 files changed, 16 insertions, 25 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index 68e11f7414c..4243d0ef870 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -1,6 +1,4 @@
-uniform mat4 ModelViewProjectionMatrix;
-uniform mat4 ModelViewMatrix;
#ifndef USE_ATTR
uniform mat4 ModelMatrix;
uniform mat4 ModelMatrixInverse;
@@ -55,21 +53,19 @@ void main()
hairThickness,
hairThickTime);
- gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
- viewPosition = (ViewMatrix * vec4(pos, 1.0)).xyz;
- worldPosition = pos;
hairTangent = normalize(hairTangent);
worldNormal = cross(binor, hairTangent);
- viewNormal = mat3(ViewMatrix) * worldNormal;
+ worldPosition = pos;
#else
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
worldPosition = point_object_to_world(pos);
- viewPosition = point_world_to_view(worldPosition);
-
worldNormal = normalize(normal_object_to_world(nor));
+#endif
+
/* No need to normalize since this is just a rotation. */
viewNormal = normal_world_to_view(worldNormal);
-#endif
+
+ viewPosition = point_world_to_view(worldPosition);
+ gl_Position = point_world_to_ndc(worldPosition);
/* Used for planar reflections */
gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), ClipPlanes[0]);
diff --git a/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl b/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
index 9196253478a..883862855f3 100644
--- a/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
@@ -19,25 +19,23 @@ void main()
{
#ifdef HAIR_SHADER
float time, thick_time, thickness;
- vec3 pos, tan, binor;
+ vec3 worldPosition, tan, binor;
hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
ModelMatrixInverse,
ViewMatrixInverse[3].xyz,
ViewMatrixInverse[2].xyz,
- pos,
+ worldPosition,
tan,
binor,
time,
thickness,
thick_time);
-
- gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
- vec4 worldPosition = vec4(pos, 1.0);
#else
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
- vec4 worldPosition = (ModelMatrix * vec4(pos, 1.0));
+ vec3 worldPosition = point_object_to_world(pos);
#endif
+ gl_Position = point_world_to_ndc(worldPosition);
+
#ifdef CLIP_PLANES
gl_ClipDistance[0] = dot(vec4(worldPosition.xyz, 1.0), ClipPlanes[0]);
#endif
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index baaa43d84b8..4f59725fcf8 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -1,10 +1,6 @@
-uniform mat4 ModelViewProjectionMatrix;
-#ifdef MESH_SHADER
-uniform mat4 ModelViewMatrix;
-# ifndef USE_ATTR
+#ifndef USE_ATTR
uniform mat4 ModelMatrix;
-# endif
#endif
in vec3 pos;
@@ -19,10 +15,11 @@ out vec3 viewNormal;
void main()
{
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ vec3 world_pos = point_object_to_world(pos);
+ gl_Position = point_world_to_ndc(world_pos);
#ifdef MESH_SHADER
- viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
- worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
+ worldPosition = world_pos;
+ viewPosition = point_world_to_view(worldPosition);
worldNormal = normalize(normal_object_to_world(nor));
/* No need to normalize since this is just a rotation. */