diff options
Diffstat (limited to 'resources/shaders/shader.vert')
-rwxr-xr-x | resources/shaders/shader.vert | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/resources/shaders/shader.vert b/resources/shaders/shader.vert index 8447dd9..750a4da 100755 --- a/resources/shaders/shader.vert +++ b/resources/shaders/shader.vert @@ -21,13 +21,15 @@ out vec3 pos; out vec3 refrPos; out float refrProb; out vec2 uv; +out float matIor; vec4 getRefrPos() { - float depth = -1.f; // TODO: Pass as uniform + float depth = -3.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; float n_t = 1.33f; +// matIor = n_t; float determinant = 1.f - (pow((n_i / n_t), 2.f) * (1.f - pow(cos_theta_i, 2.f))); float r0 = pow((n_i - n_t) / (n_i + n_t), 2.f); // variable required to calculate probability of reflection @@ -52,10 +54,11 @@ vec4 getRefrPos() { } void main() { - float depth = -2.f; - float dist = position.y - depth; +// float depth = -4.f; +// float dist = position.y - depth; float width = 81.f * 2.f; float length = 81.f * 2.f; + matIor = 1.33f; normal_cameraSpace = normalize(inverse(transpose(mat3(view))) * inverseTransposeModel * normal); camera_worldSpace = vec3(inverseView * vec4(0.f, 0.f, 0.f, 1.f)); @@ -63,11 +66,11 @@ void main() { pos = vec3(model * vec4(position, 1.f)); //vec3(model * vec4(objSpacePos, 1.f)); // pos = position; - float depthScale = dist / normal.y; - vec3 groundContactPoint = -(normal * depthScale) + position; // carries down to ground - groundContactPoint = vec3(model * vec4(position, 1)); - uv = vec2((position.x + 81.f) / (162.f), groundContactPoint.z); - uv = vec2(texCoords); +// float depthScale = dist / normal.y; +// vec3 groundContactPoint = -(normal * depthScale) + position; // carries down to ground +// groundContactPoint = vec3(model * vec4(position, 1)); +// uv = vec2((position.x + 81.f) / (162.f), groundContactPoint.z); +// uv = vec2(normal); vec4 refrPos_and_prob = getRefrPos(); refrPos = vec3(refrPos_and_prob); refrProb = clamp(refrPos_and_prob.w, 0.f, 1.f); |