diff options
[WGL/P] Fully implemented ray tracing
1 files changed, 1 insertions, 15 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/shaders.js | 16 |
diff --git a/Year 2/Computer Graphics with WebGL/Project/shaders.js b/Year 2/Computer Graphics with WebGL/Project/shaders.js index c3a2ab4..c34ab1c 100644 --- a/Year 2/Computer Graphics with WebGL/Project/shaders.js +++ b/Year 2/Computer Graphics with WebGL/Project/shaders.js @@ -42,13 +42,6 @@ var fShader = ` uniform vec4 uBH[5];
uniform vec3 uEye;
- uniform vec3 uEyeForward;
- uniform vec3 uEyeUp;
- uniform vec3 uEyeLeft;
-
- uniform vec2 uViewPort;
- uniform vec2 uPerspSize;
- uniform float uPerspDist;
// Thanks https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation
float linePointDistance(vec3 linePoint, vec3 lineDir, vec3 point) {
@@ -87,14 +80,7 @@ var fShader = ` void main()
{
- // Refer to Project.html for more info, but in brief, we're transforming
- // the screen pixel coordinates to the proper 3D coordinates
- vec2 offset = gl_FragCoord.xy / uViewPort; // from pixel coordinates to [0,1]
- offset = 2.0 * offset - 1.0; // to [-1,1]
- offset.x *= uPerspSize.x;
- offset.y *= uPerspSize.y;
-
- vec3 ray = normalize(uEyeForward * uPerspDist + offset.y * uEyeUp - offset.x * uEyeLeft);
+ vec3 ray = normalize(vXYZ - uEye);
gl_FragColor = rayMarch(ray, ray);
}
|
