summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorSebastian Park <SebPark03@gmail.com>2024-05-06 02:23:43 -0400
committerSebastian Park <SebPark03@gmail.com>2024-05-06 02:23:43 -0400
commitdcab788763ff0af5918ca0c50538daa8bbfc84d8 (patch)
treedc42bf81e8fcae01756c7fe4c2bfa58d3f521076 /resources
parent85e2ef8c9d7cdb24715a7375e149d5d1e7d580b1 (diff)
make depth and skyheight uniforms.
Diffstat (limited to 'resources')
-rwxr-xr-xresources/shaders/shader.vert9
1 files changed, 5 insertions, 4 deletions
diff --git a/resources/shaders/shader.vert b/resources/shaders/shader.vert
index 2d0bfe2..1409039 100755
--- a/resources/shaders/shader.vert
+++ b/resources/shaders/shader.vert
@@ -4,7 +4,8 @@ layout(location = 0) in vec3 position; // Position of the vertex
layout(location = 1) in vec3 normal; // Normal of the vertex
layout(location = 3) in vec3 texCoords; // Normal of the vertex
-
+uniform float depth = -1500.f;
+uniform float skyHeight = 500.f;
uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
@@ -25,7 +26,7 @@ out vec2 uv;
out float matIor;
vec4 getRefrPos() {
- float depth = -1000.f; // TODO: Pass as uniform
+// float depth = -1000.f; // TODO: Pass as uniform
vec3 w_o = normalize(pos - camera_worldSpace);
float cos_theta_i = dot(-w_o, normal_worldSpace);
float n_i = 1;
@@ -55,11 +56,11 @@ vec4 getRefrPos() {
}
vec3 getReflPos() {
- float depth = 500.f; // TODO: Pass as uniform
+// float depth = 500.f; // TODO: Pass as uniform
vec3 w_o = normalize(pos - camera_worldSpace);
vec3 reflectedRay = w_o - 2 * dot(w_o, normal_worldSpace) * normal_worldSpace;
- float dist = depth - position.y;
+ float dist = skyHeight - position.y;
float depthScale = dist / reflectedRay.y;
vec3 skyContactPoint = (reflectedRay * depthScale) + position;
return skyContactPoint;